mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Attempt to fix SplashDamage error w.r.t. line 604
Guard against event.target:getPosition() potentially being nil
This commit is contained in:
parent
1db84307fe
commit
de1f8a7abc
@ -601,7 +601,6 @@ function onWpnEvent(event)
|
|||||||
|
|
||||||
local player = event.initiator
|
local player = event.initiator
|
||||||
local targetName = event.target:getTypeName()
|
local targetName = event.target:getTypeName()
|
||||||
local impactPoint = event.target:getPosition().p
|
|
||||||
if weapon and targetName then
|
if weapon and targetName then
|
||||||
env.info(weapon.." hit "..targetName)
|
env.info(weapon.." hit "..targetName)
|
||||||
debugMsg(weapon.." hit "..targetName)
|
debugMsg(weapon.." hit "..targetName)
|
||||||
@ -610,7 +609,8 @@ function onWpnEvent(event)
|
|||||||
if clusterWeaps[weapon] then
|
if clusterWeaps[weapon] then
|
||||||
local ordnance = event.weapon
|
local ordnance = event.weapon
|
||||||
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory(), player=event.initiator }
|
tracked_weapons[event.weapon.id_] = { wpn = ordnance, init = event.initiator:getName(), pos = ordnance:getPoint(), dir = ordnance:getPosition().x, name = ordnance:getTypeName(), speed = ordnance:getVelocity(), cat = ordnance:getCategory(), player=event.initiator }
|
||||||
else
|
elseif event.target:getPosition() ~= nil then
|
||||||
|
local impactPoint = event.target:getPosition().p
|
||||||
blastWave(impactPoint, splash_damage_options.blast_search_radius, event.weapon, getWeaponExplosive(weapon), player)
|
blastWave(impactPoint, splash_damage_options.blast_search_radius, event.weapon, getWeaponExplosive(weapon), player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user