mirror of
https://github.com/FlightControl-Master/MOOSE_MISSIONS.git
synced 2025-08-15 10:37:46 +00:00
Updated Moose.lua
This commit is contained in:
@@ -1,74 +1,74 @@
|
||||
---
|
||||
-- Name: EVT-001 - UNIT OnEventShot Stability Test
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 9 Apr 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A couple of planes are firing to each other. Monitor the shot events.
|
||||
-- I am doing a collectgarbage to test the stability of the event handling.
|
||||
-- Also when the planes are destroyed, the event handling should stop etc.
|
||||
-- The tests are on GROUP level.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the planes shooting the missiles.
|
||||
-- 2. Observe when the plane shoots the missile, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the stability of the event handlings.
|
||||
|
||||
PlaneGroupsBlue = {}
|
||||
|
||||
PlaneGroupsRed = {}
|
||||
|
||||
PlaneSpawnBlue = SPAWN
|
||||
:New( "Planes Blue" )
|
||||
:InitLimit( 2, 0 )
|
||||
:SpawnScheduled( 10,0 )
|
||||
:OnSpawnGroup(
|
||||
function( SpawnGroup )
|
||||
SpawnGroupName = SpawnGroup:GetName()
|
||||
PlaneGroupsBlue[SpawnGroupName] = SpawnGroup
|
||||
PlaneGroupsBlue[SpawnGroupName]:HandleEvent( EVENTS.Shot )
|
||||
PlaneGroupsBlue[SpawnGroupName]:HandleEvent( EVENTS.Hit )
|
||||
collectgarbage()
|
||||
PlaneGroupsBlue[SpawnGroupName].OnEventShot = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just fired a missile!", 15, "Alert!" )
|
||||
end
|
||||
PlaneGroupsBlue[SpawnGroupName].OnEventHit = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
PlaneSpawnRed = SPAWN
|
||||
:New( "Planes Red" )
|
||||
:InitLimit( 2, 0 )
|
||||
:SpawnScheduled(10,0)
|
||||
:OnSpawnGroup(
|
||||
function( SpawnGroup )
|
||||
SpawnGroupName = SpawnGroup:GetName()
|
||||
PlaneGroupsRed[SpawnGroupName] = SpawnGroup
|
||||
PlaneGroupsRed[SpawnGroupName]:HandleEvent( EVENTS.Shot )
|
||||
PlaneGroupsRed[SpawnGroupName]:HandleEvent( EVENTS.Hit )
|
||||
collectgarbage()
|
||||
--- @param self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
PlaneGroupsRed[SpawnGroupName].OnEventShot = function ( self, EventData )
|
||||
self:F( EventData )
|
||||
|
||||
self:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
PlaneGroupsRed[SpawnGroupName].OnEventHit = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just fired a missile!", 15, "Alert!" )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
collectgarbage()
|
||||
BASE:E( "Collected garbage" )
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Name: EVT-001 - UNIT OnEventShot Stability Test
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 9 Apr 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A couple of planes are firing to each other. Monitor the shot events.
|
||||
-- I am doing a collectgarbage to test the stability of the event handling.
|
||||
-- Also when the planes are destroyed, the event handling should stop etc.
|
||||
-- The tests are on GROUP level.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the planes shooting the missiles.
|
||||
-- 2. Observe when the plane shoots the missile, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the stability of the event handlings.
|
||||
|
||||
PlaneGroupsBlue = {}
|
||||
|
||||
PlaneGroupsRed = {}
|
||||
|
||||
PlaneSpawnBlue = SPAWN
|
||||
:New( "Planes Blue" )
|
||||
:InitLimit( 2, 0 )
|
||||
:SpawnScheduled( 10,0 )
|
||||
:OnSpawnGroup(
|
||||
function( SpawnGroup )
|
||||
SpawnGroupName = SpawnGroup:GetName()
|
||||
PlaneGroupsBlue[SpawnGroupName] = SpawnGroup
|
||||
PlaneGroupsBlue[SpawnGroupName]:HandleEvent( EVENTS.Shot )
|
||||
PlaneGroupsBlue[SpawnGroupName]:HandleEvent( EVENTS.Hit )
|
||||
collectgarbage()
|
||||
PlaneGroupsBlue[SpawnGroupName].OnEventShot = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just fired a missile!", 15, "Alert!" )
|
||||
end
|
||||
PlaneGroupsBlue[SpawnGroupName].OnEventHit = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
PlaneSpawnRed = SPAWN
|
||||
:New( "Planes Red" )
|
||||
:InitLimit( 2, 0 )
|
||||
:SpawnScheduled(10,0)
|
||||
:OnSpawnGroup(
|
||||
function( SpawnGroup )
|
||||
SpawnGroupName = SpawnGroup:GetName()
|
||||
PlaneGroupsRed[SpawnGroupName] = SpawnGroup
|
||||
PlaneGroupsRed[SpawnGroupName]:HandleEvent( EVENTS.Shot )
|
||||
PlaneGroupsRed[SpawnGroupName]:HandleEvent( EVENTS.Hit )
|
||||
collectgarbage()
|
||||
--- @param self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
PlaneGroupsRed[SpawnGroupName].OnEventShot = function ( self, EventData )
|
||||
self:F( EventData )
|
||||
|
||||
self:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
PlaneGroupsRed[SpawnGroupName].OnEventHit = function( self, EventData )
|
||||
self:F( EventData )
|
||||
self:MessageToAll( "I just fired a missile!", 15, "Alert!" )
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
collectgarbage()
|
||||
BASE:E( "Collected garbage" )
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
---
|
||||
-- Name: EVT-002 - UNIT OnEventLand ReSpawn Test
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 9 Apr 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A couple of planes are taking off from an airbase.
|
||||
-- When they land, they send out a message that they landed.
|
||||
-- But! They are automatically respawned upon landing.
|
||||
-- The 2nd time the same plane lands, they should send the message again!!!
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe in the logging, that the event subscriptions are reset when the respawn happens!
|
||||
-- 2. Observe the 2nd time the same plane lands, they should send the message again!!!
|
||||
-- 3. Check the stability of the event handlings.
|
||||
|
||||
PlaneBlueSpawn = SPAWN
|
||||
:New( "PlaneBlue" )
|
||||
:InitLimit(2,0)
|
||||
:InitRepeatOnEngineShutDown()
|
||||
:SpawnScheduled(60,0)
|
||||
:OnSpawnGroup(
|
||||
--- @param Wrapper.Group#GROUP SpawnGroup
|
||||
function( SpawnGroup )
|
||||
SpawnGroup:HandleEvent( EVENTS.Land )
|
||||
--- @param self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function SpawnGroup:OnEventLand(EventData)
|
||||
EventData.IniGroup:MessageToAll("Landed",15,"Land Event")
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
collectgarbage()
|
||||
BASE:E( "Collected garbage" )
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Name: EVT-002 - UNIT OnEventLand ReSpawn Test
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 9 Apr 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A couple of planes are taking off from an airbase.
|
||||
-- When they land, they send out a message that they landed.
|
||||
-- But! They are automatically respawned upon landing.
|
||||
-- The 2nd time the same plane lands, they should send the message again!!!
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe in the logging, that the event subscriptions are reset when the respawn happens!
|
||||
-- 2. Observe the 2nd time the same plane lands, they should send the message again!!!
|
||||
-- 3. Check the stability of the event handlings.
|
||||
|
||||
PlaneBlueSpawn = SPAWN
|
||||
:New( "PlaneBlue" )
|
||||
:InitLimit(2,0)
|
||||
:InitRepeatOnEngineShutDown()
|
||||
:SpawnScheduled(60,0)
|
||||
:OnSpawnGroup(
|
||||
--- @param Wrapper.Group#GROUP SpawnGroup
|
||||
function( SpawnGroup )
|
||||
SpawnGroup:HandleEvent( EVENTS.Land )
|
||||
--- @param self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function SpawnGroup:OnEventLand(EventData)
|
||||
EventData.IniGroup:MessageToAll("Landed",15,"Land Event")
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
collectgarbage()
|
||||
BASE:E( "Collected garbage" )
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user