Wrapper/Group migrated to new repo

This commit is contained in:
kaltokri 2024-02-29 19:56:05 +01:00
parent b800ed0154
commit 1fb598324c
47 changed files with 0 additions and 552 deletions

View File

@ -1,32 +0,0 @@
---
-- Name: GRP-100 - IsAlive
-- Author: FlightControl
-- Date Created: 23 Feb 2017
--
-- # Situation:
--
-- This test is about checking if IsAlive on GROUP level is working correctly.
-- Two ground forces GROUPS are shooting each other.
-- Check the IsAlive status in the logging of the survivor and the defeat.
--
-- # Test cases:
--
-- 1. Observe the IsAlive statuses in the dcs.log file.
--Create Spawn Groups
local GroupBlue = GROUP:FindByName( "Blue" )
local GroupRed = GROUP:FindByName( "Red" )
local Schedule, ScheduleID = SCHEDULER:New( nil,
--- Variable Declarations
-- @param Wrapper.Group#GROUP GroupBlue
-- @param Wrapper.Group#GROUP GroupRed
function( GroupBlue, GroupRed )
local IsAliveBlue = GroupBlue:IsAlive()
local IsAliveRed = GroupRed:IsAlive()
BASE:E( { IsAliveBlue = IsAliveBlue, IsAliveRed = IsAliveRed } )
end, { GroupBlue, GroupRed }, 1, 1
)

View File

@ -1,30 +0,0 @@
--- This test demonstrates the use(s) of the SwitchWayPoint method of the GROUP class.
local HeliGroup = GROUP:FindByName( "Helicopter" )
local AttackGroup = GROUP:FindByName( "AttackGroup" )
local AttackUnits = AttackGroup:GetUnits()
local Tasks = {}
for i = 1, #AttackUnits do
local AttackUnit = AttackGroup:GetUnit( i )
Tasks[#Tasks+1] = HeliGroup:TaskAttackUnit( AttackUnit )
end
Tasks[#Tasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )
--- @param Wrapper.Group#GROUP HeliGroup
function _Resume( HeliGroup )
env.info( '_Resume' )
HeliGroup:MessageToAll( "Resuming",10,"Info")
end
HeliGroup:PushTask(
HeliGroup:TaskCombo(
Tasks
), 30
)

View File

@ -1,24 +0,0 @@
--Create Spawn Groups
local SpawnPlane1 = SPAWN:New("Plane 1")
local SpawnPlane2 = SPAWN:New("Plane 2")
--Spawn Groups into world
local GroupPlane1 = SpawnPlane1:Spawn()
--local GroupPlane1 = GROUP:FindByName( "Plane 1" )
local GroupPlane2 = SpawnPlane2:Spawn()
--local GroupPlane2 = GROUP:FindByName( "Plane 2" )
--Create Task for plane2 (follow groupPlane1 at Vec3 offset) (Note: I think I need to be using controllers here)
--i.e. cntrlPlane1 = groupPlane1.getController(groupPlane1)
local PointVec3 = POINT_VEC3:New( 100, 0, -100 ) -- This is a Vec3 class.
local FollowDCSTask = GroupPlane2:TaskFollow( GroupPlane1, PointVec3:GetVec3() )
--Activate Task (Either PushTask/SetTask?)
-- PushTask will push a task on the execution queue of the group.
-- SetTask will delete all tasks from the current group queue, and executes this task.
GroupPlane2:SetTask( FollowDCSTask, 1 )

View File

@ -1,12 +0,0 @@
--- This test demonstrates the use(s) of the SwitchWayPoint method of the GROUP class.
HeliGroup = GROUP:FindByName( "Helicopter" )
--- Route the helicopter back to the FARP after 60 seconds.
-- We use the SCHEDULER class to do this.
SCHEDULER:New( nil,
function( HeliGroup )
local CommandRTB = HeliGroup:CommandSwitchWayPoint( 2, 8 )
HeliGroup:SetCommand( CommandRTB )
end, { HeliGroup }, 90
)

View File

@ -1,39 +0,0 @@
---
-- Name: GRP-310 - Command StopRoute
-- Author: FlightControl
-- Date Created: 25 Mar 2017
--
-- # Situation:
-- A ground unit is moving.
-- Using the command CommandStopMove it will stop moving after 10 seconds.
--
-- # Test cases:
--
-- 1. Observe the ground group stopping to move.
--
--- @param Wrapper.Group#GROUP GroundGroup
function StopMove( GroundGroup )
BASE:E("Stop")
local Command = GroundGroup:CommandStopRoute( true )
GroundGroup:SetCommand(Command)
end
--- @param Wrapper.Group#GROUP GroundGroup
function StartMove( GroundGroup )
BASE:E("Start")
local Command = GroundGroup:CommandStopRoute( false )
GroundGroup:SetCommand(Command)
end
GroundGroup = GROUP:FindByName( "Ground" )
Scheduler = SCHEDULER:New( nil )
ScheduleIDStop = Scheduler:Schedule(nil, StopMove, { GroundGroup }, 10, 20 )
ScheduleIDStart = Scheduler:Schedule(nil, StartMove, { GroundGroup }, 20, 20 )

View File

@ -1,45 +0,0 @@
---
-- Name: GRP-400 - RouteReturnToAirbase
-- Author: FlightControl
-- Date Created: 25 Mar 2017
--
-- # Situation:
-- Three air units are flying and are commanded to return a specific airbase.
--
-- # Test cases:
--
-- 1. Observe the Air1 group return to Batumi after 10 seconds.
-- 2. Observe the Air2 group returning to Kobuleti after 300 seconds. (It was planned to land at Kutaisi).
-- 3. Observe the Air3 group returning to the home (landing) airbase after 300 seconds. (It was planned to land at Kutaisi).
--
--- @param Wrapper.Group#GROUP AirGroup
function ReturnToBatumi( AirGroup )
BASE:E("ReturnToBatumi")
AirGroup:RouteRTB( AIRBASE:FindByName("Batumi") )
end
--- @param Wrapper.Group#GROUP AirGroup
function ReturnToKobuleti( AirGroup )
BASE:E("ReturnToKobuleti")
AirGroup:RouteRTB( AIRBASE:FindByName("Kobuleti") )
end
--- @param Wrapper.Group#GROUP AirGroup
function ReturnToHome( AirGroup )
BASE:E("ReturnToHome")
AirGroup:RouteRTB()
end
Air1Group = GROUP:FindByName( "Air1" )
Air2Group = GROUP:FindByName( "Air2" )
Air3Group = GROUP:FindByName( "Air3" )
Scheduler = SCHEDULER:New( nil )
ScheduleIDAir1 = Scheduler:Schedule(nil, ReturnToBatumi, { Air1Group }, 10 )
ScheduleIDAir2 = Scheduler:Schedule(nil, ReturnToKobuleti, { Air2Group }, 300 )
ScheduleIDAir3 = Scheduler:Schedule(nil, ReturnToHome, { Air3Group }, 300 )

View File

@ -1,21 +0,0 @@
-- This routes a GroundGroup 1km further with an angle of 180 degrees.
local GroundGroup = GROUP:FindByName( "Vehicle" )
-- Get the current coordinate of GroundGroup
FromCoord = GroundGroup:GetCoordinate()
-- From the current coordinate, calculate 1km away with an angle of 180 degrees.
ToCoord = FromCoord:Translate( 1000, 180 )
RoutePoints = {}
-- Create a "grount route point", which is a "point" structure that can be given as a parameter to a Task
RoutePoints[#RoutePoints+1] = FromCoord:RoutePointGround( 0 )
RoutePoints[#RoutePoints+1] = ToCoord:RoutePointGround( 60, "Cone" )
-- Create a combo task, that creates a route task to the RoutePoint
RouteTask = GroundGroup:TaskRoute( RoutePoints )
-- Set the task to be executed by the GroundGroup
GroundGroup:SetTask( RouteTask, 1 )

View File

@ -1,16 +0,0 @@
-- This routes a GroundGroup 1km further with an angle of 180 degrees.
local GroundGroup = GROUP:FindByName( "Vehicle" )
-- Get the current coordinate of GroundGroup
FromCoord = GroundGroup:GetCoordinate()
-- From the current coordinate, calculate 1km away with an angle of 180 degrees.
ToCoord = FromCoord:Translate( 1000, 180 )
-- Create a combo task, that creates a route task to the RoutePoint
RouteTask = GroundGroup:TaskRouteToVec2( ToCoord:GetVec2() )
-- Set the task to be executed by the GroundGroup
GroundGroup:SetTask( RouteTask, 1 )

View File

@ -1,46 +0,0 @@
--- This makes a vehicle fly to random zones when a waypoint has been reached.
-- Name: GRP - Group Commands/GRP-502 - Route at waypoint to random point
-- Author: FlightControl
-- Date Created: 08 Aug 2017
local ZoneList = {
ZONE:New( "ZONE1" ),
ZONE:New( "ZONE2" ),
ZONE:New( "ZONE3" ),
ZONE:New( "ZONE4" ),
ZONE:New( "ZONE5" )
}
GroundGroup = GROUP:FindByName( "Vehicle" )
--- @param Wrapper.Group#GROUP GroundGroup
function RouteToZone( Vehicle, ZoneRoute )
local Route = {}
Vehicle:E( { ZoneRoute = ZoneRoute } )
Vehicle:MessageToAll( "Moving to zone " .. ZoneRoute:GetName(), 10 )
-- Get the current coordinate of the Vehicle
local FromCoord = Vehicle:GetCoordinate()
-- Select a random Zone and get the Coordinate of the new Zone.
local RandomZone = ZoneList[ math.random( 1, #ZoneList ) ] -- Core.Zone#ZONE
local ToCoord = RandomZone:GetCoordinate()
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
Route[#Route+1] = FromCoord:RoutePointGround( 72 )
Route[#Route+1] = ToCoord:RoutePointGround( 60, "Vee" )
local TaskRouteToZone = Vehicle:TaskFunction( "RouteToZone", RandomZone )
Vehicle:SetTaskAtWaypoint( Route, #Route, TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
Vehicle:Route( Route, math.random( 10, 20 ) ) -- Move after a random seconds to the Route. See the Route method for details.
end
RouteToZone( GroundGroup, ZoneList[1] )

View File

@ -1,45 +0,0 @@
--- This makes a vehicle drive to random zones when a waypoint has been reached.
-- Name: GRP - Group Commands/GRP-503 - NTTR Route at waypoint to random point
-- Author: FlightControl
-- Date Created: 08 Aug 2017
local ZoneList = {
ZONE:New( "ZONE1" ),
ZONE:New( "ZONE2" ),
ZONE:New( "ZONE3" ),
ZONE:New( "ZONE4" ),
ZONE:New( "ZONE5" ),
}
VehicleGroup = GROUP:FindByName( "Vehicle #001" )
--- @param Wrapper.Group#GROUP RoutedGroup
function ReRoute( VehicleGroup )
VehicleGroup:E( "Routing" )
local ZoneNumber = math.random( 1, #ZoneList )
VehicleGroup:E( ZoneNumber )
local FromCoord = VehicleGroup:GetCoordinate() -- Core.Point#COORDINATE
local FromWP = FromCoord:WaypointGround()
local ZoneTo = ZoneList[ ZoneNumber ] -- Core.Zone#ZONE
local ToCoord = ZoneTo:GetCoordinate()
local ToWP = ToCoord:WaypointGround( 72, "Vee" )
local TaskReRoute = VehicleGroup:TaskFunction( "ReRoute" )
VehicleGroup:SetTaskWaypoint( ToWP, TaskReRoute )
VehicleGroup:Route( { FromWP, ToWP }, 1 )
end
ReRoute( VehicleGroup )

View File

@ -1,17 +0,0 @@
--- This makes a vehicle drive its route in a repetitive way.
-- Name: GRP-550 - Patrol a route
-- Author: FlightControl
-- Date Created: 24 Sep 2017
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Patrol the route of the Vehicle.
Vehicle:PatrolRoute()
-- Find the Ship and create a GROUP object.
Ship = GROUP:FindByName( "Ship" )
-- Patrol the route of the Ship.
Ship:PatrolRoute()

View File

@ -1,17 +0,0 @@
--- This makes a vehicle drive its route using the waypoints of the route and selecing random points on the route.
-- Name: GRP-551 - Patrol to random points of a route
-- Author: FlightControl
-- Date Created: 24 Sep 2017
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Patrol to random points of the route at 120 km/h in "Vee" formation.
Vehicle:PatrolRouteRandom( 120, "Vee" )
-- Find the Ship and create a GROUP object.
Ship = GROUP:FindByName( "Ship" )
-- Patrol to random points of the route at 120 km/h in "Vee" formation.
Ship:PatrolRouteRandom( 120, "Vee" )

View File

@ -1,16 +0,0 @@
--- This makes a vehicle drive its route selecting random points in a zone.
-- Name: GRP-552 - Patrol in a zone
-- Author: FlightControl
-- Date Created: 24 Sep 2017
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Patrol to random points in the trigger zone ZONE, at 120 km/h in Vee format.
Vehicle:PatrolZones( { ZONE:New( "ZONEVEHICLE" ) }, 120, "Vee" )
-- Find the Vehicle and create a GROUP object.
Ship = GROUP:FindByName( "Ship" )
-- Patrol to random points in the trigger zone ZONE, at 120 km/h in Vee format.
Ship:PatrolZones( { ZONE:New( "ZONESHIP" ) }, 120, "Vee" )

View File

@ -1,16 +0,0 @@
--- This makes a vehicle drive its route selecting random points in a zone.
-- Name: GRP-553 - Patrol in a list of zones
-- Author: FlightControl
-- Date Created: 24 Sep 2017
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Patrol to random points in the trigger zones ZONEVEHICLE1, ZONEVEHICLE2, ZONEVEHICLE3, at 120 km/h in Vee format.
Vehicle:PatrolZones( { ZONE:New( "ZONEVEHICLE1" ), ZONE:New( "ZONEVEHICLE2" ), ZONE:New( "ZONEVEHICLE3" ) }, 120, "Vee" )
-- Find the Ship and create a GROUP object.
Ship = GROUP:FindByName( "Ship" )
-- Patrol to random points in the trigger zones ZONESHIP1, ZONESHIP2, ZONESHIP3, at 120 km/h in Vee format.
Ship:PatrolZones( { ZONE:New( "ZONESHIP1" ), ZONE:New( "ZONESHIP2" ), ZONE:New( "ZONESHIP3" ) }, 120, "Vee" )

Binary file not shown.

View File

@ -1,11 +0,0 @@
--- This makes a vehicle respawn itself when the mission starts.
-- The vehicle is hidden, so you need to observe from the watch tower!
-- Name: GRP-601 - Respawn hidden
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Respawn the vehicle.
Vehicle:Respawn()

View File

@ -1,16 +0,0 @@
--- This makes a vehicle respawn itself when the mission starts.
-- Name: GRP-600 - Respawn
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,18 +0,0 @@
--- This makes a vehicle respawn itself within ZONEVEHICLE1.
-- The vehicle group consists of multiple units and are spawned in relation to the original template position.
--
-- Name: GRP-611 - Respawn multiple units in Zone
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,19 +0,0 @@
--- This makes a vehicle respawn itself within ZONEVEHICLE1.
-- The vehicle group consists of multiple units and are spawned in randomized within the new zone.
--
-- Name: GRP-612 - Respawn multiple units in Zone randomized.
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
Vehicle:InitRandomizePositionZone( true )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,17 +0,0 @@
--- This makes a vehicle respawn within ZONEVEHICLE1.
-- The vehicle is hidden, so you need to observe at the watch tower through external view.
-- Name: GRP-615 - Respawn in Zone hidden
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,19 +0,0 @@
--- This makes a vehicle respawn itself within ZONEVEHICLE1.
-- The vehicle group consists of multiple units and are spawned in relation to the original template position.
-- The vehicle is hidden, so you need to observe from the watch tower (external view).
--
-- Name: GRP-616 - Respawn multiple units in Zone hidden
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,20 +0,0 @@
--- This makes a vehicle respawn itself within ZONEVEHICLE1 hidden.
-- The vehicle group consists of multiple units and are spawned in randomized within the new zone.
-- The vehicle is hidden, so you need to observe from the watch tower (external view).
--
-- Name: GRP-617 - Respawn multiple units in Zone randomized hidden
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
Vehicle:InitRandomizePositionZone( true )
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()

View File

@ -1,29 +0,0 @@
--- This makes a vehicle respawn itself within ZONEVEHICLE1.
-- The vehicle group consists of multiple units and are spawned in randomized within the new zone.
-- When the last vehicle of the group is destroyed, the group will respawn.
--
-- Name: GRP-620 - Respawn multiple units when destroyed
-- Author: FlightControl
-- Date Created: 01 Mar 2018
-- Find the Vehicle and create a GROUP object.
Vehicle = GROUP:FindByName( "Vehicle" )
-- Setup RespawnZone1 linking to the trigger zone ZONEVEHICLE1.
RespawnZone1 = ZONE:New( "ZONEVEHICLE1")
-- Prepare the spawning to be done in RespawnZone1.
Vehicle:InitZone( RespawnZone1 )
Vehicle:InitRandomizePositionZone( true )
Vehicle:HandleEvent( EVENTS.Dead )
function Vehicle:OnEventDead( EventData )
self:E( { "Size ", Size = Vehicle:GetSize() } )
-- When the last vehicle of the group is declared dead, respawn the group.
if Vehicle:GetSize() == 1 then
-- Respawn the vehicle in RespawnZone1.
Vehicle:Respawn()
end
end

View File

@ -1,27 +0,0 @@
---
-- Name: GRP-900 - Option Green and Red State
-- Author: FlightControl
-- Date Created: 10 Dec 2017
--
-- This tests the option to set the alarm state of a group to RED or GREEN.
-- Both options are tested with two groups.
-- Please check the dcs.log in case of errors, and the time the group reacts to the approaching target.
-- The Red State Group should react much faster than the Green State Group.
--
-- Join the Game Master to observe the reaction of the ground units.
--
-- Blue is attacking.
-- Green is defending.
--
RedStateGroup = GROUP:FindByName( "Red State" )
GreenStateGroup = GROUP:FindByName( "Green State" )
RedStateGroup:OptionAlarmStateRed()
GreenStateGroup:OptionAlarmStateGreen()