mirror of
https://github.com/ciribob/DCS-CSAR.git
synced 2025-10-29 16:56:07 +00:00
Added ability to drop rescued pilot at FARP or Airfield
This commit is contained in:
67
CSAR.lua
67
CSAR.lua
@@ -1,5 +1,5 @@
|
|||||||
-- CSAR Script for DCS Ciribob - 2015
|
-- CSAR Script for DCS Ciribob - 2015
|
||||||
-- Version 1.8.1 - 28/12/2015
|
-- Version 1.8.2 - 31/12/2015
|
||||||
-- DCS 1.5 Compatible - Needs Mist 4.0.55 or higher!
|
-- DCS 1.5 Compatible - Needs Mist 4.0.55 or higher!
|
||||||
|
|
||||||
csar = {}
|
csar = {}
|
||||||
@@ -157,6 +157,8 @@ csar.loadDistance = 60 -- configure distance for pilot to get in helicopter in m
|
|||||||
|
|
||||||
csar.radioSound = "beacon.ogg" -- the name of the sound file to use for the Pilot radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
csar.radioSound = "beacon.ogg" -- the name of the sound file to use for the Pilot radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
||||||
|
|
||||||
|
csar.allowFARPRescue = true --allows pilot to be rescued by landing at a FARP or Airbase
|
||||||
|
|
||||||
-- SETTINGS FOR MISSION DESIGNER ^^^^^^^^^^^^^^^^^^^*
|
-- SETTINGS FOR MISSION DESIGNER ^^^^^^^^^^^^^^^^^^^*
|
||||||
|
|
||||||
-- Sanity checks of mission designer
|
-- Sanity checks of mission designer
|
||||||
@@ -339,6 +341,32 @@ function csar.eventHandler:onEvent(_event)
|
|||||||
|
|
||||||
csar.initSARForPilot(_spawnedGroup,_freq)
|
csar.initSARForPilot(_spawnedGroup,_freq)
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
elseif world.event.S_EVENT_LAND == _event.id then
|
||||||
|
|
||||||
|
if csar.allowFARPRescue then
|
||||||
|
|
||||||
|
local _unit = _event.initiator
|
||||||
|
|
||||||
|
if _unit == nil then
|
||||||
|
return -- error!
|
||||||
|
end
|
||||||
|
|
||||||
|
local _place = _event.place
|
||||||
|
|
||||||
|
if _place == nil then
|
||||||
|
return -- error!
|
||||||
|
end
|
||||||
|
|
||||||
|
if _place:getCoalition() == _unit:getCoalition() or _place:getCoalition() == 0 then
|
||||||
|
csar.rescuePilots(_unit)
|
||||||
|
--env.info("Rescued")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
end, _event)
|
end, _event)
|
||||||
if (not status) then
|
if (not status) then
|
||||||
@@ -887,18 +915,7 @@ function csar.scheduledSARFlight(_args)
|
|||||||
|
|
||||||
if _dist < 200 and _heliUnit:inAir() == false then
|
if _dist < 200 and _heliUnit:inAir() == false then
|
||||||
|
|
||||||
local _rescuedGroups = csar.inTransitGroups[_heliUnit:getName()]
|
csar.rescuePilots(_heliUnit)
|
||||||
|
|
||||||
csar.inTransitGroups[_heliUnit:getName()] = nil
|
|
||||||
|
|
||||||
local _txt = string.format("%s: The pilots have been taken to the\nmedical clinic. Good job!", _heliUnit:getName())
|
|
||||||
|
|
||||||
-- enable pilots again
|
|
||||||
for _, _rescueGroup in pairs(_rescuedGroups) do
|
|
||||||
csar.currentlyDisabled[_rescueGroup.originalUnit] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
csar.displayMessageToSAR(_heliUnit, _txt, 10)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -917,6 +934,28 @@ function csar.scheduledSARFlight(_args)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function csar.rescuePilots(_heliUnit)
|
||||||
|
local _rescuedGroups = csar.inTransitGroups[_heliUnit:getName()]
|
||||||
|
|
||||||
|
if _rescuedGroups == nil then
|
||||||
|
-- Groups already rescued
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
csar.inTransitGroups[_heliUnit:getName()] = nil
|
||||||
|
|
||||||
|
local _txt = string.format("%s: The pilots have been taken to the\nmedical clinic. Good job!", _heliUnit:getName())
|
||||||
|
|
||||||
|
-- enable pilots again
|
||||||
|
for _, _rescueGroup in pairs(_rescuedGroups) do
|
||||||
|
csar.currentlyDisabled[_rescueGroup.originalUnit] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
csar.displayMessageToSAR(_heliUnit, _txt, 10)
|
||||||
|
|
||||||
|
env.info("Rescued")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function csar.getSARHeli(_unitName)
|
function csar.getSARHeli(_unitName)
|
||||||
|
|
||||||
@@ -1190,7 +1229,7 @@ function csar.checkOnboard(_unitName)
|
|||||||
csar.displayMessageToSAR(_unit, "No Rescued Pilots onboard", 30)
|
csar.displayMessageToSAR(_unit, "No Rescued Pilots onboard", 30)
|
||||||
else
|
else
|
||||||
|
|
||||||
local _text = "Onboard: "
|
local _text = "Onboard - RTB to FARP/Airfield or MASH: "
|
||||||
|
|
||||||
for _,_onboard in pairs(csar.inTransitGroups[_unitName]) do
|
for _,_onboard in pairs(csar.inTransitGroups[_unitName]) do
|
||||||
_text = _text .."\n".._onboard.desc
|
_text = _text .."\n".._onboard.desc
|
||||||
|
|||||||
BIN
csar-test.miz
BIN
csar-test.miz
Binary file not shown.
Reference in New Issue
Block a user