mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#CSAR - use custom callsigns, add weight to helo per saved pilot
This commit is contained in:
parent
30ce1aa907
commit
2bf5cc2369
@ -30,7 +30,7 @@
|
|||||||
-- @module Ops.CSAR
|
-- @module Ops.CSAR
|
||||||
-- @image OPS_CSAR.jpg
|
-- @image OPS_CSAR.jpg
|
||||||
|
|
||||||
-- Date: June 2022
|
-- Date: October 2022
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||||
@ -270,7 +270,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
|
|||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.13"
|
CSAR.version="1.0.15"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@ -1210,6 +1210,20 @@ function CSAR:_RemoveNameFromDownedPilots(name,force)
|
|||||||
return found
|
return found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (Internal) Check if a name is in downed pilot table and remove it.
|
||||||
|
-- @param #CSAR self
|
||||||
|
-- @param #string UnitName
|
||||||
|
-- @return #string CallSign
|
||||||
|
function CSAR:_GetCustomCallSign(UnitName)
|
||||||
|
local callsign = Unitname
|
||||||
|
local unit = UNIT:FindByName(UnitName)
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
local group = unit:GetGroup()
|
||||||
|
callsign = group:GetCustomCallSign(true,true)
|
||||||
|
end
|
||||||
|
return callsign
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Check state of wounded group.
|
--- (Internal) Check state of wounded group.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param #string heliname heliname
|
-- @param #string heliname heliname
|
||||||
@ -1266,9 +1280,9 @@ function CSAR:_CheckWoundedGroupStatus(heliname,woundedgroupname)
|
|||||||
local dist = UTILS.MetersToNM(self.autosmokedistance)
|
local dist = UTILS.MetersToNM(self.autosmokedistance)
|
||||||
disttext = string.format("%.0fnm",dist)
|
disttext = string.format("%.0fnm",dist)
|
||||||
end
|
end
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. I hear you! Finally, that is music in my ears!\nI'll pop a smoke when you are %s away.\nLand or hover by the smoke.", _heliName, _pilotName, disttext), self.messageTime,false,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. I hear you! Finally, that is music in my ears!\nI'll pop a smoke when you are %s away.\nLand or hover by the smoke.", self:_GetCustomCallSign(_heliName), _pilotName, disttext), self.messageTime,false,true)
|
||||||
else
|
else
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. I hear you! Finally, that is music in my ears!\nRequest a flare or smoke if you need.", _heliName, _pilotName), self.messageTime,false,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. I hear you! Finally, that is music in my ears!\nRequest a flare or smoke if you need.", self:_GetCustomCallSign(_heliName), _pilotName), self.messageTime,false,true)
|
||||||
end
|
end
|
||||||
--mark as shown for THIS heli and THIS group
|
--mark as shown for THIS heli and THIS group
|
||||||
self.heliVisibleMessage[_lookupKeyHeli] = true
|
self.heliVisibleMessage[_lookupKeyHeli] = true
|
||||||
@ -1332,7 +1346,7 @@ function CSAR:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupNam
|
|||||||
_maxUnits = self.max_units
|
_maxUnits = self.max_units
|
||||||
end
|
end
|
||||||
if _unitsInHelicopter + 1 > _maxUnits then
|
if _unitsInHelicopter + 1 > _maxUnits then
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s, %s. We\'re already crammed with %d guys! Sorry!", _pilotName, _heliName, _unitsInHelicopter, _unitsInHelicopter), self.messageTime,false,false,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s, %s. We\'re already crammed with %d guys! Sorry!", _pilotName, self:_GetCustomCallSign(_heliName), _unitsInHelicopter, _unitsInHelicopter), self.messageTime,false,false,true)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1350,13 +1364,29 @@ function CSAR:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupNam
|
|||||||
_woundedGroup:Destroy(false)
|
_woundedGroup:Destroy(false)
|
||||||
self:_RemoveNameFromDownedPilots(_woundedGroupName,true)
|
self:_RemoveNameFromDownedPilots(_woundedGroupName,true)
|
||||||
|
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s I\'m in! Get to the MASH ASAP! ", _heliName, _pilotName), self.messageTime,true,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s I\'m in! Get to the MASH ASAP! ", self:_GetCustomCallSign(_heliName), _pilotName), self.messageTime,true,true)
|
||||||
|
|
||||||
|
self:_UpdateUnitCargoMass(_heliName)
|
||||||
|
|
||||||
self:__Boarded(5,_heliName,_woundedGroupName,grouptable.desc)
|
self:__Boarded(5,_heliName,_woundedGroupName,grouptable.desc)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (Internal) Function to calculate and set Unit internal cargo mass
|
||||||
|
-- @param #CSAR self
|
||||||
|
-- @param #string _heliName Unit name
|
||||||
|
-- @return #CSAR self
|
||||||
|
function CSAR:_UpdateUnitCargoMass(_heliName)
|
||||||
|
self:T(self.lid .. " _UpdateUnitCargoMass")
|
||||||
|
local calculatedMass = self:_PilotsOnboard(_heliName)*80
|
||||||
|
local Unit = UNIT:FindByName(_heliName)
|
||||||
|
if Unit then
|
||||||
|
Unit:SetUnitInternalCargo(calculatedMass)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Move group to destination.
|
--- (Internal) Move group to destination.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param Wrapper.Group#GROUP _leader
|
-- @param Wrapper.Group#GROUP _leader
|
||||||
@ -1371,7 +1401,6 @@ function CSAR:_OrderGroupToMoveToPoint(_leader, _destination)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- (internal) Function to check if the heli door(s) are open. Thanks to Shadowze.
|
--- (internal) Function to check if the heli door(s) are open. Thanks to Shadowze.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param #string unit_name Name of unit.
|
-- @param #string unit_name Name of unit.
|
||||||
@ -1405,9 +1434,9 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
|||||||
|
|
||||||
if self.heliCloseMessage[_lookupKeyHeli] == nil then
|
if self.heliCloseMessage[_lookupKeyHeli] == nil then
|
||||||
if self.autosmoke == true then
|
if self.autosmoke == true then
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. You\'re close now! Land or hover at the smoke.", _heliName, _pilotName), self.messageTime,false,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. You\'re close now! Land or hover at the smoke.", self:_GetCustomCallSign(_heliName), _pilotName), self.messageTime,false,true)
|
||||||
else
|
else
|
||||||
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. You\'re close now! Land in a safe place, I will go there ", _heliName, _pilotName), self.messageTime,false,true)
|
self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s. You\'re close now! Land in a safe place, I will go there ", self:_GetCustomCallSign(_heliName), _pilotName), self.messageTime,false,true)
|
||||||
end
|
end
|
||||||
self.heliCloseMessage[_lookupKeyHeli] = true
|
self.heliCloseMessage[_lookupKeyHeli] = true
|
||||||
end
|
end
|
||||||
@ -1574,9 +1603,12 @@ function CSAR:_RescuePilots(_heliUnit)
|
|||||||
|
|
||||||
self.inTransitGroups[_heliName] = nil
|
self.inTransitGroups[_heliName] = nil
|
||||||
|
|
||||||
local _txt = string.format("%s: The %d pilot(s) have been taken to the\nmedical clinic. Good job!", _heliName, PilotsSaved)
|
local _txt = string.format("%s: The %d pilot(s) have been taken to the\nmedical clinic. Good job!", self:_GetCustomCallSign(_heliName), PilotsSaved)
|
||||||
|
|
||||||
self:_DisplayMessageToSAR(_heliUnit, _txt, self.messageTime)
|
self:_DisplayMessageToSAR(_heliUnit, _txt, self.messageTime)
|
||||||
|
|
||||||
|
self:_UpdateUnitCargoMass(_heliName)
|
||||||
|
|
||||||
-- trigger event
|
-- trigger event
|
||||||
self:__Rescued(-1,_heliUnit,_heliName, PilotsSaved)
|
self:__Rescued(-1,_heliUnit,_heliName, PilotsSaved)
|
||||||
return self
|
return self
|
||||||
@ -1610,7 +1642,7 @@ function CSAR:_DisplayMessageToSAR(_unit, _text, _time, _clear, _speak, _overrid
|
|||||||
local _clear = _clear or nil
|
local _clear = _clear or nil
|
||||||
local _time = _time or self.messageTime
|
local _time = _time or self.messageTime
|
||||||
if _override or not self.suppressmessages then
|
if _override or not self.suppressmessages then
|
||||||
local m = MESSAGE:New(_text,_time,"Info",_clear):ToGroup(group)
|
local m = MESSAGE:New(_text,_time,"CSAR",_clear):ToGroup(group)
|
||||||
end
|
end
|
||||||
-- integrate SRS
|
-- integrate SRS
|
||||||
if _speak and self.useSRS then
|
if _speak and self.useSRS then
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
-- @module Ops.CTLD
|
-- @module Ops.CTLD
|
||||||
-- @image OPS_CTLD.jpg
|
-- @image OPS_CTLD.jpg
|
||||||
|
|
||||||
-- Date: Feb 2022
|
|
||||||
-- Last Update October 2022
|
-- Last Update October 2022
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user