Skip to content

Commit bd282b5

Browse files
committed
Hide odin technical range in LUS
fix for #5587
1 parent f644509 commit bd282b5

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

scripts/bomberassault.lua

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ include "constants.lua"
2828
local manualTarget_p1 = false
2929
local manualTarget_p2 = false
3030
local manualTarget_p3 = false
31+
local rangeChanged = false
32+
local THERMITE_BOMB_ID
33+
local FAKE_WEAPON_ID
34+
for i = 1, #UnitDefs[unitDefID].weapons do
35+
local weaponName = WeaponDefs[UnitDefs[unitDefID].weapons[i].weaponDef].name
36+
if weaponName == "bomberassault_thermite_bomb" then
37+
THERMITE_BOMB_ID = i
38+
end
39+
if weaponName == "bomberassault_zeppelin_bomb" then
40+
FAKE_WEAPON_ID = i
41+
end
42+
end
43+
local THERMITE_BOMB_RANGE = Spring.GetUnitWeaponState(unitID, FAKE_WEAPON_ID, "range")
3144

3245
function ReammoComplete()
3346
Show(bomb)
@@ -129,10 +142,23 @@ function script.FireWeapon(num)
129142
end
130143

131144
function script.BlockShot(num, targetID)
132-
if num == 1 or (num == manualfireWeapon and not IsManualFireTargetValid()) then
145+
if num == 1 or
146+
(num == manualfireWeapon and not IsManualFireTargetValid()) or
147+
(GetUnitValue(COB.CRASHING) == 1) or RearmBlockShot() then
133148
return true
134149
end
135-
return (GetUnitValue(COB.CRASHING) == 1) or RearmBlockShot()
150+
if num == THERMITE_BOMB_ID then
151+
rangeChanged = true
152+
Spring.SetUnitWeaponState(unitID, THERMITE_BOMB_ID, "range", 9001) -- large so noExplode doesn't remove projectile due to vertical drop distance
153+
end
154+
return false
155+
end
156+
157+
function script.EndBurst()
158+
if rangeChanged then
159+
rangeChanged = false
160+
Spring.SetUnitWeaponState(unitID, THERMITE_BOMB_ID, "range", THERMITE_BOMB_RANGE)
161+
end
136162
end
137163

138164
function script.Killed(recentDamage, maxHealth)

units/bomberassault.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ return { bomberassault = {
152152
myGravity = 0.08,
153153
noExplode = true,
154154
noSelfDamage = true,
155-
range = 3000, -- large so noExplode doesn't remove projectile due to vertical drop distance
155+
range = 180, -- dynamically updated in LUS so noExplode doesn't remove projectile due to vertical drop distance
156156
reloadtime = 2,
157157
size = 0.01,
158158
soundStart = [[explosion/ex_large9]],

0 commit comments

Comments
 (0)