Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions scripts/bomberassault.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ include "constants.lua"
local manualTarget_p1 = false
local manualTarget_p2 = false
local manualTarget_p3 = false
local rangeChanged = false
local THERMITE_NUM, FAKE_GUN_NUM, THERMITE_TRUERANGE, THERMITE_ALT_RANGE
for i = 1, #UnitDefs[unitDefID].weapons do
local weapondef = WeaponDefs[UnitDefs[unitDefID].weapons[i].weaponDef]
if weapondef == WeaponDefNames["bomberassault_thermite_bomb"] then
THERMITE_NUM = i
THERMITE_TRUERANGE = weapondef.customParams.truerange
THERMITE_ALT_RANGE = weapondef.customParams.fakerange
end
if weapondef == WeaponDefNames["bomberassault_zeppelin_bomb"] then
FAKE_GUN_NUM = i
end
end

function ReammoComplete()
Show(bomb)
Expand Down Expand Up @@ -129,10 +142,24 @@ function script.FireWeapon(num)
end

function script.BlockShot(num, targetID)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for style in this function

if num == 1 or (num == manualfireWeapon and not IsManualFireTargetValid()) then
if num == FAKE_GUN_NUM or
(num == manualfireWeapon and not IsManualFireTargetValid()) or
(GetUnitValue(COB.CRASHING) == 1) or
RearmBlockShot() then
return true
end
return (GetUnitValue(COB.CRASHING) == 1) or RearmBlockShot()
if num == THERMITE_NUM then
rangeChanged = true
Spring.SetUnitWeaponState(unitID, THERMITE_NUM, "range", THERMITE_ALT_RANGE)
end
return false
end

function script.EndBurst()
if rangeChanged then
rangeChanged = false
Spring.SetUnitWeaponState(unitID, THERMITE_NUM, "range", THERMITE_TRUERANGE)
end
end

function script.Killed(recentDamage, maxHealth)
Expand Down
3 changes: 2 additions & 1 deletion units/bomberassault.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ return { bomberassault = {
stats_hide_damage = 1,
damage_vs_feature = 20, -- Doesn't ramp for technical reasons, so this is here to deal some reasonable damage.
truerange = 180,
fakerange = 9001, -- range extention to not disappear past trueraange (noExplode interaction)

thermite_frames = 900,
thermite_dps_start = 0,
Expand Down Expand Up @@ -152,7 +153,7 @@ return { bomberassault = {
myGravity = 0.08,
noExplode = true,
noSelfDamage = true,
range = 3000, -- large so noExplode doesn't remove projectile due to vertical drop distance
range = 180, -- overridden by customparams.truerange
reloadtime = 2,
size = 0.01,
soundStart = [[explosion/ex_large9]],
Expand Down