mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
MANTIS - Change logic to FSM, added functions
CSAR - advanced options to name injected AI downed pilots CTLD - added Herc speed check
This commit is contained in:
parent
e33de03522
commit
433d1bbf57
File diff suppressed because it is too large
Load Diff
@ -662,7 +662,9 @@ end
|
|||||||
-- @param #string _description (optional) Description.
|
-- @param #string _description (optional) Description.
|
||||||
-- @param #boolean _randomPoint (optional) Random yes or no.
|
-- @param #boolean _randomPoint (optional) Random yes or no.
|
||||||
-- @param #boolean _nomessage (optional) If true, don\'t send a message to SAR.
|
-- @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.
|
||||||
|
function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage, unitname, typename)
|
||||||
self:T(self.lid .. " _SpawnCsarAtZone")
|
self:T(self.lid .. " _SpawnCsarAtZone")
|
||||||
local freq = self:_GenerateADFFrequency()
|
local freq = self:_GenerateADFFrequency()
|
||||||
local _triggerZone = ZONE:New(_zone) -- trigger to use as reference position
|
local _triggerZone = ZONE:New(_zone) -- trigger to use as reference position
|
||||||
@ -671,7 +673,9 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
|||||||
return
|
return
|
||||||
end
|
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 = {}
|
local pos = {}
|
||||||
if _randomPoint then
|
if _randomPoint then
|
||||||
@ -690,7 +694,7 @@ function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _
|
|||||||
_country = country.id.UN_PEACEKEEPERS
|
_country = country.id.UN_PEACEKEEPERS
|
||||||
end
|
end
|
||||||
|
|
||||||
self:_AddCsar(_coalition, _country, pos, "PoW", _description, nil, freq, _nomessage, _description)
|
self:_AddCsar(_coalition, _country, pos, typename, unitname, _description, freq, _nomessage, _description)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -702,12 +706,14 @@ end
|
|||||||
-- @param #string Description (optional) Description.
|
-- @param #string Description (optional) Description.
|
||||||
-- @param #boolean RandomPoint (optional) Random yes or no.
|
-- @param #boolean RandomPoint (optional) Random yes or no.
|
||||||
-- @param #boolean Nomessage (optional) If true, don\'t send a message to SAR.
|
-- @param #boolean Nomessage (optional) If true, don\'t send a message to SAR.
|
||||||
|
-- @param #string unitname (optional) Name of the lost unit.
|
||||||
|
-- @param #string typename (optional) Type of plane.
|
||||||
-- @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:
|
-- @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:
|
||||||
--
|
--
|
||||||
-- -- Create downed "Pilot Wagner" in #ZONE "CSAR_Start_1" at a random point for the blue coalition
|
-- -- 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 )
|
-- my_csar:SpawnCSARAtZone( "CSAR_Start_1", coalition.side.BLUE, "Wagner", true, false, "Charly-1-1", "F5E" )
|
||||||
function CSAR:SpawnCSARAtZone(Zone, Coalition, Description, RandomPoint, Nomessage)
|
function CSAR:SpawnCSARAtZone(Zone, Coalition, Description, RandomPoint, Nomessage, Unitname, Typename)
|
||||||
self:_SpawnCsarAtZone(Zone, Coalition, Description, RandomPoint, Nomessage)
|
self:_SpawnCsarAtZone(Zone, Coalition, Description, RandomPoint, Nomessage, Unitname, Typename)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1199,7 +1205,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
|||||||
end
|
end
|
||||||
if _time <= 0 or _distance < self.loadDistance then
|
if _time <= 0 or _distance < self.loadDistance then
|
||||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) 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
|
return true
|
||||||
else
|
else
|
||||||
self.landedStatus[_lookupKeyHeli] = nil
|
self.landedStatus[_lookupKeyHeli] = nil
|
||||||
@ -1211,7 +1217,7 @@ function CSAR:_CheckCloseWoundedGroup(_distance, _heliUnit, _heliName, _woundedG
|
|||||||
else
|
else
|
||||||
if (_distance < self.loadDistance) then
|
if (_distance < self.loadDistance) then
|
||||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) 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
|
return true
|
||||||
else
|
else
|
||||||
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
self:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupName)
|
||||||
@ -1252,7 +1258,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)
|
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
|
else
|
||||||
if self.pilotmustopendoors and not self:_IsLoadingDoorOpen(_heliName) then
|
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
|
return true
|
||||||
else
|
else
|
||||||
self.hoverStatus[_lookupKeyHeli] = nil
|
self.hoverStatus[_lookupKeyHeli] = nil
|
||||||
|
|||||||
@ -410,6 +410,7 @@ do
|
|||||||
-- my_ctld.enableHercules = true
|
-- my_ctld.enableHercules = true
|
||||||
-- my_ctld.HercMinAngels = 155 -- for troop/cargo drop via chute in meters, ca 470 ft
|
-- 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.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`:
|
-- Also, the following options need to be set to `true`:
|
||||||
--
|
--
|
||||||
@ -478,7 +479,7 @@ CTLD = {
|
|||||||
-- @field #table vhfbeacon Beacon info as #CTLD.ZoneBeacon
|
-- @field #table vhfbeacon Beacon info as #CTLD.ZoneBeacon
|
||||||
|
|
||||||
--- Zone Type Info.
|
--- Zone Type Info.
|
||||||
-- @type CTLD.
|
-- @type CTLD.CargoZoneType
|
||||||
CTLD.CargoZoneType = {
|
CTLD.CargoZoneType = {
|
||||||
LOAD = "load",
|
LOAD = "load",
|
||||||
DROP = "drop",
|
DROP = "drop",
|
||||||
@ -651,6 +652,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self.enableHercules = false
|
self.enableHercules = false
|
||||||
self.HercMinAngels = 165 -- for troop/cargo drop via chute
|
self.HercMinAngels = 165 -- for troop/cargo drop via chute
|
||||||
self.HercMaxAngels = 2000 -- 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
|
-- message suppression
|
||||||
self.suppressmessages = false
|
self.suppressmessages = false
|
||||||
@ -2283,10 +2285,12 @@ end
|
|||||||
local aheight = uheight - gheight -- height above ground
|
local aheight = uheight - gheight -- height above ground
|
||||||
local maxh = self.HercMinAngels-- 1500m
|
local maxh = self.HercMinAngels-- 1500m
|
||||||
local minh = self.HercMaxAngels -- 5000m
|
local minh = self.HercMaxAngels -- 5000m
|
||||||
local mspeed = 2 -- 2 m/s
|
local maxspeed = self.HercMaxSpeed -- 77 mps
|
||||||
-- TODO:Add speed test for Herc, should not be above 280kph/150kn
|
-- TODO: TEST - 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))
|
local kmspeed = uspeed * 3.6
|
||||||
if (aheight <= maxh) and (aheight >= minh) then
|
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
|
-- yep within parameters
|
||||||
outcome = true
|
outcome = true
|
||||||
end
|
end
|
||||||
@ -2302,7 +2306,14 @@ end
|
|||||||
local inhover = self:IsCorrectHover(Unit)
|
local inhover = self:IsCorrectHover(Unit)
|
||||||
local htxt = "true"
|
local htxt = "true"
|
||||||
if not inhover then htxt = "false" end
|
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)
|
self:_SendMessage(text, 10, false, Group)
|
||||||
--local m = MESSAGE:New(text,10,"CTLD",false):ToGroup(Group)
|
--local m = MESSAGE:New(text,10,"CTLD",false):ToGroup(Group)
|
||||||
return self
|
return self
|
||||||
@ -2316,9 +2327,16 @@ end
|
|||||||
local inhover = self:IsCorrectFlightParameters(Unit)
|
local inhover = self:IsCorrectFlightParameters(Unit)
|
||||||
local htxt = "true"
|
local htxt = "true"
|
||||||
if not inhover then htxt = "false" end
|
if not inhover then htxt = "false" end
|
||||||
local minheight = UTILS.MetersToFeet(self.HercMinAngels)
|
local text = ""
|
||||||
local maxheight = UTILS.MetersToFeet(self.HercMaxAngels)
|
if _SETTINGS:IsImperial() then
|
||||||
local text = string.format("Flight parameters (airdrop):\n - Min height %dft \n - Max height %dft \n - In parameter: %s", minheight, maxheight, htxt)
|
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)
|
self:_SendMessage(text, 10, false, Group)
|
||||||
--local m = MESSAGE:New(text,15,"CTLD",false):ToGroup(Group)
|
--local m = MESSAGE:New(text,15,"CTLD",false):ToGroup(Group)
|
||||||
return self
|
return self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user