0ptr/nullptr/models/system.py

25 lines
502 B
Python
Raw Normal View History

2023-06-09 11:19:47 +00:00
from .base import Base
from math import sqrt
class System(Base):
2023-06-10 18:49:50 +00:00
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)
2023-06-10 17:39:32 +00:00
@classmethod
2023-06-09 11:19:47 +00:00
def ext(self):
return 'stm'
2023-06-09 20:20:46 +00:00
def path(self):
sector, symbol = self.symbol.split('-')
return f'atlas/{sector}/{symbol[0:1]}/{self.symbol}.{self.ext()}'
def distance(self, other):
return int(sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2))