Find below an example of the prototype how to write an event handling function for two units:
+
+Note the function( self, EventData ). It takes two parameters:
-
- | BASE:AddEvent(Event, EventFunction) |
-
- Set a new listener for the class.
- |
-
-
| BASE.ClassID |
The ID number of the class.
@@ -315,12 +304,6 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:CreateEventCrash(EventTime, Initiator) |
Creation of a Crash Event.
- |
-
-
- | BASE:DisableEvents() |
-
- Disable the event listeners for the class.
|
@@ -330,153 +313,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
- | BASE:EnableEvents() |
-
- Enable the event listeners for the class.
- |
-
-
- | BASE:Event() |
+ BASE:EventDispatcher() |
Returns the event dispatcher
- |
-
-
- | BASE:EventOnBaseCaptured(EventFunction) |
-
- Subscribe to a SEVENTBASE_CAPTURED event.
- |
-
-
- | BASE:EventOnBirth(EventFunction) |
-
- Subscribe to a S_EVENT_BIRTH event.
- |
-
-
- | BASE:EventOnCrash(EventFunction) |
-
- Subscribe to a S_EVENT_CRASH event.
- |
-
-
- | BASE:EventOnDead(EventFunction) |
-
- Subscribe to a S_EVENT_DEAD event.
- |
-
-
- | BASE:EventOnEjection(EventFunction) |
-
- Subscribe to a S_EVENT_EJECTION event.
- |
-
-
- | BASE:EventOnEngineShutdown(EventFunction) |
-
- Subscribe to a SEVENTENGINE_SHUTDOWN event.
- |
-
-
- | BASE:EventOnEngineStartup(EventFunction) |
-
- Subscribe to a SEVENTENGINE_STARTUP event.
- |
-
-
- | BASE:EventOnHit(EventFunction) |
-
- Subscribe to a S_EVENT_HIT event.
- |
-
-
- | BASE:EventOnHumanFailure(EventFunction) |
-
- Subscribe to a SEVENTHUMAN_FAILURE event.
- |
-
-
- | BASE:EventOnLand(EventFunction) |
-
- Subscribe to a S_EVENT_LAND event.
- |
-
-
- | BASE:EventOnMissionStart(EventFunction) |
-
- Subscribe to a SEVENTMISSION_START event.
- |
-
-
- | BASE:EventOnPilotDead(EventFunction) |
-
- Subscribe to a SEVENTPILOT_DEAD event.
- |
-
-
- | BASE:EventOnPlayerComment(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_COMMENT event.
- |
-
-
- | BASE:EventOnPlayerEnterUnit(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_ENTER_UNIT event.
- |
-
-
- | BASE:EventOnPlayerLeaveUnit(EventFunction) |
-
- Subscribe to a SEVENTPLAYER_LEAVE_UNIT event.
- |
-
-
- | BASE:EventOnPlayerMissionEnd(EventFunction) |
-
- Subscribe to a SEVENTMISSION_END event.
- |
-
-
- | BASE:EventOnRefueling(EventFunction) |
-
- Subscribe to a S_EVENT_REFUELING event.
- |
-
-
- | BASE:EventOnRefuelingStop(EventFunction) |
-
- Subscribe to a SEVENTREFUELING_STOP event.
- |
-
-
- | BASE:EventOnShootingEnd(EventFunction) |
-
- Subscribe to a SEVENTSHOOTING_END event.
- |
-
-
- | BASE:EventOnShootingStart(EventFunction) |
-
- Subscribe to a SEVENTSHOOTING_START event.
- |
-
-
- | BASE:EventOnShot(EventFunction) |
-
- Subscribe to a S_EVENT_SHOT event.
- |
-
-
- | BASE:EventOnTakeOff(EventFunction) |
-
- Subscribe to a S_EVENT_TAKEOFF event.
- |
-
-
- | BASE:EventOnTookControl(EventFunction) |
-
- Subscribe to a SEVENTTOOK_CONTROL event.
|
@@ -543,6 +382,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:GetState(Object, Key, Value) |
Get a Value given a Key from the Object.
+ |
+
+
+ | BASE:HandleEvent(Event, EventFunction) |
+
+ Subscribe to a DCS Event.
|
@@ -561,6 +406,135 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
| BASE:New() |
+ |
+
+
+ | BASE:OnEvent(EventData) |
+
+ Occurs when an object is completely destroyed.
+ |
+
+
+ | BASE:OnEventBaseCaptured(EventData) |
+
+ Occurs when a ground unit captures either an airbase or a farp.
+ |
+
+
+ | BASE:OnEventBirth(EventData) |
+
+ Occurs when any object is spawned into the mission.
+ |
+
+
+ | BASE:OnEventCrash(EventData) |
+
+ Occurs when any aircraft crashes into the ground and is completely destroyed.
+ |
+
+
+ | BASE:OnEventEjection(EventData) |
+
+ Occurs when a pilot ejects from an aircraft
+initiator : The unit that has ejected
+ |
+
+
+ | BASE:OnEventEngineShutdown(EventData) |
+
+ Occurs when any aircraft shuts down its engines.
+ |
+
+
+ | BASE:OnEventEngineStartup(EventData) |
+
+ Occurs when any aircraft starts its engines.
+ |
+
+
+ | BASE:OnEventHit(EventData) |
+
+ Occurs whenever an object is hit by a weapon.
+ |
+
+
+ | BASE:OnEventHumanFailure(EventData) |
+
+ Occurs when any system fails on a human controlled aircraft.
+ |
+
+
+ | BASE:OnEventLand(EventData) |
+
+ Occurs when an aircraft lands at an airbase, farp or ship
+initiator : The unit that has landed
+place: Object that the unit landed on.
+ |
+
+
+ | BASE:OnEventMissionEnd(EventData) |
+
+ Occurs when a mission ends
+ |
+
+
+ | BASE:OnEventMissionStart(EventData) |
+
+ Occurs when a mission starts
+ |
+
+
+ | BASE:OnEventPilotDead(EventData) |
+
+ Occurs when the pilot of an aircraft is killed.
+ |
+
+
+ | BASE:OnEventPlayerEnterUnit(EventData) |
+
+ Occurs when any player assumes direct control of a unit.
+ |
+
+
+ | BASE:OnEventPlayerLeaveUnit(EventData) |
+
+ Occurs when any player relieves control of a unit to the AI.
+ |
+
+
+ | BASE:OnEventRefueling(EventData) |
+
+ Occurs when an aircraft connects with a tanker and begins taking on fuel.
+ |
+
+
+ | BASE:OnEventRefuelingStop(EventData) |
+
+ Occurs when an aircraft is finished taking fuel.
+ |
+
+
+ | BASE:OnEventShootingEnd(EventData) |
+
+ Occurs when any unit stops firing its weapon.
+ |
+
+
+ | BASE:OnEventShootingStart(EventData) |
+
+ Occurs when any unit begins firing a weapon that has a high rate of fire.
+ |
+
+
+ | BASE:OnEventShot(EventData) |
+
+ Occurs whenever any unit in a mission fires a weapon.
+ |
+
+
+ | BASE:OnEventTakeoff(EventData) |
+
+ Occurs when an aircraft takes off from an airbase, farp, or ship.
|
@@ -629,6 +603,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
Set trace on or off
Note that when trace is off, no debug statement is performed, increasing performance!
When Moose is loaded statically, (as one file), tracing is switched off by default.
+
+
+
+ | BASE:UnHandleEvent(Event) |
+
+ UnSubscribe to a DCS event.
|
@@ -718,37 +698,6 @@ When Moose is loaded statically, (as one file), tracing is switched off by defau
-
-
-BASE:AddEvent(Event, EventFunction)
-
-
--
-
-
Set a new listener for the class.
-
- Parameters
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
BASE.ClassID
@@ -886,24 +835,6 @@ The initiating object of the event.
-
-
-BASE:DisableEvents()
-
-
--
-
-
Disable the event listeners for the class.
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
BASE:E(Arguments)
@@ -929,26 +860,8 @@ A #table or any field.
-
-
-BASE:EnableEvents()
-
-
--
-
-
Enable the event listeners for the class.
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:Event()
+
+BASE:EventDispatcher()
-
@@ -960,627 +873,6 @@ A #table or any field.
Core.Event#EVENT:
-
-
-
--
-
-
-BASE:EventOnBaseCaptured(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTBASE_CAPTURED event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnBirth(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_BIRTH event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnCrash(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_CRASH event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnDead(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_DEAD event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEjection(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_EJECTION event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEngineShutdown(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTENGINE_SHUTDOWN event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnEngineStartup(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTENGINE_STARTUP event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnHit(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_HIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnHumanFailure(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTHUMAN_FAILURE event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnLand(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_LAND event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnMissionStart(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTMISSION_START event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPilotDead(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPILOT_DEAD event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-
--
-
-
Subscribe to a SEVENTPLAYER_COMMENT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerEnterUnit(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPLAYER_ENTER_UNIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerLeaveUnit(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTPLAYER_LEAVE_UNIT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnPlayerMissionEnd(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTMISSION_END event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnRefueling(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_REFUELING event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnRefuelingStop(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTREFUELING_STOP event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShootingEnd(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTSHOOTING_END event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShootingStart(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTSHOOTING_START event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnShot(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_SHOT event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnTakeOff(EventFunction)
-
-
--
-
-
Subscribe to a S_EVENT_TAKEOFF event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
-
-
-
--
-
-
-BASE:EventOnTookControl(EventFunction)
-
-
--
-
-
Subscribe to a SEVENTTOOK_CONTROL event.
-
- Parameter
-
- Return value
-
-#BASE:
-
-
@@ -1836,6 +1128,38 @@ The value to is stored in the Object.
The Value retrieved.
+
+
+
+-
+
+
+BASE:HandleEvent(Event, EventFunction)
+
+
+-
+
+
Subscribe to a DCS Event.
+
+ Parameters
+
+ Return value
+
+#BASE:
+
+
@@ -1908,6 +1232,533 @@ Child
-
+
+BASE:OnEvent(EventData)
+
+
+-
+
+
Occurs when an object is completely destroyed.
+
+
+initiator : The unit that is was destroyed.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventBaseCaptured(EventData)
+
+
+-
+
+
Occurs when a ground unit captures either an airbase or a farp.
+
+
+initiator : The unit that captured the base
+place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventBirth(EventData)
+
+
+-
+
+
Occurs when any object is spawned into the mission.
+
+
+initiator : The unit that was spawned
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventCrash(EventData)
+
+
+-
+
+
Occurs when any aircraft crashes into the ground and is completely destroyed.
+
+
+initiator : The unit that has crashed
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEjection(EventData)
+
+
+-
+
+
Occurs when a pilot ejects from an aircraft
+initiator : The unit that has ejected
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEngineShutdown(EventData)
+
+
+-
+
+
Occurs when any aircraft shuts down its engines.
+
+
+initiator : The unit that is stopping its engines.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventEngineStartup(EventData)
+
+
+-
+
+
Occurs when any aircraft starts its engines.
+
+
+initiator : The unit that is starting its engines.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventHit(EventData)
+
+
+-
+
+
Occurs whenever an object is hit by a weapon.
+
+
+initiator : The unit object the fired the weapon
+weapon: Weapon object that hit the target
+target: The Object that was hit.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventHumanFailure(EventData)
+
+
+-
+
+
Occurs when any system fails on a human controlled aircraft.
+
+
+initiator : The unit that had the failure
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventLand(EventData)
+
+
+-
+
+
Occurs when an aircraft lands at an airbase, farp or ship
+initiator : The unit that has landed
+place: Object that the unit landed on.
+
+
+Can be an Airbase Object, FARP, or Ships
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventMissionEnd(EventData)
+
+
+-
+
+
Occurs when a mission ends
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventMissionStart(EventData)
+
+
+-
+
+
Occurs when a mission starts
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPilotDead(EventData)
+
+
+-
+
+
Occurs when the pilot of an aircraft is killed.
+
+
+Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane.
+initiator : The unit that the pilot has died in.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPlayerEnterUnit(EventData)
+
+
+-
+
+
Occurs when any player assumes direct control of a unit.
+
+
+initiator : The unit that is being taken control of.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventPlayerLeaveUnit(EventData)
+
+
+-
+
+
Occurs when any player relieves control of a unit to the AI.
+
+
+initiator : The unit that the player left.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventRefueling(EventData)
+
+
+-
+
+
Occurs when an aircraft connects with a tanker and begins taking on fuel.
+
+
+initiator : The unit that is receiving fuel.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventRefuelingStop(EventData)
+
+
+-
+
+
Occurs when an aircraft is finished taking fuel.
+
+
+initiator : The unit that was receiving fuel.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShootingEnd(EventData)
+
+
+-
+
+
Occurs when any unit stops firing its weapon.
+
+
+Event will always correspond with a shooting start event.
+initiator : The unit that was doing the shooing.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShootingStart(EventData)
+
+
+-
+
+
Occurs when any unit begins firing a weapon that has a high rate of fire.
+
+
+Most common with aircraft cannons (GAU-8), autocannons, and machine guns.
+initiator : The unit that is doing the shooing.
+target: The unit that is being targeted.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventShot(EventData)
+
+
+-
+
+
Occurs whenever any unit in a mission fires a weapon.
+
+
+But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart.
+
+ Parameter
+
+
+
+
+-
+
+
+BASE:OnEventTakeoff(EventData)
+
+
+-
+
+
Occurs when an aircraft takes off from an airbase, farp, or ship.
+
+
+initiator : The unit that tookoff
+place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
+
+ Parameter
+
+
+
+
+-
+
BASE:SetEventPriority(EventPriority)
@@ -2200,6 +2051,32 @@ BASE:TraceOnOff( true )
-- Switch the tracing Off
BASE:TraceOnOff( false )
+
+
+
+-
+
+
+BASE:UnHandleEvent(Event)
+
+
+-
+
+
UnSubscribe to a DCS event.
+
+ Parameter
+
+ Return value
+
+#BASE:
+
+
diff --git a/docs/Documentation/Controllable.html b/docs/Documentation/Controllable.html
index c2a5442eb..c9540f79e 100644
--- a/docs/Documentation/Controllable.html
+++ b/docs/Documentation/Controllable.html
@@ -292,7 +292,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
- | CONTROLLABLE:EnRouteTaskEngageUnit(AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack) |
+ CONTROLLABLE:EnRouteTaskEngageUnit(EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack) |
(AIR) Attack the Unit.
|
@@ -1064,7 +1064,7 @@ The DCS task structure.
-CONTROLLABLE:EnRouteTaskEngageUnit(AttackUnit, Priority, WeaponType, WeaponExpend, AttackQty, Direction, AttackQtyLimit, ControllableAttack)
+CONTROLLABLE:EnRouteTaskEngageUnit(EngageUnit, Priority, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack)
@@ -1075,20 +1075,20 @@ The DCS task structure.
-
-
Wrapper.Unit#UNIT AttackUnit :
+
Wrapper.Unit#UNIT EngageUnit :
The UNIT.
-
#number Priority :
-All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
+(optional) All en-route tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.
-
-
#number WeaponType :
-(optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
+#boolean GroupAttack :
+(optional) If true, all units in the group will attack the Unit when found.
-
@@ -1111,8 +1111,14 @@ All en-route tasks have the priority parameter. This is a number (less value - h
-
-
#boolean AttackQtyLimit :
-(optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackControllable" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
+Dcs.DCSTypes#Distance Altitude :
+(optional) Desired altitude to perform the unit engagement.
+
+
+ -
+
+
#boolean Visible :
+(optional) Unit must be visible.
-
diff --git a/docs/Documentation/Event.html b/docs/Documentation/Event.html
index ff3d6630e..c37b270e2 100644
--- a/docs/Documentation/Event.html
+++ b/docs/Documentation/Event.html
@@ -71,10 +71,21 @@
Module Event
-
This module contains the EVENT class.
+
This module contains the EVENT class, which models the dispatching of DCS Events to subscribed MOOSE classes,
+following a given priority.
+
+
+

+
+
+
+
+ - This module contains the EVENT class.
+
+
Takes care of EVENT dispatching between DCS events and event handling functions defined in MOOSE classes.
@@ -95,6 +106,12 @@
EVENT |
+ |
+
+
+ | EVENTS |
+
+
|
@@ -125,7 +142,7 @@