From 20f8a98cf0e5e025aba292ac7efc110df128404d Mon Sep 17 00:00:00 2001 From: FlightControl Date: Tue, 7 Feb 2017 13:46:52 +0100 Subject: [PATCH] Event documentation --- docs/Documentation/AI_Cas.html | 255 +++- docs/Documentation/AI_Patrol.html | 22 +- docs/Documentation/Base.html | 1659 ++++++++++++-------------- docs/Documentation/Controllable.html | 22 +- docs/Documentation/Event.html | 86 +- docs/Documentation/Fsm.html | 56 +- docs/Documentation/Scheduler.html | 2 +- docs/Documentation/Spawn.html | 7 +- docs/Documentation/Unit.html | 70 ++ docs/Documentation/index.html | 3 +- 10 files changed, 1246 insertions(+), 936 deletions(-) diff --git a/docs/Documentation/AI_Cas.html b/docs/Documentation/AI_Cas.html index bae974427..a18c40a16 100644 --- a/docs/Documentation/AI_Cas.html +++ b/docs/Documentation/AI_Cas.html @@ -262,6 +262,36 @@ It can be notified to go RTB through the RTB event.

AI_CAS_ZONE:Engage()

Synchronous Event Trigger for Event Engage.

+ + + + AI_CAS_ZONE.EngageAltitude + + + + + + AI_CAS_ZONE.EngageAttackQty + + + + + + AI_CAS_ZONE.EngageDirection + + + + + + AI_CAS_ZONE.EngageSpeed + + + + + + AI_CAS_ZONE.EngageWeaponExpend + + @@ -301,7 +331,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To) + AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)

OnAfter Transition Handler for Event Engage.

@@ -331,7 +361,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To) + AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)

OnBefore Transition Handler for Event Engage.

@@ -415,7 +445,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To) + AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection) @@ -424,6 +454,12 @@ It can be notified to go RTB through the RTB event.

AI_CAS_ZONE:onafterStart(Controllable, From, Event, To)

onafter State Transition for Event Start.

+ + + + AI_CAS_ZONE:onafterTarget(Controllable, From, Event, To) + + @@ -569,6 +605,74 @@ It can be notified to go RTB through the RTB event.

Synchronous Event Trigger for Event Engage.

+ + +
+
+ + +AI_CAS_ZONE.EngageAltitude + +
+
+ + + +
+
+
+
+ + + +AI_CAS_ZONE.EngageAttackQty + +
+
+ + + +
+
+
+
+ + + +AI_CAS_ZONE.EngageDirection + +
+
+ + + +
+
+
+
+ + +AI_CAS_ZONE.EngageSpeed + +
+
+ + + +
+
+
+
+ + + +AI_CAS_ZONE.EngageWeaponExpend + +
+
+ + +
@@ -784,7 +888,7 @@ The To State string.

-AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To) +AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
@@ -816,6 +920,36 @@ The Event string.

#string To : The To State string.

+ +
  • + +

    #number EngageSpeed : +(optional) The speed the Group will hold when engaging to the target zone.

    + +
  • +
  • + +

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : +(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

    + +
  • +
  • + +

    Dcs.DCSTypes#Distance EngageAltitude : +(optional) Desired altitude to perform the unit engagement.

    + +
  • +
  • + +

    #number EngageAttackQty : +(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.

    + +
  • +
  • + +

    Dcs.DCSTypes#Azimuth EngageDirection : +(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.

    +
  • @@ -999,7 +1133,7 @@ Return false to cancel Transition.

    -AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To) +AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
    @@ -1032,12 +1166,37 @@ The Event string.

    The To State string.

    - -

    Return value

    +
  • -

    #boolean: -Return false to cancel Transition.

    +

    #number EngageSpeed : +(optional) The speed the Group will hold when engaging to the target zone.

    +
  • +
  • + +

    Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : +(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

    + +
  • +
  • + +

    Dcs.DCSTypes#Distance EngageAltitude : +(optional) Desired altitude to perform the unit engagement.

    + +
  • +
  • + +

    #number EngageAttackQty : +(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.

    + +
  • +
  • + +

    Dcs.DCSTypes#Azimuth EngageDirection : +(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.

    + +
  • +
    @@ -1434,13 +1593,83 @@ The To State string.

    -AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To) +AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)
    +

    Parameters

    +
      +
    • + +

      Wrapper.Controllable#CONTROLLABLE Controllable : +The Controllable Object managed by the FSM.

      + +
    • +
    • + +

      #string From : +The From State string.

      + +
    • +
    • + +

      #string Event : +The Event string.

      + +
    • +
    • + +

      #string To : +The To State string.

      + +
    • +
    • + +

      #number EngageSpeed : +(optional) The speed the Group will hold when engaging to the target zone.

      + +
    • +
    • + +

      Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend : +(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.

      + +
    • +
    • + +

      Dcs.DCSTypes#Distance EngageAltitude : +(optional) Desired altitude to perform the unit engagement.

      + +
    • +
    • + +

      #number EngageAttackQty : +(optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.

      + +
    • +
    • + +

      Dcs.DCSTypes#Azimuth EngageDirection : +(optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.

      + +
    • +
    +
    +
    +
    +
    + + +AI_CAS_ZONE:onafterStart(Controllable, From, Event, To) + +
    +
    + +

    onafter State Transition for Event Start.

    +

    Parameters

    diff --git a/docs/Documentation/Base.html b/docs/Documentation/Base.html index f57d62e02..39c311970 100644 --- a/docs/Documentation/Base.html +++ b/docs/Documentation/Base.html @@ -139,59 +139,54 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l

    1.3 DCS simulator Event Handling

    The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator, -and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently. -Therefore, the BASE class exposes the following event handling functions:

    +and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.

    + +

    1.3.1 Subscribe / Unsubscribe to DCS Events

    + +

    At first, the mission designer will need to Subscribe to a specific DCS event for the class. +So, when the DCS event occurs, the class will be notified of that event. +There are two functions which you use to subscribe to or unsubscribe from an event.

    -

    The EventOn() methods provide the Event#EVENTDATA structure to the event handling function. -The Event#EVENTDATA structure contains an enriched data set of information about the event being handled.

    +

    1.3.2 Event Handling of DCS Events

    -

    Find below an example of the prototype how to write an event handling function:

    +

    Once the class is subscribed to the event, an Event Handling method on the object or class needs to be written that will be called +when the DCS event occurs. The Event Handling method receives an Event#EVENTDATA structure, which contains a lot of information +about the event that occurred.

    -
     CommandCenter:EventOnPlayerEnterUnit(
    -   --- @param #COMMANDCENTER self
    -   -- @param Core.Event#EVENTDATA EventData
    -   function( self, EventData )
    -     local PlayerUnit = EventData.IniUnit
    -     for MissionID, Mission in pairs( self:GetMissions() ) do
    -       local Mission = Mission -- Tasking.Mission#MISSION
    -       Mission:JoinUnit( PlayerUnit )
    -       Mission:ReportDetails()
    -     end
    -   end
    -   )
    +

    Find below an example of the prototype how to write an event handling function for two units:

    + +
     local Tank1 = UNIT:FindByName( "Tank A" )
    + local Tank2 = UNIT:FindByName( "Tank B" )
    +
    + -- Here we subscribe to the Dead events. So, if one of these tanks dies, the Tank1 or Tank2 objects will be notified.
    + Tank1:HandleEvent( EVENTS.Dead )
    + Tank2:HandleEvent( EVENTS.Dead )
    +
    + --- This function is an Event Handling function that will be called when Tank1 is Dead.
    + -- @param Wrapper.Unit#UNIT self 
    + -- @param Core.Event#EVENTDATA EventData
    + function Tank1:OnEventDead( EventData )
    +
    +   self:SmokeGreen()
    + end
    +
    + --- This function is an Event Handling function that will be called when Tank2 is Dead.
    + -- @param Wrapper.Unit#UNIT self 
    + -- @param Core.Event#EVENTDATA EventData
    + function Tank2:OnEventDead( EventData )
    +
    +   self:SmokeBlue()
    + end
     
    -

    Note the function( self, EventData ). It takes two parameters:

    -
      -
    • self = the object that is handling the EventOnPlayerEnterUnit.
    • -
    • EventData = the Event#EVENTDATA structure, containing more information of the Event.
    • -
    + +

    See the Event module for more information about event handling.

    1.4) Class identification methods

    @@ -276,12 +271,6 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    Type BASE

    - - - - - - - - @@ -330,153 +313,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -543,6 +382,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    + + + + @@ -561,6 +406,135 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -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.

    + + + + + @@ -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

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnBirth(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_BIRTH event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnCrash(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_CRASH event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnDead(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_DEAD event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnEjection(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_EJECTION event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnEngineShutdown(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTENGINE_SHUTDOWN event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnEngineStartup(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTENGINE_STARTUP event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnHit(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_HIT event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnHumanFailure(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTHUMAN_FAILURE event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnLand(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_LAND event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnMissionStart(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTMISSION_START event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnPilotDead(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTPILOT_DEAD event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnPlayerComment(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTPLAYER_COMMENT event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnPlayerEnterUnit(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTPLAYER_ENTER_UNIT event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnPlayerLeaveUnit(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTPLAYER_LEAVE_UNIT event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnPlayerMissionEnd(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTMISSION_END event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnRefueling(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_REFUELING event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnRefuelingStop(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTREFUELING_STOP event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnShootingEnd(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTSHOOTING_END event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnShootingStart(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTSHOOTING_START event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnShot(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_SHOT event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnTakeOff(EventFunction) - -
    -
    - -

    Subscribe to a S_EVENT_TAKEOFF event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    Return value

    - -

    #BASE:

    - - -
    -
    -
    -
    - - -BASE:EventOnTookControl(EventFunction) - -
    -
    - -

    Subscribe to a SEVENTTOOK_CONTROL event.

    - -

    Parameter

    -
      -
    • - -

      #function EventFunction : -The function to be called when the event occurs for the unit.

      - -
    • -
    -

    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

    +
      +
    • + +

      Core.Event#EVENTS Event :

      + +
    • +
    • + +

      #function EventFunction : +(optional) The function to be called when the event occurs for the unit.

      + +
    • +
    +

    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
    - + @@ -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.

      +

      + +

      Banner Image

      + +
      + +
        +
      • 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 @@
    + + + +
    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.

    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.

    BASE:GetState(Object, Key, Value)

    Get a Value given a Key from the Object.

    +
    BASE:HandleEvent(Event, EventFunction) +

    Subscribe to a DCS Event.

    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.

    BASE:UnHandleEvent(Event) +

    UnSubscribe to a DCS event.

    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.

    EVENT +
    EVENTS +
    @@ -125,7 +142,7 @@ - EVENT:Init(EventID, EventPriority, EventClass) + EVENT:Init(EventID, EventClass)

    Initializes the Events structure for the event

    @@ -380,6 +397,12 @@ EVENT:RemoveAll(EventObject)

    Clears all event subscriptions for a Base#BASE derived object.

    + + + + EVENT:RemoveForUnit(EventClass, EventID, UnitName) + +

    Removes an Events entry for a Unit

    @@ -537,6 +560,20 @@ + +
    +
    +
    + + + +EVENTS + +
    +
    + + +

    Type Event

    @@ -613,7 +650,7 @@
    -EVENT:Init(EventID, EventPriority, EventClass) +EVENT:Init(EventID, EventClass)
    @@ -629,12 +666,6 @@
  • -

    #number EventPriority : -The priority of the EventClass.

    - -
  • -
  • -

    Core.Base#BASE EventClass :

  • @@ -2006,6 +2037,43 @@ The self instance of the class for which the event is.

    + +EVENT:RemoveForUnit(EventClass, EventID, UnitName) + +
    +
    + +

    Removes an Events entry for a Unit

    + +

    Parameters

    + +

    Return value

    + +

    #EVENT.Events:

    + + +
    +
    +
    +
    + EVENT:onEvent(Event) diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html index 712e2566e..3ef15c2df 100644 --- a/docs/Documentation/Fsm.html +++ b/docs/Documentation/Fsm.html @@ -571,6 +571,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    FSM._EndStates + + + + FSM._EventSchedules + + @@ -604,7 +610,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    - FSM:_call_handler(handler, params) + FSM:_call_handler(handler, params, EventName) @@ -728,7 +734,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    - FSM_CONTROLLABLE:_call_handler(handler, params) + FSM_CONTROLLABLE:_call_handler(handler, params, EventName) @@ -856,7 +862,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    - FSM_SET:_call_handler(handler, params) + FSM_SET:_call_handler(handler, params, EventName) @@ -884,7 +890,7 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    - FSM_TASK:_call_handler(handler, params) + FSM_TASK:_call_handler(handler, params, EventName) @@ -1452,6 +1458,20 @@ A string defining the start state.

    +
    + +
    +
    + + + +FSM._EventSchedules + +
    +
    + + +
    @@ -1540,7 +1560,7 @@ A string defining the start state.

    -FSM:_call_handler(handler, params) +FSM:_call_handler(handler, params, EventName)
    @@ -1558,6 +1578,11 @@ A string defining the start state.

    params :

    + +
  • + +

    EventName :

    +
  • @@ -1967,7 +1992,7 @@ Finite State Machine Table

    -FSM_CONTROLLABLE:_call_handler(handler, params) +FSM_CONTROLLABLE:_call_handler(handler, params, EventName)
    @@ -1985,6 +2010,11 @@ Finite State Machine Table

    params :

    + +
  • + +

    EventName :

    +
  • @@ -2436,7 +2466,7 @@ FSMSet (optional) The Set object that the FSM_SET governs.

    -FSM_SET:_call_handler(handler, params) +FSM_SET:_call_handler(handler, params, EventName)
    @@ -2454,6 +2484,11 @@ FSMSet (optional) The Set object that the FSM_SET governs.

    params :

    + +
  • + +

    EventName :

    +
  • @@ -2532,7 +2567,7 @@ FSMSet (optional) The Set object that the FSM_SET governs.

    -FSM_TASK:_call_handler(handler, params) +FSM_TASK:_call_handler(handler, params, EventName)
    @@ -2550,6 +2585,11 @@ FSMSet (optional) The Set object that the FSM_SET governs.

    params :

    + +
  • + +

    EventName :

    +
  • diff --git a/docs/Documentation/Scheduler.html b/docs/Documentation/Scheduler.html index 4d8e5962b..e4d0d899f 100644 --- a/docs/Documentation/Scheduler.html +++ b/docs/Documentation/Scheduler.html @@ -290,7 +290,7 @@ Specifies the amount of seconds when the scheduler will be stopped.

  • #SCHEDULER: -self

    +self.

  • diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index ddcc34cd2..5237d7f0e 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -1758,6 +1758,9 @@ The group that was spawned. You can use this group for further actions.

    + +

    Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

    +
  • @@ -2528,7 +2531,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
    - + #boolean SPAWN.SpawnUnControlled @@ -2552,7 +2555,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 ) -

    Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.

    +

    When the first Spawn executes, all the Groups need to be made visible before start.

    diff --git a/docs/Documentation/Unit.html b/docs/Documentation/Unit.html index d1f39c968..7a731ad48 100644 --- a/docs/Documentation/Unit.html +++ b/docs/Documentation/Unit.html @@ -289,6 +289,12 @@ If you want to obtain the complete 3D position including ori� UNIT:GetUnits()

    Returns the UNIT in a UNIT list of one element.

    + + + + UNIT:HandleEvent(Event, EventFunction) + +

    Subscribe to a DCS Event.

    @@ -409,6 +415,12 @@ If you want to obtain the complete 3D position including ori� UNIT:SmokeWhite()

    Smoke the UNIT White.

    + + + + UNIT:UnHandleEvent(Event) + +

    UnSubscribe to a DCS event.

    @@ -1024,6 +1036,38 @@ The DCS Unit is not existing or alive.

    #list: Wrapper.Unit#UNIT> The UNITs wrappers.

    + +
    +
    +
    + + +UNIT:HandleEvent(Event, EventFunction) + +
    +
    + +

    Subscribe to a DCS Event.

    + +

    Parameters

    +
      +
    • + +

      Core.Event#EVENTS Event :

      + +
    • +
    • + +

      #function EventFunction : +(optional) The function to be called when the event occurs for the unit.

      + +
    • +
    +

    Return value

    + +

    #UNIT:

    + +
    @@ -1505,6 +1549,32 @@ The name of the DCS unit.

    Smoke the UNIT White.

    + +
    +
    +
    + + +UNIT:UnHandleEvent(Event) + +
    +
    + +

    UnSubscribe to a DCS event.

    + +

    Parameter

    + +

    Return value

    + +

    #UNIT:

    + +
    diff --git a/docs/Documentation/index.html b/docs/Documentation/index.html index 19605f3fe..b9f027a75 100644 --- a/docs/Documentation/index.html +++ b/docs/Documentation/index.html @@ -231,7 +231,8 @@ and automatically engage any airborne enemies that are within a certain range or 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.