0ptr/nullptr/models/waypoint.py
2023-06-12 10:51:01 +02:00

30 lines
660 B
Python

from .base import Base
from nullptr.util import *
from typing import List
class Waypoint(Base):
x:int = 0
y:int = 0
type:str = 'unknown'
traits:List[str]=[]
faction:str = ''
def update(self, d):
self.seta('x', d)
self.seta('y', d)
self.seta('type', d)
self.seta('faction', d, 'faction.symbol')
self.setlst('traits', d, 'traits', 'symbol')
@classmethod
def ext(self):
return 'way'
def path(self):
sector, system, symbol = self.symbol.split('-')
return f'atlas/{sector}/{system[0:1]}/{system}/{symbol}.{self.ext()}'
def system(self):
p = self.symbol.split('-')
return f'{p[0]}-{p[1]}'