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

26 lines
614 B
Lua

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