Fix system effect states
This commit is contained in:
@@ -604,8 +604,8 @@ class Fit(object):
|
||||
Slot.RIG: "rigSlots",
|
||||
Slot.SUBSYSTEM: "maxSubSystems"}
|
||||
|
||||
if type == Slot.MODE:
|
||||
# Mode slot doesn't really exist, return default 0
|
||||
if type in (Slot.MODE, Slot.SYSTEM):
|
||||
# These slots don't really exist, return default 0
|
||||
return 0
|
||||
|
||||
slotsUsed = self.getSlotsUsed(type, countDummies)
|
||||
|
||||
@@ -35,12 +35,17 @@ class State(Enum):
|
||||
OVERHEATED = 2
|
||||
|
||||
class Slot(Enum):
|
||||
# These are self-explanatory
|
||||
LOW = 1
|
||||
MED = 2
|
||||
HIGH = 3
|
||||
RIG = 4
|
||||
SUBSYSTEM = 5
|
||||
MODE = 6 # not a real slot, need for pyfa display rack separation
|
||||
# not a real slot, need for pyfa display rack separation
|
||||
MODE = 6
|
||||
# system effects. They are projected "modules" and pyfa assumes all modules
|
||||
# have a slot. In this case, make one up.
|
||||
SYSTEM = 7
|
||||
|
||||
class Hardpoint(Enum):
|
||||
NONE = 0
|
||||
@@ -528,7 +533,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effectName in item.effects:
|
||||
return slot
|
||||
if item.group.name == "Effect Beacon":
|
||||
return Slot.RIG
|
||||
return Slot.SYSTEM
|
||||
|
||||
raise ValueError("Passed item does not fit in any known slot")
|
||||
|
||||
|
||||
@@ -932,21 +932,32 @@ class Fit(object):
|
||||
self.checkStates(fit, base)
|
||||
|
||||
# Old state : New State
|
||||
localMap = {State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.ONLINE,
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.ACTIVE}
|
||||
projectedMap = {State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
State.OFFLINE: State.ACTIVE,
|
||||
State.ONLINE: State.ACTIVE} # Just in case
|
||||
localMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.ONLINE,
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.ACTIVE}
|
||||
projectedMap = {
|
||||
State.OVERHEATED: State.ACTIVE,
|
||||
State.ACTIVE: State.OFFLINE,
|
||||
State.OFFLINE: State.ACTIVE,
|
||||
State.ONLINE: State.ACTIVE} # Just in case
|
||||
# For system effects. They should only ever be online or offline
|
||||
projectedSystem = {
|
||||
State.OFFLINE: State.ONLINE,
|
||||
State.ONLINE: State.OFFLINE}
|
||||
|
||||
def __getProposedState(self, mod, click, proposedState=None):
|
||||
if mod.slot is Slot.SUBSYSTEM or mod.isEmpty:
|
||||
if mod.slot == Slot.SUBSYSTEM or mod.isEmpty:
|
||||
return State.ONLINE
|
||||
|
||||
if mod.slot == Slot.SYSTEM:
|
||||
transitionMap = self.projectedSystem
|
||||
else:
|
||||
transitionMap = self.projectedMap if mod.projected else self.localMap
|
||||
|
||||
currState = mod.state
|
||||
transitionMap = self.projectedMap if mod.projected else self.localMap
|
||||
|
||||
if proposedState is not None:
|
||||
state = proposedState
|
||||
elif click == "right":
|
||||
|
||||
Reference in New Issue
Block a user