mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Wrap getLife with pcall to handle error where unit is lost (#3390)
This commit is contained in:
parent
cbf5f5ed90
commit
11304542bd
@ -151,9 +151,11 @@ end
|
|||||||
function update_hit_points(event)
|
function update_hit_points(event)
|
||||||
local update = {}
|
local update = {}
|
||||||
update.name = event.target:getName()
|
update.name = event.target:getName()
|
||||||
update.hit_points = event.target:getLife()
|
get_life_success, update.hit_points = pcall(event.target.getLife, event.target)
|
||||||
unit_hit_point_updates[#unit_hit_point_updates + 1] = update
|
if get_life_success then
|
||||||
write_state()
|
unit_hit_point_updates[#unit_hit_point_updates + 1] = update
|
||||||
|
write_state()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
activeWeapons = {}
|
activeWeapons = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user