mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Update Airboss.lua
This commit is contained in:
parent
9df35840fe
commit
5ee0ae44cd
@ -207,6 +207,8 @@
|
|||||||
-- @field #AIRBOSS.MarshalCalls MarshalCall Radio voice over of the Marshal/Airboss.
|
-- @field #AIRBOSS.MarshalCalls MarshalCall Radio voice over of the Marshal/Airboss.
|
||||||
-- @field #number lowfuelAI Low fuel threshold for AI groups in percent.
|
-- @field #number lowfuelAI Low fuel threshold for AI groups in percent.
|
||||||
-- @field #boolean emergency If true (default), allow emergency landings, i.e. bypass any pattern and go for final approach.
|
-- @field #boolean emergency If true (default), allow emergency landings, i.e. bypass any pattern and go for final approach.
|
||||||
|
-- @field #boolean respawnAI If true, respawn AI flights as they enter the CCA to detach and airfields from the mission plan. Default false.
|
||||||
|
-- @field #boolean turning If true, carrier is currently turning.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- Be the boss!
|
--- Be the boss!
|
||||||
@ -1044,6 +1046,7 @@ AIRBOSS = {
|
|||||||
MarshalCall = nil,
|
MarshalCall = nil,
|
||||||
lowfuelAI = nil,
|
lowfuelAI = nil,
|
||||||
emergency = nil,
|
emergency = nil,
|
||||||
|
respawnAI = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Aircraft types capable of landing on carrier (human+AI).
|
--- Aircraft types capable of landing on carrier (human+AI).
|
||||||
@ -1589,6 +1592,9 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
-- No despawn after engine shutdown by default.
|
-- No despawn after engine shutdown by default.
|
||||||
self:SetDespawnOnEngineShutdown(false)
|
self:SetDespawnOnEngineShutdown(false)
|
||||||
|
|
||||||
|
-- No respawning of AI groups when entering the CCA.
|
||||||
|
self:SetRespawnAI(false)
|
||||||
|
|
||||||
-- Mission uses static weather by default.
|
-- Mission uses static weather by default.
|
||||||
self:SetStaticWeather()
|
self:SetStaticWeather()
|
||||||
|
|
||||||
@ -1658,6 +1664,8 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
BASE:TraceLevel(1)
|
BASE:TraceLevel(1)
|
||||||
self.dTstatus=0.1
|
self.dTstatus=0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--self:_GetZoneGroove():SmokeZone(SMOKECOLOR.Red, 5)
|
||||||
|
|
||||||
-- Smoke zones.
|
-- Smoke zones.
|
||||||
if self.Debug and false then
|
if self.Debug and false then
|
||||||
@ -2217,7 +2225,7 @@ function AIRBOSS:SetEmergencyLandings(switch)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Despawn AI groups after they they shut down their engines
|
--- Despawn AI groups after they they shut down their engines.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #boolean switch If true or nil, AI groups are despawned.
|
-- @param #boolean switch If true or nil, AI groups are despawned.
|
||||||
-- @return #AIRBOSS self
|
-- @return #AIRBOSS self
|
||||||
@ -2230,6 +2238,19 @@ function AIRBOSS:SetDespawnOnEngineShutdown(switch)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Respawn AI groups once they reach the CCA. Clears any attached airbases and allows making them land on the carrier via script.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #boolean switch If true or nil, AI groups are respawned.
|
||||||
|
-- @return #AIRBOSS self
|
||||||
|
function AIRBOSS:SetRespawnAI(switch)
|
||||||
|
if switch==true or switch==nil then
|
||||||
|
self.respawnAI=true
|
||||||
|
else
|
||||||
|
self.respawnAI=false
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set folder where the airboss sound files are located **within you mission (miz) file**.
|
--- Set folder where the airboss sound files are located **within you mission (miz) file**.
|
||||||
-- The default path is "l10n/DEFAULT/" but sound files simply copied there will be removed by DCS the next time you save the mission.
|
-- The default path is "l10n/DEFAULT/" but sound files simply copied there will be removed by DCS the next time you save the mission.
|
||||||
@ -3970,6 +3991,69 @@ function AIRBOSS:_InitVoiceOvers()
|
|||||||
subtitle="",
|
subtitle="",
|
||||||
duration=0.40, --0.38 too short
|
duration=0.40, --0.38 too short
|
||||||
},
|
},
|
||||||
|
CASE={
|
||||||
|
file="MARSHAL-Case",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.45,
|
||||||
|
},
|
||||||
|
EXPECTED={
|
||||||
|
file="MARSHAL-Expected",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.60,
|
||||||
|
},
|
||||||
|
BRC={
|
||||||
|
file="MARSHAL-BRC",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.68,
|
||||||
|
},
|
||||||
|
HOLDAT={
|
||||||
|
file="MARSHAL-HoldAt",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.43,
|
||||||
|
},
|
||||||
|
ANGELS={
|
||||||
|
file="MARSHAL-Angels",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.68,
|
||||||
|
},
|
||||||
|
EXPECTED={
|
||||||
|
file="MARSHAL-Expected",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.72,
|
||||||
|
},
|
||||||
|
ALTIMETER={
|
||||||
|
file="MARSHAL-Altimeter",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.73,
|
||||||
|
},
|
||||||
|
POINT={
|
||||||
|
file="MARSHAL-Point",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=0.42,
|
||||||
|
},
|
||||||
|
REPORTSEEME={
|
||||||
|
file="MARSHAL-ReportSeeMe",
|
||||||
|
suffix="ogg",
|
||||||
|
loud=false,
|
||||||
|
subtitle="",
|
||||||
|
duration=1.05,
|
||||||
|
},
|
||||||
CLICK={
|
CLICK={
|
||||||
file="AIRBOSS-RadioClick",
|
file="AIRBOSS-RadioClick",
|
||||||
suffix="ogg",
|
suffix="ogg",
|
||||||
@ -4640,13 +4724,13 @@ function AIRBOSS:_ScanCarrierZone()
|
|||||||
if stack then
|
if stack then
|
||||||
|
|
||||||
-- Send AI to marshal stack. We respawn the group to clean possible departure and destination airbases.
|
-- Send AI to marshal stack. We respawn the group to clean possible departure and destination airbases.
|
||||||
self:_MarshalAI(knownflight, stack, true)
|
self:_MarshalAI(knownflight, stack, self.respawnAI)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Send AI to orbit outside 10 NM zone and wait until the next Marshal stack is available.
|
-- Send AI to orbit outside 10 NM zone and wait until the next Marshal stack is available.
|
||||||
if not self:_InQueue(self.Qwaiting, knownflight.group) then
|
if not self:_InQueue(self.Qwaiting, knownflight.group) then
|
||||||
self:_WaitAI(knownflight, true) -- Group is respawned to clear any attached airfields.
|
self:_WaitAI(knownflight, self.respawnAI) -- Group is respawned to clear any attached airfields.
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -8893,13 +8977,13 @@ end
|
|||||||
|
|
||||||
--- Get groove zone.
|
--- Get groove zone.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #number l Length of the groove in NM. Default 1.5 NM.
|
-- @param #number l Length of the groove in NM. Default 2.0 NM.
|
||||||
-- @param #number w Width of the groove in NM. Default
|
-- @param #number w Width of the groove in NM. Default 0.3 NM.
|
||||||
-- @return Core.Zone#ZONE_POLYGON_BASE Initial zone.
|
-- @return Core.Zone#ZONE_POLYGON_BASE Initial zone.
|
||||||
function AIRBOSS:_GetZoneGroove(l, w)
|
function AIRBOSS:_GetZoneGroove(l, w)
|
||||||
|
|
||||||
l=l or 1.5
|
l=l or 2.0
|
||||||
w=w or 0.5
|
w=w or 0.3
|
||||||
|
|
||||||
-- Get radial, i.e. inverse of BRC.
|
-- Get radial, i.e. inverse of BRC.
|
||||||
local fbi=self:GetRadial(1, false, false)
|
local fbi=self:GetRadial(1, false, false)
|
||||||
@ -8907,6 +8991,8 @@ function AIRBOSS:_GetZoneGroove(l, w)
|
|||||||
-- Stern coordinate.
|
-- Stern coordinate.
|
||||||
local st=self:_GetSternCoord()
|
local st=self:_GetSternCoord()
|
||||||
|
|
||||||
|
-- TODO: optimize for Tarawa. shift port.
|
||||||
|
|
||||||
-- Zone points.
|
-- Zone points.
|
||||||
local c1=st:Translate(self.carrierparam.totwidthstarboard, fbi-90)
|
local c1=st:Translate(self.carrierparam.totwidthstarboard, fbi-90)
|
||||||
local c2=st:Translate(UTILS.NMToMeters(0.10), fbi-90):Translate(UTILS.NMToMeters(0.3), fbi)
|
local c2=st:Translate(UTILS.NMToMeters(0.10), fbi-90):Translate(UTILS.NMToMeters(0.3), fbi)
|
||||||
@ -11579,7 +11665,25 @@ function AIRBOSS:_CheckPatternUpdate()
|
|||||||
self.Corientlast=vNew
|
self.Corientlast=vNew
|
||||||
|
|
||||||
-- Carrier is turning when its heading changed by at least one degree since last check.
|
-- Carrier is turning when its heading changed by at least one degree since last check.
|
||||||
local turning=deltaLast>=1
|
local turning=math.abs(deltaLast)>=1
|
||||||
|
|
||||||
|
-- Starting to turn.
|
||||||
|
if turning and not self.turning then
|
||||||
|
-- Turning!
|
||||||
|
self.turning=true
|
||||||
|
|
||||||
|
-- Get heading.
|
||||||
|
local hdg
|
||||||
|
if self.turnintowind then
|
||||||
|
hdg=select(1,self:GetWind())
|
||||||
|
else
|
||||||
|
hdg=self:GetCoordinate():HeadingTo(self:_GetNextWaypoint())
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Inform everyone.
|
||||||
|
local text=string.format("staring turn to heading %03d°.", hdg)
|
||||||
|
self:MessageToMarshal(text, "AIRBOSS", "99")
|
||||||
|
end
|
||||||
|
|
||||||
-- No update if carrier is turning!
|
-- No update if carrier is turning!
|
||||||
if turning then
|
if turning then
|
||||||
@ -11624,12 +11728,13 @@ function AIRBOSS:_CheckPatternUpdate()
|
|||||||
local FB=self:GetFinalBearing(true)
|
local FB=self:GetFinalBearing(true)
|
||||||
local text=string.format("new final bearing %03d°.", FB)
|
local text=string.format("new final bearing %03d°.", FB)
|
||||||
self:MessageToMarshal(text, "AIRBOSS", "99")
|
self:MessageToMarshal(text, "AIRBOSS", "99")
|
||||||
|
self.turning=false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Reset parameters for next update check.
|
-- Reset parameters for next update check.
|
||||||
self.Corientation=vNew
|
self.Corientation=vNew
|
||||||
self.Cposition=pos
|
self.Cposition=pos
|
||||||
self.Tpupdate=timer.getTime()
|
self.Tpupdate=timer.getTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -12310,7 +12415,16 @@ function AIRBOSS:RadioTransmission(radio, call, loud, delay)
|
|||||||
call~=self[caller].N6 and
|
call~=self[caller].N6 and
|
||||||
call~=self[caller].N7 and
|
call~=self[caller].N7 and
|
||||||
call~=self[caller].N8 and
|
call~=self[caller].N8 and
|
||||||
call~=self[caller].N9 then
|
call~=self[caller].N9 and
|
||||||
|
call~=self[caller].EXPECTED and
|
||||||
|
call~=self[caller].BRC and
|
||||||
|
call~=self[caller].ALTIMETER and
|
||||||
|
call~=self[caller].POINT and
|
||||||
|
call~=self[caller].HOLDAT and
|
||||||
|
call~=self[caller].CASE and
|
||||||
|
call~=self[caller].POINT and
|
||||||
|
call~=self[caller].ANGELS and
|
||||||
|
call~=self[caller].CHARLIETIME then
|
||||||
self:RadioTransmission(radio, self[caller].CLICK, false, delay)
|
self:RadioTransmission(radio, self[caller].CLICK, false, delay)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -12889,47 +13003,54 @@ function AIRBOSS:_MarshalCallArrived(modex, case, brc, altitude, charlie, qfe)
|
|||||||
text=text..string.format("Altimeter %.2f. Report see me.", qfe)
|
text=text..string.format("Altimeter %.2f. Report see me.", qfe)
|
||||||
|
|
||||||
-- Create new call to display complete subtitle.
|
-- Create new call to display complete subtitle.
|
||||||
--local casecall=self:_NewRadioCall(self.MarshalCall.CASE, "MARSHAL", text, self.Tmessage, modex)
|
local casecall=self:_NewRadioCall(self.MarshalCall.CASE, "MARSHAL", text, self.Tmessage, modex)
|
||||||
|
|
||||||
-- Until we have a case sound we take the noise for testing
|
|
||||||
local casecall=self:_NewRadioCall(self.MarshalCall.NOISE, "MARSHAL", text, self.Tmessage, modex)
|
local delay=0
|
||||||
|
|
||||||
-- Case..
|
-- Case..
|
||||||
self:RadioTransmission(self.MarshalRadio, casecall)
|
self:RadioTransmission(self.MarshalRadio, casecall, nil, delay)
|
||||||
-- X..
|
-- X..
|
||||||
self:_Number2Radio(self.MarshalRadio, tostring(case))
|
self:_Number2Radio(self.MarshalRadio, tostring(case), nil, delay)
|
||||||
|
delay=delay+0.5
|
||||||
-- expected..
|
-- expected..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.EXPECTED)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.EXPECTED, nil, delay)
|
||||||
-- BRC..
|
-- BRC..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.BRC)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.BRC, nil, delay)
|
||||||
-- XYZ..
|
-- XYZ..
|
||||||
self:_Number2Radio(self.MarshalRadio, string.format("%03d", brc))
|
self:_Number2Radio(self.MarshalRadio, string.format("%03d", brc), nil, delay)
|
||||||
|
delay=delay+0.5
|
||||||
-- hold at..
|
-- hold at..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.HOLDAT)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.HOLDAT, nil, delay)
|
||||||
|
delay=delay+0.1
|
||||||
-- angels..
|
-- angels..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.ANGELS)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.ANGELS, nil, delay)
|
||||||
-- X..
|
-- X..
|
||||||
self:_Number2Radio(self.MarshalRadio, tostring(angels))
|
self:_Number2Radio(self.MarshalRadio, tostring(angels), nil, delay)
|
||||||
|
delay=delay+0.5
|
||||||
-- Expected..
|
-- Expected..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.EXPECTED)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.EXPECTED, nil, delay)
|
||||||
-- Charlie time..
|
-- Charlie time..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.CHARLIETIME)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.CHARLIETIME, nil, delay)
|
||||||
-- XY.. (hours)
|
-- XY.. (hours)
|
||||||
self:_Number2Radio(self.MarshalRadio, CT[1])
|
self:_Number2Radio(self.MarshalRadio, CT[1], nil, delay)
|
||||||
-- XY.. (minutes)
|
-- XY.. (minutes)
|
||||||
self:_Number2Radio(self.MarshalRadio, CT[2])
|
self:_Number2Radio(self.MarshalRadio, CT[2], nil, delay)
|
||||||
|
delay=delay+0.5
|
||||||
-- Altimeter..
|
-- Altimeter..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.ALTIMETER)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.ALTIMETER, nil, delay)
|
||||||
-- XY..
|
-- XY..
|
||||||
self:_Number2Radio(self.MarshalRadio, QFE[1])
|
self:_Number2Radio(self.MarshalRadio, QFE[1], nil, delay)
|
||||||
-- Point..
|
-- Point..
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.POINT)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.POINT, nil, delay)
|
||||||
-- XY..
|
-- XY..
|
||||||
self:_Number2Radio(self.MarshalRadio, QFE[2])
|
self:_Number2Radio(self.MarshalRadio, QFE[2], nil, delay)
|
||||||
|
delay=delay+0.5
|
||||||
-- Report see me.
|
-- Report see me.
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.REPORTSEEME)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.REPORTSEEME, nil, delay)
|
||||||
|
delay=delay+0.2
|
||||||
-- Click!
|
-- Click!
|
||||||
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.CLICK)
|
self:RadioTransmission(self.MarshalRadio, self.MarshalCall.CLICK, nil, delay)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user