Ensure we get all ship group and ship type restrictions
This commit is contained in:
@@ -374,22 +374,21 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
|||||||
if shipType is not None:
|
if shipType is not None:
|
||||||
fitsOnType.add(shipType)
|
fitsOnType.add(shipType)
|
||||||
|
|
||||||
for i in xrange(1, 10):
|
for attr in self.itemModifiedAttributes.keys():
|
||||||
shipType = self.getModifiedItemAttr("canFitShipType%d" % i)
|
if attr.startswith("canFitShipType"):
|
||||||
if shipType is not None:
|
shipType = self.getModifiedItemAttr(attr)
|
||||||
fitsOnType.add(shipType)
|
if shipType is not None:
|
||||||
|
fitsOnType.add(shipType)
|
||||||
|
|
||||||
|
for attr in self.itemModifiedAttributes.keys():
|
||||||
# Check ship group restrictions
|
if attr.startswith("canFitShipGroup"):
|
||||||
for i in xrange(1, 10):
|
shipGroup = self.getModifiedItemAttr(attr)
|
||||||
shipGroup = self.getModifiedItemAttr("canFitShipGroup%d" % i)
|
if shipGroup is not None:
|
||||||
if shipGroup is not None:
|
fitsOnGroup.add(shipGroup)
|
||||||
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:
|
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
|
return False
|
||||||
|
|
||||||
|
|
||||||
# If the mod is a subsystem, don't let two subs in the same slot fit
|
# If the mod is a subsystem, don't let two subs in the same slot fit
|
||||||
if self.slot == Slot.SUBSYSTEM:
|
if self.slot == Slot.SUBSYSTEM:
|
||||||
subSlot = self.getModifiedItemAttr("subSystemSlot")
|
subSlot = self.getModifiedItemAttr("subSystemSlot")
|
||||||
|
|||||||
Reference in New Issue
Block a user