I have this in my weapondefs_post.lua (minus comments):
Code: Select all
local modOptions
if (Spring.GetModOptions) then
modOptions = Spring.GetModOptions()
end
-- Range Multiplier
if (modOptions and modOptions.weapon_range_mult) then
local totalWeapons
totalWeapons = 0
local rangeCoeff
rangeCoeff = modOptions.weapon_range_mult
Spring.Echo("Starting weapon range multiplying, coefficient: "..rangeCoeff)
for name in pairs(WeaponDefs) do
local curRange = WeaponDefs[name].range
if (curRange) then
WeaponDefs[name].range = curRange * rangeCoeff
totalWeapons = totalWeapons + 1
end
end
Spring.Echo("Done with the ranges, "..totalWeapons.." weapons processed.")
end
This multiplies all the weapon ranges in the mod by a set factor (configurable via mod options as weapon_range_mult). Or at least it did that in 0.76. Now (0.77b5) it just breaks weapons in strange ways. For example, all the beamlasers just refuse to fire (they remain in 'Aiming' state indefinitely and cannot be fired even while using FPS mode), and most other weapons become ballistic (those that originally weren't, like missiles). I'm sure the problem is somewhere in that piece of lua, as if I remove that file from the mod, all is fine (but the ranges are not changeable anymore of course). So, does anyone have an idea what is wrong here?