Support speedLimit introduced with Entosis Link

This commit is contained in:
blitzmann
2015-08-25 17:25:36 -04:00
parent 31331b1e34
commit 6e95f69565
4 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
runtime = "late"
type = "passive"
def handler(fit, src, context):
fit.extraAttributes['speedLimit'] = src.getModifiedItemAttr("speedLimit")

View File

@@ -303,6 +303,14 @@ class Fit(object):
def jamChance(self):
return (1-self.ecmProjectedStr)*100
@property
def maxSpeed(self):
speedLimit = self.ship.getModifiedItemAttr("speedLimit")
if speedLimit and self.ship.getModifiedItemAttr("maxVelocity") > speedLimit:
return speedLimit
return self.ship.getModifiedItemAttr("maxVelocity")
@property
def alignTime(self):
agility = self.ship.getModifiedItemAttr("agility")

View File

@@ -35,6 +35,10 @@ class Ship(ItemAttrShortcut, HandledItem):
"droneControlRange": 20000,
"cloaked": False,
"siege": False
# We also have speedLimit for Entosis Link, but there seems to be an
# issue with naming it exactly "speedLimit" due to unknown reasons.
# Regardless, we don't have to put it here anyways - it will come up
# as None unless the Entosis effect sets it.
}
def __init__(self, item):

View File

@@ -149,7 +149,7 @@ class TargetingMiscViewFull(StatsView):
("labelScanRes", {"main": lambda: fit.ship.getModifiedItemAttr("scanResolution")}, 3, 0, 0, "mm"),
("labelSensorStr", {"main": lambda: fit.scanStrength}, 3, 0, 0, ""),
("labelCtrlRange", {"main": lambda: fit.extraAttributes["droneControlRange"] / 1000}, 3, 0, 0, "km"),
("labelFullSpeed", {"main": lambda: fit.ship.getModifiedItemAttr("maxVelocity")}, 3, 0, 0, "m/s"),
("labelFullSpeed", {"main": lambda: fit.maxSpeed}, 3, 0, 0, "m/s"),
("labelFullAlignTime", {"main": lambda: fit.alignTime}, 3, 0, 0, "s"),
("labelFullSigRadius", {"main": lambda: fit.ship.getModifiedItemAttr("signatureRadius")}, 3, 0, 9, ""),
("labelFullWarpSpeed", {"main": lambda: fit.warpSpeed}, 3, 0, 0, "AU/s"),