mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Reflect DEVELOP changes in MASTER
This commit is contained in:
parent
6fbf050b72
commit
2fb0ab1aed
File diff suppressed because it is too large
Load Diff
@ -609,7 +609,8 @@ end
|
||||
-- @param #number _freq Frequency
|
||||
-- @param #boolean noMessage
|
||||
-- @param #string _description Description
|
||||
function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description )
|
||||
-- @param #boolean forcedesc Use the description only for the pilot track entry
|
||||
function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description, forcedesc )
|
||||
self:T(self.lid .. " _AddCsar")
|
||||
self:T({_coalition , _country, _point, _typeName, _unitName, _playerName, _freq, noMessage, _description})
|
||||
|
||||
@ -622,11 +623,10 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
||||
|
||||
local _spawnedGroup, _alias = self:_SpawnPilotInField(_country,_point,_freq)
|
||||
|
||||
local _typeName = _typeName or "PoW"
|
||||
local _typeName = _typeName or "Pilot"
|
||||
|
||||
if not noMessage then
|
||||
self:_DisplayToAllSAR("MAYDAY MAYDAY! " .. _typeName .. " is down. ", self.coalition, 10)
|
||||
--local m = MESSAGE:New("MAYDAY MAYDAY! " .. _typeName .. " is down. ",10,"INFO"):ToCoalition(self.coalition)
|
||||
end
|
||||
|
||||
if _freq then
|
||||
@ -635,15 +635,14 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
||||
|
||||
self:_AddSpecialOptions(_spawnedGroup)
|
||||
|
||||
local _text = " "
|
||||
if _playerName ~= nil then
|
||||
_text = "Pilot " .. _playerName .. " of " .. _unitName .. " - " .. _typeName
|
||||
elseif _typeName ~= nil then
|
||||
_text = "AI Pilot of " .. _unitName .. " - " .. _typeName
|
||||
else
|
||||
_text = _description
|
||||
end
|
||||
|
||||
local _text = _description
|
||||
if not forcedesc then
|
||||
if _playerName ~= nil then
|
||||
_text = "Pilot " .. _playerName
|
||||
elseif _unitName ~= nil then
|
||||
_text = "AI Pilot of " .. _unitName
|
||||
end
|
||||
end
|
||||
self:T({_spawnedGroup, _alias})
|
||||
|
||||
local _GroupName = _spawnedGroup:GetName() or _alias
|
||||
@ -662,7 +661,10 @@ end
|
||||
-- @param #string _description (optional) Description.
|
||||
-- @param #boolean _randomPoint (optional) Random yes or no.
|
||||
-- @param #boolean _nomessage (optional) If true, don\'t send a message to SAR.
|
||||
function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage)
|
||||
-- @param #string unitname (optional) Name of the lost unit.
|
||||
-- @param #string typename (optional) Type of plane.
|
||||
-- @param #boolean forcedesc (optional) Force to use the description passed only for the pilot track entry. Use to have fully custom names.
|
||||
function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage, unitname, typename, forcedesc)
|
||||
self:T(self.lid .. " _SpawnCsarAtZone")
|
||||
local freq = self:_GenerateADFFrequency()
|
||||
local _triggerZone = ZONE:New(_zone) -- trigger to use as reference position
|
||||
@ -671,7 +673,9 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
||||
return
|
||||
end
|
||||
|
||||
local _description = _description or "Unknown"
|
||||
local _description = _description or "PoW"
|
||||
local unitname = unitname or "Old Rusty"
|
||||
local typename = typename or "Phantom II"
|
||||
|
||||
local pos = {}
|
||||
if _randomPoint then
|
||||
@ -690,7 +694,7 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
||||
_country = country.id.UN_PEACEKEEPERS
|
||||
end
|
||||
|
||||
self:_AddCsar(_coalition, _country, pos, "PoW", _description, nil, freq, _nomessage, _description)
|
||||
self:_AddCsar(_coalition, _country, pos, typename, unitname, _description, freq, _nomessage, _description, forcedesc)
|
||||
|
||||
return self
|
||||
end
|
||||
@ -702,12 +706,15 @@ end
|
||||
-- @param #string Description (optional) Description.
|
||||
-- @param #boolean RandomPoint (optional) Random yes or no.
|
||||
-- @param #boolean Nomessage (optional) If true, don\'t send a message to SAR.
|
||||
-- @usage If missions designers want to spawn downed pilots into the field, e.g. at mission begin, to give the helicopter guys works, they can do this like so:
|
||||
-- @param #string Unitname (optional) Name of the lost unit.
|
||||
-- @param #string Typename (optional) Type of plane.
|
||||
-- @param #boolean Forcedesc (optional) Force to use the **description passed only** for the pilot track entry. Use to have fully custom names.
|
||||
-- @usage If missions designers want to spawn downed pilots into the field, e.g. at mission begin, to give the helicopter guys work, they can do this like so:
|
||||
--
|
||||
-- -- Create downed "Pilot Wagner" in #ZONE "CSAR_Start_1" at a random point for the blue coalition
|
||||
-- my_csar:SpawnCSARAtZone( "CSAR_Start_1", coalition.side.BLUE, "Pilot Wagner", true )
|
||||
function CSAR:SpawnCSARAtZone(Zone, Coalition, Description, RandomPoint, Nomessage)
|
||||
self:_SpawnCsarAtZone(Zone, Coalition, Description, RandomPoint, Nomessage)
|
||||
-- my_csar:SpawnCSARAtZone( "CSAR_Start_1", coalition.side.BLUE, "Wagner", true, false, "Charly-1-1", "F5E" )
|
||||
function CSAR:SpawnCSARAtZone(Zone, Coalition, Description, RandomPoint, Nomessage, Unitname, Typename, Forcedesc)
|
||||
self:_SpawnCsarAtZone(Zone, Coalition, Description, RandomPoint, Nomessage, Unitname, Typename, Forcedesc)
|
||||
return self
|
||||
end
|
||||
|
||||
@ -1199,7 +1206,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
end
|
||||
if _time <= 0 or _distance < self.loadDistance then
|
||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in, bugger!", self.messageTime, true)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true)
|
||||
return true
|
||||
else
|
||||
self.landedStatus[_lookupKeyHeli] = nil
|
||||
@ -1211,7 +1218,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
else
|
||||
if (_distance < self.loadDistance) then
|
||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in, honk!", self.messageTime, true)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true)
|
||||
return true
|
||||
else
|
||||
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
||||
@ -1252,7 +1259,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Hovering above " .. _pilotName .. ". \n\nHold hover for " .. _time .. " seconds to winch them up. \n\nIf the countdown stops you\'re too far away!", self.messageTime, true)
|
||||
else
|
||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) then
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in, noob!", self.messageTime, true)
|
||||
self:_DisplayMessageToSAR(_heliUnit, "Open the door to let me in!", self.messageTime, true)
|
||||
return true
|
||||
else
|
||||
self.hoverStatus[_lookupKeyHeli] = nil
|
||||
@ -1377,7 +1384,7 @@ end
|
||||
--- (Internal) Check and return Wrappe.Unit#UNIT based on the name if alive.
|
||||
-- @param #CSAR self
|
||||
-- @param #string _unitname Name of Unit
|
||||
-- @return #UNIT or nil
|
||||
-- @return Wrapper.Unit#UNIT The unit or nil
|
||||
function CSAR:_GetSARHeli(_unitName)
|
||||
self:T(self.lid .. " _GetSARHeli")
|
||||
local unit = UNIT:FindByName(_unitName)
|
||||
@ -1428,12 +1435,8 @@ function CSAR:_GetPositionOfWounded(_woundedGroup)
|
||||
_coordinatesText = _coordinate:ToStringLLDMS()
|
||||
elseif self.coordtype == 2 then -- MGRS
|
||||
_coordinatesText = _coordinate:ToStringMGRS()
|
||||
elseif self.coordtype == 3 then -- Bullseye Imperial
|
||||
local Settings = _SETTINGS:SetImperial()
|
||||
_coordinatesText = _coordinate:ToStringBULLS(self.coalition,Settings)
|
||||
else -- Bullseye Metric --(medevac.coordtype == 4)
|
||||
local Settings = _SETTINGS:SetMetric()
|
||||
_coordinatesText = _coordinate:ToStringBULLS(self.coalition,Settings)
|
||||
else -- Bullseye Metric --(medevac.coordtype == 4 or 3)
|
||||
_coordinatesText = _coordinate:ToStringBULLS(self.coalition)
|
||||
end
|
||||
end
|
||||
return _coordinatesText
|
||||
@ -1467,12 +1470,11 @@ function CSAR:_DisplayActiveSAR(_unitName)
|
||||
local _woundcoord = _woundedGroup:GetCoordinate()
|
||||
local _distance = self:_GetDistance(_helicoord, _woundcoord)
|
||||
self:T({_distance = _distance})
|
||||
-- change distance to miles if self.coordtype < 4
|
||||
local distancetext = ""
|
||||
if self.coordtype < 4 then
|
||||
distancetext = string.format("%.3fnm",UTILS.MetersToNM(_distance))
|
||||
if _SETTINGS:IsImperial() then
|
||||
distancetext = string.format("%.1fnm",UTILS.MetersToNM(_distance))
|
||||
else
|
||||
distancetext = string.format("%.3fkm", _distance/1000.0)
|
||||
distancetext = string.format("%.1fkm", _distance/1000.0)
|
||||
end
|
||||
table.insert(_csarList, { dist = _distance, msg = string.format("%s at %s - %.2f KHz ADF - %s ", _value.desc, _coordinatesText, _value.frequency / 1000, distancetext) })
|
||||
end
|
||||
@ -1542,10 +1544,10 @@ function CSAR:_SignalFlare(_unitName)
|
||||
|
||||
local _clockDir = self:_GetClockDirection(_heli, _closest.pilot)
|
||||
local _distance = 0
|
||||
if self.coordtype < 4 then
|
||||
_distance = string.format("%.3fnm",UTILS.MetersToNM(_closest.distance))
|
||||
if _SETTINGS:IsImperial() then
|
||||
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
|
||||
else
|
||||
_distance = string.format("%.3fkm",_closest.distance)
|
||||
_distance = string.format("%.1fkm",_closest.distance)
|
||||
end
|
||||
local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", _unitName, _clockDir, _distance)
|
||||
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true)
|
||||
@ -1554,7 +1556,7 @@ function CSAR:_SignalFlare(_unitName)
|
||||
_coord:FlareRed(_clockDir)
|
||||
else
|
||||
local disttext = "4.3nm"
|
||||
if self.coordtype == 4 then
|
||||
if _SETTINGS:IsMetric() then
|
||||
disttext = "8km"
|
||||
end
|
||||
self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",disttext), self.messageTime)
|
||||
@ -1593,10 +1595,10 @@ function CSAR:_Reqsmoke( _unitName )
|
||||
if _closest ~= nil and _closest.pilot ~= nil and _closest.distance < 8000.0 then
|
||||
local _clockDir = self:_GetClockDirection(_heli, _closest.pilot)
|
||||
local _distance = 0
|
||||
if self.coordtype < 4 then
|
||||
_distance = string.format("%.3fnm",UTILS.MetersToNM(_closest.distance))
|
||||
if _SETTINGS:IsImperial() then
|
||||
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
|
||||
else
|
||||
_distance = string.format("%.3fkm",_closest.distance)
|
||||
_distance = string.format("%.1fkm",_closest.distance)
|
||||
end
|
||||
local _msg = string.format("%s - Popping signal smoke at your %s o\'clock. Distance %s", _unitName, _clockDir, _distance)
|
||||
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true)
|
||||
@ -1605,7 +1607,7 @@ function CSAR:_Reqsmoke( _unitName )
|
||||
_coord:Smoke(color)
|
||||
else
|
||||
local disttext = "4.3nm"
|
||||
if self.coordtype == 4 then
|
||||
if _SETTINGS:IsMetric() then
|
||||
disttext = "8km"
|
||||
end
|
||||
self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",disttext), self.messageTime)
|
||||
|
||||
@ -81,8 +81,8 @@ CTLD_CARGO = {
|
||||
self.Name = Name or "none" -- #string
|
||||
self.Templates = Templates or {} -- #table
|
||||
self.CargoType = Sorte or "type" -- #CTLD_CARGO.Enum
|
||||
self.HasBeenMoved = HasBeenMoved or false -- #booolean
|
||||
self.LoadDirectly = LoadDirectly or false -- #booolean
|
||||
self.HasBeenMoved = HasBeenMoved or false -- #boolean
|
||||
self.LoadDirectly = LoadDirectly or false -- #boolean
|
||||
self.CratesNeeded = CratesNeeded or 0 -- #number
|
||||
self.Positionable = Positionable or nil -- Wrapper.Positionable#POSITIONABLE
|
||||
self.HasBeenDropped = Dropped or false --#boolean
|
||||
@ -410,6 +410,7 @@ do
|
||||
-- my_ctld.enableHercules = true
|
||||
-- my_ctld.HercMinAngels = 155 -- for troop/cargo drop via chute in meters, ca 470 ft
|
||||
-- my_ctld.HercMaxAngels = 2000 -- for troop/cargo drop via chute in meters, ca 6000 ft
|
||||
-- my_ctld.HercMaxSpeed = 77 -- 77mps or 270 kph or 150 kn
|
||||
--
|
||||
-- Also, the following options need to be set to `true`:
|
||||
--
|
||||
@ -478,7 +479,7 @@ CTLD = {
|
||||
-- @field #table vhfbeacon Beacon info as #CTLD.ZoneBeacon
|
||||
|
||||
--- Zone Type Info.
|
||||
-- @type CTLD.
|
||||
-- @type CTLD.CargoZoneType
|
||||
CTLD.CargoZoneType = {
|
||||
LOAD = "load",
|
||||
DROP = "drop",
|
||||
@ -651,6 +652,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
self.enableHercules = false
|
||||
self.HercMinAngels = 165 -- for troop/cargo drop via chute
|
||||
self.HercMaxAngels = 2000 -- for troop/cargo drop via chute
|
||||
self.HercMaxSpeed = 77 -- 280 kph or 150kn eq 77 mps
|
||||
|
||||
-- message suppression
|
||||
self.suppressmessages = false
|
||||
@ -803,16 +805,10 @@ function CTLD:_GenerateUHFrequencies()
|
||||
end
|
||||
|
||||
--- (Internal) Function to generate valid FM Frequencies
|
||||
-- @param #CTLD sel
|
||||
-- @param #CTLD self
|
||||
function CTLD:_GenerateFMFrequencies()
|
||||
self:T(self.lid .. " _GenerateFMrequencies")
|
||||
self.FreeFMFrequencies = {}
|
||||
local _start = 220000000
|
||||
|
||||
while _start < 399000000 do
|
||||
|
||||
_start = _start + 500000
|
||||
end
|
||||
|
||||
for _first = 3, 7 do
|
||||
for _second = 0, 5 do
|
||||
@ -2289,10 +2285,12 @@ end
|
||||
local aheight = uheight - gheight -- height above ground
|
||||
local maxh = self.HercMinAngels-- 1500m
|
||||
local minh = self.HercMaxAngels -- 5000m
|
||||
local mspeed = 2 -- 2 m/s
|
||||
-- TODO:Add speed test for Herc, should not be above 280kph/150kn
|
||||
--self:Tstring.format("%s Unit parameters: at %dm AGL with %dmps",self.lid,aheight,uspeed))
|
||||
if (aheight <= maxh) and (aheight >= minh) then
|
||||
local maxspeed = self.HercMaxSpeed -- 77 mps
|
||||
-- TODO: TEST - Speed test for Herc, should not be above 280kph/150kn
|
||||
local kmspeed = uspeed * 3.6
|
||||
local knspeed = kmspeed / 1.86
|
||||
self:T(string.format("%s Unit parameters: at %dm AGL with %dmps | %dkph | %dkn",self.lid,aheight,uspeed,kmspeed,knspeed))
|
||||
if (aheight <= maxh) and (aheight >= minh) and (uspeed <= maxspeed) then
|
||||
-- yep within parameters
|
||||
outcome = true
|
||||
end
|
||||
@ -2308,7 +2306,14 @@ end
|
||||
local inhover = self:IsCorrectHover(Unit)
|
||||
local htxt = "true"
|
||||
if not inhover then htxt = "false" end
|
||||
local text = string.format("Hover parameters (autoload/drop):\n - Min height %dm \n - Max height %dm \n - Max speed 2mps \n - In parameter: %s", self.minimumHoverHeight, self.maximumHoverHeight, htxt)
|
||||
local text = ""
|
||||
if _SETTINGS:IsMetric() then
|
||||
text = string.format("Hover parameters (autoload/drop):\n - Min height %dm \n - Max height %dm \n - Max speed 2mps \n - In parameter: %s", self.minimumHoverHeight, self.maximumHoverHeight, htxt)
|
||||
else
|
||||
local minheight = UTILS.MetersToFeet(self.minimumHoverHeight)
|
||||
local maxheight = UTILS.MetersToFeet(self.maximumHoverHeight)
|
||||
text = string.format("Hover parameters (autoload/drop):\n - Min height %dm \n - Max height %dm \n - Max speed 6fts \n - In parameter: %s", minheight, maxheight, htxt)
|
||||
end
|
||||
self:_SendMessage(text, 10, false, Group)
|
||||
--local m = MESSAGE:New(text,10,"CTLD",false):ToGroup(Group)
|
||||
return self
|
||||
@ -2322,9 +2327,16 @@ end
|
||||
local inhover = self:IsCorrectFlightParameters(Unit)
|
||||
local htxt = "true"
|
||||
if not inhover then htxt = "false" end
|
||||
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
|
||||
local maxheight = UTILS.MetersToFeet(self.HercMaxAngels)
|
||||
local text = string.format("Flight parameters (airdrop):\n - Min height %dft \n - Max height %dft \n - In parameter: %s", minheight, maxheight, htxt)
|
||||
local text = ""
|
||||
if _SETTINGS:IsImperial() then
|
||||
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
|
||||
local maxheight = UTILS.MetersToFeet(self.HercMaxAngels)
|
||||
text = string.format("Flight parameters (airdrop):\n - Min height %dft \n - Max height %dft \n - In parameter: %s", minheight, maxheight, htxt)
|
||||
else
|
||||
local minheight = self.HercMinAngels
|
||||
local maxheight = self.HercMaxAngels
|
||||
text = string.format("Flight parameters (airdrop):\n - Min height %dm \n - Max height %dm \n - In parameter: %s", minheight, maxheight, htxt)
|
||||
end
|
||||
self:_SendMessage(text, 10, false, Group)
|
||||
--local m = MESSAGE:New(text,15,"CTLD",false):ToGroup(Group)
|
||||
return self
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user