diff --git a/.gitignore b/.gitignore index 22e90135a..fe8f502fb 100644 --- a/.gitignore +++ b/.gitignore @@ -224,3 +224,4 @@ _gsdata_/ #GITHUB .gitattributes .gitignore +Moose Test Missions/MOOSE_Test_Template.miz diff --git a/Moose Development/Moose/AI/AI_Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua index 693c99a03..e49b718be 100644 --- a/Moose Development/Moose/AI/AI_Patrol.lua +++ b/Moose Development/Moose/AI/AI_Patrol.lua @@ -601,7 +601,7 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To ) self.Controllable:OnReSpawn( function( PatrolGroup ) self:E( "ReSpawn" ) - self:__Reset() + self:__Reset( 1 ) self:__Route( 5 ) end ) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 269cd17bc..a6dbb7204 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -152,6 +152,10 @@ -- -- @module Event + + + + --- The EVENT structure -- @type EVENT -- @field #EVENT.Events Events @@ -721,3 +725,18 @@ function EVENT:onEvent( Event ) end end +--- The EVENTHANDLER structure +-- @type EVENTHANDLER +-- @extends Core.Base#BASE +EVENTHANDLER = { + ClassName = "EVENTHANDLER", + ClassID = 0, +} + +--- The EVENTHANDLER constructor +-- @param #EVENTHANDLER self +-- @return #EVENTHANDLER +function EVENTHANDLER:New() + self = BASE:Inherit( self, BASE:New() ) -- #EVENTHANDLER + return self +end diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua index 6e7dd0f52..9c4014ef4 100644 --- a/Moose Development/Moose/Core/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -627,16 +627,20 @@ do -- FSM return function( self, DelaySeconds, ... ) self:T2( "Delayed Event: " .. EventName ) local CallID = 0 - if DelaySeconds < 0 then -- Only call the event ONCE! - DelaySeconds = math.abs( DelaySeconds ) - if not self._EventSchedules[EventName] then - CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) - self._EventSchedules[EventName] = CallID + if DelaySeconds ~= nil then + if DelaySeconds < 0 then -- Only call the event ONCE! + DelaySeconds = math.abs( DelaySeconds ) + if not self._EventSchedules[EventName] then + CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) + self._EventSchedules[EventName] = CallID + else + -- reschedule + end else - -- reschedule + CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) end else - CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) + error( "FSM: An asynchronous event trigger requires a DelaySeconds parameter!!! This can be positive or negative! Sorry, but will not process this." ) end self:T2( { CallID = CallID } ) end diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 63e846363..b3c154192 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -848,7 +848,7 @@ function TASK:onenterAssigned( From, Event, To ) self:E("Task Assigned") self:MessageToGroups( "Task " .. self:GetName() .. " has been assigned to your group." ) - self:GetMission():__Start() + self:GetMission():__Start( 1 ) end @@ -864,7 +864,7 @@ function TASK:onenterSuccess( From, Event, To ) self:MessageToGroups( "Task " .. self:GetName() .. " is successful! Good job!" ) self:UnAssignFromGroups() - self:GetMission():__Complete() + self:GetMission():__Complete( 1 ) end diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.lua b/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.lua new file mode 100644 index 000000000..a62960186 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.lua @@ -0,0 +1,163 @@ +-- Name: AIB-007 - AI Balancers For all airports and both coalitions +-- Author: Delta99 +-- Date Created: 11 Feb 2017 +-- +-- Originally created to solve issues jg7xman (from Moose Slack group) was having in creating +-- AI_BALANCER across multiple airbases. + +-- # Situation: +-- +-- AI_BALANCERS created per airbase for both coalitions. Mutiple patrol zones are created +-- for each side. Each flight that is created by AI_BALANCER will pick a random patrol zone +-- to patrol. + +-- # Test Cases +-- +-- 1. Observe at least 1 flight spawning and taking off from each airbase. +-- 2. Each flight patrols randomly in one of its sides zones. +-- 3. AI will respawn after killed. +-- 4. Additional client slots are available at Sochi. If players don't take a slot there +-- will be more than one AI taking off from Sochi. +-- 5. Batumi contains a flight of 3 units rather than just 1 like most of the rest of the airbases. +-- 6. Watch the coalition AI clash and kill each other. + +-- Create the Red Patrol Zone Array + +-- This zone array will be used in the AI_BALANCER to randomize the patrol +-- zone that each spawned group will patrol + +local RedPatrolZone = {} +RedPatrolZone[1] = ZONE:New( "RedPatrolZone1" ) +RedPatrolZone[2] = ZONE:New( "RedPatrolZone2" ) +RedPatrolZone[3] = ZONE:New( "RedPatrolZone3" ) +RedPatrolZone[4] = ZONE:New( "RedPatrolZone4" ) +RedPatrolZone[5] = ZONE:New( "RedPatrolZone5" ) +RedPatrolZone[6] = ZONE:New( "RedPatrolZone6" ) + +-- Russian CAP Aircraft + +-- These are the aircraft created in the mission editor that the AI will spawn +-- with replacing any CLIENT created aircraft in the mission that a human +-- player does not take. + +local RU_PlanesSpawn = {} +RU_PlanesSpawn[1] = SPAWN:New( "RU CAP Anapa AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[2] = SPAWN:New( "RU CAP Beslan AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[3] = SPAWN:New( "RU CAP Gelendzhik AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[4] = SPAWN:New( "RU CAP Krasnodar Center AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[5] = SPAWN:New( "RU CAP Krasnodar Pashkovsky AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[6] = SPAWN:New( "RU CAP Krymsk AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[7] = SPAWN:New( "RU CAP Maykop AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[8] = SPAWN:New( "RU CAP Mineralnye Vody AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[9] = SPAWN:New( "RU CAP Mozdok AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[10] = SPAWN:New( "RU CAP Nalchik AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[11] = SPAWN:New( "RU CAP Novorossiysk AB" ):InitCleanUp( 45 ) + +-- Russian Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) + +-- If you want more client slots per airbase that you want AI to be able to take control of then +-- name them with the prefixes below and they will be picked up automatically by FilterPrevixes. +-- +-- For example, if you want another Client slot available at Anapa name it "RU CLIENT Anapa AB 2". +-- The code here does not need to be changed. Only an addition in the mission editor. An example +-- of this can be found on the USA side at Sochi AB. + +local RU_PlanesClientSet = {} +RU_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Anapa AB") +RU_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Beslan AB") +RU_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Gelendzhik AB") +RU_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Center AB") +RU_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Pashkovsky AB") +RU_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krymsk AB") +RU_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Maykop AB") +RU_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mineralnye Vody AB") +RU_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mozdok AB") +RU_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Nalchik AB") +RU_PlanesClientSet[11] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Novorossiysk AB") + +-- We setup an array to store all the AI_BALANCERS that are going to be created. Basically one +-- per airbase. We loop through and create an AI_BALANCER as well as a separate OnAfterSpawned +-- function for each. The Patrol Zone is randomized in the first parameter to AI_PATROL_ZONE:New() +-- call. This is done for each of the AI_BALANCERS. To add more patrol zones, just define them in +-- the mission editor and add into the array above. Code here does not need to be changed. The +-- table.getn(RedPatrolZone) gets the number of elements in the RedPatrolZone array so that all +-- of them are included to pick randomly. + + +local RU_AI_Balancer = {} +for i=1, 11 do + RU_AI_Balancer[i] = AI_BALANCER:New(RU_PlanesClientSet[i], RU_PlanesSpawn[i]) + + -- We set a local variable within the for loop to the AI_BALANCER that was just created. + -- I couldn't get RU_AI_BALANCER[i]:OnAfterSpawn to be recognized so this is just pointing + -- curAIBalancer to the relevant RU_AI_BALANCER array item for each loop. + + -- So in this case there are essentially 11 OnAfterSpawned functions defined and handled. + + local curAIBalancer = RU_AI_Balancer[i] + function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + local Patrol = AI_PATROL_ZONE:New( RedPatrolZone[math.random( 1, table.getn(RedPatrolZone))], 1500, 5500, 700, 1400 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + end +end + +-- US / Blue side is setup pretty much identically to the RU side above. Same detailed comments +-- above apply here. The main difference here is 10 airbases instead of 11. + +-- Another difference is additional client slots at Sochi and a group defined at Batumi with +-- more than 1 unit per group (flight of 3 units). This is just to show that you can have more +-- client slots per airbase and more units in a single group that the AI will control. I think +-- this will also allow you to fly lead with AI on your wing or you can fly wing with an AI +-- leader. + +-- Create the Blue Patrol Zone Array +local BluePatrolZone = {} +BluePatrolZone[1] = ZONE:New( "BluePatrolZone1") +BluePatrolZone[2] = ZONE:New( "BluePatrolZone2") +BluePatrolZone[3] = ZONE:New( "BluePatrolZone3") +BluePatrolZone[4] = ZONE:New( "BluePatrolZone4") +BluePatrolZone[5] = ZONE:New( "BluePatrolZone5") +BluePatrolZone[6] = ZONE:New( "BluePatrolZone6") + +--United States CAP Aircraft (these are used as templates for AI) + +local US_PlanesSpawn = {} +US_PlanesSpawn[1] = SPAWN:New( "US CAP Batumi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[2] = SPAWN:New( "US CAP Gudauta AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[3] = SPAWN:New( "US CAP Kobuleti AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[4] = SPAWN:New( "US CAP Kutaisi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[5] = SPAWN:New( "US CAP Senaki AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[6] = SPAWN:New( "US CAP Sochi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[7] = SPAWN:New( "US CAP Soganlug AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[8] = SPAWN:New( "US CAP Sukhumi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[9] = SPAWN:New( "US CAP Vaziani AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[10] = SPAWN:New( "US CAP Tbilisi AB" ):InitCleanUp( 45 ) + +--United States Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) + +local US_PlanesClientSet = {} +US_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("US CLIENT Batumi AB") +US_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("US CLIENT Gudauta AB") +US_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kobuleti AB") +US_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kutaisi AB") +US_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("US CLIENT Senaki AB") +US_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sochi AB") +US_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("US CLIENT Soganlug AB") +US_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sukhumi AB") +US_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("US CLIENT Vaziani AB") +US_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("US CLIENT Tbilisi AB") + +local US_AI_Balancer = {} +for i=1, 10 do + US_AI_Balancer[i] = AI_BALANCER:New( US_PlanesClientSet[i], US_PlanesSpawn[i] ) + + local curAIBalancer = US_AI_Balancer[i] + function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + local Patrol = AI_PATROL_ZONE:New( BluePatrolZone[math.random( 1, table.getn(BluePatrolZone))], 1500, 5500, 700, 1400 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + end +end \ No newline at end of file diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.miz b/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.miz new file mode 100644 index 000000000..bac809a23 Binary files /dev/null and b/Moose Test Missions/AIB - AI Balancing/AIB-007 - AI Balancers For all airports and both coalitions/AIB-007 - AI Balancers For all airports and both coalitions.miz differ diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.lua new file mode 100644 index 000000000..287760dcb --- /dev/null +++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.lua @@ -0,0 +1,27 @@ +--- +-- Name: CAP-020 - Combat Air Patrol RTB Test +-- Author: FlightControl +-- Date Created: 14 February 2017 +-- +-- # Situation: +-- The Su-27 airplane will patrol in PatrolZone. +-- It will return to base when out of fuel. +-- +-- # Test cases: +-- +-- 1. Observe the Su-27 patrolling. +-- 2. It should return to base when out of fuel. +-- + +local CapSpawn = SPAWN:New( "Plane" ):InitLimit(1,2):InitRepeatOnLanding() + +local CapGroup = CapSpawn:Spawn() + +local PatrolZone = ZONE:New( "Patrol Zone" ) + +local AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 ) + +AICapZone:SetControllable( CapGroup ) + +AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone. + diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.miz new file mode 100644 index 000000000..50f74d299 Binary files /dev/null and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-020 - Combat Air Patrol RTB Test/CAP-020 - Combat Air Patrol RTB Test.miz differ diff --git a/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.lua b/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.lua new file mode 100644 index 000000000..4d5946aba --- /dev/null +++ b/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.lua @@ -0,0 +1,34 @@ +--- +-- Name: EVT-401 - Generic OnEventHit Example +-- Author: FlightControl +-- Date Created: 15 February 2017 +-- +-- # Situation: +-- +-- Ground targets are shooting each other. +-- +-- # Test cases: +-- +-- 1. Observe the ground forces shooting each other. +-- 2. Observe when a tank receives a hit, a dcs.log entry is written in the logging. +-- 3. The generic EventHandler objects should receive the hit events. + +local CC = COMMANDCENTER:New( UNIT:FindByName( "HQ" ), "HQ" ) + +local EventHandler1 = EVENTHANDLER:New() +local EventHandler2 = EVENTHANDLER:New() + +EventHandler1:HandleEvent( EVENTS.Hit ) +EventHandler2:HandleEvent( EVENTS.Hit ) + +function EventHandler1:OnEventHit( EventData ) + self:E("hello 1") + CC:GetPositionable():MessageToAll( "I just got hit!", 15 , "Alert!" ) +end + +function EventHandler2:OnEventHit( EventData ) + self:E("hello 2") + CC:GetPositionable():MessageToAll( "I just got hit!", 15, "Alert!" ) +end + + diff --git a/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.miz b/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.miz new file mode 100644 index 000000000..c7c698501 Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-401 - Generic OnEventHit Example/EVT-401 - Generic OnEventHit Example.miz differ diff --git a/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.lua b/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.lua new file mode 100644 index 000000000..2d81929e2 --- /dev/null +++ b/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.lua @@ -0,0 +1,63 @@ +--- +-- Name: EVT-103 - OnEventLand Example +-- Author: CraigOwen +-- Date Created: 12 February 2017 +-- +-- # Situation: +-- +-- A client plane is landing on an airfield, trying to pick a rope in the landing zones. +-- When the plane landed in one of the zones, a vehicle flares and a message ist printed out to the client. +-- +-- # Test cases: +-- +-- 1. Land the plane. +-- 2. When the plane landed, observe your message and the signal. +-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file. + +-- Create a unit which signalizes if the client landed good. +signal = UNIT:FindByName("LandingZoneChallenge - Signal") + +-- Create the zones used for the landing check +-- Init Zone +InitZone = ZONE:New("LandingChallange - InitZone") + +-- Ropes +zonegroup1 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 1" ) +zonegroup2 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 2" ) +zonegroup3 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 3" ) +LandZoneRope1 = ZONE_POLYGON:New( "Rope1", zonegroup1) +LandZoneRope2 = ZONE_POLYGON:New( "Rope2", zonegroup2) +LandZoneRope3 = ZONE_POLYGON:New( "Rope3", zonegroup3) + +-- Create a variable Plane that holds a reference to CLIENT object (created by moose at the beginning of the mission) with the name "Plane". +Plane = CLIENT:FindByName( "Plane" ) +-- Subscribe to the event Land. The Land event occurs when a plane lands at an airfield. +Plane:HandleEvent( EVENTS.Land ) + +-- This function will be called whenever the Plane-Object (client) lands! +function Plane:OnEventLand( EventData ) + + -- check wether the client landet at the right airport, where the challenge is located + if not Plane:IsInZone(InitZone) then + return + end + + -- check if the touchdown took place inside of one of the zones + if Plane:IsInZone(LandZoneRope1) then + MESSAGE:New("Great job! You picked the first rope.", 15, "Landing challenge" ):ToClient( Plane ) + signal:FlareGreen() + elseif Plane:IsInZone(LandZoneRope2) then + MESSAGE:New("Good job! You picked the second rope.", 15, "Landing challenge" ):ToClient( Plane ) + signal:FlareYellow() + elseif Plane:IsInZone(LandZoneRope3) then + MESSAGE:New("Close! You picked the last rope.", 15, "Landing challenge" ):ToClient( Plane ) + signal:FlareRed() + else + MESSAGE:New("Too bad, no rope picked! Thrust your engines and try again.", 15, "Landing challenge" ):ToClient( Plane ) + end + + +end + + +MESSAGE:New("Try to land on the runway in between the red trucks.", 15, "Landing challenge"):ToClient(Plane) \ No newline at end of file diff --git a/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.miz b/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.miz new file mode 100644 index 000000000..e5bc7e14b Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-500 - OnEventLand LandingChallenge/EVT-500 - OnEventLand LandingChallenge.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.lua b/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.lua new file mode 100644 index 000000000..207bf362d --- /dev/null +++ b/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.lua @@ -0,0 +1,41 @@ +--- +-- Name: SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit +-- Author: FlightControl +-- Date Created: 05 Feb 2017 +-- +-- # Situation: +-- +-- One airplane and one helicopter will be spawned. +-- Only one airplane and one helicopter can be alive at the same time. +-- Upon landing, the airplane and helicopter will respawn at Kutaisi. +-- +-- # Test cases: +-- +-- 1. Observe the spawning of the airplane and helicopter +-- 2. There should not be more airplanes alive than there are set by InitLimit. +-- 3. Upon landing, the planes should respawn. +-- 4. The KA-50 should respawn itself directly when landed. +-- 5. The A-10C should respawn itself when the air unit has parked at the ramp. + + +do + + -- Declare SPAWN objects + local Spawn_KA_50 = SPAWN:New("KA-50"):InitLimit( 1, 10 ) + local Spawn_A_10C = SPAWN:New("A-10C"):InitLimit( 1, 10 ) + + -- Choose repeat functionality + + -- Repeat on landing + Spawn_KA_50:InitRepeatOnLanding() + + -- Repeat on enging shutdown (when landed on the airport) + Spawn_A_10C:InitRepeatOnEngineShutDown() + + -- Now SPAWN the GROUPs + Spawn_KA_50:SpawnScheduled(30,0) + Spawn_A_10C:SpawnScheduled(30,0) + + -- Now run the mission and observe the behaviour. + +end diff --git a/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.miz b/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.miz new file mode 100644 index 000000000..9746819a5 Binary files /dev/null and b/Moose Test Missions/SPA - Spawning/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit/SPA-120 - Air Ops - Scheduled Spawn with Repeat on Landing with Limit.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.lua b/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.lua deleted file mode 100644 index 209ce7e16..000000000 --- a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.lua +++ /dev/null @@ -1,41 +0,0 @@ ---- --- 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. --- - -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