Pass projection range parameter to effects
This commit is contained in:
3983
eos/effects.py
3983
eos/effects.py
File diff suppressed because it is too large
Load Diff
@@ -122,7 +122,7 @@ class Booster(HandledItem, ItemAttrShortcut):
|
||||
(effect.isType("passive") or effect.isType("boosterSideEffect")):
|
||||
if effect.isType("boosterSideEffect") and effect not in self.activeSideEffectEffects:
|
||||
continue
|
||||
effect.handler(fit, self, ("booster",))
|
||||
effect.handler(fit, self, ("booster",), None)
|
||||
|
||||
@validates("ID", "itemID", "ammoID", "active")
|
||||
def validator(self, key, val):
|
||||
|
||||
@@ -422,7 +422,7 @@ class Skill(HandledItem):
|
||||
(not fit.isStructure or effect.isType("structure")) and \
|
||||
effect.activeByDefault:
|
||||
try:
|
||||
effect.handler(fit, self, ("skill",))
|
||||
effect.handler(fit, self, ("skill",), None)
|
||||
except AttributeError:
|
||||
continue
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.amount = 0
|
||||
self.amountActive = 0
|
||||
self.projected = False
|
||||
self.projectionRange = None
|
||||
self.build()
|
||||
|
||||
@reconstructor
|
||||
@@ -319,23 +320,17 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
projected is False and effect.isType("passive")):
|
||||
# See GH issue #765
|
||||
if effect.getattr('grouped'):
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange, effect=effect)
|
||||
else:
|
||||
i = 0
|
||||
while i != self.amountActive:
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange, effect=effect)
|
||||
i += 1
|
||||
|
||||
if self.charge:
|
||||
for effect in self.charge.effects.values():
|
||||
if effect.runTime == runTime and effect.activeByDefault:
|
||||
effect.handler(fit, self, ("droneCharge",))
|
||||
effect.handler(fit, self, ("droneCharge",), self.projectionRange)
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
copy = Drone(self.item)
|
||||
|
||||
@@ -47,6 +47,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
self.itemID = item.ID if item is not None else None
|
||||
self.projected = False
|
||||
self.projectionRange = None
|
||||
self.active = True
|
||||
|
||||
# -1 is a placeholder that represents max squadron size, which we may not know yet as ships may modify this with
|
||||
@@ -399,17 +400,11 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effect.runTime == runTime and effect.activeByDefault and \
|
||||
((projected and effect.isType("projected")) or not projected):
|
||||
if ability.grouped:
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange, effect=effect)
|
||||
else:
|
||||
i = 0
|
||||
while i != self.amount:
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange, effect=effect)
|
||||
i += 1
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
|
||||
@@ -95,7 +95,7 @@ class Implant(HandledItem, ItemAttrShortcut):
|
||||
return
|
||||
for effect in self.item.effects.values():
|
||||
if effect.runTime == runTime and effect.isType("passive") and effect.activeByDefault:
|
||||
effect.handler(fit, self, ("implant",))
|
||||
effect.handler(fit, self, ("implant",), None)
|
||||
|
||||
@validates("fitID", "itemID", "active")
|
||||
def validator(self, key, val):
|
||||
|
||||
@@ -54,7 +54,7 @@ class Mode(ItemAttrShortcut, HandledItem):
|
||||
if self.item:
|
||||
for effect in self.item.effects.values():
|
||||
if effect.runTime == runTime and effect.activeByDefault:
|
||||
effect.handler(fit, self, context=("module",))
|
||||
effect.handler(fit, self, ("module",), None)
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
copy = Mode(self.item)
|
||||
|
||||
@@ -90,6 +90,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__charge = None
|
||||
|
||||
self.projected = False
|
||||
self.projectionRange = None
|
||||
self.state = FittingModuleState.ONLINE
|
||||
self.build()
|
||||
|
||||
@@ -867,13 +868,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
(not gang or (gang and effect.isType("gang")))
|
||||
):
|
||||
contexts = ("moduleCharge",)
|
||||
# For gang effects, we pass in the effect itself as an argument. However, to avoid going through all
|
||||
# the effect definitions and defining this argument, do a simple try/catch here and be done with it.
|
||||
# @todo: possibly fix this
|
||||
try:
|
||||
effect.handler(fit, self, contexts, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, contexts)
|
||||
effect.handler(fit, self, contexts, self.projectionRange, effect=effect)
|
||||
|
||||
if self.item:
|
||||
if self.state >= FittingModuleState.OVERHEATED:
|
||||
@@ -883,7 +878,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
and not forceProjected \
|
||||
and effect.activeByDefault \
|
||||
and ((gang and effect.isType("gang")) or not gang):
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange)
|
||||
|
||||
for effect in self.item.effects.values():
|
||||
if effect.runTime == runTime and \
|
||||
@@ -893,10 +888,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
(effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) \
|
||||
and ((projected and effect.isType("projected")) or not projected) \
|
||||
and ((gang and effect.isType("gang")) or not gang):
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
effect.handler(fit, self, context, self.projectionRange, effect=effect)
|
||||
|
||||
def getCycleParameters(self, reloadOverride=None):
|
||||
"""Copied from new eos as well"""
|
||||
|
||||
@@ -98,7 +98,7 @@ class Ship(ItemAttrShortcut, HandledItem):
|
||||
# skillbook modifiers will use the stale modifier value
|
||||
# GH issue #351
|
||||
fit.register(self)
|
||||
effect.handler(fit, self, ("ship",))
|
||||
effect.handler(fit, self, ("ship",), None)
|
||||
|
||||
def validateModeItem(self, item, owner=None):
|
||||
""" Checks if provided item is a valid mode """
|
||||
|
||||
Reference in New Issue
Block a user