diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index f9cf1714f..814cecccf 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -24,6 +24,7 @@ from eos.effectHandlerHelpers import HandledItem, HandledCharge from eos.enum import Enum from eos.mathUtils import floorFloat import eos.db +from eos.types import Citadel import logging logger = logging.getLogger(__name__) @@ -395,6 +396,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): if (len(fitsOnGroup) > 0 or len(fitsOnType) > 0) and fit.ship.item.group.ID not in fitsOnGroup and fit.ship.item.ID not in fitsOnType: return False + # AFAIK Citadel modules will always be restricted based on canFitShipType/Group. If we are fitting to a Citadel + # and the module does not have these properties, return false to prevent regular ship modules from being used + if isinstance(fit.ship, Citadel) and len(fitsOnGroup) == 0 and len(fitsOnType) == 0: + return False + # If the mod is a subsystem, don't let two subs in the same slot fit if self.slot == Slot.SUBSYSTEM: subSlot = self.getModifiedItemAttr("subSystemSlot") diff --git a/eos/types.py b/eos/types.py index 31bbcd47a..12e7eb281 100644 --- a/eos/types.py +++ b/eos/types.py @@ -25,6 +25,8 @@ from eos.saveddata.crestchar import CrestChar from eos.saveddata.damagePattern import DamagePattern from eos.saveddata.targetResists import TargetResists from eos.saveddata.character import Character, Skill +from eos.saveddata.ship import Ship +from eos.saveddata.citadel import Citadel from eos.saveddata.module import Module, State, Slot, Hardpoint, Rack from eos.saveddata.drone import Drone from eos.saveddata.fighterAbility import FighterAbility @@ -34,8 +36,6 @@ from eos.saveddata.implant import Implant from eos.saveddata.implantSet import ImplantSet from eos.saveddata.booster import SideEffect from eos.saveddata.booster import Booster -from eos.saveddata.ship import Ship -from eos.saveddata.citadel import Citadel from eos.saveddata.fit import Fit, ImplantLocation from eos.saveddata.mode import Mode from eos.saveddata.fleet import Fleet, Wing, Squad diff --git a/gui/itemStats.py b/gui/itemStats.py index ad3e49b6c..45ebfff7b 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -24,7 +24,7 @@ from gui.bitmapLoader import BitmapLoader import sys import wx.lib.mixins.listctrl as listmix import wx.html -from eos.types import Fit, Ship, Module, Skill, Booster, Implant, Drone, Mode, Fighter +from eos.types import Fit, Ship, Citadel, Module, Skill, Booster, Implant, Drone, Mode, Fighter from gui.utils.numberFormatter import formatAmount import service import config @@ -561,7 +561,7 @@ class ItemEffects (wx.Panel): class ItemAffectedBy (wx.Panel): - ORDER = [Fit, Ship, Mode, Module, Drone, Fighter, Implant, Booster, Skill] + ORDER = [Fit, Ship, Citadel, Mode, Module, Drone, Fighter, Implant, Booster, Skill] def __init__(self, parent, stuff, item): wx.Panel.__init__(self, parent) self.stuff = stuff diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 7557813db..db3d8104c 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -155,7 +155,7 @@ class MainFrame(wx.Frame): self.marketBrowser.splitter.SetSashPosition(self.marketHeight) self.shipBrowser = ShipBrowser(self.notebookBrowsers) - self.notebookBrowsers.AddPage(self.shipBrowser, "Ships", tabImage = shipBrowserImg, showClose = False) + self.notebookBrowsers.AddPage(self.shipBrowser, "Fittings", tabImage = shipBrowserImg, showClose = False) #======================================================================= # DISABLED FOR RC2 RELEASE diff --git a/service/fit.py b/service/fit.py index 71f8c873d..eb136a5d4 100644 --- a/service/fit.py +++ b/service/fit.py @@ -157,7 +157,10 @@ class Fit(object): return fit.modules[pos] def newFit(self, shipID, name=None): - ship = eos.types.Ship(eos.db.getItem(shipID)) + try: + ship = eos.types.Ship(eos.db.getItem(shipID)) + except ValueError: + ship = eos.types.Citadel(eos.db.getItem(shipID)) fit = eos.types.Fit(ship) fit.name = name if name is not None else "New %s" % fit.ship.item.name fit.damagePattern = self.pattern