Ensure we get all ship group and ship type restrictions

This commit is contained in:
blitzmann
2016-04-03 16:51:01 -04:00
parent a203799bd2
commit 0cfa7cb28f

View File

@@ -374,22 +374,21 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if shipType is not None:
fitsOnType.add(shipType)
for i in xrange(1, 10):
shipType = self.getModifiedItemAttr("canFitShipType%d" % i)
if shipType is not None:
fitsOnType.add(shipType)
for attr in self.itemModifiedAttributes.keys():
if attr.startswith("canFitShipType"):
shipType = self.getModifiedItemAttr(attr)
if shipType is not None:
fitsOnType.add(shipType)
# Check ship group restrictions
for i in xrange(1, 10):
shipGroup = self.getModifiedItemAttr("canFitShipGroup%d" % i)
if shipGroup is not None:
fitsOnGroup.add(shipGroup)
for attr in self.itemModifiedAttributes.keys():
if attr.startswith("canFitShipGroup"):
shipGroup = self.getModifiedItemAttr(attr)
if shipGroup is not None:
fitsOnGroup.add(shipGroup)
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
# 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")