0ptr/nullptr/models/waypoint.py

27 lines
661 B
Python
Raw Normal View History

from .system_member import SystemMember
from nullptr.util import *
from dataclasses import field
class Waypoint(SystemMember):
def define(self):
self.x:int = 0
self.y:int = 0
self.type:str = 'unknown'
self.traits:list = []
self.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, _ = self.symbol.split('-')
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'