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