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,16 +176,19 @@ 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
|
||||||
dead_events[#dead_events + 1] = event.initiator.getName(event.initiator)
|
get_initiator_name_success, initiator_name = pcall(event.initiator.getName, event.initiator)
|
||||||
local position = event.initiator.getPosition(event.initiator)
|
if get_initiator_name_success then
|
||||||
local destruction = {}
|
dead_events[#dead_events + 1] = event.initiator.getName(event.initiator)
|
||||||
destruction.x = position.p.x
|
local position = event.initiator.getPosition(event.initiator)
|
||||||
destruction.y = position.p.y
|
local destruction = {}
|
||||||
destruction.z = position.p.z
|
destruction.x = position.p.x
|
||||||
destruction.type = event.initiator:getTypeName()
|
destruction.y = position.p.y
|
||||||
destruction.orientation = mist.getHeading(event.initiator) * 57.3
|
destruction.z = position.p.z
|
||||||
destroyed_objects_positions[#destroyed_objects_positions + 1] = destruction
|
destruction.type = event.initiator:getTypeName()
|
||||||
write_state()
|
destruction.orientation = mist.getHeading(event.initiator) * 57.3
|
||||||
|
destroyed_objects_positions[#destroyed_objects_positions + 1] = destruction
|
||||||
|
write_state()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_HIT then
|
if event.id == world.event.S_EVENT_HIT then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user