Skip to content

Commit f778f9c

Browse files
committed
Take ship radius in consideration when displaying missile range in range column
1 parent 7fb6170 commit f778f9c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

eos/saveddata/module.py

+5
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,16 @@ def calculateRange(maxVelocity, mass, agility, flightTime):
368368
higherTime = math.ceil(flightTime)
369369
lowerRange = calculateRange(maxVelocity, mass, agility, lowerTime)
370370
higherRange = calculateRange(maxVelocity, mass, agility, higherTime)
371+
# Fof range limit is supposedly calculated based on overview (surface-to-surface) range
371372
if 'fofMissileLaunching' in self.charge.effects:
372373
rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
373374
if rangeLimit:
374375
lowerRange = min(lowerRange, rangeLimit)
375376
higherRange = min(higherRange, rangeLimit)
377+
# Make range center-to-surface, as missiles spawn in the center of the ship
378+
shipRadius = self.owner.ship.getModifiedItemAttr("radius")
379+
lowerRange = max(0, lowerRange - shipRadius)
380+
higherRange = max(0, higherRange - shipRadius)
376381
higherChance = flightTime - lowerTime
377382
return lowerRange, higherRange, higherChance
378383

graphs/data/fitDamageStats/calc/application.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ def getLauncherMult(mod, src, distance, tgtSpeed, tgtSigRadius):
155155
missileMaxRangeData = mod.missileMaxRangeData
156156
if missileMaxRangeData is None:
157157
return 0
158+
# The ranges already consider ship radius
158159
lowerRange, higherRange, higherChance = missileMaxRangeData
159-
if distance is None or distance + src.getRadius() <= lowerRange:
160+
if distance is None or distance <= lowerRange:
160161
distanceFactor = 1
161-
elif lowerRange < distance + src.getRadius() <= higherRange:
162+
elif lowerRange < distance <= higherRange:
162163
distanceFactor = higherChance
163164
else:
164165
distanceFactor = 0

0 commit comments

Comments
 (0)