Added missing data to fit copying
This commit is contained in:
@@ -142,14 +142,8 @@ class Booster(HandledItem, ItemAttrShortcut):
|
||||
copy = Booster(self.item)
|
||||
copy.active = self.active
|
||||
|
||||
# Legacy booster side effect code, disabling as not currently implemented
|
||||
'''
|
||||
origSideEffects = list(self.iterSideEffects())
|
||||
copySideEffects = list(copy.iterSideEffects())
|
||||
i = 0
|
||||
while i < len(origSideEffects):
|
||||
copySideEffects[i].active = origSideEffects[i].active
|
||||
i += 1
|
||||
'''
|
||||
for sideEffect in self.sideEffects:
|
||||
copyEffect = next(filter(lambda eff: eff.effectID == sideEffect.effectID, copy.sideEffects))
|
||||
copyEffect.active = sideEffect.active
|
||||
|
||||
return copy
|
||||
|
||||
@@ -291,6 +291,10 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
def __deepcopy__(self, memo):
|
||||
copy = Fighter(self.item)
|
||||
copy.amount = self.amount
|
||||
copy.active = self.active
|
||||
for ability in self.abilities:
|
||||
copyAbility = next(filter(lambda a: a.effectID == ability.effectID, copy.abilities))
|
||||
copyAbility.active = ability.active
|
||||
return copy
|
||||
|
||||
def fits(self, fit):
|
||||
|
||||
@@ -1580,6 +1580,7 @@ class Fit(object):
|
||||
copy_ship.name = "%s copy" % self.name
|
||||
copy_ship.damagePattern = self.damagePattern
|
||||
copy_ship.targetResists = self.targetResists
|
||||
copy_ship.implantLocation = self.implantLocation
|
||||
copy_ship.notes = self.notes
|
||||
|
||||
toCopy = (
|
||||
@@ -1598,12 +1599,27 @@ class Fit(object):
|
||||
for i in orig:
|
||||
c.append(deepcopy(i))
|
||||
|
||||
for fit in self.projectedFits:
|
||||
copy_ship.__projectedFits[fit.ID] = fit
|
||||
# this bit is required -- see GH issue # 83
|
||||
# this bit is required -- see GH issue # 83
|
||||
def forceUpdateSavedata(fit):
|
||||
eos.db.saveddata_session.flush()
|
||||
eos.db.saveddata_session.refresh(fit)
|
||||
|
||||
for fit in self.commandFits:
|
||||
copy_ship.__commandFits[fit.ID] = fit
|
||||
forceUpdateSavedata(fit)
|
||||
copyCommandInfo = fit.getCommandInfo(copy_ship.ID)
|
||||
originalCommandInfo = fit.getCommandInfo(self.ID)
|
||||
copyCommandInfo.active = originalCommandInfo.active
|
||||
forceUpdateSavedata(fit)
|
||||
|
||||
for fit in self.projectedFits:
|
||||
copy_ship.__projectedFits[fit.ID] = fit
|
||||
forceUpdateSavedata(fit)
|
||||
copyProjectionInfo = fit.getProjectionInfo(copy_ship.ID)
|
||||
originalProjectionInfo = fit.getProjectionInfo(self.ID)
|
||||
copyProjectionInfo.active = originalProjectionInfo.active
|
||||
forceUpdateSavedata(fit)
|
||||
|
||||
return copy_ship
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
Reference in New Issue
Block a user