Rework cargo to module command

This commit is contained in:
DarkPhoenix
2019-04-16 01:41:19 +03:00
parent a270dc44d2
commit 64bba0cfdb
13 changed files with 174 additions and 116 deletions

View File

@@ -593,6 +593,12 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
else:
return True
def getMaxState(self, proposedState=None):
states = sorted((s for s in FittingModuleState if proposedState is None or s <= proposedState), reverse=True)
for state in states:
if self.isValidState(state):
return state
def canHaveState(self, state=None, projectedOnto=None):
"""
Check with other modules if there are restrictions that might not allow this module to be activated