mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Wrap DEAD event handler in pcall as it sometimes fails (#3497)
This commit is contained in:
parent
5f66b6230f
commit
023c56700e
@ -176,6 +176,8 @@ local function onEvent(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_DEAD and event.initiator then
|
if event.id == world.event.S_EVENT_DEAD and event.initiator then
|
||||||
|
get_initiator_name_success, initiator_name = pcall(event.initiator.getName, event.initiator)
|
||||||
|
if get_initiator_name_success then
|
||||||
dead_events[#dead_events + 1] = event.initiator.getName(event.initiator)
|
dead_events[#dead_events + 1] = event.initiator.getName(event.initiator)
|
||||||
local position = event.initiator.getPosition(event.initiator)
|
local position = event.initiator.getPosition(event.initiator)
|
||||||
local destruction = {}
|
local destruction = {}
|
||||||
@ -187,6 +189,7 @@ local function onEvent(event)
|
|||||||
destroyed_objects_positions[#destroyed_objects_positions + 1] = destruction
|
destroyed_objects_positions[#destroyed_objects_positions + 1] = destruction
|
||||||
write_state()
|
write_state()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_HIT then
|
if event.id == world.event.S_EVENT_HIT then
|
||||||
target_category = event.target:getCategory()
|
target_category = event.target:getCategory()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user