0ptr/nullptr/models/system.py
2023-06-13 16:33:22 +02:00

25 lines
497 B
Python

from .base import Base
from math import sqrt
class System(Base):
x:int = 0
y:int = 0
type:str = 'unknown'
def update(self, d):
self.seta('x', d)
self.seta('y', d)
self.seta('type', d)
@classmethod
def ext(self):
return 'stm'
def path(self):
sector, symbol = self.symbol.split('-')
return f'atlas/{sector}/{symbol[0:1]}/{self.symbol}.{self.ext()}'
def distance(self, other):
return sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2)