mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into FlightControl
# Conflicts: # Moose Development/Moose/Core/Event.lua # Moose Development/Moose/Functional/Scoring.lua # Moose Development/Moose/Wrapper/Controllable.lua # Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua # Moose Mission Setup/Moose.lua # Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.miz # Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.miz # Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.miz # Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.miz # Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.miz # Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.miz # Moose Test Missions/SCO - Scoring/SCO-101 - Scoring Client to Client/SCO-101 - Scoring Client to Client.miz # docs/Documentation/Controllable.html # docs/Documentation/Event.html # docs/Documentation/Point.html # docs/Documentation/Zone.html
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
-- Name: EVT-100 - OnEventShot Example
|
||||
-- Name: EVT-100 - UNIT OnEventShot Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 February 2017
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
-- Name: EVT-100 - UNIT OnEventShot Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A plane is flying in the air and shoots an missile to a ground target.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the plane shooting the missile.
|
||||
-- 2. Observe when the plane shoots the missile, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_SHOT entry.
|
||||
|
||||
local Plane = UNIT:FindByName( "Plane" )
|
||||
|
||||
Plane:HandleEvent( EVENTS.Shot )
|
||||
|
||||
function Plane:OnEventShot( EventData )
|
||||
|
||||
Plane:MessageToAll( "I just fired a missile!", 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
---
|
||||
-- Name: EVT-101 - OnEventHit Example
|
||||
-- Name: EVT-101 - UNIT OnEventHit Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 February 2017
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
-- Name: EVT-101 - UNIT OnEventHit Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A plane is flying in the air and shoots an missile to a ground target.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the plane shooting the missile.
|
||||
-- 2. Observe when the missile hits the target, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_HIT entry.
|
||||
|
||||
local Plane = UNIT:FindByName( "Plane" )
|
||||
|
||||
local Tank = UNIT:FindByName( "Tank" )
|
||||
|
||||
Plane:HandleEvent( EVENTS.Hit )
|
||||
Tank:HandleEvent( EVENTS.Hit )
|
||||
|
||||
function Plane:OnEventHit( EventData )
|
||||
|
||||
Plane:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
|
||||
function Tank:OnEventHit( EventData )
|
||||
Tank:MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
---
|
||||
-- Name: EVT-102 - OnEventTakeoff Example
|
||||
-- Name: EVT-102 - UNIT OnEventTakeoff Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 February 2017
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
-- Name: EVT-102 - UNIT OnEventTakeoff Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A human plane and an AI plane are taking off from an airfield.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Take-Off the planes from the runway.
|
||||
-- 2. When the planes take-off, observe the message being sent.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_TAKEOFF entry in the dcs.log file.
|
||||
|
||||
local PlaneAI = UNIT:FindByName( "PlaneAI" )
|
||||
|
||||
local PlaneHuman = UNIT:FindByName( "PlaneHuman" )
|
||||
|
||||
PlaneAI:HandleEvent( EVENTS.Takeoff )
|
||||
PlaneHuman:HandleEvent( EVENTS.Takeoff )
|
||||
|
||||
function PlaneAI:OnEventTakeoff( EventData )
|
||||
|
||||
PlaneHuman:MessageToAll( "AI Taking Off", 15, "Alert!" )
|
||||
end
|
||||
|
||||
function PlaneHuman:OnEventTakeoff( EventData )
|
||||
|
||||
PlaneHuman:MessageToAll( "Player " .. PlaneHuman:GetPlayerName() .. " is Taking Off", 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
---
|
||||
-- Name: EVT-103 - OnEventLand Example
|
||||
-- Name: EVT-103 - UNIT OnEventLand Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 February 2017
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
-- Name: EVT-103 - UNIT OnEventLand Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- An AI plane is landing on an airfield.
|
||||
-- When the plane landed, a new plane is spawned.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the plane landing.
|
||||
-- 2. When the AI plane lands, observe the new plane being spawned.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file.
|
||||
|
||||
-- Create a variable PlaneAI that holds a reference to UNIT object (created by moose at the beginning of the mission) with the name "PlaneAI".
|
||||
local PlaneAI = UNIT:FindByName( "PlaneAI" )
|
||||
|
||||
-- Create a SPAWN object to spawn a new plane once the hold one lands.
|
||||
local SpawnPlane = SPAWN:New( "SpawnPlaneAI" )
|
||||
|
||||
-- Declare a new variable that will hold the new spawned SpawnPlaneAI
|
||||
local NewPlane
|
||||
|
||||
|
||||
-- Subscribe to the event Land. The Land event occurs when a plane lands at an airfield.
|
||||
PlaneAI:HandleEvent( EVENTS.Land )
|
||||
|
||||
-- Because the PlaneAI object is subscribed to the Land event, the following method will be automatically
|
||||
-- called when the land event is happening FOR THE PlaneAI UNIT only!
|
||||
function PlaneAI:OnEventLand( EventData )
|
||||
|
||||
-- Okay, the PlaneAI has landed, now spawn the new plane ( a predator )
|
||||
NewPlane = SpawnPlane:Spawn()
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
---
|
||||
-- Name: EVT-104 - OnEventCrash Example
|
||||
-- Name: EVT-104 - UNIT OnEventCrash Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 February 2017
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
-- Name: EVT-104 - UNIT OnEventCrash Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A human plane is fyling in the air. Crash it into the ground.
|
||||
-- Once you are crashed into the ground, at the place where you crashed, a smoke should start burning ...
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Fly the plane into the ground.
|
||||
-- 2. When your plane crashes, observe a smoke starting to burn right were you crashed.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_CRASH entry in the dcs.log file.
|
||||
|
||||
-- Create a variable PlaneHuman that holds a reference to UNIT object (created by moose at the beginning of the mission) with the name "PlaneHuman".
|
||||
local PlaneHuman = UNIT:FindByName( "PlaneHuman" )
|
||||
|
||||
-- Subscribe to the event Crash. The Crash event occurs when a plane crashes into the ground (or into something else).
|
||||
PlaneHuman:HandleEvent( EVENTS.Crash )
|
||||
|
||||
-- Because the PlaneHuman object is subscribed to the Crash event, the following method will be automatically
|
||||
-- called when the Crash event is happening FOR THE PlaneHuman UNIT only!
|
||||
|
||||
--- @param self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function PlaneHuman:OnEventCrash( EventData )
|
||||
|
||||
-- Okay, the PlaneHuman has crashed, now smoke at the x, z position.
|
||||
self:E( "Smoking at the position" )
|
||||
EventData.IniUnit:SmokeOrange()
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
---
|
||||
-- Name: EVT-200 - GROUP OnEventShot Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 07 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- Two groups of planes are flying in the air and shoot an missile to a multitude of ground targets.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the planes shooting the missile.
|
||||
-- 2. Observe when the planes shoots the missile, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_SHOT entry.
|
||||
-- 4. The planes of GROUP "Group Plane A", should only send a message when they shoot a missile.
|
||||
-- 5. The planes of GROUP "Group Plane B", should NOT send a message when they shoot a missile.
|
||||
|
||||
local PlaneGroup = GROUP:FindByName( "Group Plane A" )
|
||||
|
||||
PlaneGroup:HandleEvent( EVENTS.Shot )
|
||||
|
||||
function PlaneGroup:OnEventShot( EventData )
|
||||
|
||||
self:E( "I just fired a missile and I am part of " .. EventData.IniGroupName )
|
||||
EventData.IniUnit:MessageToAll( "I just fired a missile and I am part of " .. EventData.IniGroupName, 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
---
|
||||
-- Name: EVT-201 - GROUP OnEventHit Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 08 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- Two groups of planes are flying in the air and shoot an missile to a multitude of ground targets.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the planes shooting the missile.
|
||||
-- 2. Observe when the planes shoots the missile, and hit the group Tanks A, a dcs.log entry is written in the logging.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_HIT entry.
|
||||
-- 4. The tanks of GROUP "Group Tanks A", should only send a message when they get hit.
|
||||
-- 5. The tanks of GROUP "Group Tanks B", should NOT send a message when they get hit.
|
||||
|
||||
local TanksGroup = GROUP:FindByName( "Group Tanks A" )
|
||||
|
||||
TanksGroup:HandleEvent( EVENTS.Hit )
|
||||
|
||||
function TanksGroup:OnEventHit( EventData )
|
||||
|
||||
self:E( "I just got hit and I am part of " .. EventData.TgtGroupName )
|
||||
EventData.TgtUnit:MessageToAll( "I just got hit and I am part of " .. EventData.TgtGroupName, 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
---
|
||||
-- Name: EVT-600 - OnEventHit Example with a Set of Units
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 6 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A plane is flying in the air and shoots an missile to a ground target.
|
||||
-- It will shoot a couple of tanks units that are part of a Set.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the plane shooting the missile.
|
||||
-- 2. Observe when the plane hits a tank, a dcs.log entry is written in the logging.
|
||||
-- 4. Observe the tanks hitting the targets and the messages appear.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_HIT entries.
|
||||
|
||||
local Plane = UNIT:FindByName( "Plane" )
|
||||
|
||||
local UnitSet = SET_UNIT:New():FilterPrefixes( "Tank" ):FilterStart()
|
||||
|
||||
UnitSet:HandleEvent( EVENTS.Hit )
|
||||
|
||||
function UnitSet:OnEventHit( EventData )
|
||||
|
||||
Plane:MessageToAll( "I just hit a tank! " .. EventData.IniUnit:GetName(), 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user