mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
commit
55eb06b2d9
@ -43,7 +43,7 @@
|
|||||||
-- * @{#SPAWN.RandomizeTemplate}: Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.
|
-- * @{#SPAWN.RandomizeTemplate}: Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.
|
||||||
-- * @{#SPAWN.Uncontrolled}: Spawn plane groups uncontrolled.
|
-- * @{#SPAWN.Uncontrolled}: Spawn plane groups uncontrolled.
|
||||||
-- * @{#SPAWN.Array}: Make groups visible before they are actually activated, and order these groups like a batallion in an array.
|
-- * @{#SPAWN.Array}: Make groups visible before they are actually activated, and order these groups like a batallion in an array.
|
||||||
-- * @{#SPAWN.Repeat}: Re-spawn groups when they land at the home base. Similar functions are @{#SPAWN.RepeatOnLanding} and @{#SPAWN.RepeatOnEngineShutDown}.
|
-- * @{#SPAWN.InitRepeat}: Re-spawn groups when they land at the home base. Similar functions are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}.
|
||||||
--
|
--
|
||||||
-- SPAWN spawning methods:
|
-- SPAWN spawning methods:
|
||||||
-- =======================
|
-- =======================
|
||||||
@ -115,7 +115,7 @@ function SPAWN:New( SpawnTemplatePrefix )
|
|||||||
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
||||||
self.SpawnIsScheduled = false -- Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.
|
self.SpawnIsScheduled = false -- Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.
|
||||||
self.SpawnTemplate = self._GetTemplate( self, SpawnTemplatePrefix ) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
self.SpawnTemplate = self._GetTemplate( self, SpawnTemplatePrefix ) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||||
self.SpawnRepeat = false -- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
|
self.Repeat = false -- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
|
||||||
self.UnControlled = false -- When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.
|
self.UnControlled = false -- When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.
|
||||||
self.SpawnMaxUnitsAlive = 0 -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.
|
self.SpawnMaxUnitsAlive = 0 -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.
|
||||||
self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned.
|
self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned.
|
||||||
@ -152,7 +152,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
|
|||||||
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
|
||||||
self.SpawnIsScheduled = false -- Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.
|
self.SpawnIsScheduled = false -- Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.
|
||||||
self.SpawnTemplate = self._GetTemplate( self, SpawnTemplatePrefix ) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
self.SpawnTemplate = self._GetTemplate( self, SpawnTemplatePrefix ) -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
|
||||||
self.SpawnRepeat = false -- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
|
self.Repeat = false -- Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
|
||||||
self.UnControlled = false -- When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.
|
self.UnControlled = false -- When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.
|
||||||
self.SpawnMaxUnitsAlive = 0 -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.
|
self.SpawnMaxUnitsAlive = 0 -- The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.
|
||||||
self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned.
|
self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned.
|
||||||
@ -274,36 +274,37 @@ end
|
|||||||
-- -- RU Su-34 - AI Ship Attack
|
-- -- RU Su-34 - AI Ship Attack
|
||||||
-- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
|
-- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
|
||||||
-- SpawnRU_SU34 = SPAWN:New( 'TF1 RU Su-34 Krymsk@AI - Attack Ships' ):Schedule( 2, 3, 1800, 0.4 ):SpawnUncontrolled():RandomizeRoute( 1, 1, 3000 ):RepeatOnEngineShutDown()
|
-- SpawnRU_SU34 = SPAWN:New( 'TF1 RU Su-34 Krymsk@AI - Attack Ships' ):Schedule( 2, 3, 1800, 0.4 ):SpawnUncontrolled():RandomizeRoute( 1, 1, 3000 ):RepeatOnEngineShutDown()
|
||||||
function SPAWN:Repeat()
|
function SPAWN:InitRepeat()
|
||||||
self:F( { self.SpawnTemplatePrefix, self.SpawnIndex } )
|
self:F( { self.SpawnTemplatePrefix, self.SpawnIndex } )
|
||||||
|
|
||||||
self.SpawnRepeat = true
|
self.Repeat = true
|
||||||
self.RepeatOnEngineShutDown = false
|
self.RepeatOnEngineShutDown = false
|
||||||
self.RepeatOnLanding = true
|
self.RepeatOnLanding = true
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Same as the @{Repeat) method.
|
--- Respawn group after landing.
|
||||||
-- @return SPAWN
|
-- @param #SPAWN self
|
||||||
-- @see Repeat
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitRepeatOnLanding()
|
||||||
function SPAWN:RepeatOnLanding()
|
|
||||||
self:F( { self.SpawnTemplatePrefix } )
|
self:F( { self.SpawnTemplatePrefix } )
|
||||||
|
|
||||||
self:Repeat()
|
self:InitRepeat()
|
||||||
self.RepeatOnEngineShutDown = false
|
self.RepeatOnEngineShutDown = false
|
||||||
self.RepeatOnLanding = true
|
self.RepeatOnLanding = true
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Same as the @{#SPAWN.Repeat) method, but now the Group will respawn after its engines have shut down.
|
|
||||||
-- @return SPAWN
|
--- Respawn after landing when its engines have shut down.
|
||||||
function SPAWN:RepeatOnEngineShutDown()
|
-- @param #SPAWN self
|
||||||
|
-- @return #SPAWN self
|
||||||
|
function SPAWN:InitRepeatOnEngineShutDown()
|
||||||
self:F( { self.SpawnTemplatePrefix } )
|
self:F( { self.SpawnTemplatePrefix } )
|
||||||
|
|
||||||
self:Repeat()
|
self:InitRepeat()
|
||||||
self.RepeatOnEngineShutDown = true
|
self.RepeatOnEngineShutDown = true
|
||||||
self.RepeatOnLanding = false
|
self.RepeatOnLanding = false
|
||||||
|
|
||||||
@ -378,10 +379,8 @@ function SPAWN:Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY )
|
|||||||
_EVENTDISPATCHER:OnCrashForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnDeadOrCrash, self )
|
_EVENTDISPATCHER:OnCrashForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnDeadOrCrash, self )
|
||||||
_EVENTDISPATCHER:OnDeadForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnDeadOrCrash, self )
|
_EVENTDISPATCHER:OnDeadForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnDeadOrCrash, self )
|
||||||
|
|
||||||
if self.SpawnRepeat then
|
if self.Repeat then
|
||||||
_EVENTDISPATCHER:OnTakeOffForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnTakeOff, self )
|
_EVENTDISPATCHER:OnTakeOffForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnTakeOff, self )
|
||||||
end
|
|
||||||
if self.RepeatOnLanding then
|
|
||||||
_EVENTDISPATCHER:OnLandForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnLand, self )
|
_EVENTDISPATCHER:OnLandForTemplate( self.SpawnGroups[SpawnGroupID].SpawnTemplate, self._OnLand, self )
|
||||||
end
|
end
|
||||||
if self.RepeatOnEngineShutDown then
|
if self.RepeatOnEngineShutDown then
|
||||||
@ -450,10 +449,8 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
|
|||||||
_EVENTDISPATCHER:OnCrashForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnDeadOrCrash, self )
|
_EVENTDISPATCHER:OnCrashForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnDeadOrCrash, self )
|
||||||
_EVENTDISPATCHER:OnDeadForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnDeadOrCrash, self )
|
_EVENTDISPATCHER:OnDeadForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnDeadOrCrash, self )
|
||||||
|
|
||||||
if self.SpawnRepeat then
|
if self.Repeat then
|
||||||
_EVENTDISPATCHER:OnTakeOffForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnTakeOff, self )
|
_EVENTDISPATCHER:OnTakeOffForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnTakeOff, self )
|
||||||
end
|
|
||||||
if self.RepeatOnLanding then
|
|
||||||
_EVENTDISPATCHER:OnLandForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnLand, self )
|
_EVENTDISPATCHER:OnLandForTemplate( self.SpawnGroups[self.SpawnIndex].SpawnTemplate, self._OnLand, self )
|
||||||
end
|
end
|
||||||
if self.RepeatOnEngineShutDown then
|
if self.RepeatOnEngineShutDown then
|
||||||
@ -467,7 +464,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex )
|
|||||||
self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) )
|
self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) )
|
||||||
end
|
end
|
||||||
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
||||||
--if self.SpawnRepeat then
|
--if self.Repeat then
|
||||||
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
|
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -46,15 +46,15 @@ Spawn_Helicopter_Scheduled = SPAWN:New( "Spawn Helicopter Scheduled" ):SpawnSche
|
|||||||
Spawn_Ship_Scheduled = SPAWN:New( "Spawn Ship Scheduled" ):SpawnScheduled( 30, 0.5 )
|
Spawn_Ship_Scheduled = SPAWN:New( "Spawn Ship Scheduled" ):SpawnScheduled( 30, 0.5 )
|
||||||
Spawn_Vehicle_Scheduled = SPAWN:New( "Spawn Vehicle Scheduled" ):SpawnScheduled( 30, 0.5 )
|
Spawn_Vehicle_Scheduled = SPAWN:New( "Spawn Vehicle Scheduled" ):SpawnScheduled( 30, 0.5 )
|
||||||
|
|
||||||
-- Tests Tbilisi: Limited Spawning
|
-- Tests Tbilisi: Limited Spawning and repeat
|
||||||
-- -------------------------------
|
-- ------------------------------------------
|
||||||
-- Spawing one group, and respawning the same group when it lands ...
|
-- Spawing one group, and respawning the same group when it lands ...
|
||||||
Spawn_Plane_Limited_Repeat = SPAWN:New( "Spawn Plane Limited Repeat" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Plane_Limited_Repeat = SPAWN:New( "Spawn Plane Limited Repeat" ):Limit( 1, 1 ):InitRepeat():Spawn()
|
||||||
Spawn_Plane_Limited_RepeatOnLanding = SPAWN:New( "Spawn Plane Limited RepeatOnLanding" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Plane_Limited_RepeatOnLanding = SPAWN:New( "Spawn Plane Limited RepeatOnLanding" ):Limit( 1, 1 ):InitRepeatOnLanding():Spawn()
|
||||||
Spawn_Plane_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Plane Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Plane_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Plane Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):InitRepeatOnEngineShutDown():Spawn()
|
||||||
Spawn_Helicopter_Limited_Repeat = SPAWN:New( "Spawn Helicopter Limited Repeat" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Helicopter_Limited_Repeat = SPAWN:New( "Spawn Helicopter Limited Repeat" ):Limit( 1, 1 ):InitRepeat():Spawn()
|
||||||
Spawn_Helicopter_Limited_RepeatOnLanding = SPAWN:New( "Spawn Helicopter Limited RepeatOnLanding" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Helicopter_Limited_RepeatOnLanding = SPAWN:New( "Spawn Helicopter Limited RepeatOnLanding" ):Limit( 1, 1 ):InitRepeatOnLanding():Spawn()
|
||||||
Spawn_Helicopter_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Helicopter Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):Repeat():Spawn()
|
Spawn_Helicopter_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Helicopter Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):InitRepeatOnEngineShutDown():Spawn()
|
||||||
|
|
||||||
|
|
||||||
-- Tests Soganlug
|
-- Tests Soganlug
|
||||||
@ -67,8 +67,8 @@ Spawn_Ground_Limited_Scheduled = SPAWN:New( "Spawn Vehicle Limited Scheduled" ):
|
|||||||
-- Tests Sukhumi
|
-- Tests Sukhumi
|
||||||
-- -------------
|
-- -------------
|
||||||
-- Limited spawning of groups, scheduled every seconds with route randomization.
|
-- Limited spawning of groups, scheduled every seconds with route randomization.
|
||||||
Spawn_Plane_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Plane Limited Scheduled RandomizeRoute" ):Limit( 2, 10 ):RandomizeRoute( 1, 1, 4000 ):SpawnScheduled( 30, 0 )
|
Spawn_Plane_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Plane Limited Scheduled RandomizeRoute" ):Limit( 5, 10 ):RandomizeRoute( 1, 1, 4000 ):SpawnScheduled( 2, 0 )
|
||||||
Spawn_Helicopter_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Helicopter Limited Scheduled RandomizeRoute" ):Limit( 2, 10 ):RandomizeRoute( 1, 1, 4000 ):SpawnScheduled( 30, 0 )
|
Spawn_Helicopter_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Helicopter Limited Scheduled RandomizeRoute" ):Limit( 5, 10 ):RandomizeRoute( 1, 1, 4000 ):SpawnScheduled( 2, 0 )
|
||||||
Spawn_Vehicle_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Vehicle Limited Scheduled RandomizeRoute" ):Limit( 10, 10 ):RandomizeRoute( 1, 1, 1000 ):SpawnScheduled( 1, 0 )
|
Spawn_Vehicle_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Vehicle Limited Scheduled RandomizeRoute" ):Limit( 10, 10 ):RandomizeRoute( 1, 1, 1000 ):SpawnScheduled( 1, 0 )
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ Spawn_Vehicle_Scheduled_CleanUp = SPAWN:New( "Spawn Vehicle Scheduled CleanUp" )
|
|||||||
-- Creates arrays of groups ready to be spawned and dynamic spawning of groups from another group.
|
-- Creates arrays of groups ready to be spawned and dynamic spawning of groups from another group.
|
||||||
|
|
||||||
-- SpawnTestVisible creates an array of 200 groups, every 20 groups with 20 meters space in between, and will activate a group of the array every 10 seconds with a 0.2 time randomization.
|
-- SpawnTestVisible creates an array of 200 groups, every 20 groups with 20 meters space in between, and will activate a group of the array every 10 seconds with a 0.2 time randomization.
|
||||||
SpawnTestVisible = SPAWN:New( "Spawn Vehicle Visible Scheduled" ):Limit( 200, 200 ):Array( 59, 20, 20, 10 ):SpawnScheduled( 10, 0.2 )
|
SpawnTestVisible = SPAWN:New( "Spawn Vehicle Visible Scheduled" ):Limit( 200, 200 ):Array( 59, 20, 30, 30 ):SpawnScheduled( 10, 0.2 )
|
||||||
|
|
||||||
-- Spawn_Templates_Visible contains different templates...
|
-- Spawn_Templates_Visible contains different templates...
|
||||||
Spawn_Templates_Visible = { "Spawn Vehicle Visible Template A",
|
Spawn_Templates_Visible = { "Spawn Vehicle Visible Template A",
|
||||||
|
|||||||
Binary file not shown.
@ -12,10 +12,6 @@
|
|||||||
|
|
||||||
Include.File("Spawn")
|
Include.File("Spawn")
|
||||||
|
|
||||||
BASE:TraceClass("GROUP")
|
|
||||||
BASE:TraceClass("SPAWN")
|
|
||||||
BASE:TraceClass("DATABASE")
|
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
-- Declare SPAWN objects
|
-- Declare SPAWN objects
|
||||||
@ -27,21 +23,21 @@ do
|
|||||||
-- Choose repeat functionality
|
-- Choose repeat functionality
|
||||||
|
|
||||||
-- Repeat on landing
|
-- Repeat on landing
|
||||||
Spawn_KA_50:RepeatOnLanding()
|
Spawn_KA_50:InitRepeatOnLanding()
|
||||||
Spawn_C_101EB:RepeatOnLanding()
|
Spawn_C_101EB:InitRepeatOnLanding()
|
||||||
|
|
||||||
-- Repeat on enging shutdown (when landed on the airport)
|
-- Repeat on enging shutdown (when landed on the airport)
|
||||||
Spawn_MI_8MTV2:RepeatOnEngineShutDown()
|
Spawn_MI_8MTV2:InitRepeatOnEngineShutDown()
|
||||||
Spawn_A_10C:RepeatOnEngineShutDown()
|
Spawn_A_10C:InitRepeatOnEngineShutDown()
|
||||||
|
|
||||||
-- Now SPAWN the GROUPs
|
-- Now SPAWN the GROUPs
|
||||||
Spawn_KA_50:Spawn()
|
Spawn_KA_50:Spawn()
|
||||||
Spawn_KA_50:Spawn()
|
|
||||||
Spawn_C_101EB:Spawn()
|
Spawn_C_101EB:Spawn()
|
||||||
Spawn_C_101EB:Spawn()
|
|
||||||
Spawn_MI_8MTV2:Spawn()
|
|
||||||
Spawn_MI_8MTV2:Spawn()
|
Spawn_MI_8MTV2:Spawn()
|
||||||
Spawn_A_10C:Spawn()
|
Spawn_A_10C:Spawn()
|
||||||
|
Spawn_KA_50:Spawn()
|
||||||
|
Spawn_C_101EB:Spawn()
|
||||||
|
Spawn_MI_8MTV2:Spawn()
|
||||||
Spawn_A_10C:Spawn()
|
Spawn_A_10C:Spawn()
|
||||||
|
|
||||||
-- Now run the mission and observe the behaviour.
|
-- Now run the mission and observe the behaviour.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user