83 lines
1.5 KiB
Python
83 lines
1.5 KiB
Python
import enum
|
|
|
|
|
|
class ItemTypes(enum.Enum):
|
|
COCKPIT = 1
|
|
REAKTOR = 2
|
|
GYROSKOPE = 3
|
|
ACTIVATOR = 4
|
|
JOINT = 5
|
|
SENSORS = 6
|
|
SUSTAINMENT = 7
|
|
|
|
|
|
class ItemStatus(enum.Flag):
|
|
FINE = 0
|
|
DAMAGED = 1
|
|
DESTROYED = 2
|
|
|
|
|
|
class Item(object):
|
|
def __init__(self, item_type: ItemTypes):
|
|
self._type = item_type
|
|
self._state = ItemStatus.FINE
|
|
|
|
@property
|
|
def type(self):
|
|
return self._type
|
|
|
|
@property
|
|
def state(self):
|
|
return self._state
|
|
|
|
@state.setter
|
|
def state(self, new_state: ItemStatus):
|
|
self._state = new_state
|
|
|
|
|
|
class BigItem(Item):
|
|
|
|
def __init__(self, item_type: ItemTypes, tonnage: float):
|
|
super().__init__(item_type)
|
|
self._tonnage = tonnage
|
|
|
|
@property
|
|
def tonnage(self) -> float:
|
|
return self._tonnage
|
|
|
|
|
|
class Cockpit(BigItem):
|
|
def __init__(self):
|
|
super().__init__(ItemTypes.COCKPIT, 3.0)
|
|
|
|
|
|
class Reaktor(BigItem):
|
|
|
|
def __init__(self, value: int, tonnage: float):
|
|
super().__init__(ItemTypes.REAKTOR, tonnage)
|
|
self._value = value
|
|
|
|
@property
|
|
def value(self):
|
|
return self._value
|
|
|
|
|
|
class Activator(Item):
|
|
def __init__(self):
|
|
super().__init__(ItemTypes.ACTIVATOR)
|
|
|
|
|
|
class Joint(Item):
|
|
def __init__(self):
|
|
super().__init__(ItemTypes.JOINT)
|
|
|
|
|
|
class Sensors(Item):
|
|
def __init__(self):
|
|
super().__init__(ItemTypes.SENSORS)
|
|
|
|
|
|
class Sustainment(Item):
|
|
def __init__(self):
|
|
super().__init__(ItemTypes.SUSTAINMENT)
|