Files
MOOSE/Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.lua
T
FlightControl 3db8062583 Event Handling Optimization
-- Created a HandleEvent method
-- Created an UnHandleEvent method
2017-02-07 13:33:29 +01:00

34 lines
860 B
Lua

---
-- Name: EVT-102 - OnEventTakeoff Example
-- Author: FlightControl
-- Date Created: 7 February 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