An instance of this class represents a module together with its charge and modified attributes
| 63 | |
| 64 | |
| 65 | class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut, MutatedMixin): |
| 66 | """An instance of this class represents a module together with its charge and modified attributes""" |
| 67 | MINING_ATTRIBUTES = ("miningAmount",) |
| 68 | SYSTEM_GROUPS = ( |
| 69 | "Effect Beacon", "MassiveEnvironments", "Abyssal Hazards", "Non-Interactable Object", |
| 70 | "Destructible Effect Beacon", "Sovereignty Hub System Effect Generator Upgrades") |
| 71 | |
| 72 | def __init__(self, item, baseItem=None, mutaplasmid=None): |
| 73 | """Initialize a module from the program""" |
| 74 | |
| 75 | self.itemID = item.ID if item is not None else None |
| 76 | |
| 77 | self._item = item |
| 78 | self._mutaInit(baseItem=baseItem, mutaplasmid=mutaplasmid) |
| 79 | |
| 80 | if item is not None and self.isInvalid: |
| 81 | raise ValueError("Passed item is not a Module") |
| 82 | |
| 83 | self.__charge = None |
| 84 | |
| 85 | self.projected = False |
| 86 | self.projectionRange = None |
| 87 | self.state = FittingModuleState.ONLINE |
| 88 | self.build() |
| 89 | |
| 90 | @reconstructor |
| 91 | def init(self): |
| 92 | """Initialize a module from the database and validate""" |
| 93 | self._item = None |
| 94 | self.__charge = None |
| 95 | |
| 96 | # we need this early if module is invalid and returns early |
| 97 | self.__slot = self.dummySlot |
| 98 | |
| 99 | if self.itemID: |
| 100 | self._item = eos.db.getItem(self.itemID) |
| 101 | if self._item is None: |
| 102 | pyfalog.error("Item (id: {0}) does not exist", self.itemID) |
| 103 | return |
| 104 | |
| 105 | try: |
| 106 | self._mutaReconstruct() |
| 107 | except MutaError: |
| 108 | return |
| 109 | |
| 110 | if self.isInvalid: |
| 111 | pyfalog.error("Item (id: {0}) is not a Module", self.itemID) |
| 112 | return |
| 113 | |
| 114 | if self.chargeID: |
| 115 | self.__charge = eos.db.getItem(self.chargeID) |
| 116 | |
| 117 | self.build() |
| 118 | |
| 119 | def build(self): |
| 120 | """ Builds internal module variables from both init's """ |
| 121 | |
| 122 | if self.__charge and self.__charge.category.name != "Charge": |
no outgoing calls
no test coverage detected