From 0971f8ffa72c0e1efb0a8250bc78eaf64fac8405 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 22 Sep 2022 10:57:43 +0200 Subject: [PATCH 1/3] #SPAWN * Fix for InitCleanup() --- Moose Development/Moose/Core/Spawn.lua | 42 ++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index b22a27939..e37570f35 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1418,7 +1418,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth ) end -- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats. -- if self.Repeat then - -- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" ) + -- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" ) -- end end @@ -2971,9 +2971,9 @@ end function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2 self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } ) - -- if not self.SpawnTemplate then - -- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) - -- end + -- if not self.SpawnTemplate then + -- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) + -- end local SpawnTemplate if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then @@ -3254,20 +3254,20 @@ function SPAWN:_OnDeadOrCrash( EventData ) local unit=UNIT:FindByName(EventData.IniUnitName) - if unit then - - local EventPrefix = self:_GetPrefixFromGroupName(unit.GroupName) - + if unit then + + local EventPrefix = self:_GetPrefixFromGroupName(unit.GroupName) + if EventPrefix then -- EventPrefix can be nil if no # is found, which means, no spawnable group! self:T( { "Dead event: " .. EventPrefix } ) if EventPrefix == self.SpawnTemplatePrefix or ( self.SpawnAliasPrefix and EventPrefix == self.SpawnAliasPrefix ) then - self.AliveUnits = self.AliveUnits - 1 - - self:T( "Alive Units: " .. self.AliveUnits ) - end - + self.AliveUnits = self.AliveUnits - 1 + + self:T( "Alive Units: " .. self.AliveUnits ) + end + end end end @@ -3365,12 +3365,16 @@ end -- @return #boolean True = Continue Scheduler function SPAWN:_SpawnCleanUpScheduler() self:F( { "CleanUp Scheduler:", self.SpawnTemplatePrefix } ) - + local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup() self:T( { "CleanUp Scheduler:", SpawnGroup, SpawnCursor } ) + local IsHelo = false + while SpawnGroup do - + + IsHelo = SpawnGroup:IsHelicopter() + local SpawnUnits = SpawnGroup:GetUnits() for UnitID, UnitData in pairs( SpawnUnits ) do @@ -3383,8 +3387,8 @@ function SPAWN:_SpawnCleanUpScheduler() self:T( { SpawnUnitName, Stamp } ) if Stamp.Vec2 then - if SpawnUnit:InAir() == false and SpawnUnit:GetVelocityKMH() < 1 then - local NewVec2 = SpawnUnit:GetVec2() + if (SpawnUnit:InAir() == false and SpawnUnit:GetVelocityKMH() < 1) or IsHelo then + local NewVec2 = SpawnUnit:GetVec2() or {x=0, y=0} if (Stamp.Vec2.x == NewVec2.x and Stamp.Vec2.y == NewVec2.y) or (SpawnUnit:GetLife() <= 1) then -- If the plane is not moving or dead , and is on the ground, assign it with a timestamp... if Stamp.Time + self.SpawnCleanUpInterval < timer.getTime() then @@ -3402,8 +3406,8 @@ function SPAWN:_SpawnCleanUpScheduler() Stamp.Time = nil end else - if SpawnUnit:InAir() == false then - Stamp.Vec2 = SpawnUnit:GetVec2() + if SpawnUnit:InAir() == false or (IsHelo and SpawnUnit:GetLife() <= 1) then + Stamp.Vec2 = SpawnUnit:GetVec2() or {x=0, y=0} if (SpawnUnit:GetVelocityKMH() < 1) then Stamp.Time = timer.getTime() end From 8820b8a41ce8ec0baf028af8e6a22acf56bc61ad Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Sep 2022 15:46:55 +0200 Subject: [PATCH 2/3] Nimitz deck height (#1787) Corrected deck height of Nimitz class to 18.3m/60ft --- Moose Development/Moose/Ops/Airboss.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 1dfe90d83..b3e13cce4 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -4233,7 +4233,7 @@ function AIRBOSS:_InitStennis() -- Carrier Parameters. self.carrierparam.sterndist = -153 - self.carrierparam.deckheight = 19.06 + self.carrierparam.deckheight = 18.30 -- Total size of the carrier (approx as rectangle). self.carrierparam.totlength = 310 -- Wiki says 332.8 meters overall length. From 481ee186aac6584b2bd5a1778070280081d48777 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 22 Sep 2022 15:49:31 +0200 Subject: [PATCH 3/3] #AIRBOSS, #UTILS * Alitude to Altitude --- Moose Development/Moose/Ops/Airboss.lua | 24 ++++++++++----------- Moose Development/Moose/Utilities/Utils.lua | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index b3e13cce4..1bd4c98da 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -2764,9 +2764,9 @@ function AIRBOSS:SetRefuelAI( LowFuelThreshold ) return self end ---- Set max alitude to register flights in the initial zone. Aircraft above this altitude will not be registerered. +--- Set max altitude to register flights in the initial zone. Aircraft above this altitude will not be registerered. -- @param #AIRBOSS self --- @param #number MaxAltitude Max alitude in feet. Default 1300 ft. +-- @param #number MaxAltitude Max altitude in feet. Default 1300 ft. -- @return #AIRBOSS self function AIRBOSS:SetInitialMaxAlt( MaxAltitude ) self.initialmaxalt = UTILS.FeetToMeters( MaxAltitude or 1300 ) @@ -5916,7 +5916,7 @@ function AIRBOSS:_WaitAI( flight, respawn ) -- Heading from carrier to flight group local hdgto = cv:HeadingTo( fc ) - -- Holding alitude between angels 6 and 10 (random). + -- Holding altitude between angels 6 and 10 (random). local angels = math.random( 6, 10 ) local altitude = UTILS.FeetToMeters( angels * 1000 ) @@ -8910,7 +8910,7 @@ function AIRBOSS:_Initial( playerData ) -- Relative heading to carrier direction. local relheading = self:_GetRelativeHeading( playerData.unit, false ) - -- Alitude of player in feet. + -- altitude of player in feet. local altitude = playerData.unit:GetAltitude() -- Check if player is in zone and flying roughly in the right direction. @@ -11108,7 +11108,7 @@ function AIRBOSS:_Lineup( unit, runway ) return lineup end ---- Get alitude of aircraft wrt carrier deck. Should give zero when the aircraft touched down. +--- Get altitude of aircraft wrt carrier deck. Should give zero when the aircraft touched down. -- @param #AIRBOSS self -- @param Wrapper.Unit#UNIT unit Aircraft unit. -- @return #number Altitude in meters wrt carrier height. @@ -14102,7 +14102,7 @@ end --- Convert altitude from meters to angels (thousands of feet). -- @param #AIRBOSS self --- @param alt Alitude in meters. +-- @param alt altitude in meters. -- @return #number Altitude in Anglels = thousands of feet using math.floor(). function AIRBOSS:_GetAngels( alt ) @@ -15333,7 +15333,7 @@ function AIRBOSS:_MarshalCallNewFinalBearing( FB ) end ---- Compile a radio call when Marshal tells a flight the holding alitude. +--- Compile a radio call when Marshal tells a flight the holding altitude. -- @param #AIRBOSS self -- @param #number hdg Heading in degrees. function AIRBOSS:_MarshalCallCarrierTurnTo( hdg ) @@ -15356,7 +15356,7 @@ function AIRBOSS:_MarshalCallCarrierTurnTo( hdg ) end ---- Compile a radio call when Marshal tells a flight the holding alitude. +--- Compile a radio call when Marshal tells a flight the holding altitude. -- @param #AIRBOSS self -- @param #string modex Tail number. -- @param #number nwaiting Number of flights already waiting. @@ -15382,7 +15382,7 @@ function AIRBOSS:_MarshalCallStackFull( modex, nwaiting ) self:RadioTransmission( self.MarshalRadio, call, nil, nil, nil, true ) end ---- Compile a radio call when Marshal tells a flight the holding alitude. +--- Compile a radio call when Marshal tells a flight the holding altitude. -- @param #AIRBOSS self function AIRBOSS:_MarshalCallRecoveryStart( case ) @@ -15422,12 +15422,12 @@ function AIRBOSS:_MarshalCallRecoveryStart( case ) end ---- Compile a radio call when Marshal tells a flight the holding alitude. +--- Compile a radio call when Marshal tells a flight the holding altitude. -- @param #AIRBOSS self -- @param #string modex Tail number. -- @param #number case Recovery case. -- @param #number brc Base recovery course. --- @param #number altitude Holding alitude. +-- @param #number altitude Holding altitude. -- @param #string charlie Charlie Time estimate. -- @param #number qfe Alitmeter inHg. function AIRBOSS:_MarshalCallArrived( modex, case, brc, altitude, charlie, qfe ) @@ -17270,7 +17270,7 @@ function AIRBOSS:_MarkMarshalZone( _unitName, flare ) -- Get Case I commence zone at three position. local zoneThree = self:_GetZoneCommence( case, stack ) - -- Pattern alitude. + -- Pattern altitude. local patternalt = self:_GetMarshalAltitude( stack, case ) -- Flare and smoke at the ground. diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index a3519be48..da6e66988 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -489,7 +489,7 @@ UTILS.hPa2inHg = function( hPa ) return hPa * 0.0295299830714 end ---- Convert knots to alitude corrected KIAS, e.g. for tankers. +--- Convert knots to altitude corrected KIAS, e.g. for tankers. -- @param #number knots Speed in knots. -- @param #number altitude Altitude in feet -- @return #number Corrected KIAS