2023-07-10 17:25:01 +00:00
|
|
|
from .base import Base
|
2023-07-12 20:26:25 +00:00
|
|
|
from .system import System
|
2023-06-16 12:41:11 +00:00
|
|
|
from dataclasses import field
|
2023-06-12 08:51:01 +00:00
|
|
|
|
2023-07-10 17:25:01 +00:00
|
|
|
class Jumpgate(Base):
|
2023-06-18 17:15:51 +00:00
|
|
|
def define(self):
|
|
|
|
self.range: int = 0
|
|
|
|
self.faction: str = ''
|
|
|
|
self.systems: list = []
|
2023-07-12 20:26:25 +00:00
|
|
|
self.system = self.get_system()
|
2023-06-12 08:51:01 +00:00
|
|
|
|
|
|
|
def update(self, d):
|
2023-07-12 20:26:25 +00:00
|
|
|
getter = self.store.getter(System, create=True)
|
|
|
|
self.setlst('systems', d, 'connectedSystems', 'symbol', interp=getter)
|
2023-06-12 08:51:01 +00:00
|
|
|
self.seta('faction', d, 'factionSymbol')
|
|
|
|
self.seta('range', d, 'jumpRange')
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def ext(self):
|
|
|
|
return 'jmp'
|
|
|
|
|
2023-06-17 12:59:52 +00:00
|
|
|
def f(self, detail=1):
|
|
|
|
r = self.symbol
|
|
|
|
if detail > 1:
|
2023-06-17 18:23:24 +00:00
|
|
|
r += '\n'
|
2023-07-12 20:26:25 +00:00
|
|
|
r += '\n'.join([s.symbol for s in self.systems])
|
2023-06-17 12:59:52 +00:00
|
|
|
return r
|