mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Completed a first version of an escort follow function!!!
And made a test mission for it.
This commit is contained in:
19
Test Missions/lua/MOOSE_Escort_Test_Follow.lua
Normal file
19
Test Missions/lua/MOOSE_Escort_Test_Follow.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
Include.File( "Mission" )
|
||||
Include.File( "Client" )
|
||||
Include.File( "Escort" )
|
||||
|
||||
|
||||
do
|
||||
local EscortClient = CLIENT:New( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" )
|
||||
local EscortGroup = GROUP:NewFromName( "Escort Helicopter" )
|
||||
|
||||
local Escort = ESCORT:New( EscortClient, EscortGroup, "Escort Test" )
|
||||
end
|
||||
|
||||
|
||||
-- MISSION SCHEDULER STARTUP
|
||||
MISSIONSCHEDULER.Start()
|
||||
MISSIONSCHEDULER.ReportMenu()
|
||||
MISSIONSCHEDULER.ReportMissionsHide()
|
||||
|
||||
env.info( "Test Mission loaded" )
|
||||
125
Test Missions/lua/MOOSE_Pickup_Test.lua
Normal file
125
Test Missions/lua/MOOSE_Pickup_Test.lua
Normal file
@@ -0,0 +1,125 @@
|
||||
Include.File( "Mission" )
|
||||
Include.File( "Client" )
|
||||
Include.File( "DeployTask" )
|
||||
Include.File( "PickupTask" )
|
||||
Include.File( "DestroyGroupsTask" )
|
||||
Include.File( "DestroyRadarsTask" )
|
||||
Include.File( "DestroyUnitTypesTask" )
|
||||
Include.File( "GoHomeTask" )
|
||||
Include.File( "Spawn" )
|
||||
Include.File( "Movement" )
|
||||
Include.File( "Sead" )
|
||||
Include.File( "CleanUp" )
|
||||
|
||||
do
|
||||
local Mission = MISSION:New( 'Pickup', 'Operational', 'Pickup Troops', 'NATO' )
|
||||
|
||||
Mission:AddClient( CLIENT:New( 'DE Pickup Test 1' ):Transport() )
|
||||
Mission:AddClient( CLIENT:New( 'DE Pickup Test 2' ):Transport() )
|
||||
|
||||
local CargoTable = {}
|
||||
|
||||
local EngineerNames = { "Alpha", "Beta", "Gamma", "Delta", "Theta" }
|
||||
|
||||
Cargo_Pickup_Zone_1 = CARGO_ZONE:New( 'Pickup Zone 1', 'DE Communication Center 1' ):BlueSmoke()
|
||||
Cargo_Pickup_Zone_2 = CARGO_ZONE:New( 'Pickup Zone 2', 'DE Communication Center 2' ):RedSmoke()
|
||||
|
||||
for CargoItem = 1, 2 do
|
||||
CargoTable[CargoItem] = CARGO_GROUP:New( 'Engineers', 'Team ' .. EngineerNames[CargoItem], math.random( 70, 100 ) * 3, 'DE Infantry', Cargo_Pickup_Zone_1 )
|
||||
end
|
||||
|
||||
for CargoItem = 3, 5 do
|
||||
CargoTable[CargoItem] = CARGO_GROUP:New( 'Engineers', 'Team ' .. EngineerNames[CargoItem], math.random( 70, 100 ) * 3, 'DE Infantry', Cargo_Pickup_Zone_2 )
|
||||
end
|
||||
|
||||
--Cargo_Package = CARGO_INVISIBLE:New( 'Letter', 0.1, 'DE Secret Agent', 'Pickup Zone Package' )
|
||||
--Cargo_Goods = CARGO_STATIC:New( 'Goods', 20, 'Goods', 'Pickup Zone Goods', 'DE Collection Point' )
|
||||
--Cargo_SlingLoad = CARGO_SLING:New( 'Basket', 40, 'Basket', 'Pickup Zone Sling Load', 'DE Cargo Guard' )
|
||||
|
||||
|
||||
-- Assign the Pickup Task
|
||||
local PickupTask = PICKUPTASK:New( 'Engineers', CLIENT.ONBOARDSIDE.LEFT )
|
||||
PickupTask:FromZone( Cargo_Pickup_Zone_1 )
|
||||
PickupTask:FromZone( Cargo_Pickup_Zone_2 )
|
||||
PickupTask:InitCargo( CargoTable )
|
||||
PickupTask:SetGoalTotal( 3 )
|
||||
Mission:AddTask( PickupTask, 1 )
|
||||
|
||||
|
||||
Cargo_Deploy_Zone_1 = CARGO_ZONE:New( 'Deploy Zone 1', 'DE Communication Center 3' ):RedFlare()
|
||||
Cargo_Deploy_Zone_2 = CARGO_ZONE:New( 'Deploy Zone 2', 'DE Communication Center 4' ):WhiteFlare()
|
||||
|
||||
-- Assign the Pickup Task
|
||||
local DeployTask = DEPLOYTASK:New( 'Engineers' )
|
||||
DeployTask:ToZone( Cargo_Deploy_Zone_1 )
|
||||
DeployTask:ToZone( Cargo_Deploy_Zone_2 )
|
||||
DeployTask:SetGoalTotal( 3 )
|
||||
Mission:AddTask( DeployTask, 2 )
|
||||
|
||||
MISSIONSCHEDULER.AddMission( Mission )
|
||||
end
|
||||
|
||||
do
|
||||
local Mission = MISSION:New( 'Deliver secret letter', 'Operational', 'Pickup letter to the commander.', 'NATO' )
|
||||
|
||||
Client_Package_1 = CLIENT:New( 'BE Package Test 1' ):Transport()
|
||||
|
||||
Mission:AddClient( Client_Package_1 )
|
||||
|
||||
Package_Pickup_Zone = CARGO_ZONE:New( 'Package Pickup Zone', 'DE Guard' ):GreenSmoke()
|
||||
|
||||
Cargo_Package = CARGO_PACKAGE:New( 'Letter', 'Letter to Command', 0.1, Client_Package_1 )
|
||||
--Cargo_Goods = CARGO_STATIC:New( 'Goods', 20, 'Goods', 'Pickup Zone Goods', 'DE Collection Point' )
|
||||
--Cargo_SlingLoad = CARGO_SLING:New( 'Basket', 40, 'Basket', 'Pickup Zone Sling Load', 'DE Cargo Guard' )
|
||||
|
||||
|
||||
-- Assign the Pickup Task
|
||||
local PickupTask = PICKUPTASK:New( 'Letter', CLIENT.ONBOARDSIDE.FRONT )
|
||||
PickupTask:FromZone( Package_Pickup_Zone )
|
||||
PickupTask:InitCargo( { Cargo_Package } )
|
||||
PickupTask:SetGoalTotal( 1 )
|
||||
Mission:AddTask( PickupTask, 1 )
|
||||
|
||||
|
||||
Package_Deploy_Zone = CARGO_ZONE:New( 'Package Deploy Zone', 'DE Secret Car' ):GreenFlare()
|
||||
|
||||
-- Assign the Pickup Task
|
||||
local DeployTask = DEPLOYTASK:New( 'Letter' )
|
||||
DeployTask:ToZone( Package_Deploy_Zone )
|
||||
DeployTask:SetGoalTotal( 1 )
|
||||
Mission:AddTask( DeployTask, 2 )
|
||||
|
||||
MISSIONSCHEDULER.AddMission( Mission )
|
||||
end
|
||||
|
||||
do
|
||||
local Mission = MISSION:New( 'Sling load Cargo', 'Operational', 'Sling Load Cargo to Deploy Zone.', 'NATO' )
|
||||
|
||||
Mission:AddClient( CLIENT:New( 'Sling Load Test Client 1' ):Transport() )
|
||||
Mission:AddClient( CLIENT:New( 'Sling Load Test Client 2' ):Transport() )
|
||||
|
||||
Sling_Load_Pickup_Zone = CARGO_ZONE:New( 'Sling Load Pickup Zone', 'Sling Load Guard' ):RedSmoke()
|
||||
|
||||
Cargo_Sling_Load = CARGO_SLINGLOAD:New( 'Sling', 'Food Boxes', 200, 'Sling Load Pickup Zone', 'Sling Load Guard', country.id.USA )
|
||||
--Cargo_Goods = CARGO_STATIC:New( 'Goods', 20, 'Goods', 'Pickup Zone Goods', 'DE Collection Point' )
|
||||
--Cargo_SlingLoad = CARGO_SLING:New( 'Basket', 40, 'Basket', 'Pickup Zone Sling Load', 'DE Cargo Guard' )
|
||||
|
||||
|
||||
-- Assign the Pickup Task
|
||||
local PickupTask = PICKUPTASK:New( 'Sling', CLIENT.ONBOARDSIDE.FRONT )
|
||||
PickupTask:FromZone( Sling_Load_Pickup_Zone )
|
||||
PickupTask:InitCargo( { Cargo_Sling_Load } )
|
||||
PickupTask:SetGoalTotal( 1 )
|
||||
Mission:AddTask( PickupTask, 1 )
|
||||
|
||||
MISSIONSCHEDULER.AddMission( Mission )
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- MISSION SCHEDULER STARTUP
|
||||
MISSIONSCHEDULER.Start()
|
||||
MISSIONSCHEDULER.ReportMenu()
|
||||
MISSIONSCHEDULER.ReportMissionsHide()
|
||||
|
||||
env.info( "Test Mission loaded" )
|
||||
139
Test Missions/lua/MOOSE_Spawn_Test.lua
Normal file
139
Test Missions/lua/MOOSE_Spawn_Test.lua
Normal file
@@ -0,0 +1,139 @@
|
||||
Include.File( "Spawn" )
|
||||
|
||||
|
||||
-- Tests Anapa: Spawn Basics
|
||||
-- -------------------------
|
||||
-- Spawning groups using Spawn function.
|
||||
Spawn_Plane = SPAWN:New( "Spawn Plane" )
|
||||
Group_Plane = Spawn_Plane:Spawn()
|
||||
|
||||
Spawn_Helicopter = SPAWN:New( "Spawn Helicopter" ):RandomizeRoute( 1, 1, 1000 )
|
||||
Group_Helicopter = Spawn_Helicopter:Spawn()
|
||||
Group_Helicopter2 = Spawn_Helicopter:Spawn()
|
||||
|
||||
Spawn_Ship = SPAWN:New( "Spawn Ship" ):RandomizeRoute( 0, 0, 2000 )
|
||||
Group_Ship1 = Spawn_Ship:Spawn()
|
||||
Group_Ship2 = Spawn_Ship:Spawn()
|
||||
|
||||
Spawn_Vehicle = SPAWN:New( "Spawn Vehicle" ):RandomizeRoute( 1, 0, 50 )
|
||||
Group_Vehicle1 = Spawn_Vehicle:Spawn()
|
||||
Group_Vehicle2 = Spawn_Vehicle:Spawn()
|
||||
Group_Vehicle3 = Spawn_Vehicle:Spawn()
|
||||
Group_Vehicle4 = Spawn_Vehicle:Spawn()
|
||||
Group_Vehicle5 = Spawn_Vehicle:Spawn()
|
||||
Group_Vehicle6 = Spawn_Vehicle:Spawn()
|
||||
|
||||
Group_Vehicle1:RouteToZone( ZONE:New( "Landing Zone" ), true, 40, "Cone" )
|
||||
|
||||
-- Now land the spawned plane on to the Vinson, by copying the route of another object.
|
||||
Route_Plane = GROUP:NewFromName( "Spawn Helicopter Route Copy" ):CopyRoute( 1, 0 )
|
||||
|
||||
Group_Plane:Route( Route_Plane )
|
||||
|
||||
--Route_Helicopter[#Route_Helicopter].linkUnit = Group_Ship1:GetDCSUnit(1)
|
||||
--Route_Helicopter[#Route_Helicopter].helipadId = Group_Ship1:GetDCSUnit(1)
|
||||
--Route_Helicopter[#Route_Helicopter].x = Group_Ship1:GetUnit(1):GetPointVec2().x
|
||||
--Route_Helicopter[#Route_Helicopter].y = Group_Ship1:GetUnit(1):GetPointVec2().y
|
||||
--env.info( Route_Helicopter[#Route_Helicopter].type .. " on " .. Group_Ship1:GetUnit(1):GetID() )
|
||||
--Group_Helicopter:Route( Route_Helicopter )
|
||||
|
||||
|
||||
-- Tests Batumi: Scheduled Spawning
|
||||
-- --------------------------------
|
||||
-- Unlimited spawning of groups, scheduled every 30 seconds ...
|
||||
Spawn_Plane_Scheduled = SPAWN:New( "Spawn Plane Scheduled" ):SpawnScheduled( 30, 0.4 )
|
||||
Spawn_Helicopter_Scheduled = SPAWN:New( "Spawn Helicopter Scheduled" ):SpawnScheduled( 30, 1 )
|
||||
Spawn_Ship_Scheduled = SPAWN:New( "Spawn Ship Scheduled" ):SpawnScheduled( 30, 0.5 )
|
||||
Spawn_Vehicle_Scheduled = SPAWN:New( "Spawn Vehicle Scheduled" ):SpawnScheduled( 30, 0.5 )
|
||||
|
||||
-- Tests Tbilisi: Limited Spawning
|
||||
-- -------------------------------
|
||||
-- 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_RepeatOnLanding = SPAWN:New( "Spawn Plane Limited RepeatOnLanding" ):Limit( 1, 1 ):Repeat():Spawn()
|
||||
Spawn_Plane_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Plane Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):Repeat():Spawn()
|
||||
Spawn_Helicopter_Limited_Repeat = SPAWN:New( "Spawn Helicopter Limited Repeat" ):Limit( 1, 1 ):Repeat():Spawn()
|
||||
Spawn_Helicopter_Limited_RepeatOnLanding = SPAWN:New( "Spawn Helicopter Limited RepeatOnLanding" ):Limit( 1, 1 ):Repeat():Spawn()
|
||||
Spawn_Helicopter_Limited_RepeatOnEngineShutDown = SPAWN:New( "Spawn Helicopter Limited RepeatOnEngineShutDown" ):Limit( 1, 1 ):Repeat():Spawn()
|
||||
|
||||
|
||||
-- Tests Soganlug
|
||||
-- --------------
|
||||
-- Limited spawning of groups, scheduled every 30 seconds ...
|
||||
Spawn_Plane_Limited_Scheduled = SPAWN:New( "Spawn Plane Limited Scheduled" ):Limit( 2, 10 ):SpawnScheduled( 30, 0 )
|
||||
Spawn_Helicopter_Limited_Scheduled = SPAWN:New( "Spawn Helicopter Limited Scheduled" ):Limit( 2, 10 ):SpawnScheduled( 30, 0 )
|
||||
Spawn_Ground_Limited_Scheduled = SPAWN:New( "Spawn Vehicle Limited Scheduled" ):Limit( 1, 20 ):SpawnScheduled( 90, 0 )
|
||||
|
||||
-- Tests Sukhumi
|
||||
-- -------------
|
||||
-- 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_Helicopter_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Helicopter Limited Scheduled RandomizeRoute" ):Limit( 2, 10 ):RandomizeRoute( 1, 1, 4000 ):SpawnScheduled( 30, 0 )
|
||||
Spawn_Vehicle_Limited_Scheduled_RandomizeRoute = SPAWN:New( "Spawn Vehicle Limited Scheduled RandomizeRoute" ):Limit( 10, 10 ):RandomizeRoute( 1, 1, 1000 ):SpawnScheduled( 1, 0 )
|
||||
|
||||
|
||||
-- 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( 180 ):SpawnScheduled( 10, 0 )
|
||||
Spawn_Vehicle_Scheduled_CleanUp = SPAWN:New( "Spawn Vehicle Scheduled CleanUp" ):Limit( 3, 100 ):RandomizeRoute( 1, 1, 1000 ):SpawnScheduled( 10, 0 )
|
||||
|
||||
-- Maykop
|
||||
-- ------
|
||||
-- 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 = SPAWN:New( "Spawn Vehicle Visible Scheduled" ):Limit( 200, 200 ):SpawnArray( 59, 20, 20, 10 ):SpawnScheduled( 10, 0.2 )
|
||||
|
||||
-- Spawn_Templates_Visible contains different templates...
|
||||
Spawn_Templates_Visible = { "Spawn Vehicle Visible Template A",
|
||||
"Spawn Vehicle Visible Template B",
|
||||
"Spawn Vehicle Visible Template C",
|
||||
"Spawn Vehicle Visible Template D",
|
||||
"Spawn Vehicle Visible Template E",
|
||||
"Spawn Vehicle Visible Template F",
|
||||
"Spawn Vehicle Visible Template G",
|
||||
"Spawn Vehicle Visible Template H",
|
||||
"Spawn Vehicle Visible Template I",
|
||||
"Spawn Vehicle Visible Template J"
|
||||
}
|
||||
|
||||
-- Spawn_Vehicle_Visible_RandomizeTemplate_Scheduled creates an array of 40 vehicle groups, spread out by 20 groups each, with an 8 meter distance,
|
||||
-- and chooses for each group from the templates specified in Spawn_Templates_Visible.
|
||||
|
||||
Spawn_Vehicle_Visible_RandomizeTemplate_Scheduled = SPAWN:New( "Spawn Vehicle Visible RandomizeTemplate Scheduled" )
|
||||
:Limit( 80, 80 )
|
||||
:RandomizeTemplate( Spawn_Templates_Visible )
|
||||
:SpawnArray( 49, 20, 8, 8 )
|
||||
:SpawnScheduled( 10, 0.2 )
|
||||
|
||||
-- Spawn_Infantry allows to spawn 10 Infantry groups.
|
||||
Spawn_Infantry = SPAWN:New( "Spawn Infantry" )
|
||||
:Limit( 10, 10 )
|
||||
|
||||
-- Spawn_Vehicle_Host reserves 10 vehicle groups, shown within an array arranged by 5 vehicles in a row with a distance of 8 meters, and schedules a vehicle each 10 seconds with a 20% variation.
|
||||
Spawn_Vehicle_Host = SPAWN:New( "Spawn Vehicle Host" )
|
||||
:Limit( 10, 10 )
|
||||
:SpawnArray( 0, 5, 8, 8 )
|
||||
:SpawnScheduled( 10, 0.2 )
|
||||
|
||||
-- Spawn_Vehicle_SpawnToZone allows to spawn 10 vehicle groups.
|
||||
Spawn_Vehicle_SpawnToZone = SPAWN:New( "Spawn Vehicle SpawnToZone" )
|
||||
:Limit( 10, 10 )
|
||||
|
||||
-- Spawn_Helicopter_SpawnToZone will fly to a location, hover, and spawn one vehicle on the ground, the helicopter will land
|
||||
-- and the vehicle will drive to a random location within the defined zone.
|
||||
-- For this, the following code is activated within the mission on waypoint 3:
|
||||
--
|
||||
-- local InfantryDropGroup = Spawn_Vehicle_SpawnToZone:SpawnFromUnit( GROUP:New( ... ):GetUnit(1) )
|
||||
-- local InfantryDropRoute = InfantryDropGroup:CopyRoute( 1, 0 )
|
||||
-- InfantryDropGroup:RouteToZone( ZONE:New( "Target Zone" ), true, 80 )
|
||||
--
|
||||
|
||||
Spawn_Helicopter_SpawnToZone = SPAWN:New( "Spawn Helicopter SpawnToZone" )
|
||||
:Limit( 10, 10 )
|
||||
:SpawnScheduled( 60, 0.2 )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user