Fix #434
This commit is contained in:
@@ -5,5 +5,5 @@
|
||||
type = "passive"
|
||||
runTime = "early"
|
||||
def handler(fit, ship, context):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Cloaking Device",
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Cloaking"),
|
||||
"cpu", ship.getModifiedItemAttr("eliteBonusCoverOps1"), skill="Covert Ops")
|
||||
|
||||
@@ -44,7 +44,8 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
class CalculationPlaceholder():
|
||||
pass
|
||||
|
||||
def __init__(self, fit = None):
|
||||
def __init__(self, fit=None, parent=None):
|
||||
self.parent = parent
|
||||
self.fit = fit
|
||||
# Stores original values of the entity
|
||||
self.__original = None
|
||||
@@ -225,8 +226,15 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
with the fit and thus get the correct affector. Returns skill level to
|
||||
be used to modify modifier. See GH issue #101
|
||||
"""
|
||||
skill = self.fit.character.getSkill(skillName)
|
||||
self.fit.register(skill)
|
||||
fit = self.fit
|
||||
if not fit:
|
||||
# self.fit is usually set during fit calculations when the item is registered with the fit. However,
|
||||
# under certain circumstances, an effect will not work as it will try to modify an item which has NOT
|
||||
# yet been registered and thus has not had self.fit set. In this case, use the modules owner attribute
|
||||
# to point to the correct fit. See GH Issue #434
|
||||
fit = self.parent.owner
|
||||
skill = fit.character.getSkill(skillName)
|
||||
fit.register(skill)
|
||||
return skill.level
|
||||
|
||||
def getAfflictions(self, key):
|
||||
|
||||
@@ -107,8 +107,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
self.__reloadForce = None
|
||||
self.__chargeCycles = None
|
||||
self.__hardpoint = Hardpoint.NONE
|
||||
self.__itemModifiedAttributes = ModifiedAttributeDict()
|
||||
self.__chargeModifiedAttributes = ModifiedAttributeDict()
|
||||
self.__itemModifiedAttributes = ModifiedAttributeDict(parent=self)
|
||||
self.__chargeModifiedAttributes = ModifiedAttributeDict(parent=self)
|
||||
self.__slot = self.dummySlot # defaults to None
|
||||
|
||||
if self.__item:
|
||||
|
||||
Reference in New Issue
Block a user