from .base import Base from .system import System from dataclasses import field class Jumpgate(Base): def define(self): self.range: int = 0 self.faction: str = '' self.systems: list = [] self.system = self.get_system() def update(self, d): getter = self.store.getter(System, create=True) self.setlst('systems', d, 'connectedSystems', 'symbol', interp=getter) self.seta('faction', d, 'factionSymbol') self.seta('range', d, 'jumpRange') @classmethod def ext(self): return 'jmp' def f(self, detail=1): r = self.symbol if detail > 1: r += '\n' r += '\n'.join([s.symbol for s in self.systems]) return r