MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / checkStates

Method checkStates

service/fit.py:468–499  ·  view source on GitHub ↗
(self, fit, base)

Source from the content-addressed store, hash-verified

466 self.recalc(fit)
467
468 def checkStates(self, fit, base):
469 pyfalog.debug("Check states for fit ID: {0}", fit)
470 changedMods = {}
471 changedProjMods = {}
472 changedProjDrones = {}
473 for pos, mod in enumerate(fit.modules):
474 if mod is not base:
475 # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
476 canHaveState = mod.canHaveState(mod.state)
477 if canHaveState is not True:
478 changedMods[pos] = mod.state
479 mod.state = canHaveState
480 elif not mod.isValidState(mod.state):
481 changedMods[pos] = mod.state
482 mod.state = FittingModuleState.ONLINE
483
484 for pos, mod in enumerate(fit.projectedModules):
485 # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module
486 canHaveState = mod.canHaveState(mod.state, fit)
487 if canHaveState is not True:
488 changedProjMods[pos] = mod.state
489 mod.state = canHaveState
490 elif not mod.isValidState(mod.state):
491 changedProjMods[pos] = mod.state
492 mod.state = FittingModuleState.OFFLINE
493
494 for pos, drone in enumerate(fit.projectedDrones):
495 if drone.amountActive > 0 and not drone.canBeApplied(fit):
496 changedProjDrones[pos] = drone.amountActive
497 drone.amountActive = 0
498
499 return changedMods, changedProjMods, changedProjDrones
500
501 @classmethod
502 def fitObjectIter(cls, fit, forceFitImplants=False):

Callers 15

getFitMethod · 0.95
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80

Calls 3

canHaveStateMethod · 0.80
isValidStateMethod · 0.80
canBeAppliedMethod · 0.45

Tested by

no test coverage detected