Fix exclusive abyssal weathers items (#1794)

This commit is contained in:
blitzmann
2018-12-01 23:01:13 -05:00
parent 194c159379
commit d404d10bfe
3 changed files with 15 additions and 7 deletions

View File

@@ -237,20 +237,23 @@ class HandledProjectedModList(HandledList):
return
proj.projected = True
isSystemEffect = proj.item.group.name == "Effect Beacon"
if isSystemEffect:
if proj.isExclusiveSystemEffect:
self.makeRoom(proj)
HandledList.append(self, proj)
# Remove non-projectable modules
if not proj.item.isType("projected") and not isSystemEffect:
if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
self.remove(proj)
@property
def currentSystemEffect(self):
return next((m for m in self if m.isExclusiveSystemEffect), None)
def makeRoom(self, proj):
# remove other system effects - only 1 per fit plz
oldEffect = next((m for m in self if m.item.group.name == "Effect Beacon"), None)
oldEffect = self.currentSystemEffect
if oldEffect:
pyfalog.info("System effect occupied with {0}, replacing with {1}", oldEffect.item.name, proj.item.name)

View File

@@ -280,6 +280,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return self in self.owner.projectedModules
return None
@property
def isExclusiveSystemEffect(self):
return self.item.group.name in ("Effect Beacon", "Non-Interactable Object", "MassiveEnvironments")
@property
def isCapitalSize(self):
return self.getModifiedItemAttr("volume", 0) >= 4000

View File

@@ -28,11 +28,12 @@ class FitAddProjectedEnvCommand(wx.Command):
# todo: thing to check for existing environmental effects
self.old_item = fit.projectedModules.makeRoom(module)
module.state = State.ONLINE
fit.projectedModules.append(module)
if module.isExclusiveSystemEffect:
# if this is an exclusive system effect, we need to cache the old one. We make room for the new one here, which returns the old one
self.old_item = fit.projectedModules.makeRoom(module)
fit.projectedModules.append(module)
eos.db.commit()
self.new_index = fit.projectedModules.index(module)
return True