New SPAWN class methods

-- Added SpawnFromVec3
-- Added SpawnFromVec2
-- Revised SpawnFromUnit
-- Revised SpawnFromZone
-- Added POINT_VEC3:GetVec2()
-- Added POINT_VEC3:GetRandomVec2InRadius()
-- Added POINT_VEC2:NewFromVec2()
-- Revised the STATIC class working with POISITIONABLE
-- Revised ZONE_RADIUS:GetPointVec3
--
This commit is contained in:
FlightControl
2016-07-23 10:31:52 +02:00
parent a634fbb33c
commit 231b382df1
58 changed files with 787 additions and 311 deletions

View File

@@ -0,0 +1,8 @@
-- Tests Kutaisi
-- -------------
-- Tests the CleanUp functionality.
-- Limited spawning of groups, scheduled every 10 seconds, who are engaging into combat. Some helicopters may crash land on the ground.
-- Observe when helicopters land but are not dead and are out of the danger zone, that they get removed after a while (+/- 180 seconds) and ReSpawn.
Spawn_Helicopter_Scheduled_CleanUp = SPAWN:New( "Spawn Helicopter Scheduled CleanUp" ):Limit( 3, 100 ):RandomizeRoute( 1, 1, 1000 ):CleanUp( 60 ):SpawnScheduled( 10, 0 )
Spawn_Vehicle_Scheduled_CleanUp = SPAWN:New( "Spawn Vehicle Scheduled CleanUp" ):Limit( 3, 100 ):RandomizeRoute( 1, 1, 1000 ):SpawnScheduled( 10, 0 )

View File

@@ -0,0 +1,15 @@
-- Tests Gudauta
-- --------------
-- Limited spawning of groups, scheduled every 30 seconds ...
Spawn_Plane_Limited_Scheduled = SPAWN:New( "Spawn Plane Limited Scheduled" ):Limit( 4, 20 ):SpawnScheduled( 30, 0 )
Spawn_Helicopter_Limited_Scheduled = SPAWN:New( "Spawn Helicopter Limited Scheduled" ):Limit( 4, 20 ):SpawnScheduled( 30, 0 )
Spawn_Ground_Limited_Scheduled = SPAWN:New( "Spawn Vehicle Limited Scheduled" ):Limit( 4, 20 ):SpawnScheduled( 90, 0 )
-- Tests Sukhumi
-- -------------
-- Limited spawning of groups, scheduled every seconds with destruction.
Spawn_Plane_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Plane Limited Scheduled Destroy" ):Limit( 4, 20 ):SpawnScheduled( 10, 0 )
Spawn_Helicopter_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Helicopter Limited Scheduled Destroy" ):Limit( 4, 20 ):SpawnScheduled( 10, 0 )
Spawn_Vehicle_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Vehicle Limited Scheduled Destroy" ):Limit( 4, 20 ):SpawnScheduled( 10, 0 )

View File

@@ -0,0 +1,45 @@
---
-- MOOSE SPAWN repeat test scenario
-- -------------------------------
-- There are 8 GROUPs Spawned.
-- They fly around Kutaisi and will land.
-- Upon landing:
-- 1. The KA-50 and the C-101EB should respawn itself directly when landed.
-- 2. the MI-8MTV2 and the A-10C should respawn itself when the air unit has parked at the ramp.
-- @module MOOSE_Test_SPAWN_Repeat
-- @author FlightControl
do
-- Declare SPAWN objects
local Spawn_KA_50 = SPAWN:New("KA-50")
local Spawn_MI_8MTV2 = SPAWN:New("MI-8MTV2")
local Spawn_C_101EB = SPAWN:New("C-101EB")
local Spawn_A_10C = SPAWN:New("A-10C")
-- Choose repeat functionality
-- Repeat on landing
Spawn_KA_50:InitRepeatOnLanding()
Spawn_C_101EB:InitRepeatOnLanding()
-- Repeat on enging shutdown (when landed on the airport)
Spawn_MI_8MTV2:InitRepeatOnEngineShutDown()
Spawn_A_10C:InitRepeatOnEngineShutDown()
-- Now SPAWN the GROUPs
Spawn_KA_50:Spawn()
Spawn_C_101EB:Spawn()
Spawn_MI_8MTV2:Spawn()
Spawn_A_10C:Spawn()
Spawn_KA_50:Spawn()
Spawn_C_101EB:Spawn()
Spawn_MI_8MTV2:Spawn()
Spawn_A_10C:Spawn()
-- Now run the mission and observe the behaviour.
end

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundStatics = { "GroundStatic1", "GroundStatic2", "GroundStatic3" }
AirplaneStatics = { "AirplaneStatic1", "AirplaneStatic2", "AirplaneStatic3" }
HelicopterStatics = { "HelicopterStatic1", "HelicopterStatic2", "HelicopterStatic3" }
ShipStatics = { "ShipStatic1", "ShipStatic2", "ShipStatic3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local StaticName = GroundStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnGrounds:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Airplanes
local StaticName = AirplaneStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnAirplanes:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Helicopters
local StaticName = HelicopterStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnHelicopters:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Ships
local StaticName = ShipStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnShips:SpawnFromUnit( SpawnStatic, 500, 100 )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundUnits = { "GroundUnit1", "GroundUnit2", "GroundUnit3" }
AirplaneUnits = { "AirplaneUnit1", "AirplaneUnit2", "AirplaneUnit3" }
HelicopterUnits = { "HelicopterUnit1", "HelicopterUnit2", "HelicopterUnit3" }
ShipUnits = { "ShipUnit1", "ShipUnit2", "ShipUnit3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local UnitName = GroundUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnGrounds:SpawnFromUnit( SpawnUnit, 10, 3 )
end
do
-- Spawn Airplanes
local UnitName = AirplaneUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnAirplanes:SpawnFromUnit( SpawnUnit )
end
do
-- Spawn Helicopters
local UnitName = HelicopterUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnHelicopters:SpawnFromUnit( SpawnUnit )
end
do
-- Spawn Ships
local UnitName = ShipUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnShips:SpawnFromUnit( SpawnUnit )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundZones = { "GroundZone1", "GroundZone2", "GroundZone3" }
AirplaneZones = { "AirplaneZone1", "AirplaneZone2", "AirplaneZone3" }
HelicopterZones = { "HelicopterZone1", "HelicopterZone2", "HelicopterZone3" }
ShipZones = { "ShipZone1", "ShipZone2", "ShipZone3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local ZoneName = GroundZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnGrounds:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Airplanes
local ZoneName = AirplaneZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnAirplanes:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Helicopters
local ZoneName = HelicopterZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnHelicopters:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Ships
local ZoneName = ShipZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnShips:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundZones = { "GroundZone1", "GroundZone2", "GroundZone3" }
AirplaneZones = { "AirplaneZone1", "AirplaneZone2", "AirplaneZone3" }
HelicopterZones = { "HelicopterZone1", "HelicopterZone2", "HelicopterZone3" }
ShipZones = { "ShipZone1", "ShipZone2", "ShipZone3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local ZoneName = GroundZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnGrounds:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Airplanes
local ZoneName = AirplaneZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnAirplanes:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Helicopters
local ZoneName = HelicopterZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnHelicopters:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Ships
local ZoneName = ShipZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnShips:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
end, {}, 0, 15, 0.5
)