mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1241 from FlightControl-Master/FF/Develop
SPAWN AI_Balancer
This commit is contained in:
commit
cf34ec0905
@ -196,8 +196,12 @@ function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, A
|
||||
SetGroup:Flush( self )
|
||||
end
|
||||
|
||||
--- @param #AI_BALANCER self
|
||||
--- RTB
|
||||
-- @param #AI_BALANCER self
|
||||
-- @param Core.Set#SET_GROUP SetGroup
|
||||
-- @param #string From
|
||||
-- @param #string Event
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
@ -213,10 +217,13 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
||||
local PointVec2 = POINT_VEC2:New( AIGroup:GetVec2().x, AIGroup:GetVec2().y )
|
||||
local ClosestAirbase = self.ReturnAirbaseSet:FindNearestAirbaseFromPointVec2( PointVec2 )
|
||||
self:T( ClosestAirbase.AirbaseName )
|
||||
--[[
|
||||
AIGroup:MessageToRed( "Returning to " .. ClosestAirbase:GetName().. " ...", 30 )
|
||||
local RTBRoute = AIGroup:RouteReturnToAirbase( ClosestAirbase )
|
||||
AIGroupTemplate.route = RTBRoute
|
||||
AIGroup:Respawn( AIGroupTemplate )
|
||||
]]
|
||||
AIGroup:RouteRTB(ClosestAirbase)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -326,6 +326,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
||||
self.SpawnInitModu = nil -- No special modulation.
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
@ -378,6 +379,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
|
||||
self.SpawnInitModu = nil -- No special modulation.
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
@ -433,6 +435,7 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
|
||||
self.SpawnInitModu = nil -- No special modulation.
|
||||
self.SpawnInitRadio = nil -- No radio comms setting.
|
||||
self.SpawnInitModex = nil
|
||||
self.SpawnInitAirbase = nil
|
||||
|
||||
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
|
||||
else
|
||||
@ -503,6 +506,21 @@ function SPAWN:InitLateActivated( LateActivated )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set spawns to happen at a particular airbase. Only for aircraft, of course.
|
||||
-- @param #SPAWN self
|
||||
-- @param #string AirbaseName Name of the airbase.
|
||||
-- @param #number Takeoff (Optional) Takeoff type. Can be SPAWN.Takeoff.Hot (default), SPAWN.Takeoff.Cold or SPAWN.Takeoff.Runway.
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitAirbase( AirbaseName, Takeoff )
|
||||
self:F( )
|
||||
|
||||
self.SpawnInitAirbase=AIRBASE:FindByName(AirbaseName)
|
||||
|
||||
self.SpawnInitTakeoff=Takeoff or SPAWN.Takeoff.Hot
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Defines the Heading for the new spawned units.
|
||||
-- The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees.
|
||||
@ -1115,7 +1133,12 @@ end -- Delay methods
|
||||
function SPAWN:Spawn()
|
||||
self:F( { self.SpawnTemplatePrefix, self.SpawnIndex, self.AliveUnits } )
|
||||
|
||||
return self:SpawnWithIndex( self.SpawnIndex + 1 )
|
||||
if self.SpawnInitAirbase then
|
||||
return self:SpawnAtAirbase(self.SpawnInitAirbase, self.SpawnInitTakeoff)
|
||||
else
|
||||
return self:SpawnWithIndex( self.SpawnIndex + 1 )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- Will re-spawn a group based on a given index.
|
||||
@ -3239,6 +3262,7 @@ end
|
||||
|
||||
--- This function is called automatically by the Spawning scheduler.
|
||||
-- It is the internal worker method SPAWNing new Groups on the defined time intervals.
|
||||
-- @param #SPAWN self
|
||||
function SPAWN:_Scheduler()
|
||||
self:F2( { "_Scheduler", self.SpawnTemplatePrefix, self.SpawnAliasPrefix, self.SpawnIndex, self.SpawnMaxGroups, self.SpawnMaxUnitsAlive } )
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user