0ptr/nullptr/models/agent.py

24 lines
529 B
Python
Raw Normal View History

2023-06-10 17:39:32 +00:00
from .base import Base
2024-01-24 18:03:57 +00:00
from nullptr.models.waypoint import Waypoint
2023-06-10 17:39:32 +00:00
class Agent(Base):
def define(self):
self.token: str = None
self.credits: int = 0
2024-01-24 18:03:57 +00:00
self.headquarters: Waypoint = None
2023-06-10 17:39:32 +00:00
def update(self, d):
2023-06-10 18:49:50 +00:00
self.seta('credits', d)
2024-01-24 18:03:57 +00:00
getter = self.store.getter(Waypoint, create=True)
self.seta('headquarters', d, interp=getter)
2023-06-10 17:39:32 +00:00
@classmethod
def ext(self):
return 'agt'
def f(self, detail=1):
r = super().f(detail)
if detail >2:
r += f' c:{self.credits}'
return r