From b4d6f78e42587b7a4c6a8dea1b4d743693cc855a Mon Sep 17 00:00:00 2001 From: FlightControl Date: Thu, 25 Apr 2019 08:59:07 +0300 Subject: [PATCH] WIP, need to make a new class next week, AI_ESCORT_REQUEST. Need to solve the issue with the formation flying uof multiple escort classes working together. Planes may not crash into each other. --- Moose Development/Moose/AI/AI_Escort.lua | 275 +++----------------- Moose Development/Moose/AI/AI_Formation.lua | 6 +- Moose Development/Moose/Core/Spawn.lua | 36 ++- Moose Development/Moose/Modules.lua | 1 + Moose Development/Moose/Utilities/Enums.lua | 9 + 5 files changed, 78 insertions(+), 249 deletions(-) create mode 100644 Moose Development/Moose/Utilities/Enums.lua diff --git a/Moose Development/Moose/AI/AI_Escort.lua b/Moose Development/Moose/AI/AI_Escort.lua index 784799ef9..59932b443 100644 --- a/Moose Development/Moose/AI/AI_Escort.lua +++ b/Moose Development/Moose/AI/AI_Escort.lua @@ -250,7 +250,7 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) self.GT1 = 0 - self.FlightMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Flight" ) + self.FlightMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), EscortName ) EscortGroupSet:ForEachGroup( --- @param Core.Group#GROUP EscortGroup @@ -271,17 +271,6 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) end ) - EscortGroupSet:ForSomeGroup( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - EscortGroup.EscortMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), EscortGroup:GetName() ) - end - ) - - - self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 ) - - self.Detection:Start() return self end @@ -295,7 +284,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet ) EscortGroupSet:ForEachGroup( --- @param Core.Group#GROUP EscortGroup function( EscortGroup ) - EscortGroup.EscortMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), EscortGroup:GetName() ) + --EscortGroup.EscortMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), EscortGroup:GetName() ) EscortGroup:WayPointInitialize( 1 ) EscortGroup:OptionROTVertical() @@ -311,6 +300,10 @@ function AI_ESCORT:onafterStart( EscortGroupSet ) Report:Add( "Joining Up ..." ) LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.EscortUnit ) + + self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 ) + + self.Detection:__Start( 30 ) end @@ -364,7 +357,7 @@ function AI_ESCORT:Menus() self:MenuReportTargets( 60 ) self:MenuAssistedAttack() self:MenuROE() - self:MenuEvasion() +-- self:MenuEvasion() -- self:MenuResumeMission() @@ -396,21 +389,6 @@ function AI_ESCORT:MenuFormation( Formation, ... ) ) end --- self.EscortGroupSet:ForSomeGroupAlive( --- --- @param Core.Group#GROUP EscortGroup --- function( EscortGroup ) --- if EscortGroup:IsAir() then --- if not EscortGroup.EscortMenuReportNavigation then --- EscortGroup.EscortMenuReportNavigation = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Navigation", EscortGroup.EscortMenu ) --- end --- --- if not EscortGroup["EscortMenuFormation"..Formation] then --- EscortGroup["EscortMenuFormation"..Formation] = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), Formation, EscortGroup.EscortMenuReportNavigation, AI_ESCORT["_EscortFormation"..Formation], self, EscortGroup, ... ) --- end --- end --- end --- ) - end @@ -428,22 +406,6 @@ function AI_ESCORT:MenuJoinUp() self.FlightMenuJoinUp = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Join Up", self.FlightMenuReportNavigation, AI_ESCORT._FlightJoinUp, self ) end - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if EscortGroup:IsAir() then - if not EscortGroup.EscortMenuReportNavigation then - EscortGroup.EscortMenuReportNavigation = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Navigation", EscortGroup.EscortMenu ) - end - - if not EscortGroup.EscortMenuJoinUpAndFollow then - EscortGroup.EscortMenuJoinUpAndFollow = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Join-Up", EscortGroup.EscortMenuReportNavigation, ESCORT._JoinUp, self, EscortGroup ) - end - - end - end - ) - return self end @@ -652,36 +614,6 @@ function AI_ESCORT:MenuHoldAtEscortPosition( Height, Speed, MenuTextFormat ) Speed ) - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if EscortGroup:IsAir() then - - if not EscortGroup.EscortMenuHold then - EscortGroup.EscortMenuHold = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Hold position", EscortGroup.EscortMenu ) - end - - - if not EscortGroup.EscortMenuHoldPosition then - EscortGroup.EscortMenuHoldPosition = {} - end - - EscortGroup.EscortMenuHoldPosition[#EscortGroup.EscortMenuHoldPosition+1] = MENU_GROUP_COMMAND - :New( - self.EscortUnit:GetGroup(), - MenuText, - EscortGroup.EscortMenuHold, - AI_ESCORT._HoldPosition, - self, - EscortGroup, - EscortGroup, - Height, - Speed - ) - end - end - ) - return self end @@ -739,58 +671,6 @@ function AI_ESCORT:MenuHoldAtLeaderPosition( Height, Speed, MenuTextFormat ) Speed ) - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if EscortGroup:IsAir() then - - if not EscortGroup.EscortMenuHold then - EscortGroup.EscortMenuHold = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Hold position", EscortGroup.EscortMenu ) - end - - if not Height then - Height = 30 - end - - if not Speed then - Speed = 0 - end - - local MenuText = "" - if not MenuTextFormat then - if Speed == 0 then - MenuText = string.format( "Rejoin and hold at %d meter", Height ) - else - MenuText = string.format( "Rejoin and hold at %d meter at %d", Height, Speed ) - end - else - if Speed == 0 then - MenuText = string.format( MenuTextFormat, Height ) - else - MenuText = string.format( MenuTextFormat, Height, Speed ) - end - end - - if not self.EscortMenuHoldAtLeaderPosition then - self.EscortMenuHoldAtLeaderPosition = {} - end - - self.EscortMenuHoldAtLeaderPosition[#self.EscortMenuHoldAtLeaderPosition+1] = MENU_GROUP_COMMAND - :New( - self.EscortUnit:GetGroup(), - MenuText, - EscortGroup.EscortMenuHold, - AI_ESCORT._HoldPosition, - self, - self.EscortUnit:GetGroup(), - EscortGroup, - Height, - Speed - ) - end - end - ) - return self end @@ -880,30 +760,6 @@ function AI_ESCORT:MenuFlare( MenuTextFormat ) self.FlightMenuFlareYellow = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release yellow flare", self.FlightMenuFlare, AI_ESCORT._FlightFlare, self, FLARECOLOR.Yellow, "Released a yellow flare!" ) end - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if not EscortGroup.EscortMenuReportNavigation then - EscortGroup.EscortMenuReportNavigation = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Navigation", EscortGroup.EscortMenu ) - end - - local MenuText = "" - if not MenuTextFormat then - MenuText = "Flare" - else - MenuText = MenuTextFormat - end - - if not EscortGroup.EscortMenuFlare then - EscortGroup.EscortMenuFlare = MENU_GROUP:New( self.EscortUnit:GetGroup(), MenuText, EscortGroup.EscortMenuReportNavigation ) - EscortGroup.EscortMenuFlareGreen = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release green flare", EscortGroup.EscortMenuFlare, AI_ESCORT._Flare, self, EscortGroup, FLARECOLOR.Green, "Released a green flare!" ) - EscortGroup.EscortMenuFlareRed = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release red flare", EscortGroup.EscortMenuFlare, AI_ESCORT._Flare, self, EscortGroup, FLARECOLOR.Red, "Released a red flare!" ) - EscortGroup.EscortMenuFlareWhite = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release white flare", EscortGroup.EscortMenuFlare, AI_ESCORT._Flare, self, EscortGroup, FLARECOLOR.White, "Released a white flare!" ) - EscortGroup.EscortMenuFlareYellow = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release yellow flare", EscortGroup.EscortMenuFlare, AI_ESCORT._Flare, self, EscortGroup, FLARECOLOR.Yellow, "Released a yellow flare!" ) - end - end - ) - return self end @@ -937,33 +793,6 @@ function AI_ESCORT:MenuSmoke( MenuTextFormat ) self.FlightMenuSmokeBlue = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release blue smoke", self.FlightMenuSmoke, AI_ESCORT._FlightSmoke, self, SMOKECOLOR.Blue, "Releasing blue smoke!" ) end - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if not EscortGroup:IsAir() then - if not EscortGroup.EscortMenuReportNavigation then - EscortGroup.EscortMenuReportNavigation = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Navigation", EscortGroup.EscortMenu ) - end - - local MenuText = "" - if not MenuTextFormat then - MenuText = "Smoke" - else - MenuText = MenuTextFormat - end - - if not EscortGroup.EscortMenuSmoke then - EscortGroup.EscortMenuSmoke = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Smoke", EscortGroup.EscortMenuReportNavigation ) - EscortGroup.EscortMenuSmokeGreen = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release green smoke", EscortGroup.EscortMenuSmoke, AI_ESCORT._Smoke, self, EscortGroup, SMOKECOLOR.Green, "Releasing green smoke!" ) - EscortGroup.EscortMenuSmokeRed = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release red smoke", EscortGroup.EscortMenuSmoke, AI_ESCORT._Smoke, self, EscortGroup, SMOKECOLOR.Red, "Releasing red smoke!" ) - EscortGroup.EscortMenuSmokeWhite = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release white smoke", EscortGroup.EscortMenuSmoke, AI_ESCORT._Smoke, self, EscortGroup, SMOKECOLOR.White, "Releasing white smoke!" ) - EscortGroup.EscortMenuSmokeOrange = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release orange smoke", EscortGroup.EscortMenuSmoke, AI_ESCORT._Smoke, self, EscortGroup, SMOKECOLOR.Orange, "Releasing orange smoke!" ) - EscortGroup.EscortMenuSmokeBlue = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Release blue smoke", EscortGroup.EscortMenuSmoke, AI_ESCORT._Smoke, self, EscortGroup, SMOKECOLOR.Blue, "Releasing blue smoke!" ) - end - end - end - ) - return self end @@ -996,29 +825,6 @@ function AI_ESCORT:MenuReportTargets( Seconds ) self.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, 5, Seconds ) - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if EscortGroup:IsAir() then - - if not EscortGroup.EscortMenuReportNearbyTargets then - EscortGroup.EscortMenuReportNearbyTargets = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Report targets", EscortGroup.EscortMenu ) - end - - -- Report Targets - EscortGroup.EscortMenuReportNearbyTargetsNow = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Report targets now!", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._ReportNearbyTargetsNow, self, EscortGroup, true ) - EscortGroup.EscortMenuReportNearbyTargetsOn = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Report targets on", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, true ) - EscortGroup.EscortMenuReportNearbyTargetsOff = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Report targets off", EscortGroup.EscortMenuReportNearbyTargets, AI_ESCORT._SwitchReportNearbyTargets, self, EscortGroup, false ) - - -- Attack Targets - EscortGroup.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortUnit:GetGroup(), "Attack targets", EscortGroup.EscortMenu ) - - EscortGroup.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, { EscortGroup }, timer, Seconds ) - timer=timer+1 - end - end - ) - return self end @@ -1051,28 +857,23 @@ end function AI_ESCORT:MenuROE( MenuTextFormat ) self:F( MenuTextFormat ) - self.EscortGroupSet:ForSomeGroupAlive( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - if not EscortGroup.EscortMenuROE then - -- Rules of Engagement - EscortGroup.EscortMenuROE = MENU_GROUP:New( self.EscortUnit:GetGroup(), "ROE", EscortGroup.EscortMenu ) - if EscortGroup:OptionROEHoldFirePossible() then - EscortGroup.EscortMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Hold Fire", EscortGroup.EscortMenuROE, AI_ESCORT._ROE, self, EscortGroup, EscortGroup:OptionROEHoldFire(), "Holding weapons!" ) - end - if EscortGroup:OptionROEReturnFirePossible() then - EscortGroup.EscortMenuROEReturnFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Return Fire", EscortGroup.EscortMenuROE, AI_ESCORT._ROE, self, EscortGroup, EscortGroup:OptionROEReturnFire(), "Returning fire!" ) - end - if EscortGroup:OptionROEOpenFirePossible() then - EscortGroup.EscortMenuROEOpenFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Open Fire", EscortGroup.EscortMenuROE, AI_ESCORT._ROE, self, EscortGroup, EscortGroup:OptionROEOpenFire(), "Opening fire on designated targets!!" ) - end - if EscortGroup:OptionROEWeaponFreePossible() then - EscortGroup.EscortMenuROEWeaponFree = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Weapon Free", EscortGroup.EscortMenuROE, AI_ESCORT._ROE, self, EscortGroup, EscortGroup:OptionROEWeaponFree(), "Opening fire on targets of opportunity!" ) - end - end - end - ) + if not self.FlightMenuROE then + self.FlightMenuROE = MENU_GROUP:New( self.EscortUnit:GetGroup(), "ROE", self.FlightMenu ) + end + if not self.FlightMenuROEHoldFire then + self.FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Hold fire", self.FlightMenuROE, AI_ESCORT._ROE, self, ENUMS.ROE.HoldFire, "Holding weapons!" ) + end + if not self.FlightMenuROEReturnFire then + self.FlightMenuROEReturnFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Return fire", self.FlightMenuROE, AI_ESCORT._ROE, self, ENUMS.ROE.ReturnFire, "Returning fire!" ) + end + if not self.FlightMenuROEOpenFire then + self.FlightMenuROEOpenFire = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Open fire", self.FlightMenuROE, AI_ESCORT._ROE, self, ENUMS.ROE.OpenFire, "Open fire at designated targets!" ) + end + if not self.FlightMenuROEWeaponFree then + self.FlightMenuROEWeaponFree = MENU_GROUP_COMMAND:New( self.EscortUnit:GetGroup(), "Engage all targets", self.FlightMenuROE, AI_ESCORT._ROE, self, ENUMS.ROE.WeaponFree, "Engaging all targets!" ) + end + return self end @@ -1318,15 +1119,6 @@ function AI_ESCORT:_FlightSmoke( Color, Message ) end -function AI_ESCORT:_ReportNearbyTargetsNow( EscortGroup ) - - local EscortUnit = self.EscortUnit - - self:_ReportTargetsScheduler( EscortGroup ) - -end - - function AI_ESCORT:_FlightReportNearbyTargetsNow() self:_FlightReportTargetsScheduler() @@ -1522,12 +1314,27 @@ function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem ) end -function AI_ESCORT:_ROE( EscortGroup, EscortROEFunction, EscortROEMessage ) +function AI_ESCORT:_ROE( EscortAction, EscortROEMessage ) + + self:F({EscortAction=EscortAction,EscortROEMessage=EscortROEMessage}) local EscortUnit = self.EscortUnit - pcall( function() EscortROEFunction() end ) - EscortGroup:MessageTypeToGroup( EscortROEMessage, MESSAGE.Type.Information, EscortUnit:GetGroup() ) + self.EscortGroupSet:ForSomeGroupAlive( + --- @param Wrapper.Group#GROUP EscortGroup + function( EscortGroup ) + if EscortAction == ENUMS.ROE.HoldFire then + EscortGroup:OptionROEHoldFire() + elseif EscortAction == ENUMS.ROE.ReturnFire then + EscortGroup:OptionROEReturnFire() + elseif EscortAction == ENUMS.ROE.OpenFire then + EscortGroup:OptionROEOpenFire() + elseif EscortAction == ENUMS.ROE.WeaponFree then + EscortGroup:OptionROEWeaponFree() + end + EscortGroup:MessageTypeToGroup( EscortROEMessage, MESSAGE.Type.Information, EscortUnit:GetGroup() ) + end + ) end diff --git a/Moose Development/Moose/AI/AI_Formation.lua b/Moose Development/Moose/AI/AI_Formation.lua index e0981a599..5eae434e2 100644 --- a/Moose Development/Moose/AI/AI_Formation.lua +++ b/Moose Development/Moose/AI/AI_Formation.lua @@ -1087,11 +1087,11 @@ function AI_FORMATION:onenterFollowing( FollowGroupSet ) --R2.1 local Speed = - ( Distance + FollowFormation.x ) / Time - if Distance > -4000 then - Speed = - ( Distance + FollowFormation.x ) / 90 + if Distance > -10000 then + Speed = - ( Distance + FollowFormation.x ) / 60 end - if Distance > -1500 then + if Distance > -2500 then Speed = - ( Distance + FollowFormation.x ) / 20 end diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 615bfcffe..a7bb1a76f 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1173,7 +1173,7 @@ end -- @param #SPAWN self -- @param #string SpawnIndex The index of the group to be spawned. -- @return Wrapper.Group#GROUP The group that was spawned. You can use this group for further actions. -function SPAWN:SpawnWithIndex( SpawnIndex ) +function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth ) self:F2( { SpawnTemplatePrefix = self.SpawnTemplatePrefix, SpawnIndex = SpawnIndex, AliveUnits = self.AliveUnits, SpawnMaxGroups = self.SpawnMaxGroups } ) if self:_GetSpawnIndex( SpawnIndex ) then @@ -1275,14 +1275,16 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) SpawnTemplate.CoalitionID = self.SpawnInitCoalition or SpawnTemplate.CoalitionID - if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then - if SpawnTemplate.route.points[1].type == "TakeOffParking" then - SpawnTemplate.uncontrolled = self.SpawnUnControlled - end - end +-- if SpawnTemplate.CategoryID == Group.Category.HELICOPTER or SpawnTemplate.CategoryID == Group.Category.AIRPLANE then +-- if SpawnTemplate.route.points[1].type == "TakeOffParking" then +-- SpawnTemplate.uncontrolled = self.SpawnUnControlled +-- end +-- end end - self:HandleEvent( EVENTS.Birth, self._OnBirth ) + if not NoBirth then + self:HandleEvent( EVENTS.Birth, self._OnBirth ) + end self:HandleEvent( EVENTS.Dead, self._OnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._OnDeadOrCrash ) self:HandleEvent( EVENTS.RemoveUnit, self._OnDeadOrCrash ) @@ -1471,17 +1473,23 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT EmergencyAirSpawn=true end + self:F( { SpawnIndex = self.SpawnIndex } ) + if self:_GetSpawnIndex( self.SpawnIndex + 1 ) then -- Get group template. local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate + self:F( { SpawnTemplate = SpawnTemplate } ) + if SpawnTemplate then -- Check if the aircraft with the specified SpawnIndex is already spawned. -- If yes, ensure that the aircraft is spawned at the same aircraft spot. local GroupAlive = self:GetGroupFromIndex( self.SpawnIndex ) + + self:F( { GroupAlive = GroupAlive } ) -- Debug output self:T( { "Current point of ", self.SpawnTemplatePrefix, SpawnAirbase } ) @@ -1802,6 +1810,8 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT SpawnTemplate.x = PointVec3.x SpawnTemplate.y = PointVec3.z + SpawnTemplate.uncontrolled = nil + -- Spawn group. local GroupSpawned = self:SpawnWithIndex( self.SpawnIndex ) @@ -1868,13 +1878,14 @@ function SPAWN:ParkAtAirbase( SpawnAirbase, TerminalType, Parkingdata ) -- R2.2, -- Get position of airbase. local PointVec3 = SpawnAirbase:GetCoordinate() - self:T2(PointVec3) -- Set take off type. Default is hot. local Takeoff = SPAWN.Takeoff.Cold for SpawnIndex = 1, self.SpawnMaxGroups do + self:F( { SpawnIndex = SpawnIndex, SpawnMaxGroups = self.SpawnMaxGroups } ) + -- Get group template. local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate @@ -1945,7 +1956,7 @@ function SPAWN:ParkAtAirbase( SpawnAirbase, TerminalType, Parkingdata ) -- R2.2, elseif AirbaseCategory == Airbase.Category.AIRDROME then spawnonairport=true end - spawnonrunway=Takeoff==SPAWN.Takeoff.Cold + spawnonrunway=Takeoff==SPAWN.Takeoff.Runway end -- Array with parking spots coordinates. @@ -2096,7 +2107,7 @@ function SPAWN:ParkAtAirbase( SpawnAirbase, TerminalType, Parkingdata ) -- R2.2, SpawnTemplate.parked = true for UnitID = 1, nunits do - self:T2('Before Translation SpawnTemplate.units['..UnitID..'].x = '..SpawnTemplate.units[UnitID].x..', SpawnTemplate.units['..UnitID..'].y = '..SpawnTemplate.units[UnitID].y) + self:F('Before Translation SpawnTemplate.units['..UnitID..'].x = '..SpawnTemplate.units[UnitID].x..', SpawnTemplate.units['..UnitID..'].y = '..SpawnTemplate.units[UnitID].y) -- Template of the current unit. local UnitTemplate = SpawnTemplate.units[UnitID] @@ -2166,8 +2177,10 @@ function SPAWN:ParkAtAirbase( SpawnAirbase, TerminalType, Parkingdata ) -- R2.2, SpawnTemplate.x = PointVec3.x SpawnTemplate.y = PointVec3.z + SpawnTemplate.uncontrolled = true + -- Spawn group. - local GroupSpawned = self:SpawnWithIndex( SpawnIndex ) + local GroupSpawned = self:SpawnWithIndex( SpawnIndex, true ) -- When spawned in the air, we need to generate a Takeoff Event. if Takeoff == GROUP.Takeoff.Air then @@ -2181,7 +2194,6 @@ function SPAWN:ParkAtAirbase( SpawnAirbase, TerminalType, Parkingdata ) -- R2.2, SCHEDULER:New(nil, AIRBASE.CheckOnRunWay, {SpawnAirbase, GroupSpawned, 75, true} , 1.0) end - return GroupSpawned end end diff --git a/Moose Development/Moose/Modules.lua b/Moose Development/Moose/Modules.lua index 68e0125d9..42ce0a74e 100644 --- a/Moose Development/Moose/Modules.lua +++ b/Moose Development/Moose/Modules.lua @@ -1,3 +1,4 @@ +__Moose.Include( 'Scripts/Moose/Utilities/Enums.lua' ) __Moose.Include( 'Scripts/Moose/Utilities/Routines.lua' ) __Moose.Include( 'Scripts/Moose/Utilities/Utils.lua' ) diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua new file mode 100644 index 000000000..b5f1e0fde --- /dev/null +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -0,0 +1,9 @@ +ENUMS = {} + +ENUMS.ROE = { + HoldFire = 1, + ReturnFire = 2, + OpenFire = 3, + WeaponFree = 4 + } +