mirror of
https://github.com/ciribob/DCS-CSAR.git
synced 2025-10-29 16:56:07 +00:00
Double Ejection Fix
This commit is contained in:
27
CSAR.lua
27
CSAR.lua
@@ -344,6 +344,10 @@ function csar.eventHandler:onEvent(_event)
|
|||||||
-- Catch multiple events here?
|
-- Catch multiple events here?
|
||||||
if csar.takenOff[_event.initiator:getName()] == true or _unit:inAir() then
|
if csar.takenOff[_event.initiator:getName()] == true or _unit:inAir() then
|
||||||
|
|
||||||
|
if csar.doubleEjection(_unit) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
trigger.action.outTextForCoalition(_unit:getCoalition(), "MAYDAY MAYDAY! " .. _unit:getTypeName() .. " shot down. No Chute!", 10)
|
trigger.action.outTextForCoalition(_unit:getCoalition(), "MAYDAY MAYDAY! " .. _unit:getTypeName() .. " shot down. No Chute!", 10)
|
||||||
csar.handleEjectOrCrash(_unit, true)
|
csar.handleEjectOrCrash(_unit, true)
|
||||||
else
|
else
|
||||||
@@ -384,6 +388,11 @@ function csar.eventHandler:onEvent(_event)
|
|||||||
return -- give up, pilot hasnt taken off
|
return -- give up, pilot hasnt taken off
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if csar.doubleEjection(_unit) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local _spawnedGroup = csar.spawnGroup(_unit)
|
local _spawnedGroup = csar.spawnGroup(_unit)
|
||||||
csar.addSpecialParametersToGroup(_spawnedGroup)
|
csar.addSpecialParametersToGroup(_spawnedGroup)
|
||||||
@@ -457,6 +466,24 @@ function csar.eventHandler:onEvent(_event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
csar.lastCrash = {}
|
||||||
|
|
||||||
|
function csar.doubleEjection(_unit)
|
||||||
|
|
||||||
|
if csar.lastCrash[_unit:getName()] then
|
||||||
|
local _time = csar.lastCrash[_unit:getTime()]
|
||||||
|
|
||||||
|
if timer.getTime() - _time < 10 then
|
||||||
|
env.info("Caught double ejection!")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
csar.lastCrash[_unit:getName()] = timer.getTime()
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function csar.handleEjectOrCrash(_unit, _crashed)
|
function csar.handleEjectOrCrash(_unit, _crashed)
|
||||||
|
|
||||||
-- disable aircraft for ALL pilots
|
-- disable aircraft for ALL pilots
|
||||||
|
|||||||
Reference in New Issue
Block a user