Move check for module state being valid out of effectHandlerHelpers and into service\fit. We can't have it there because of cyclical imports. Plus we're already checking the module state here, so makes lots of sense to merge them.

This commit is contained in:
Ebag333
2017-02-08 21:24:24 -08:00
parent 636474610b
commit 3b91ec8c06
2 changed files with 6 additions and 9 deletions

View File

@@ -136,13 +136,6 @@ class HandledModuleList(HandledList):
self.remove(mod)
return
# fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
# TODO: This can't point to es_module, cyclical import loop
'''
if not mod.isValidState(mod.state):
mod.state = es_State.ONLINE
'''
def insert(self, index, mod):
mod.position = index
i = index

View File

@@ -905,13 +905,17 @@ class Fit(object):
changed = False
for mod in fit.modules:
if mod != base:
if not mod.canHaveState(mod.state):
# fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
if not mod.canHaveState(mod.state) or not mod.isValidState(mod.state):
mod.state = State.ONLINE
changed = True
for mod in fit.projectedModules:
if not mod.canHaveState(mod.state, fit):
# fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
if not mod.canHaveState(mod.state, fit) or not mod.isValidState(mod.state):
mod.state = State.OFFLINE
changed = True
for drone in fit.projectedDrones:
if drone.amountActive > 0 and not drone.canBeApplied(fit):
drone.amountActive = 0