diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 937303aaa..c03a52ace 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -73,6 +73,8 @@ -- * [[MOOSE] Airboss - Groove Test A-4E Community Mod](https://www.youtube.com/watch?v=ZbjD7FHiaHo) -- * [[MOOSE] Airboss - Groove Test: On-the-fly LSO Grading](https://www.youtube.com/watch?v=Xgs1hwDcPyM) -- * [[MOOSE] Airboss - Carrier Auto Steam Into Wind](https://www.youtube.com/watch?v=IsU8dYgsp90) +-- * [[MOOSE] Airboss - CASE I Walkthrough by TG](https://www.youtube.com/watch?v=o1UrP4Q6PMM) +-- * [[MOOSE] Airboss - New LSO/Marshal Voice Overs by Raynor](https://www.youtube.com/watch?v=_Suo68bRu8k) -- -- ### Lex explaining Boat Ops: -- @@ -211,6 +213,7 @@ -- @field #number dTbeacon Time interval to refresh the beacons. Default 5 minutes. -- @field #AIRBOSS.LSOCalls LSOCall Radio voice overs of the LSO. -- @field #AIRBOSS.MarshalCalls MarshalCall Radio voice over of the Marshal/Airboss. +-- @field #AIRBOSS.PilotCalls PilotCall Radio voice over from AI pilots. -- @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 respawnAI If true, respawn AI flights as they enter the CCA to detach and airfields from the mission plan. Default false. @@ -876,6 +879,29 @@ -- -- airbossStennis:SetSoundfilesFolder("Airboss Soundfiles/") -- +-- ## Carrier Specific Voice Overs +-- +-- It is possible to use different sound files for different carriers. If you have set up two (or more) AIRBOSS objects at different carriers - say Stennis and Tarawa - each +-- carrier would use the files in the specified directory, e.g. +-- +-- airbossStennis:SetSoundfilesFolder("Airboss Soundfiles Stennis/") +-- airbossTarawa:SetSoundfilesFolder("Airboss Soundfiles Tarawa/") +-- +-- ## Sound Packs +-- +-- The AIRBOSS currently has two different "sound packs" for both LSO and Marshal radios. These contain voice overs by different actors. +-- These can be set by @{#AIRBOSS.SetVoiceOversLSOByRaynor}() and @{#AIRBOSS.SetVoiceOversMarshalByRaynor}(). These are the default settings. +-- The other sound files can be set by @{#AIRBOSS.SetVoiceOversLSOByFF}() and @{#AIRBOSS.SetVoiceOversMarshalByFF}(). +-- Also combinations can be used, e.g. +-- +-- airbossStennis:SetVoiceOversLSOByFF() +-- airbossStennis:SetVoiceOversMarshalByRaynor() +-- +-- In this example LSO voice overs by FF and Marshal voice overs by Raynor are used. +-- +-- **Note** that this only initializes the correct parameters parameters of sound files, i.e. the duration. The correct files have to be in the directory set by the +-- @{#AIRBOSS.SetSoundfilesFolder}(*folder*) function. +-- -- ## How To Use Your Own Voice Overs -- -- If you have a set of AIRBOSS sound files recorded or got it from elsewhere it is possible to use those instead of the default ones. @@ -895,13 +921,7 @@ -- -- Again, changing the file name, subtitle, subtitle duration is not required if you name the file exactly like the original one, which is this case would be "LSO-RogerBall.ogg". -- --- ## Carrier Specific Voice Overs -- --- It is possible to use different sound files for different carriers. If you have set up two (or more) AIRBOSS objects at different carriers - say Stennis and Tarawa - each --- carrier would use the files in the specified directory, e.g. --- --- airbossStennis:SetSoundfilesFolder("Airboss Soundfiles Stennis/") --- airbossTarawa:SetSoundfilesFolder("Airboss Soundfiles Tarawa/") -- -- ## The Radio Dilemma -- @@ -1379,6 +1399,30 @@ AIRBOSS.GroovePos={ -- @field #string modexreceiver Onboard number of the receiver (optional). -- @field #string sender Sender of the message (optional). Default radio alias. +--- Pilot radio calls. +-- type AIRBOSS.PilotCalls +-- @field #AIRBOSS.RadioCall N0 "Zero" call. +-- @field #AIRBOSS.RadioCall N1 "One" call. +-- @field #AIRBOSS.RadioCall N2 "Two" call. +-- @field #AIRBOSS.RadioCall N3 "Three" call. +-- @field #AIRBOSS.RadioCall N4 "Four" call. +-- @field #AIRBOSS.RadioCall N5 "Five" call. +-- @field #AIRBOSS.RadioCall N6 "Six" call. +-- @field #AIRBOSS.RadioCall N7 "Seven" call. +-- @field #AIRBOSS.RadioCall N8 "Eight" call. +-- @field #AIRBOSS.RadioCall N9 "Nine" call. +-- @field #AIRBOSS.RadioCall POINT "Point" call. +-- @field #AIRBOSS.RadioCall BALL "Ball" call. +-- @field #AIRBOSS.RadioCall HARRIER "Harrier" call. +-- @field #AIRBOSS.RadioCall HAWKEYE "Hawkeye" call. +-- @field #AIRBOSS.RadioCall HORNET "Hornet" call. +-- @field #AIRBOSS.RadioCall SKYHAWK "Skyhawk" call. +-- @field #AIRBOSS.RadioCall TOMCAT "Tomcat" call. +-- @field #AIRBOSS.RadioCall VIKING "Viking" call. +-- @field #AIRBOSS.RadioCall BINGOFUEL "Bingo Fuel" call. +-- @field #AIRBOSS.RadioCall GASATDIVERT "Going for gas at the divert field" call. +-- @field #AIRBOSS.RadioCall GASATTANKER "Going for gas at the recovery tanker" call. + --- LSO radio calls. -- @type AIRBOSS.LSOCalls -- @field #AIRBOSS.RadioCall BOLTER "Bolter, Bolter" call. @@ -1416,13 +1460,6 @@ AIRBOSS.GroovePos={ -- @field #AIRBOSS.RadioCall WELCOMEABOARD "Welcome aboard" call. -- @field #AIRBOSS.RadioCall CLICK Radio end transmission click sound. -- @field #AIRBOSS.RadioCall NOISE Static noise sound. --- @field #AIRBOSS.RadioCall BALL "Ball" call. --- @field #AIRBOSS.RadioCall HARRIER "Harrier" call. --- @field #AIRBOSS.RadioCall HAWKEYE "Hawkeye" call. --- @field #AIRBOSS.RadioCall HORNET "Hornet" call. --- @field #AIRBOSS.RadioCall SKYHAWK "Skyhawk" call. --- @field #AIRBOSS.RadioCall TOMCAT "Tomcat" call. --- @field #AIRBOSS.RadioCall VIKING "Viking" call. -- @field #AIRBOSS.RadioCall SPINIT "Spin it" call. --- Marshal radio calls. @@ -1468,9 +1505,7 @@ AIRBOSS.GroovePos={ -- @field #AIRBOSS.RadioCall STARTINGRECOVERY "Starting aircraft recovery" call. -- @field #AIRBOSS.RadioCall CLICK Radio end transmission click sound. -- @field #AIRBOSS.RadioCall NOISE Static noise sound. --- @field #AIRBOSS.RadioCall BINGOFUEL "Bingo Fuel" call. --- @field #AIRBOSS.RadioCall GASATDIVERT "Going for gas at the divert field" call. --- @field #AIRBOSS.RadioCall GASATTANKER "Going for gas at the recovery tanker" call. + --- Difficulty level. -- @type AIRBOSS.Difficulty @@ -1624,7 +1659,7 @@ AIRBOSS.MenuF10Root=nil --- Airboss class version. -- @field #string version -AIRBOSS.version="0.9.9.4" +AIRBOSS.version="0.9.9.5" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -3166,7 +3201,7 @@ function AIRBOSS:onafterStatus(From, Event, To) for _name,_player in pairs(self.players) do i=i+1 local player=_player --#AIRBOSS.FlightGroup - text=text..string.format("\n%d.) %s step=%s, unit=%s", i, tostring(player.name), tostring(player.step), tostring(player.unitname)) + text=text..string.format("\n%d.) %s: Step=%s, Unit=%s, Airframe=%s", i, tostring(player.name), tostring(player.step), tostring(player.unitname), tostring(player.actype)) end if i==0 then text=text.." none" @@ -4029,6 +4064,184 @@ function AIRBOSS:_InitTarawa() end +--- Init parameters for Marshal Voice overs by *Raynor*. +-- @param #AIRBOSS self +function AIRBOSS:SetVoiceOversMarshalByRaynor() + self:I(self.lid..string.format("Marshal Raynor reporting for duty!")) + + self.MarshalCall.AFFIRMATIVE.duration=0.70 + self.MarshalCall.ALTIMETER.duration=0.60 + self.MarshalCall.BRC.duration=0.60 + self.MarshalCall.CARRIERTURNTOHEADING.duration=1.87 + self.MarshalCall.CASE.duration=0.60 + self.MarshalCall.CHARLIETIME.duration=0.81 + self.MarshalCall.CLEAREDFORRECOVERY.duration=1.21 + self.MarshalCall.DECKCLOSED.duration=0.86 + self.MarshalCall.DEGREES.duration=0.55 + self.MarshalCall.EXPECTED.duration=0.61 + self.MarshalCall.FLYNEEDLES.duration=0.90 + self.MarshalCall.HOLDATANGELS.duration=0.91 + self.MarshalCall.HOURS.duration=0.54 + self.MarshalCall.MARSHALRADIAL.duration=0.80 + self.MarshalCall.N0.duration=0.38 + self.MarshalCall.N1.duration=0.30 + self.MarshalCall.N2.duration=0.30 + self.MarshalCall.N3.duration=0.30 + self.MarshalCall.N4.duration=0.32 + self.MarshalCall.N5.duration=0.41 + self.MarshalCall.N6.duration=0.48 + self.MarshalCall.N7.duration=0.51 + self.MarshalCall.N8.duration=0.38 + self.MarshalCall.N9.duration=0.34 + self.MarshalCall.NEGATIVE.duration=0.60 + self.MarshalCall.NEWFB.duration=1.10 + self.MarshalCall.OPS.duration=0.46 + self.MarshalCall.POINT.duration=0.21 + self.MarshalCall.RADIOCHECK.duration=0.95 + self.MarshalCall.RECOVERY.duration=0.63 + self.MarshalCall.RECOVERYOPSSTOPPED.duration=1.36 + self.MarshalCall.RECOVERYPAUSEDNOTICE.duration=2.8 -- Strangely the file is actually a shorter ~2.4 sec. + self.MarshalCall.RECOVERYPAUSEDRESUMED.duration=2.75 + self.MarshalCall.REPORTSEEME.duration=1.06 --0.96 + self.MarshalCall.RESUMERECOVERY.duration=1.41 + self.MarshalCall.ROGER.duration=0.41 + self.MarshalCall.SAYNEEDLES.duration=0.79 + self.MarshalCall.STACKFULL.duration=4.70 + self.MarshalCall.STARTINGRECOVERY.duration=2.06 + +end + +--- Set parameters for LSO Voice overs by *Raynor*. +-- @param #AIRBOSS self +function AIRBOSS:SetVoiceOversLSOByRaynor() + self:I(self.lid..string.format("LSO Raynor reporting for duty!")) + + self.LSOCall.BOLTER.duration=0.75 + self.LSOCall.CALLTHEBALL.duration=0.625 + self.LSOCall.CHECK.duration=0.40 + self.LSOCall.CLEAREDTOLAND.duration=0.85 + self.LSOCall.COMELEFT.duration=0.60 + self.LSOCall.DEPARTANDREENTER.duration=1.10 + self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.30 + self.LSOCall.EXPECTSPOT75.duration=1.85 + self.LSOCall.FAST.duration=0.75 + self.LSOCall.FOULDECK.duration=0.75 + self.LSOCall.HIGH.duration=0.65 + self.LSOCall.IDLE.duration=0.40 + self.LSOCall.LONGINGROOVE.duration=1.25 + self.LSOCall.LOW.duration=0.60 + self.LSOCall.N0.duration=0.38 + self.LSOCall.N1.duration=0.30 + self.LSOCall.N2.duration=0.30 + self.LSOCall.N3.duration=0.30 + self.LSOCall.N4.duration=0.32 + self.LSOCall.N5.duration=0.41 + self.LSOCall.N6.duration=0.48 + self.LSOCall.N7.duration=0.51 + self.LSOCall.N8.duration=0.38 + self.LSOCall.N9.duration=0.34 + self.LSOCall.PADDLESCONTACT.duration=0.91 + self.LSOCall.POWER.duration=0.45 + self.LSOCall.RADIOCHECK.duration=0.90 + self.LSOCall.RIGHTFORLINEUP.duration=0.70 + self.LSOCall.ROGERBALL.duration=0.72 + self.LSOCall.SLOW.duration=0.63 + --self.LSOCall.SLOW.duration=0.59 --TODO + self.LSOCall.STABILIZED.duration=0.75 + self.LSOCall.WAVEOFF.duration=0.55 + self.LSOCall.WELCOMEABOARD.duration=0.80 +end + + + +--- Set parameters for LSO Voice overs by *funkyfranky*. +-- @param #AIRBOSS self +function AIRBOSS:SetVoiceOversLSOByFF() + self:I(self.lid..string.format("Marshal FF reporting for duty!")) + + self.LSOCall.BOLTER.duration=0.75 + self.LSOCall.CALLTHEBALL.duration=0.60 + self.LSOCall.CHECK.duration=0.45 + self.LSOCall.CLEAREDTOLAND.duration=1.00 + self.LSOCall.COMELEFT.duration=0.60 + self.LSOCall.DEPARTANDREENTER.duration=1.10 + self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.20 + self.LSOCall.EXPECTSPOT75.duration=2.00 + self.LSOCall.FAST.duration=0.70 + self.LSOCall.FOULDECK.duration=0.62 + self.LSOCall.HIGH.duration=0.65 + self.LSOCall.IDLE.duration=0.45 + self.LSOCall.LONGINGROOVE.duration=1.20 + self.LSOCall.LOW.duration=0.50 + self.LSOCall.N0.duration=0.40 + self.LSOCall.N1.duration=0.25 + self.LSOCall.N2.duration=0.37 + self.LSOCall.N3.duration=0.37 + self.LSOCall.N4.duration=0.39 + self.LSOCall.N5.duration=0.39 + self.LSOCall.N6.duration=0.40 + self.LSOCall.N7.duration=0.40 + self.LSOCall.N8.duration=0.37 + self.LSOCall.N9.duration=0.40 + self.LSOCall.PADDLESCONTACT.duration=1.00 + self.LSOCall.POWER.duration=0.50 + self.LSOCall.RADIOCHECK.duration=1.10 + self.LSOCall.RIGHTFORLINEUP.duration=0.80 + self.LSOCall.ROGERBALL.duration=1.00 + self.LSOCall.SLOW.duration=0.65 + self.LSOCall.SLOW.duration=0.59 + self.LSOCall.STABILIZED.duration=0.90 + self.LSOCall.WAVEOFF.duration=0.60 + self.LSOCall.WELCOMEABOARD.duration=1.00 +end + +--- Intit parameters for Marshal Voice overs by *funkyfranky*. +-- @param #AIRBOSS self +function AIRBOSS:SetVoiceOversMarshalByFF() + self:I(self.lid..string.format("Marshal FF reporting for duty!")) + + self.MarshalCall.AFFIRMATIVE.duration=0.90 + self.MarshalCall.ALTIMETER.duration=0.85 + self.MarshalCall.BRC.duration=0.80 + self.MarshalCall.CARRIERTURNTOHEADING.duration=2.48 + self.MarshalCall.CASE.duration=0.40 + self.MarshalCall.CHARLIETIME.duration=0.90 + self.MarshalCall.CLEAREDFORRECOVERY.duration=1.25 + self.MarshalCall.DECKCLOSED.duration=1.10 + self.MarshalCall.DEGREES.duration=0.60 + self.MarshalCall.EXPECTED.duration=0.55 + self.MarshalCall.FLYNEEDLES.duration=0.90 + self.MarshalCall.HOLDATANGELS.duration=1.10 + self.MarshalCall.HOURS.duration=0.60 + self.MarshalCall.MARSHALRADIAL.duration=1.10 + self.MarshalCall.N0.duration=0.40 + self.MarshalCall.N1.duration=0.25 + self.MarshalCall.N2.duration=0.37 + self.MarshalCall.N3.duration=0.37 + self.MarshalCall.N4.duration=0.39 + self.MarshalCall.N5.duration=0.39 + self.MarshalCall.N6.duration=0.40 + self.MarshalCall.N7.duration=0.40 + self.MarshalCall.N8.duration=0.37 + self.MarshalCall.N9.duration=0.40 + self.MarshalCall.NEGATIVE.duration=0.80 + self.MarshalCall.NEWFB.duration=1.35 + self.MarshalCall.OPS.duration=0.48 + self.MarshalCall.POINT.duration=0.33 + self.MarshalCall.RADIOCHECK.duration=1.20 + self.MarshalCall.RECOVERY.duration=0.70 + self.MarshalCall.RECOVERYOPSSTOPPED.duration=1.65 + self.MarshalCall.RECOVERYPAUSEDNOTICE.duration=2.9 -- Strangely the file is actually a shorter ~2.4 sec. + self.MarshalCall.RECOVERYPAUSEDRESUMED.duration=3.40 + self.MarshalCall.REPORTSEEME.duration=0.95 + self.MarshalCall.RESUMERECOVERY.duration=1.75 + self.MarshalCall.ROGER.duration=0.53 + self.MarshalCall.SAYNEEDLES.duration=0.90 + self.MarshalCall.STACKFULL.duration=6.35 + self.MarshalCall.STARTINGRECOVERY.duration=2.65 + +end + --- Init voice over radio transmission call. -- @param #AIRBOSS self function AIRBOSS:_InitVoiceOvers() @@ -4307,62 +4520,6 @@ function AIRBOSS:_InitVoiceOvers() subtitle="", duration=3.6, }, - SKYHAWK={ - file="AIRBOSS-Skyhawk", - suffix="ogg", - loud=false, - subtitle="", - duration=0.95, - subduration=5, - }, - HARRIER={ - file="AIRBOSS-Harrier", - suffix="ogg", - loud=false, - subtitle="", - duration=0.58, - subduration=5, - }, - HAWKEYE={ - file="AIRBOSS-Hawkeye", - suffix="ogg", - loud=false, - subtitle="", - duration=0.63, - subduration=5, - }, - TOMCAT={ - file="AIRBOSS-Tomcat", - suffix="ogg", - loud=false, - subtitle="", - duration=0.66, - subduration=5, - }, - HORNET={ - file="AIRBOSS-Hornet", - suffix="ogg", - loud=false, - subtitle="", - duration=0.56, - subduration=5, - }, - VIKING={ - file="AIRBOSS-Viking", - suffix="ogg", - loud=false, - subtitle="", - duration=0.61, - subduration=5, - }, - BALL={ - file="AIRBOSS-Ball", - suffix="ogg", - loud=false, - subtitle="", - duration=0.50, - subduration=5, - }, SPINIT={ file="AIRBOSS-SpinIt", suffix="ogg", @@ -4373,6 +4530,168 @@ function AIRBOSS:_InitVoiceOvers() }, } + ----------------- + -- Pilot Calls -- + ----------------- + + -- Pilot Radio Calls. + self.PilotCall={ + N0={ + file="PILOT-N0", + suffix="ogg", + loud=false, + subtitle="", + duration=0.40, + }, + N1={ + file="PILOT-N1", + suffix="ogg", + loud=false, + subtitle="", + duration=0.25, + }, + N2={ + file="PILOT-N2", + suffix="ogg", + loud=false, + subtitle="", + duration=0.37, + }, + N3={ + file="PILOT-N3", + suffix="ogg", + loud=false, + subtitle="", + duration=0.37, + }, + N4={ + file="PILOT-N4", + suffix="ogg", + loud=false, + subtitle="", + duration=0.39, + }, + N5={ + file="PILOT-N5", + suffix="ogg", + loud=false, + subtitle="", + duration=0.39, + }, + N6={ + file="PILOT-N6", + suffix="ogg", + loud=false, + subtitle="", + duration=0.40, + }, + N7={ + file="PILOT-N7", + suffix="ogg", + loud=false, + subtitle="", + duration=0.40, + }, + N8={ + file="PILOT-N8", + suffix="ogg", + loud=false, + subtitle="", + duration=0.37, + }, + N9={ + file="PILOT-N9", + suffix="ogg", + loud=false, + subtitle="", + duration=0.40, + }, + POINT={ + file="PILOT-Point", + suffix="ogg", + loud=false, + subtitle="", + duration=0.33, + }, + SKYHAWK={ + file="PILOT-Skyhawk", + suffix="ogg", + loud=false, + subtitle="", + duration=0.95, + subduration=5, + }, + HARRIER={ + file="PILOT-Harrier", + suffix="ogg", + loud=false, + subtitle="", + duration=0.58, + subduration=5, + }, + HAWKEYE={ + file="PILOT-Hawkeye", + suffix="ogg", + loud=false, + subtitle="", + duration=0.63, + subduration=5, + }, + TOMCAT={ + file="PILOT-Tomcat", + suffix="ogg", + loud=false, + subtitle="", + duration=0.66, + subduration=5, + }, + HORNET={ + file="PILOT-Hornet", + suffix="ogg", + loud=false, + subtitle="", + duration=0.56, + subduration=5, + }, + VIKING={ + file="PILOT-Viking", + suffix="ogg", + loud=false, + subtitle="", + duration=0.61, + subduration=5, + }, + BALL={ + file="PILOT-Ball", + suffix="ogg", + loud=false, + subtitle="", + duration=0.50, + subduration=5, + }, + BINGOFUEL={ + file="PILOT-BingoFuel", + suffix="ogg", + loud=false, + subtitle="", + duration=0.80, + }, + GASATDIVERT={ + file="PILOT-GasAtDivert", + suffix="ogg", + loud=false, + subtitle="", + duration=1.80, + }, + GASATTANKER={ + file="PILOT-GasAtTanker", + suffix="ogg", + loud=false, + subtitle="", + duration=1.95, + }, + } + ------------------- -- MARSHAL Radio -- ------------------- @@ -4681,28 +5000,11 @@ function AIRBOSS:_InitVoiceOvers() subtitle="", duration=3.6, }, - BINGOFUEL={ - file="AIRBOSS-BingoFuel", - suffix="ogg", - loud=false, - subtitle="", - duration=0.80, - }, - GASATDIVERT={ - file="AIRBOSS-GasAtDivert", - suffix="ogg", - loud=false, - subtitle="", - duration=1.80, - }, - GASATTANKER={ - file="AIRBOSS-GasAtTanker", - suffix="ogg", - loud=false, - subtitle="", - duration=1.95, - }, } + + -- Default timings by Raynor + self:SetVoiceOversLSOByRaynor() + self:SetVoiceOversMarshalByRaynor() end @@ -7538,6 +7840,18 @@ end function AIRBOSS:OnEventBirth(EventData) self:F3({eventbirth = EventData}) + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event BIRTH!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event BIRTH!") + self:E(EventData) + return + end + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -7588,6 +7902,18 @@ end function AIRBOSS:OnEventLand(EventData) self:F3({eventland = EventData}) + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event LAND!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event LAND!") + self:E(EventData) + return + end + -- Get unit name that landed. local _unitName=EventData.IniUnitName @@ -7595,9 +7921,9 @@ function AIRBOSS:OnEventLand(EventData) local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) -- Debug output. - self:T3(self.lid.."LAND: unit = "..tostring(EventData.IniUnitName)) - self:T3(self.lid.."LAND: group = "..tostring(EventData.IniGroupName)) - self:T3(self.lid.."LAND: player = "..tostring(_playername)) + self:T(self.lid.."LAND: unit = "..tostring(EventData.IniUnitName)) + self:T(self.lid.."LAND: group = "..tostring(EventData.IniGroupName)) + self:T(self.lid.."LAND: player = "..tostring(_playername)) -- This would be the closest airbase. local airbase=EventData.Place @@ -7773,6 +8099,19 @@ end -- @param Core.Event#EVENTDATA EventData function AIRBOSS:OnEventEngineShutdown(EventData) self:F3({eventengineshutdown=EventData}) + + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event ENGINESHUTDOWN!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event ENGINESHUTDOWN!") + self:E(EventData) + return + end + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -7822,6 +8161,19 @@ end function AIRBOSS:OnEventTakeoff(EventData) self:F3({eventtakeoff=EventData}) + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event TAKEOFF!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event TAKEOFF!") + self:E(EventData) + return + end + + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -7873,6 +8225,19 @@ end -- @param Core.Event#EVENTDATA EventData function AIRBOSS:OnEventCrash(EventData) self:F3({eventcrash = EventData}) + + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event CRASH!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event CRASH!") + self:E(EventData) + return + end + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -7909,6 +8274,19 @@ end -- @param Core.Event#EVENTDATA EventData function AIRBOSS:OnEventEjection(EventData) self:F3({eventland = EventData}) + + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event EJECTION!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event EJECTION!") + self:E(EventData) + return + end + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -7949,6 +8327,19 @@ end --function AIRBOSS:OnEventPlayerLeaveUnit(EventData) function AIRBOSS:_PlayerLeft(EventData) self:F3({eventleave=EventData}) + + -- Nil checks. + if EventData==nil then + self:E(self.lid.."ERROR: EventData=nil in event PLAYERLEFTUNIT!") + self:E(EventData) + return + end + if EventData.IniUnit==nil then + self:E(self.lid.."ERROR: EventData.IniUnit=nil in event PLAYERLEFTUNIT!") + self:E(EventData) + return + end + local _unitName=EventData.IniUnitName local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) @@ -10087,6 +10478,7 @@ function AIRBOSS:_GetZoneHolding(case, stack) if self.carriertype==AIRBOSS.CarrierType.TARAWA then zoneHolding=ZONE_RADIUS:New("CASE I Holding Zone", self.carrier:GetVec2(), UTILS.NMToMeters(5)) end + else -- CASE II/II @@ -12999,6 +13391,7 @@ function AIRBOSS:_GetOnboardNumbers(group, playeronly) return numbers end + --- Get Tower frequency of carrier. -- @param #AIRBOSS self function AIRBOSS:_GetTowerFrequency() @@ -13477,7 +13870,8 @@ end -- @param #number delay Delay in seconds, before the message is broadcasted. -- @param #number interval Interval in seconds after the last sound has been played. -- @param #boolean click If true, play radio click at the end. -function AIRBOSS:RadioTransmission(radio, call, loud, delay, interval, click) +-- @param #booelan pilotcall If true, it's a pilot call. +function AIRBOSS:RadioTransmission(radio, call, loud, delay, interval, click, pilotcall) self:F2({radio=radio, call=call, loud=loud, delay=delay, interval=interval, click=click}) -- Nil check. @@ -13498,12 +13892,12 @@ function AIRBOSS:RadioTransmission(radio, call, loud, delay, interval, click) -- Player onboard number if sender has one. if self:_IsOnboard(call.modexsender) then - self:_Number2Radio(radio, call.modexsender, delay, 0.3) + self:_Number2Radio(radio, call.modexsender, delay, 0.3, pilotcall) end -- Play onboard number if receiver has one. if self:_IsOnboard(call.modexreceiver) then - self:_Number2Radio(radio, call.modexreceiver, delay, 0.3) + self:_Number2Radio(radio, call.modexreceiver, delay, 0.3, pilotcall) end -- Add transmission to the right queue. @@ -14058,8 +14452,9 @@ end -- @param #string number Number string, e.g. "032" or "183". -- @param #number delay Delay before transmission in seconds. -- @param #number interval Interval between the next call. +-- @param #boolean pilotcall If true, use pilot sound files. -- @return #number Duration of the call in seconds. -function AIRBOSS:_Number2Radio(radio, number, delay, interval) +function AIRBOSS:_Number2Radio(radio, number, delay, interval, pilotcall) --- Split string into characters. local function _split(str) @@ -14081,6 +14476,10 @@ function AIRBOSS:_Number2Radio(radio, number, delay, interval) self:E(self.lid..string.format("ERROR: Unknown radio alias %s!", tostring(radio.alias))) end + if pilotcall then + Sender="PilotCall" + end + -- Split string into characters. local numbers=_split(number) @@ -14132,18 +14531,18 @@ function AIRBOSS:_LSOCallAircraftBall(modex, nickname, fuelstate) local FS=UTILS.Split(string.format("%.1f", fuelstate), ".") -- Create new call to display complete subtitle. - local call=self:_NewRadioCall(self.LSOCall[NICKNAME], modex, text, self.Tmessage, nil, modex) + local call=self:_NewRadioCall(self.PilotCall[NICKNAME], modex, text, self.Tmessage, nil, modex) -- Hornet .. - self:RadioTransmission(self.LSORadio, call) + self:RadioTransmission(self.LSORadio, call, nil, nil, nil, nil, true) -- Ball, - self:RadioTransmission(self.LSORadio, self.LSOCall.BALL) + self:RadioTransmission(self.LSORadio, self.PilotCall.BALL, nil, nil, nil, nil, true) -- X.. - self:_Number2Radio(self.LSORadio, FS[1]) + self:_Number2Radio(self.LSORadio, FS[1], nil, nil, true) -- Point.. - self:RadioTransmission(self.LSORadio, self.MarshalCall.POINT) + self:RadioTransmission(self.LSORadio, self.PilotCall.POINT, nil, nil, nil, nil, true) -- Y. - self:_Number2Radio(self.LSORadio, FS[2]) + self:_Number2Radio(self.LSORadio, FS[2], nil, nil, true) -- CLICK! self:RadioTransmission(self.LSORadio, self.LSOCall.CLICK) @@ -14162,13 +14561,13 @@ function AIRBOSS:_MarshalCallGasAtTanker(modex) self:I(self.lid..text) -- Create new call to display complete subtitle. - local call=self:_NewRadioCall(self.MarshalCall.BINGOFUEL, modex, text, self.Tmessage, nil, modex) + local call=self:_NewRadioCall(self.PilotCall.BINGOFUEL, modex, text, self.Tmessage, nil, modex) -- MODEX, bingo fuel! - self:RadioTransmission(self.MarshalRadio, call) + self:RadioTransmission(self.MarshalRadio, call, nil, nil, nil, nil, true) -- Going for fuel at the recovery tanker. Click! - self:RadioTransmission(self.MarshalRadio, self.MarshalCall.GASATTANKER, nil, nil, nil, true) + self:RadioTransmission(self.MarshalRadio, self.PilotCall.GASATTANKER, nil, nil, nil, true, true) end @@ -14185,13 +14584,13 @@ function AIRBOSS:_MarshalCallGasAtDivert(modex, divertname) self:I(self.lid..text) -- Create new call to display complete subtitle. - local call=self:_NewRadioCall(self.MarshalCall.BINGOFUEL, modex, text, self.Tmessage, nil, modex) + local call=self:_NewRadioCall(self.PilotCall.BINGOFUEL, modex, text, self.Tmessage, nil, modex) -- MODEX, bingo fuel! - self:RadioTransmission(self.MarshalRadio, call) + self:RadioTransmission(self.MarshalRadio, call, nil, nil, nil, nil, true) -- Going for fuel at the divert field. Click! - self:RadioTransmission(self.MarshalRadio, self.MarshalCall.GASATDIVERT, nil, nil, nil, true) + self:RadioTransmission(self.MarshalRadio, self.PilotCall.GASATDIVERT, nil, nil, nil, true, true) end @@ -16313,23 +16712,23 @@ function AIRBOSS:_SaveTrapSheet(playerData, grade) for _,_groove in ipairs(playerData.trapsheet) do local groove=_groove --#AIRBOSS.GrooveData local t=groove.Time-T0 - local a=UTILS.MetersToNM(groove.Rho) - local b=-groove.X - local c=groove.Z - local d=UTILS.MetersToFeet(groove.Alt) - local e=groove.AoA - local f=groove.GSE - local g=-groove.LUE - local h=UTILS.MpsToKnots(groove.Vel) - local i=groove.Vy*196.85 - local j=groove.Gamma - local k=groove.Pitch - local l=groove.Roll - local m=groove.Yaw - local n=self:_GS(groove.Step, -1) - local o=groove.Grade - local p=groove.GradePoints - local q=groove.GradeDetail + local a=UTILS.MetersToNM(groove.Rho or 0) + local b=-groove.X or 0 + local c=groove.Z or 0 + local d=UTILS.MetersToFeet(groove.Alt or 0) + local e=groove.AoA or 0 + local f=groove.GSE or 0 + local g=-groove.LUE or 0 + local h=UTILS.MpsToKnots(groove.Vel or 0) + local i=(groove.Vy or 0)*196.85 + local j=groove.Gamma or 0 + local k=groove.Pitch or 0 + local l=groove.Roll or 0 + local m=groove.Yaw or 0 + local n=self:_GS(groove.Step, -1) or "n/a" + local o=groove.Grade or "n/a" + local p=groove.GradePoints or 0 + local q=groove.GradeDetail or "n/a" -- t a b c d e f g h i j k l m n o p q data=data..string.format("%.2f,%.3f,%.1f,%.1f,%.1f,%.2f,%.2f,%.2f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%s,%s,%.1f,%s\n",t,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) end diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index a790deddd..25b6a9f91 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -952,10 +952,12 @@ function GROUP:GetFuelMin() local tmp = nil for UnitID, UnitData in pairs( self:GetUnits() ) do - tmp = UnitData:GetFuel() - if tmp < min then - min = tmp - unit = UnitData + if UnitData and UnitData:IsAlive() then + tmp = UnitData:GetFuel() + if tmp < min then + min = tmp + unit = UnitData + end end end diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 91d157515..7fc35a772 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -318,6 +318,30 @@ function UNIT:GetCallsign() return nil end +--- Check if an (air) unit is a client or player slot. Information is retrieved from the group template. +-- @param #UNIT self +-- @return #boolean If true, unit is associated with a client or player slot. +function UNIT:IsPlayer() + + -- Get group. + local group=self:GetGroup() + + -- Units of template group. + local units=group:GetTemplate().units + + -- Get numbers. + for _,unit in pairs(units) do + + -- Check if unit name matach and skill is Client or Player. + if unit.name==self:GetName() and (unit.skill=="Client" or unit.skill=="Player") then + return true + end + + end + + return false +end + --- Returns name of the player that control the unit or nil if the unit is controlled by A.I. -- @param #UNIT self