diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 70535cd0e..246e960d1 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -21,7 +21,7 @@ -- * Multiple carrier support due to object oriented approach. -- * Unlimited number of players. -- * Persistence of player results (optional). LSO grading data is saved to csv file. --- * Trap sheet (optional). +-- * Trap sheet (optional). -- * Finite State Machine (FSM) implementation. -- -- **Supported Carriers:** @@ -6950,6 +6950,9 @@ function AIRBOSS:_AddMarshalGroup( flight, stack ) -- Convert to clock string. local Ccharlie = UTILS.SecondsToClock( flight.Tcharlie ) + -- Make sure brc is never above 360 + brc = brc % 360 + -- Combined marshal call. self:_MarshalCallArrived( flight.onboard, flight.case, brc, alt, Ccharlie, P ) @@ -7603,7 +7606,7 @@ function AIRBOSS:_InitPlayer( playerData, step ) playerData.landed = false playerData.Tlso = timer.getTime() playerData.Tgroove = nil - playerData.TIG0 = nil + playerData.TIG0 = 0 --changed to prevent errors in script when player is not in correct spot playerData.wire = nil playerData.flag = -100 playerData.debriefschedulerID = nil @@ -8142,8 +8145,7 @@ end --- Check current player status. -- @param #AIRBOSS self function AIRBOSS:_CheckPlayerStatus() - - -- Loop over all players. + -- Loop over all players. for _playerName, _playerData in pairs( self.players ) do local playerData = _playerData -- #AIRBOSS.PlayerData @@ -8415,7 +8417,7 @@ end function AIRBOSS:_SetTimeInGroove( playerData ) -- Set time in the groove - if playerData.TIG0 then + if playerData.TIG0 then playerData.Tgroove = timer.getTime() - playerData.TIG0 - 1.5 -- VNAO Edit - Subtracting an extra 1.5 else playerData.Tgroove = 999 @@ -9644,7 +9646,7 @@ end --- Break entry for case I/II recoveries. -- @param #AIRBOSS self -- @param #AIRBOSS.PlayerData playerData Player data table. -function AIRBOSS:_BreakEntry( playerData ) --Adam Edits begin 7/24/23 +function AIRBOSS:_BreakEntry( playerData ) -- Get distances between carrier and player unit (parallel and perpendicular to direction of movement of carrier) local X, Z = self:_GetDistances( playerData.unit ) @@ -9655,111 +9657,16 @@ function AIRBOSS:_BreakEntry( playerData ) --Adam Edits begin 7/24/23 return end - local stern = self:_GetSternCoord() - local coord = playerData.unit:GetCoordinate() - local dist = coord:Get2DDistance( stern ) - - --adam edits - local playerCallsign = playerData.unit:GetCallsign() - --trigger.action.outText(' Hornet is hook down on pre-break entry for testing hook argument ', 5) - --trigger.action.outText(' Hornet callsign is '..playerCallsign, 5) - local playerName = playerData.name - local unit = playerData.unit - - --local playerName = unit:GetName() - --trigger.action.outText(' Hornet name is '..playerName, 5) - local unitClient = Unit.getByName(unit:GetName()) - local hookArgument = unitClient:getDrawArgumentValue(25) - local hookArgument_Tomcat = unitClient:getDrawArgumentValue(1305) - local speedMPS = playerData.unit:GetVelocityMPS() - local speedKTS = UTILS.MpsToKnots( speedMPS ) - local player_alt = playerData.unit:GetAltitude() - - player_alt_feet = player_alt * 3.28 - player_alt_feet = player_alt_feet/10 - player_alt_feet = math.floor(player_alt_feet)*10 - - local player_velocity_round = speedKTS * 1.00 - player_velocity_round = player_velocity_round/10 - player_velocity_round = math.floor(player_velocity_round)*10 - - local player_alt_feet = player_alt * 3.28 - player_alt_feet = player_alt_feet/10 - player_alt_feet = math.floor(player_alt_feet)*10 - - local Play_SH_Sound = USERSOUND:New( "Airboss Soundfiles/GreatBallsOfFire.ogg" ) - local Play_666SH_Sound = USERSOUND:New( "Airboss Soundfiles/Runninwiththedevil.ogg" ) - local playerType = playerData.actype - - - - if dist <1000 and clientSHBFlag == false then - - if speedKTS > 450 and speedKTS < 590 then - if player_alt_feet < 1500 then - if hookArgument > 0 or hookArgument_Tomcat > 0 then - --trigger.action.outText(' 1 - Hornet is hook down so SHB!!!! Hook argument is: '..hookArgument, 5) - playerData.shb = true - trigger.action.outText(playerName..' performing a Sierra Hotel Break in a '..playerType, 10) - local sh_message_to_discord = ('**'..playerName..' is performing a Sierra Hotel Break in a '..playerType..' at '..player_velocity_round..' knots and '..player_alt_feet..' feet!**') - HypeMan.sendBotMessage(sh_message_to_discord) - Play_SH_Sound:ToAll() - clientSHBFlag = true - else - --trigger.action.outText(' Hornet is hook up on initial and just fast so no SHB. Hook argument is: '..hookArgument, 5) - playerData.shb = false - end - -- Next step: Early Break. - else - end - elseif speedKTS > 589 then - if player_alt_feet < 625 and player_alt_feet >575 then --SHB 666 - if hookArgument > 0 or hookArgument_Tomcat > 0 then - --trigger.action.outText(' 1 - Hornet is hook down so SHB!!!! Hook argument is: '..hookArgument, 5) - playerData.shb = true - trigger.action.outText(playerName..' performing a 666 Sierra Hotel Break in a '..playerType, 10) - local sh_message_to_discord = ('**'..playerName..' is performing a 666 Sierra Hotel Break in a '..playerType..' at '..player_velocity_round..' knots and '..player_alt_feet..' feet!**') - HypeMan.sendBotMessage(sh_message_to_discord) - Play_666SH_Sound:ToAll() - clientSHBFlag = true - else - --trigger.action.outText(' Hornet is hook up on initial and just fast so no SHB. Hook argument is: '..hookArgument, 5) - playerData.shb = false - end - else - if hookArgument > 0 or hookArgument_Tomcat > 0 then - --trigger.action.outText(' 1 - Hornet is hook down so SHB!!!! Hook argument is: '..hookArgument, 5) - playerData.shb = true - trigger.action.outText(playerName..' performing a Sierra Hotel Break in a '..playerType, 10) - local sh_message_to_discord = ('**'..playerName..' is performing a Sierra Hotel Break in a '..playerType..' at '..player_velocity_round..' knots and '..player_alt_feet..' feet!**') - HypeMan.sendBotMessage(sh_message_to_discord) - Play_SH_Sound:ToAll() - clientSHBFlag = true - else - --trigger.action.outText(' Hornet is hook up on initial and just fast so no SHB. Hook argument is: '..hookArgument, 5) - playerData.shb = false - end - end - else - --trigger.action.outText(' Hornet is less than 400 kts so not SHB.... ', 5) - end - else - --trigger.action.outText(' ******TEST OF of Break Entry and distance to CVN is: '..dist, 5) - - end - - -- Check if we are in front of the boat (diffX > 0). if self:_CheckLimits( X, Z, self.BreakEntry ) then - --trigger.action.outText(' 2 - Hornet is hook down on break entry for testing hook argument ', 5) -- Hint for player about altitude, AoA etc. self:_PlayerHint( playerData ) + -- Next step: Early Break. self:_SetPlayerStep( playerData, AIRBOSS.PatternStep.EARLYBREAK ) - clientSHBFlag = false end -end--Adam Edits end 7/24/23 +end --- Break. -- @param #AIRBOSS self @@ -10361,19 +10268,19 @@ function AIRBOSS:_Groove( playerData ) if rho >= RAR and rho <= RIM then if gd.LUE > 0.22 and lineupError < -0.22 then env.info " Drift Right across centre ==> DR-" - gd.Drift = " DR" + gd.Drift = "DR" self:T( self.lid .. string.format( "Got Drift Right across centre step %s, d=%.3f: Max LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError ) ) elseif gd.LUE < -0.22 and lineupError > 0.22 then env.info " Drift Left ==> DL-" - gd.Drift = " DL" + gd.Drift = "DL" self:T( self.lid .. string.format( "Got Drift Left across centre at step %s, d=%.3f: Min LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError ) ) elseif gd.LUE > 0.13 and lineupError < -0.14 then env.info " Little Drift Right across centre ==> (DR-)" - gd.Drift = " (DR)" + gd.Drift = "(DR)" self:T( self.lid .. string.format( "Got Little Drift Right across centre at step %s, d=%.3f: Max LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError ) ) elseif gd.LUE < -0.13 and lineupError > 0.14 then env.info " Little Drift Left across centre ==> (DL-)" - gd.Drift = " (DL)" + gd.Drift = "(DL)" self:E( self.lid .. string.format( "Got Little Drift Left across centre at step %s, d=%.3f: Min LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError ) ) end end @@ -12051,10 +11958,12 @@ function AIRBOSS:GetHeading( magnetic ) hdg = hdg - self.magvar end - -- Adjust negative values. - if hdg < 0 then - hdg = hdg + 360 - end + -- -- Adjust negative values. + -- if hdg < 0 then + -- hdg = hdg + 360 + -- end + + hdg = hdg % 360 -- using this to replace the above function to prevent negative values and BRC higher than 360 return hdg end @@ -12751,7 +12660,7 @@ function AIRBOSS:_LSOgrade( playerData ) local TIG = "" -- Analyse flight data and convert to LSO text. if playerData.Tgroove and playerData.Tgroove <= 360 and playerData.case < 3 then --Circuit Added - TIG = self:_EvalGrooveTime( playerData ) --Circuit Added + TIG = self:_EvalGrooveTime( playerData ) or "N/A" --Circuit Added end --Circuit Added local GXX, nXX = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.XX ) local GIM, nIM = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.IM ) @@ -12945,16 +12854,21 @@ function AIRBOSS:_LSOgrade( playerData ) end - -- VNAO EDIT: Subtract 1pt from overall grade if it is a 1 wire. If it's already a 1pt pass, ignore. - if playerData.wire == 1 and points > 1 then -- VNAO EDIT: added - if points == 4 then -- VNAO EDIT: added - points = 3 -- VNAO EDIT: added - grade = "(OK)" -- VNAO EDIT: added - elseif points == 3 then -- VNAO EDIT: added - points = 2 -- VNAO EDIT: added - grade = "--" -- VNAO EDIT: added - end -- VNAO EDIT: added - end -- VNAO EDIT: added + -- -- VNAO EDIT: Subtract 1pt from overall grade if it is a 1 wire. If it's already a 1pt pass, ignore. + -- if playerData.wire == 1 and points > 1 then -- VNAO EDIT: added + -- if points == 4 then -- VNAO EDIT: added + -- points = 3 -- VNAO EDIT: added + -- grade = "(OK)" -- VNAO EDIT: added + -- elseif points == 3 then -- VNAO EDIT: added + -- points = 2 -- VNAO EDIT: added + -- grade = "--" -- VNAO EDIT: added + -- end -- VNAO EDIT: added + -- end -- VNAO EDIT: added + + -- Circuit edit only take points awary from a 1 wire if there are more than 4 other deviations + if playerData.wire == 1 and points >= 3 and N > 4 then + points = points -1 + end env.info("Returning: " .. grade .. " " .. points .. " " .. G) @@ -13030,6 +12944,7 @@ function AIRBOSS:_Flightdata2Text( playerData, groovestep ) -- Speed via AoA. Depends on aircraft type. local S = nil + local A = nil --circuit moved this line to be seen outside of this scope if step~=AIRBOSS.PatternStep.GROOVE_IW then -- VNAO Edit - Added To avoid getting an AOA or GS grade in the wires... let's just check left or right in the wires if AIRBOSS.PatternStep.GROOVE_AR and playerData.waveoff == true and playerData.owo == true then -- VNAO Edit - Added -- env.info('Adam MOOSE Edit -AR and waved off so do not add AOA or GS errors to comments ') -- VNAO Edit - Added @@ -13050,7 +12965,7 @@ function AIRBOSS:_Flightdata2Text( playerData, groovestep ) end -- Glideslope/altitude. Good [-0.3, 0.4] asymmetric! - local A = nil + if GSE > self.gle.HIGH then A = underline( "H" ) elseif GSE > self.gle.High then