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:
FlightControl 2017-03-09 10:38:55 +01:00
commit 5d6ac9419f
62 changed files with 68048 additions and 292 deletions

2
.gitignore vendored
View File

@ -19,8 +19,6 @@ local.properties
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\Program Files\lua\5.1\bin\luadocumentor.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;Moose\Core\*.lua&quot; &quot;Moose\Wrapper\*.lua&quot; &quot;Moose\Actions\*.lua&quot; &quot;Moose\Functional\*.lua&quot; &quot;Moose\Tasking\*.lua&quot; &quot;Moose\Utilities\*.lua&quot; &quot;Moose\AI\*.lua&quot; --dir &quot;${project_loc:}/docs/Documentation&quot; --style &quot;${project_loc:}/docs/Stylesheet/stylesheet.css&quot;"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Development"/>
</launchConfiguration>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup\Moose_Create.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;${project_loc:}/Moose Development&quot; &quot;${current_date}&quot; &quot;${project_loc:}/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT&quot; &quot;D&quot;"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup"/>
</launchConfiguration>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup\Moose_Create.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;${project_loc:}/Moose Development/Moose&quot; &quot;${current_date}&quot; &quot;${project_loc:}/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT&quot; &quot;S&quot;"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup"/>
</launchConfiguration>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;${project_loc:}&quot;/Moose Test Missions"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
</launchConfiguration>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc:}/Moose Mission Setup/Moose Mission Update\Moose_Update_Missions.bat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="&quot;${selected_resource_loc}&quot;"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc:}/Moose Mission Setup/Moose Mission Update"/>
</launchConfiguration>

View File

@ -492,7 +492,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageSpeed,
true
)
ToTargetPointVec3:SmokeBlue()
--ToTargetPointVec3:SmokeBlue()
EngageRoute[#EngageRoute+1] = ToTargetRoutePoint

View File

@ -50,11 +50,14 @@
--
-- * **None** ( Group ): The process is not started yet.
-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone.
-- * **Returning** ( Group ): The AI is returning to Base..
-- * **Returning** ( Group ): The AI is returning to Base.
-- * **Stopped** ( Group ): The process is stopped.
-- * **Crashed** ( Group ): The AI has crashed or is dead.
--
-- ### 1.2.2) AI_PATROL_ZONE Events
--
-- * **Start** ( Group ): Start the process.
-- * **Stop** ( Group ): Stop the process.
-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
-- * **RTB** ( Group ): Route the AI to the home base.
-- * **Detect** ( Group ): The AI is detecting targets.
@ -201,6 +204,51 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
self:SetStartState( "None" )
self:AddTransition( "*", "Stop", "Stopped" )
--- OnLeave Transition Handler for State Stopped.
-- @function [parent=#AI_PATROL_ZONE] OnLeaveStopped
-- @param #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter Transition Handler for State Stopped.
-- @function [parent=#AI_PATROL_ZONE] OnEnterStopped
-- @param #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- OnBefore Transition Handler for Event Stop.
-- @function [parent=#AI_PATROL_ZONE] OnBeforeStop
-- @param #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Stop.
-- @function [parent=#AI_PATROL_ZONE] OnAfterStop
-- @param #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Stop.
-- @function [parent=#AI_PATROL_ZONE] Stop
-- @param #AI_PATROL_ZONE self
--- Asynchronous Event Trigger for Event Stop.
-- @function [parent=#AI_PATROL_ZONE] __Stop
-- @param #AI_PATROL_ZONE self
-- @param #number Delay The delay in seconds.
self:AddTransition( "None", "Start", "Patrolling" )
--- OnBefore Transition Handler for Event Start.

View File

@ -1,34 +1,66 @@
--- This module contains the BASE class.
--- **Core** - BASE forms **the basis of the MOOSE framework**. Each class within the MOOSE framework derives from BASE.
--
-- 1) @{#BASE} class
-- =================
-- The @{#BASE} class is the super class for all the classes defined within MOOSE.
-- ![Banner Image](..\Presentations\BASE\Dia1.JPG)
--
-- It handles:
-- ===
--
-- * The construction and inheritance of child classes.
-- * The tracing of objects during mission execution within the **DCS.log** file, under the **"Saved Games\DCS\Logs"** folder.
-- # 1) @{#BASE} class
--
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
-- All classes within the MOOSE framework are derived from the @{#BASE} class.
--
-- BASE provides facilities for :
--
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
--
-- Note: The BASE class is an abstract class and is not meant to be used directly.
--
-- ## 1.1) BASE constructor
--
-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
-- Any class derived from BASE, will use the @{Base#BASE.New} constructor embedded in the @{Base#BASE.Inherit} method.
-- See an example at the @{Base#BASE.New} method how this is done.
--
-- ## 1.2) BASE Trace functionality
-- ## 1.2) Trace information for debugging
--
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
-- These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution.
--
-- ### 1.2.1) Tracing functions
-- Any type of information can be passed to these tracing methods. See the following examples:
--
-- self:E( "Hello" )
--
-- Result in the word "Hello" in the dcs.log.
--
-- local Array = { 1, nil, "h", { "a","b" }, "x" }
-- self:E( Array )
--
-- Results with the text [1]=1,[3]="h",[4]={[1]="a",[2]="b"},[5]="x"} in the dcs.log.
--
-- local Object1 = "Object1"
-- local Object2 = 3
-- local Object3 = { Object 1, Object 2 }
-- self:E( { Object1, Object2, Object3 } )
--
-- Results with the text [1]={[1]="Object",[2]=3,[3]={[1]="Object",[2]=3}} in the dcs.log.
--
-- local SpawnObject = SPAWN:New( "Plane" )
-- local GroupObject = GROUP:FindByName( "Group" )
-- self:E( { Spawn = SpawnObject, Group = GroupObject } )
--
-- Results with the text [1]={Spawn={....),Group={...}} in the dcs.log.
--
-- Below a more detailed explanation of the different method types for tracing.
--
-- ### 1.2.1) Tracing methods categories
--
-- There are basically 3 types of tracing methods available within BASE:
-- There are basically 3 types of tracing methods available:
--
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
-- * @{#BASE.F}: Used to trace the entrance of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
-- * @{#BASE.T}: Used to trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Used to always trace information giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file.
--
-- ### 1.2.2) Tracing levels
--
@ -51,6 +83,7 @@
-- * Activate only the tracing of a certain class (name) through the @{#BASE.TraceClass}() method.
-- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method.
-- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method.
--
-- ### 1.2.4) Check if tracing is on.
--
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
@ -64,7 +97,7 @@
--
-- 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.
-- There are two methods which you use to subscribe to or unsubscribe from an event.
--
-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
@ -114,10 +147,12 @@
--
-- ## 1.5) All objects derived from BASE can have "States"
--
-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**.
-- States are essentially properties of objects, which are identified by a **Key** and a **Value**.
-- The method @{#BASE.SetState}() can be used to set a Value with a reference Key to the object.
-- To **read or retrieve** a state Value based on a Key, use the @{#BASE.GetState} method.
-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**.
-- States are essentially properties of objects, which are identified by a **Key** and a **Value**.
--
-- The method @{#BASE.SetState}() can be used to set a Value with a reference Key to the object.
-- To **read or retrieve** a state Value based on a Key, use the @{#BASE.GetState} method.
--
-- These two methods provide a very handy way to keep state at long lasting processes.
-- Values can be stored within the objects, and later retrieved or changed when needed.
-- There is one other important thing to note, the @{#BASE.SetState}() and @{#BASE.GetState} methods
@ -125,9 +160,9 @@
-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same
-- object name to the method.
--
-- ## 1.10) BASE Inheritance (tree) support
-- ## 1.10) Inheritance
--
-- The following methods are available to support inheritance:
-- The following methods are available to implement inheritance
--
-- * @{#BASE.Inherit}: Inherits from a class.
-- * @{#BASE.GetParent}: Returns the parent object from the object it is handling, or nil if there is no parent object.
@ -192,7 +227,17 @@ FORMATION = {
-- @todo need to investigate if the deepCopy is really needed... Don't think so.
--- BASE constructor.
--
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
--
-- function EVENT:New()
-- local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
-- return self
-- end
--
-- @param #BASE self
-- @return #BASE
function BASE:New()
local self = routines.utils.deepCopy( self ) -- Create a new self instance
local MetaTable = {}
@ -253,7 +298,12 @@ function BASE:Inherit( Child, Parent )
return Child
end
--- This is the worker method to retrieve the Parent class.
--- This is the worker method to retrieve the Parent class.
-- Note that the Parent class must be passed to call the parent class method.
--
-- self:GetParent(self):ParentMethod()
--
--
-- @param #BASE self
-- @param #BASE Child is the Child class from which the Parent class needs to be retrieved.
-- @return #BASE

View File

@ -1,5 +1,4 @@
--- This core module models the dispatching of DCS Events to subscribed MOOSE classes,
-- following a given priority.
--- **Core** - EVENT models DCS **event dispatching** using a **publish-subscribe** model.
--
-- ![Banner Image](..\Presentations\EVENT\Dia1.JPG)
--
@ -64,6 +63,13 @@
--
-- * @{Base#BASE.HandleEvent}(): Subscribe to a DCS Event.
-- * @{Base#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
--
-- Note that for a UNIT, the event will be handled **for that UNIT only**!
-- Note that for a GROUP, the event will be handled **for all the UNITs in that GROUP only**!
--
-- For all objects of other classes, the subscribed events will be handled for **all UNITs within the Mission**!
-- So if a UNIT within the mission has the subscribed event for that object,
-- then the object event handler will receive the event for that UNIT!
--
-- ### 1.3.2 Event Handling of DCS Events
--
@ -165,7 +171,9 @@
--
-- Hereby the change log:
--
-- * 2016-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.
-- * 2017-03-07: Added the correct event dispatching in case the event is subscribed by a GROUP.
--
-- * 2017-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.
--
-- ===
--
@ -179,10 +187,6 @@
--
-- @module Event
-- TODO: Need to update the EVENTDATA documentation with IniPlayerName and TgtPlayerName
-- TODO: Need to update the EVENTDATA documentation with IniObjectCategory and TgtObjectCategory
--- The EVENT structure
-- @type EVENT
@ -443,8 +447,9 @@ function EVENT:Remove( EventClass, EventID )
self.Events[EventID][EventPriority][EventClass] = nil
end
--- Removes an Events entry for a Unit
--- Removes an Events entry for a UNIT.
-- @param #EVENT self
-- @param #string UnitName The name of the UNIT.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
@ -454,7 +459,22 @@ function EVENT:RemoveForUnit( UnitName, EventClass, EventID )
local EventClass = EventClass
local EventPriority = EventClass:GetEventPriority()
local Event = self.Events[EventID][EventPriority][EventClass]
Event.IniUnit[UnitName] = nil
Event.EventUnit[UnitName] = nil
end
--- Removes an Events entry for a GROUP.
-- @param #EVENT self
-- @param #string GroupName The name of the GROUP.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param Dcs.DCSWorld#world.event EventID
-- @return #EVENT.Events
function EVENT:RemoveForGroup( GroupName, EventClass, EventID )
self:F3( { EventClass, _EVENTMETA[EventID].Text } )
local EventClass = EventClass
local EventPriority = EventClass:GetEventPriority()
local Event = self.Events[EventID][EventPriority][EventClass]
Event.EventGroup[GroupName] = nil
end
--- Clears all event subscriptions for a @{Base#BASE} derived object.
@ -505,23 +525,43 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
end
--- Set a new listener for an S_EVENT_X event
--- Set a new listener for an S_EVENT_X event for a UNIT.
-- @param #EVENT self
-- @param #string EventDCSUnitName
-- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @param #string UnitName The name of the UNIT.
-- @param #function EventFunction The function to be called when the event occurs for the GROUP.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param EventID
-- @return #EVENT
function EVENT:OnEventForUnit( EventDCSUnitName, EventFunction, EventClass, EventID )
self:F2( EventDCSUnitName )
function EVENT:OnEventForUnit( UnitName, EventFunction, EventClass, EventID )
self:F2( UnitName )
local Event = self:Init( EventID, EventClass )
if not Event.IniUnit then
Event.IniUnit = {}
if not Event.EventUnit then
Event.EventUnit = {}
end
Event.IniUnit[EventDCSUnitName] = {}
Event.IniUnit[EventDCSUnitName].EventFunction = EventFunction
Event.IniUnit[EventDCSUnitName].EventClass = EventClass
Event.EventUnit[UnitName] = {}
Event.EventUnit[UnitName].EventFunction = EventFunction
Event.EventUnit[UnitName].EventClass = EventClass
return self
end
--- Set a new listener for an S_EVENT_X event for a GROUP.
-- @param #EVENT self
-- @param #string GroupName The name of the GROUP.
-- @param #function EventFunction The function to be called when the event occurs for the GROUP.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param EventID
-- @return #EVENT
function EVENT:OnEventForGroup( GroupName, EventFunction, EventClass, EventID )
self:F2( GroupName )
local Event = self:Init( EventID, EventClass )
if not Event.EventGroup then
Event.EventGroup = {}
end
Event.EventGroup[GroupName] = {}
Event.EventGroup[GroupName].EventFunction = EventFunction
Event.EventGroup[GroupName].EventClass = EventClass
return self
end
@ -668,7 +708,9 @@ function EVENT:onEvent( Event )
if Event.IniDCSGroup and Event.IniDCSGroup:isExist() then
Event.IniDCSGroupName = Event.IniDCSGroup:getName()
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
self:E( { IniGroup = Event.IniGroup } )
if Event.IniGroup then
Event.IniGroupName = Event.IniDCSGroupName
end
end
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
@ -709,6 +751,10 @@ function EVENT:onEvent( Event )
Event.TgtDCSGroupName = ""
if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then
Event.TgtDCSGroupName = Event.TgtDCSGroup:getName()
Event.TgtGroup = GROUP:FindByName( Event.TgtDCSGroupName )
if Event.TgtGroup then
Event.TgtGroupName = Event.TgtDCSGroupName
end
end
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
@ -756,73 +802,140 @@ function EVENT:onEvent( Event )
-- Okay, we got the event from DCS. Now loop the SORTED self.EventSorted[] table for the received Event.id, and for each EventData registered, check if a function needs to be called.
for EventClass, EventData in pairs( self.Events[Event.id][EventPriority] ) do
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
Event.TgtGroup = GROUP:FindByName( Event.TgtDCSGroupName )
-- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT.
if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then
if ( Event.IniDCSUnitName and EventData.EventUnit and EventData.EventUnit[Event.IniDCSUnitName] ) or
( Event.TgtDCSUnitName and EventData.EventUnit and EventData.EventUnit[Event.TgtDCSUnitName] ) then
-- First test if a EventFunction is Set, otherwise search for the default function
if EventData.IniUnit[Event.IniDCSUnitName].EventFunction then
self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
local Result, Value = xpcall(
function()
return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventClass, Event )
end, ErrorHandler )
if EventData.EventUnit[Event.IniDCSUnitName] then
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
-- First test if a EventFunction is Set, otherwise search for the default function
if EventData.EventUnit[Event.IniDCSUnitName].EventFunction then
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
self:E( { "Calling EventFunction for UNIT ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
end
local Result, Value = xpcall(
function()
return EventData.EventUnit[Event.IniDCSUnitName].EventFunction( EventClass, Event )
end, ErrorHandler )
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
end
local Result, Value = xpcall(
function()
return EventFunction( EventClass, Event )
end, ErrorHandler )
end
end
end
if EventData.EventUnit[Event.TgtDCSUnitName] then
-- First test if a EventFunction is Set, otherwise search for the default function
if EventData.EventUnit[Event.TgtDCSUnitName].EventFunction then
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling EventFunction for UNIT ", EventClass:GetClassNameAndID(), ", Unit ", Event.TgtUnitName, EventPriority } )
end
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
local Result, Value = xpcall(
function()
return EventFunction( EventClass, Event )
return EventData.EventUnit[Event.TgtDCSUnitName].EventFunction( EventClass, Event )
end, ErrorHandler )
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
end
local Result, Value = xpcall(
function()
return EventFunction( EventClass, Event )
end, ErrorHandler )
end
end
end
else
-- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
-- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
if Event.IniDCSUnit and not EventData.IniUnit then
if EventClass == EventData.EventClass then
-- If the EventData is for a GROUP, the call directly the EventClass EventFunction for the UNIT in that GROUP.
if ( Event.IniDCSUnitName and Event.IniDCSGroupName and Event.IniGroupName and EventData.EventGroup and EventData.EventGroup[Event.IniGroupName] ) or
( Event.TgtDCSUnitName and Event.TgtDCSGroupName and Event.TgtGroupName and EventData.EventGroup and EventData.EventGroup[Event.TgtGroupName] ) then
if EventData.EventGroup[Event.IniGroupName] then
-- First test if a EventFunction is Set, otherwise search for the default function
if EventData.EventFunction then
-- There is an EventFunction defined, so call the EventFunction.
if EventData.EventGroup[Event.IniGroupName].EventFunction then
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), EventPriority } )
self:E( { "Calling EventFunction for GROUP ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } )
end
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
local Result, Value = xpcall(
function()
return EventData.EventFunction( EventClass, Event )
return EventData.EventGroup[Event.IniGroupName].EventFunction( EventClass, Event )
end, ErrorHandler )
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for GROUP ", EventClass:GetClassNameAndID(), EventPriority } )
end
local Result, Value = xpcall(
function()
return EventFunction( EventClass, Event )
end, ErrorHandler )
end
end
end
if EventData.EventGroup[Event.TgtGroupName] then
if EventData.EventGroup[Event.TgtGroupName].EventFunction then
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling EventFunction for GROUP ", EventClass:GetClassNameAndID(), ", Unit ", Event.TgtUnitName, EventPriority } )
end
local Result, Value = xpcall(
function()
return EventData.EventGroup[Event.TgtGroupName].EventFunction( EventClass, Event )
end, ErrorHandler )
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for GROUP ", EventClass:GetClassNameAndID(), EventPriority } )
end
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
local Result, Value = xpcall(
function()
@ -831,6 +944,45 @@ function EVENT:onEvent( Event )
end
end
end
else
-- If the EventData is not bound to a specific unit, then call the EventClass EventFunction.
-- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon.
if Event.IniDCSUnit and not EventData.EventUnit then
if EventClass == EventData.EventClass then
-- First test if a EventFunction is Set, otherwise search for the default function
if EventData.EventFunction then
-- There is an EventFunction defined, so call the EventFunction.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), EventPriority } )
end
local Result, Value = xpcall(
function()
return EventData.EventFunction( EventClass, Event )
end, ErrorHandler )
else
-- There is no EventFunction defined, so try to find if a default OnEvent function is defined on the object.
local EventFunction = EventClass[ _EVENTMETA[Event.id].Event ]
if EventFunction and type( EventFunction ) == "function" then
-- Now call the default event function.
if Event.IniObjectCategory ~= 3 then
self:E( { "Calling " .. _EVENTMETA[Event.id].Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } )
end
local Result, Value = xpcall(
function()
return EventFunction( EventClass, Event )
end, ErrorHandler )
end
end
end
end
end
end
end

View File

@ -1,5 +1,5 @@
--- This module contains the **FSM** (**F**inite **S**tate **M**achine) class and derived **FSM\_** classes.
-- ## Finite State Machines (FSM) are design patterns allowing efficient (long-lasting) processes and workflows.
--- **Core** - The **FSM** (**F**inite **S**tate **M**achine) class and derived **FSM\_** classes
-- are design patterns allowing efficient (long-lasting) processes and workflows.
--
-- ![Banner Image](..\Presentations\FSM\Dia1.JPG)
--

View File

@ -1,4 +1,4 @@
--- This module contains the MENU classes.
--- **Core** -- MENU_ classes model the definition of **hierarchical menu structures** and **commands for players** within a mission.
--
-- ===
--

View File

@ -1,26 +1,40 @@
--- This module contains the MESSAGE class.
--- **Core** - MESSAGE class takes are of the **real-time notifications** and **messages to players** during a simulation.
--
-- ![Banner Image](..\Presentations\MESSAGE\Dia1.JPG)
--
-- ===
--
-- # 1) @{Message#MESSAGE} class, extends @{Base#BASE}
--
-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
-- =================================================
-- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
-- Messages can contain a category which is indicating the category of the message.
--
-- 1.1) MESSAGE construction methods
-- ---------------------------------
-- ## 1.1) MESSAGE construction
--
-- Messages are created with @{Message#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
-- 1.2) Send messages with MESSAGE To methods
-- ------------------------------------------
-- Messages are sent to:
-- ## 1.2) Send messages to an audience
--
-- Messages are sent:
--
-- * Clients with @{Message#MESSAGE.ToClient}.
-- * Coalitions with @{Message#MESSAGE.ToCoalition}.
-- * All Players with @{Message#MESSAGE.ToAll}.
-- * To a @{Client} using @{Message#MESSAGE.ToClient}().
-- * To a @{Group} using @{Message#MESSAGE.ToGroup}()
-- * To a coalition using @{Message#MESSAGE.ToCoalition}().
-- * To the red coalition using @{Message#MESSAGE.ToRed}().
-- * To the blue coalition using @{Message#MESSAGE.ToBlue}().
-- * To all Players using @{Message#MESSAGE.ToAll}().
--
-- ## 1.3) Send conditionally to an audience
--
-- Messages can be sent conditionally to an audience (when a condition is true):
--
-- * To all players using @{Message#MESSAGE.ToAllIf}().
-- * To a coalition using @{Message#MESSAGE.ToCoalitionIf}().
--
--
-- @module Message
-- @author FlightControl
--- The MESSAGE class
-- @type MESSAGE
@ -229,80 +243,3 @@ function MESSAGE:ToAllIf( Condition )
return self
end
----- The MESSAGEQUEUE class
---- @type MESSAGEQUEUE
--MESSAGEQUEUE = {
-- ClientGroups = {},
-- CoalitionSides = {}
--}
--
--function MESSAGEQUEUE:New( RefreshInterval )
-- local self = BASE:Inherit( self, BASE:New() )
-- self:F( { RefreshInterval } )
--
-- self.RefreshInterval = RefreshInterval
--
-- --self.DisplayFunction = routines.scheduleFunction( self._DisplayMessages, { self }, 0, RefreshInterval )
-- self.DisplayFunction = SCHEDULER:New( self, self._DisplayMessages, {}, 0, RefreshInterval )
--
-- return self
--end
--
----- This function is called automatically by the MESSAGEQUEUE scheduler.
--function MESSAGEQUEUE:_DisplayMessages()
--
-- -- First we display all messages that a coalition needs to receive... Also those who are not in a client (CA module clients...).
-- for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
-- for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
-- if MessageData.MessageSent == false then
-- --trigger.action.outTextForCoalition( CoalitionSideID, MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageSent = true
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
-- end
--
-- -- Then we send the messages for each individual client, but also to be included are those Coalition messages for the Clients who belong to a coalition.
-- -- Because the Client messages will overwrite the Coalition messages (for that Client).
-- for ClientGroupName, ClientGroupData in pairs( self.ClientGroups ) do
-- for MessageID, MessageData in pairs( ClientGroupData.Messages ) do
-- if MessageData.MessageGroup == false then
-- trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageGroup = true
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
--
-- -- Now check if the Client also has messages that belong to the Coalition of the Client...
-- for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
-- for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
-- local CoalitionGroup = Group.getByName( ClientGroupName )
-- if CoalitionGroup and CoalitionGroup:getCoalition() == CoalitionSideID then
-- if MessageData.MessageCoalition == false then
-- trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageCoalition = true
-- end
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
-- end
-- end
--
-- return true
--end
--
----- The _MessageQueue object is created when the MESSAGE class module is loaded.
----_MessageQueue = MESSAGEQUEUE:New( 0.5 )
--

View File

@ -1,4 +1,4 @@
--- This module contains the POINT classes.
--- **Core** - **POINT\_VEC** classes define an **extensive API** to **manage 3D points** in the simulation space.
--
-- 1) @{Point#POINT_VEC3} class, extends @{Base#BASE}
-- ==================================================

View File

@ -1,4 +1,4 @@
--- This module contains the SET classes.
--- **Core** - SET classes define **collections** of objects to perform **bulk actions** and logically **group** objects.
--
-- ===
--

View File

@ -1,4 +1,6 @@
--- This core module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}.
--- **Core** - ZONE classes define **zones** within your mission of **various forms**, with **various capabilities**.
--
-- ===
--
-- There are essentially two core functions that zones accomodate:
--

View File

@ -577,7 +577,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
2
):ToAll()
self:ScoreCSV( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
UnitName, _SCORINGCoalition[UnitCoalition], _SCORINGCategory[UnitCategory], UnitData:GetTypeName() )
end
end
@ -633,7 +633,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
MESSAGE:New( Text, 30 ):ToAll()
self:ScoreCSV( PlayerName, "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
end
end
@ -671,7 +671,7 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score )
Score .. " task score!",
30 ):ToAll()
self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
end
end
@ -701,7 +701,7 @@ function SCORING:_AddMissionScore( Mission, Text, Score )
Score .. " mission score!",
60 ):ToAll()
self:ScoreCSV( PlayerName, "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end
end
end
@ -882,7 +882,7 @@ function SCORING:_EventOnHit( Event )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
end
self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
Player.Score = Player.Score + 1
PlayerHit.Score = PlayerHit.Score + 1
@ -906,7 +906,7 @@ function SCORING:_EventOnHit( Event )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
end
self:ScoreCSV( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end
else -- A scenery object was hit.
MESSAGE
@ -915,7 +915,7 @@ function SCORING:_EventOnHit( Event )
)
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
self:ScoreCSV( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
self:ScoreCSV( InitPlayerName, "", "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
end
end
end
@ -1022,8 +1022,8 @@ function SCORING:_EventOnDeadOrCrash( Event )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
end
self:ScoreCSV( PlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
local ThreatLevelTarget, ThreatTypeTarget = TargetUnit:GetThreatLevel()
@ -1054,7 +1054,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
end
self:ScoreCSV( PlayerName, "DESTROY_SCORE", 1, ThreatScore, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, ThreatScore, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
local UnitName = TargetUnit:GetName()
local Score = self.ScoringObjects[UnitName]
@ -1068,7 +1068,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
)
:ToAllIf( self:IfMessagesScore() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesScore() and self:IfMessagesToCoalition() )
self:ScoreCSV( PlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end
-- Check if there are Zones where the destruction happened.
@ -1086,7 +1086,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
15 )
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
self:ScoreCSV( PlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end
end
@ -1108,7 +1108,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
)
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
self:ScoreCSV( PlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
self:ScoreCSV( PlayerName, "", "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
end
end
end
@ -1530,7 +1530,7 @@ function SCORING:OpenCSV( ScoringCSV )
error( "Error: Cannot open CSV file in " .. lfs.writedir() )
end
self.CSVFile:write( '"GameName","RunTime","Time","PlayerName","ScoreType","PlayerUnitCoaltion","PlayerUnitCategory","PlayerUnitType","PlayerUnitName","TargetUnitCoalition","TargetUnitCategory","TargetUnitType","TargetUnitName","Times","Score"\n' )
self.CSVFile:write( '"GameName","RunTime","Time","PlayerName","TargetPlayerName","ScoreType","PlayerUnitCoaltion","PlayerUnitCategory","PlayerUnitType","PlayerUnitName","TargetUnitCoalition","TargetUnitCategory","TargetUnitType","TargetUnitName","Times","Score"\n' )
self.RunTime = os.date("%y-%m-%d_%H-%M-%S")
else
@ -1546,6 +1546,7 @@ end
--- Registers a score for a player.
-- @param #SCORING self
-- @param #string PlayerName The name of the player.
-- @param #string TargetPlayerName The name of the target player.
-- @param #string ScoreType The type of the score.
-- @param #string ScoreTimes The amount of scores achieved.
-- @param #string ScoreAmount The score given.
@ -1558,10 +1559,13 @@ end
-- @param #string TargetUnitCategory The category of the target unit.
-- @param #string TargetUnitType The type of the target unit.
-- @return #SCORING self
function SCORING:ScoreCSV( PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
--write statistic information to file
local ScoreTime = self:SecondsToClock( timer.getTime() )
PlayerName = PlayerName:gsub( '"', '_' )
TargetPlayerName = TargetPlayerName or ""
TargetPlayerName = TargetPlayerName:gsub( '"', '_' )
if PlayerUnitName and PlayerUnitName ~= '' then
local PlayerUnit = Unit.getByName( PlayerUnitName )
@ -1603,6 +1607,7 @@ function SCORING:ScoreCSV( PlayerName, ScoreType, ScoreTimes, ScoreAmount, Playe
'"' .. self.RunTime .. '"' .. ',' ..
'' .. ScoreTime .. '' .. ',' ..
'"' .. PlayerName .. '"' .. ',' ..
'"' .. TargetPlayerName .. '"' .. ',' ..
'"' .. ScoreType .. '"' .. ',' ..
'"' .. PlayerUnitCoalition .. '"' .. ',' ..
'"' .. PlayerUnitCategory .. '"' .. ',' ..

View File

@ -1,4 +1,5 @@
--- The main include file for the MOOSE system.
-- Test of permissions
--- Core Routines
Include.File( "Utilities/Routines" )

View File

@ -30,7 +30,7 @@
--
-- Find below a list of the **assigned task** methods:
--
-- * @{#CONTROLLABLE.TaskAttackControllable}: (AIR) Attack a Controllable.
-- * @{#CONTROLLABLE.TaskAttackGroup}: (AIR) Attack a Controllable.
-- * @{#CONTROLLABLE.TaskAttackMapObject}: (AIR) Attacking the map object (building, structure, e.t.c).
-- * @{#CONTROLLABLE.TaskAttackUnit}: (AIR) Attack the Unit.
-- * @{#CONTROLLABLE.TaskBombing}: (AIR) Delivering weapon at the point on the ground.
@ -38,7 +38,7 @@
-- * @{#CONTROLLABLE.TaskEmbarking}: (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.
-- * @{#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location.
-- * @{#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne controllable.
-- * @{#CONTROLLABLE.TaskFAC_AttackControllable}: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction.
-- * @{#CONTROLLABLE.TaskFAC_AttackGroup}: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction.
-- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire some or all ammunition at a VEC2 point.
-- * @{#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne controllable.
-- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving.
@ -469,13 +469,13 @@ end
-- @param #number AttackQty (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.
-- @param Dcs.DCSTypes#Azimuth Direction (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.
-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired attack start altitude. Controllable/aircraft will make its attacks from the altitude. If the altitude is too low or too high to use weapon aircraft/controllable will choose closest altitude to the desired attack start altitude. If the desired altitude is defined controllable/aircraft will not attack from safe altitude.
-- @param #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.
-- @param #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 "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit )
self:F2( { self.ControllableName, AttackGroup, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit } )
-- AttackControllable = {
-- id = 'AttackControllable',
-- AttackGroup = {
-- id = 'AttackGroup',
-- params = {
-- groupId = Group.ID,
-- weaponType = number,
@ -500,7 +500,7 @@ function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, At
end
local DCSTask
DCSTask = { id = 'AttackControllable',
DCSTask = { id = 'AttackGroup',
params = {
groupId = AttackGroup:GetID(),
weaponType = WeaponType,
@ -525,8 +525,7 @@ end
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend WeaponExpend (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.
-- @param #number AttackQty (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.
-- @param Dcs.DCSTypes#Azimuth Direction (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.
-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired altitude to perform the unit engagement.
-- @param #boolean Visible (optional) Unit must be visible.
-- @param #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 "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, AttackQty, Direction, Altitude, Visible, ControllableAttack )
@ -561,7 +560,7 @@ end
-- @param Dcs.DCSTypes#Vec2 Vec2 2D-coordinates of the point to deliver weapon at.
-- @param #number WeaponType (optional) Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend WeaponExpend (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.
-- @param #number AttackQty (optional) Desired quantity of passes. The parameter is not the same in AttackControllable and AttackUnit tasks.
-- @param #number AttackQty (optional) Desired quantity of passes. The parameter is not the same in AttackGroup and AttackUnit tasks.
-- @param Dcs.DCSTypes#Azimuth Direction (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.
-- @param #boolean ControllableAttack (optional) Flag indicates that the target must be engaged by all aircrafts of the controllable. Has effect only if the task is assigned to a controllable, not to a single aircraft.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
@ -1006,8 +1005,8 @@ end
function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, Datalink )
self:F2( { self.ControllableName, AttackGroup, WeaponType, Designation, Datalink } )
-- FAC_AttackControllable = {
-- id = 'FAC_AttackControllable',
-- FAC_AttackGroup = {
-- id = 'FAC_AttackGroup',
-- params = {
-- groupId = Group.ID,
-- weaponType = number,
@ -1017,7 +1016,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation,
-- }
local DCSTask
DCSTask = { id = 'FAC_AttackControllable',
DCSTask = { id = 'FAC_AttackGroup',
params = {
groupId = AttackGroup:GetID(),
weaponType = WeaponType,
@ -1109,7 +1108,7 @@ end
-- @param #number AttackQty (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.
-- @param Dcs.DCSTypes#Azimuth Direction (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.
-- @param Dcs.DCSTypes#Distance Altitude (optional) Desired attack start altitude. Controllable/aircraft will make its attacks from the altitude. If the altitude is too low or too high to use weapon aircraft/controllable will choose closest altitude to the desired attack start altitude. If the desired altitude is defined controllable/aircraft will not attack from safe altitude.
-- @param #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.
-- @param #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 "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.
-- @return Dcs.DCSTasking.Task#Task The DCS task structure.
function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit )
self:F2( { self.ControllableName, AttackGroup, Priority, WeaponType, WeaponExpend, AttackQty, Direction, Altitude, AttackQtyLimit } )

View File

@ -76,6 +76,9 @@
--
-- Hereby the change log:
--
-- 2017-03-07: GROUP:**HandleEvent( Event, EventFunction )** added.
-- 2017-03-07: GROUP:**UnHandleEvent( Event )** added.
--
-- 2017-01-24: GROUP:**SetAIOnOff( AIOnOff )** added.
--
-- 2017-01-24: GROUP:**SetAIOn()** added.
@ -897,4 +900,29 @@ function GROUP:OnReSpawn( ReSpawnFunction )
self.ReSpawnFunction = ReSpawnFunction
end
do -- Event Handling
--- Subscribe to a DCS Event.
-- @param #GROUP self
-- @param Core.Event#EVENTS Event
-- @param #function EventFunction (optional) The function to be called when the event occurs for the GROUP.
-- @return #GROUP
function GROUP:HandleEvent( Event, EventFunction )
self:EventDispatcher():OnEventForGroup( self:GetName(), EventFunction, self, Event )
return self
end
--- UnSubscribe to a DCS event.
-- @param #GROUP self
-- @param Core.Event#EVENTS Event
-- @return #GROUP
function GROUP:UnHandleEvent( Event )
self:EventDispatcher():RemoveForGroup( self:GetName(), self, Event )
return self
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -129,13 +129,16 @@ When the fuel treshold has been reached, the airplane will fly towards the neare
<ul>
<li><strong>None</strong> ( Group ): The process is not started yet.</li>
<li><strong>Patrolling</strong> ( Group ): The AI is patrolling the Patrol Zone.</li>
<li><strong>Returning</strong> ( Group ): The AI is returning to Base..</li>
<li><strong>Returning</strong> ( Group ): The AI is returning to Base.</li>
<li><strong>Stopped</strong> ( Group ): The process is stopped.</li>
<li><strong>Crashed</strong> ( Group ): The AI has crashed or is dead.</li>
</ul>
<h3>1.2.2) AI<em>PATROL</em>ZONE Events</h3>
<ul>
<li><strong>Start</strong> ( Group ): Start the process.</li>
<li><strong>Stop</strong> ( Group ): Stop the process.</li>
<li><strong>Route</strong> ( Group ): Route the AI to a new random 3D point within the Patrol Zone.</li>
<li><strong>RTB</strong> ( Group ): Route the AI to the home base.</li>
<li><strong>Detect</strong> ( Group ): The AI is detecting targets.</li>
@ -380,6 +383,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnAfterStatus">AI_PATROL_ZONE:OnAfterStatus(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnAfter Transition Handler for Event Status.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnAfterStop">AI_PATROL_ZONE:OnAfterStop(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnAfter Transition Handler for Event Stop.</p>
</td>
</tr>
<tr>
@ -416,6 +425,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnBeforeStatus">AI_PATROL_ZONE:OnBeforeStatus(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnBefore Transition Handler for Event Status.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnBeforeStop">AI_PATROL_ZONE:OnBeforeStop(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnBefore Transition Handler for Event Stop.</p>
</td>
</tr>
<tr>
@ -440,6 +455,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnEnterReturning">AI_PATROL_ZONE:OnEnterReturning(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnEnter Transition Handler for State Returning.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnEnterStopped">AI_PATROL_ZONE:OnEnterStopped(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnEnter Transition Handler for State Stopped.</p>
</td>
</tr>
<tr>
@ -452,6 +473,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnLeaveReturning">AI_PATROL_ZONE:OnLeaveReturning(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnLeave Transition Handler for State Returning.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).OnLeaveStopped">AI_PATROL_ZONE:OnLeaveStopped(Controllable, From, Event, To)</a></td>
<td class="summary">
<p>OnLeave Transition Handler for State Stopped.</p>
</td>
</tr>
<tr>
@ -602,6 +629,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).Status">AI_PATROL_ZONE:Status()</a></td>
<td class="summary">
<p>Synchronous Event Trigger for Event Status.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).Stop">AI_PATROL_ZONE:Stop()</a></td>
<td class="summary">
<p>Synchronous Event Trigger for Event Stop.</p>
</td>
</tr>
<tr>
@ -644,6 +677,12 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).__Status">AI_PATROL_ZONE:__Status(Delay)</a></td>
<td class="summary">
<p>Asynchronous Event Trigger for Event Status.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_PATROL_ZONE).__Stop">AI_PATROL_ZONE:__Stop(Delay)</a></td>
<td class="summary">
<p>Asynchronous Event Trigger for Event Stop.</p>
</td>
</tr>
<tr>
@ -1286,6 +1325,46 @@ The To State string.</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnAfterStop" >
<strong>AI_PATROL_ZONE:OnAfterStop(Controllable, From, Event, To)</strong>
</a>
</dt>
<dd>
<p>OnAfter Transition Handler for Event Stop.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
The Controllable Object managed by the FSM.</p>
</li>
<li>
<p><code><em>#string From </em></code>:
The From State string.</p>
</li>
<li>
<p><code><em>#string Event </em></code>:
The Event string.</p>
</li>
<li>
<p><code><em>#string To </em></code>:
The To State string.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnBeforeDetect" >
<strong>AI_PATROL_ZONE:OnBeforeDetect(Controllable, From, Event, To)</strong>
</a>
@ -1556,6 +1635,51 @@ Return false to cancel Transition.</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnBeforeStop" >
<strong>AI_PATROL_ZONE:OnBeforeStop(Controllable, From, Event, To)</strong>
</a>
</dt>
<dd>
<p>OnBefore Transition Handler for Event Stop.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
The Controllable Object managed by the FSM.</p>
</li>
<li>
<p><code><em>#string From </em></code>:
The From State string.</p>
</li>
<li>
<p><code><em>#string Event </em></code>:
The Event string.</p>
</li>
<li>
<p><code><em>#string To </em></code>:
The To State string.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#boolean:</em>
Return false to cancel Transition.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnCrash" >
<strong>AI_PATROL_ZONE:OnCrash(EventData)</strong>
</a>
@ -1678,6 +1802,46 @@ The To State string.</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnEnterStopped" >
<strong>AI_PATROL_ZONE:OnEnterStopped(Controllable, From, Event, To)</strong>
</a>
</dt>
<dd>
<p>OnEnter Transition Handler for State Stopped.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
The Controllable Object managed by the FSM.</p>
</li>
<li>
<p><code><em>#string From </em></code>:
The From State string.</p>
</li>
<li>
<p><code><em>#string Event </em></code>:
The Event string.</p>
</li>
<li>
<p><code><em>#string To </em></code>:
The To State string.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnLeavePatrolling" >
<strong>AI_PATROL_ZONE:OnLeavePatrolling(Controllable, From, Event, To)</strong>
</a>
@ -1768,6 +1932,51 @@ Return false to cancel Transition.</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnLeaveStopped" >
<strong>AI_PATROL_ZONE:OnLeaveStopped(Controllable, From, Event, To)</strong>
</a>
</dt>
<dd>
<p>OnLeave Transition Handler for State Stopped.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
The Controllable Object managed by the FSM.</p>
</li>
<li>
<p><code><em>#string From </em></code>:
The From State string.</p>
</li>
<li>
<p><code><em>#string Event </em></code>:
The Event string.</p>
</li>
<li>
<p><code><em>#string To </em></code>:
The To State string.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#boolean:</em>
Return false to cancel Transition.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).OnPilotDead" >
<strong>AI_PATROL_ZONE:OnPilotDead(EventData)</strong>
</a>
@ -2226,6 +2435,19 @@ self</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).Stop" >
<strong>AI_PATROL_ZONE:Stop()</strong>
</a>
</dt>
<dd>
<p>Synchronous Event Trigger for Event Stop.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE)._NewPatrolRoute" >
<strong>AI_PATROL_ZONE._NewPatrolRoute(AIControllable, self)</strong>
</a>
@ -2386,6 +2608,28 @@ The delay in seconds.</p>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).__Stop" >
<strong>AI_PATROL_ZONE:__Stop(Delay)</strong>
</a>
</dt>
<dd>
<p>Asynchronous Event Trigger for Event Stop.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number Delay </em></code>:
The delay in seconds.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_PATROL_ZONE).onafterDead" >
<strong>AI_PATROL_ZONE:onafterDead()</strong>
</a>

View File

@ -72,40 +72,79 @@
<div id="content">
<h1>Module <code>Base</code></h1>
<p>This module contains the BASE class.</p>
<p><strong>Core</strong> - BASE forms <strong>the basis of the MOOSE framework</strong>.</p>
<p>Each class within the MOOSE framework derives from BASE.</p>
<p><img src="..\Presentations\BASE\Dia1.JPG" alt="Banner Image"/></p>
<hr/>
<h1>1) <a href="##(BASE)">#BASE</a> class</h1>
<p>The <a href="##(BASE)">#BASE</a> class is the super class for all the classes defined within MOOSE.</p>
<p>It handles:</p>
<p>All classes within the MOOSE framework are derived from the <a href="##(BASE)">#BASE</a> class. </p>
<p>BASE provides facilities for :</p>
<ul>
<li>The construction and inheritance of child classes.</li>
<li>The tracing of objects during mission execution within the <strong>DCS.log</strong> file, under the <strong>"Saved Games\DCS\Logs"</strong> folder.</li>
<li>The construction and inheritance of MOOSE classes.</li>
<li>The class naming and numbering system.</li>
<li>The class hierarchy search system.</li>
<li>The tracing of information or objects during mission execution for debuggin purposes.</li>
<li>The subscription to DCS events for event handling in MOOSE objects.</li>
</ul>
<p>Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.</p>
<p>Note: The BASE class is an abstract class and is not meant to be used directly.</p>
<h2>1.1) BASE constructor</h2>
<p>Any class derived from BASE, must use the <a href="Base.html##(BASE).New">Base#BASE.New</a> method how this is done.</p>
<p>Any class derived from BASE, will use the <a href="Base.html##(BASE).New">Base#BASE.New</a> constructor embedded in the <a href="Base.html##(BASE).Inherit">Base#BASE.Inherit</a> method.
See an example at the <a href="Base.html##(BASE).New">Base#BASE.New</a> method how this is done.</p>
<h2>1.2) BASE Trace functionality</h2>
<h2>1.2) Trace information for debugging</h2>
<p>The BASE class contains trace methods to trace progress within a mission execution of a certain object.
Note that these trace methods are inherited by each MOOSE class interiting BASE.
As such, each object created from derived class from BASE can use the tracing functions to trace its execution.</p>
These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution.</p>
<h3>1.2.1) Tracing functions</h3>
<p>Any type of information can be passed to these tracing methods. See the following examples:</p>
<p>There are basically 3 types of tracing methods available within BASE:</p>
<pre><code>self:E( "Hello" )
</code></pre>
<p>Result in the word "Hello" in the dcs.log.</p>
<pre><code>local Array = { 1, nil, "h", { "a","b" }, "x" }
self:E( Array )
</code></pre>
<p>Results with the text [1]=1,[3]="h",[4]={[1]="a",[2]="b"},[5]="x"} in the dcs.log. </p>
<pre><code>local Object1 = "Object1"
local Object2 = 3
local Object3 = { Object 1, Object 2 }
self:E( { Object1, Object2, Object3 } )
</code></pre>
<p>Results with the text [1]={[1]="Object",[2]=3,[3]={[1]="Object",[2]=3}} in the dcs.log.</p>
<pre><code>local SpawnObject = SPAWN:New( "Plane" )
local GroupObject = GROUP:FindByName( "Group" )
self:E( { Spawn = SpawnObject, Group = GroupObject } )
</code></pre>
<p>Results with the text [1]={Spawn={....),Group={...}} in the dcs.log. </p>
<p>Below a more detailed explanation of the different method types for tracing.</p>
<h3>1.2.1) Tracing methods categories</h3>
<p>There are basically 3 types of tracing methods available:</p>
<ul>
<li><a href="##(BASE).F">BASE.F</a>: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.</li>
<li><a href="##(BASE).T">BASE.T</a>: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.</li>
<li><a href="##(BASE).E">BASE.E</a>: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.</li>
<li><a href="##(BASE).F">BASE.F</a>: Used to trace the entrance of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.</li>
<li><a href="##(BASE).T">BASE.T</a>: Used to trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.</li>
<li><a href="##(BASE).E">BASE.E</a>: Used to always trace information giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file.</li>
</ul>
<h3>1.2.2) Tracing levels</h3>
@ -131,10 +170,11 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
<li>Activate all tracing through the <a href="##(BASE).TraceAll">BASE.TraceAll</a>() method.</li>
<li>Activate only the tracing of a certain class (name) through the <a href="##(BASE).TraceClass">BASE.TraceClass</a>() method.</li>
<li>Activate only the tracing of a certain method of a certain class through the <a href="##(BASE).TraceClassMethod">BASE.TraceClassMethod</a>() method.</li>
<li>Activate only the tracing of a certain level through the <a href="##(BASE).TraceLevel">BASE.TraceLevel</a>() method.
<h3>1.2.4) Check if tracing is on.</h3></li>
<li>Activate only the tracing of a certain level through the <a href="##(BASE).TraceLevel">BASE.TraceLevel</a>() method.</li>
</ul>
<h3>1.2.4) Check if tracing is on.</h3>
<p>The method <a href="##(BASE).IsTrace">BASE.IsTrace</a>() will validate if tracing is activated or not.</p>
<h2>1.3 DCS simulator Event Handling</h2>
@ -146,7 +186,7 @@ and handled through lua scripting. MOOSE provides an encapsulation to handle the
<p>At first, the mission designer will need to <strong>Subscribe</strong> 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.</p>
There are two methods which you use to subscribe to or unsubscribe from an event.</p>
<ul>
<li><a href="##(BASE).HandleEvent">BASE.HandleEvent</a>(): Subscribe to a DCS Event.</li>
@ -201,20 +241,22 @@ about the event that occurred.</p>
<h2>1.5) All objects derived from BASE can have "States"</h2>
<p>A mechanism is in place in MOOSE, that allows to let the objects administer <strong>states</strong>.
States are essentially properties of objects, which are identified by a <strong>Key</strong> and a <strong>Value</strong>.
The method <a href="##(BASE).SetState">BASE.SetState</a>() can be used to set a Value with a reference Key to the object.
To <strong>read or retrieve</strong> a state Value based on a Key, use the <a href="##(BASE).GetState">BASE.GetState</a> method.
These two methods provide a very handy way to keep state at long lasting processes.
<p>A mechanism is in place in MOOSE, that allows to let the objects administer <strong>states</strong>. <br/>
States are essentially properties of objects, which are identified by a <strong>Key</strong> and a <strong>Value</strong>. </p>
<p>The method <a href="##(BASE).SetState">BASE.SetState</a>() can be used to set a Value with a reference Key to the object. <br/>
To <strong>read or retrieve</strong> a state Value based on a Key, use the <a href="##(BASE).GetState">BASE.GetState</a> method. </p>
<p>These two methods provide a very handy way to keep state at long lasting processes.
Values can be stored within the objects, and later retrieved or changed when needed.
There is one other important thing to note, the <a href="##(BASE).SetState">BASE.SetState</a>() and <a href="##(BASE).GetState">BASE.GetState</a> methods
receive as the <strong>first parameter the object for which the state needs to be set</strong>.
Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same
object name to the method.</p>
<h2>1.10) BASE Inheritance (tree) support</h2>
<h2>1.10) Inheritance</h2>
<p>The following methods are available to support inheritance:</p>
<p>The following methods are available to implement inheritance</p>
<ul>
<li><a href="##(BASE).Inherit">BASE.Inherit</a>: Inherits from a class.</li>
@ -406,7 +448,7 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<tr>
<td class="name" nowrap="nowrap"><a href="##(BASE).New">BASE:New()</a></td>
<td class="summary">
<p>BASE constructor.</p>
</td>
</tr>
<tr>
@ -1073,6 +1115,14 @@ The <a href="Event.html">Event</a> processing Priority.</p>
<p>This is the worker method to retrieve the Parent class.</p>
<p>Note that the Parent class must be passed to call the parent class method.</p>
<pre><code>self:GetParent(self):ParentMethod()
</code></pre>
<h3>Parameter</h3>
<ul>
<li>
@ -1223,10 +1273,23 @@ Child</p>
</dt>
<dd>
<p>BASE constructor.</p>
<p> @todo need to investigate if the deepCopy is really needed... Don't think so.</p>
<p>This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.</p>
<pre><code>function EVENT:New()
local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
return self
end
</code></pre>
<h3>Return value</h3>
<p><em><a href="##(BASE)">#BASE</a>:</em></p>
</dd>
</dl>

View File

@ -108,7 +108,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
<p>Find below a list of the <strong>assigned task</strong> methods:</p>
<ul>
<li><a href="##(CONTROLLABLE).TaskAttackControllable">CONTROLLABLE.TaskAttackControllable</a>: (AIR) Attack a Controllable.</li>
<li><a href="##(CONTROLLABLE).TaskAttackGroup">CONTROLLABLE.TaskAttackGroup</a>: (AIR) Attack a Controllable.</li>
<li><a href="##(CONTROLLABLE).TaskAttackMapObject">CONTROLLABLE.TaskAttackMapObject</a>: (AIR) Attacking the map object (building, structure, e.t.c).</li>
<li><a href="##(CONTROLLABLE).TaskAttackUnit">CONTROLLABLE.TaskAttackUnit</a>: (AIR) Attack the Unit.</li>
<li><a href="##(CONTROLLABLE).TaskBombing">CONTROLLABLE.TaskBombing</a>: (AIR) Delivering weapon at the point on the ground.</li>
@ -116,7 +116,7 @@ This is different from the EnRoute tasks, where the targets of the task need to
<li><a href="##(CONTROLLABLE).TaskEmbarking">CONTROLLABLE.TaskEmbarking</a>: (AIR) Move the controllable to a Vec2 Point, wait for a defined duration and embark a controllable.</li>
<li><a href="##(CONTROLLABLE).TaskEmbarkToTransport">CONTROLLABLE.TaskEmbarkToTransport</a>: (GROUND) Embark to a Transport landed at a location.</li>
<li><a href="##(CONTROLLABLE).TaskEscort">CONTROLLABLE.TaskEscort</a>: (AIR) Escort another airborne controllable. </li>
<li><a href="##(CONTROLLABLE).TaskFAC_AttackControllable">CONTROLLABLE.TaskFAC_AttackControllable</a>: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction.</li>
<li><a href="##(CONTROLLABLE).TaskFAC_AttackGroup">CONTROLLABLE.TaskFAC_AttackGroup</a>: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction.</li>
<li><a href="##(CONTROLLABLE).TaskFireAtPoint">CONTROLLABLE.TaskFireAtPoint</a>: (GROUND) Fire some or all ammunition at a VEC2 point.</li>
<li><a href="##(CONTROLLABLE).TaskFollow">CONTROLLABLE.TaskFollow</a>: (AIR) Following another airborne controllable.</li>
<li><a href="##(CONTROLLABLE).TaskHold">CONTROLLABLE.TaskHold</a>: (GROUND) Hold ground controllable from moving.</li>
@ -1011,7 +1011,7 @@ All en-route tasks have the priority parameter. This is a number (less value - h
<li>
<p><code><em>#boolean AttackQtyLimit </em></code>:
(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.</p>
(optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.</p>
</li>
</ul>
@ -2038,7 +2038,7 @@ The Controllable to be attacked.</p>
<li>
<p><code><em>#boolean AttackQtyLimit </em></code>:
(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.</p>
(optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.</p>
</li>
</ul>
@ -2151,6 +2151,7 @@ The UNIT.</p>
</li>
<li>
<<<<<<< HEAD
<p><code><em><a href="Dcs.DCSTypes.html##(Distance)">Dcs.DCSTypes#Distance</a> Altitude </em></code>:
(optional) Desired altitude to perform the unit engagement.</p>
@ -2159,6 +2160,10 @@ The UNIT.</p>
<p><code><em>#boolean Visible </em></code>:
(optional) Unit must be visible.</p>
=======
<p><code><em>#boolean AttackQtyLimit </em></code>:
(optional) The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.</p>
>>>>>>> refs/remotes/origin/master
</li>
<li>
@ -2209,7 +2214,7 @@ The DCS task structure.</p>
<li>
<p><code><em>#number AttackQty </em></code>:
(optional) Desired quantity of passes. The parameter is not the same in AttackControllable and AttackUnit tasks. </p>
(optional) Desired quantity of passes. The parameter is not the same in AttackGroup and AttackUnit tasks. </p>
</li>
<li>

View File

@ -72,8 +72,7 @@
<div id="content">
<h1>Module <code>Event</code></h1>
<p>This core module models the dispatching of DCS Events to subscribed MOOSE classes,
following a given priority.</p>
<p><strong>Core</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>
@ -145,6 +144,13 @@ There are two functions which you use to subscribe to or unsubscribe from an eve
<li><a href="Base.html##(BASE).UnHandleEvent">Base#BASE.UnHandleEvent</a>(): Unsubscribe from a DCS Event.</li>
</ul>
<p>Note that for a UNIT, the event will be handled <strong>for that UNIT only</strong>!
Note that for a GROUP, the event will be handled <strong>for all the UNITs in that GROUP only</strong>!</p>
<p>For all objects of other classes, the subscribed events will be handled for <strong>all UNITs within the Mission</strong>!
So if a UNIT within the mission has the subscribed event for that object,
then the object event handler will receive the event for that UNIT!</p>
<h3>1.3.2 Event Handling of DCS Events</h3>
<p>Once the class is subscribed to the event, an <strong>Event Handling</strong> method on the object or class needs to be written that will be called
@ -241,7 +247,8 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
<p>Hereby the change log:</p>
<ul>
<li>2016-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.</li>
<li><p>2017-03-07: Added the correct event dispatching in case the event is subscribed by a GROUP.</p></li>
<li><p>2017-02-07: Did a complete revision of the Event Handing API and underlying mechanisms.</p></li>
</ul>
<hr/>
@ -341,15 +348,49 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
</td>
</tr>
<tr>
<<<<<<< HEAD
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEventForTemplate">EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventClass, OnEventFunction, EventID)</a></td>
=======
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEngineShutDownForUnit">EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventClass)</a></td>
<td class="summary">
<p>Set a new listener for an S<em>EVENT</em>ENGINE_SHUTDOWN event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEngineShutDownRemove">EVENT:OnEngineShutDownRemove(EventClass)</a></td>
<td class="summary">
<p>Stop listening to S<em>EVENT</em>ENGINE_SHUTDOWN event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEngineStartUpForUnit">EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventClass)</a></td>
<td class="summary">
<p>Set a new listener for an S<em>EVENT</em>ENGINE_STARTUP event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEngineStartUpRemove">EVENT:OnEngineStartUpRemove(EventClass)</a></td>
<td class="summary">
<p>Stop listening to S<em>EVENT</em>ENGINE_STARTUP event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEventForGroup">EVENT:OnEventForGroup(GroupName, EventFunction, EventClass, EventID)</a></td>
<td class="summary">
<p>Set a new listener for an S<em>EVENT</em>X event for a GROUP.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEventForTemplate">EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventClass, OnEventFunction)</a></td>
>>>>>>> refs/remotes/origin/master
<td class="summary">
<p>Create an OnDead event handler for a group</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEventForUnit">EVENT:OnEventForUnit(EventDCSUnitName, EventFunction, EventClass, EventID)</a></td>
<td class="name" nowrap="nowrap"><a href="##(EVENT).OnEventForUnit">EVENT:OnEventForUnit(UnitName, EventFunction, EventClass, EventID)</a></td>
<td class="summary">
<p>Set a new listener for an S<em>EVENT</em>X event</p>
<p>Set a new listener for an S<em>EVENT</em>X event for a UNIT.</p>
</td>
</tr>
<tr>
@ -383,9 +424,15 @@ YYYY-MM-DD: CLASS:<strong>NewFunction( Params )</strong> added</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).RemoveForUnit">EVENT:RemoveForUnit(EventClass, EventID, UnitName)</a></td>
<td class="name" nowrap="nowrap"><a href="##(EVENT).RemoveForGroup">EVENT:RemoveForGroup(GroupName, EventClass, EventID)</a></td>
<td class="summary">
<p>Removes an Events entry for a Unit</p>
<p>Removes an Events entry for a GROUP.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(EVENT).RemoveForUnit">EVENT:RemoveForUnit(UnitName, EventClass, EventID)</a></td>
<td class="summary">
<p>Removes an Events entry for a UNIT.</p>
</td>
</tr>
<tr>
@ -1254,8 +1301,828 @@ The self instance of the class for which the event is captured. When the event h
<dl class="function">
<dt>
<<<<<<< HEAD
<a id="#(EVENT).OnLandForTemplate" >
<strong>EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventClass)</strong>
=======
<a id="#(EVENT).OnDeadForTemplate" >
<strong>EVENT:OnDeadForTemplate(EventGroup, EventFunction, EventClass, EventTemplate)</strong>
</a>
</dt>
<dd>
<p>Create an OnDead event handler for a group</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> EventGroup </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
<li>
<p><code><em> EventTemplate </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnDeadForUnit" >
<strong>EVENT:OnDeadForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>DEAD event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnDeadRemove" >
<strong>EVENT:OnDeadRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>DEAD event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEngineShutDownForTemplate" >
<strong>EVENT:OnEngineShutDownForTemplate(EventTemplate, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Create an OnDead event handler for a group</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table EventTemplate </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEngineShutDownForUnit" >
<strong>EVENT:OnEngineShutDownForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>ENGINE_SHUTDOWN event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEngineShutDownRemove" >
<strong>EVENT:OnEngineShutDownRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>ENGINE_SHUTDOWN event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEngineStartUpForUnit" >
<strong>EVENT:OnEngineStartUpForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>ENGINE_STARTUP event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEngineStartUpRemove" >
<strong>EVENT:OnEngineStartUpRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>ENGINE_STARTUP event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEventForGroup" >
<strong>EVENT:OnEventForGroup(GroupName, EventFunction, EventClass, EventID)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>X event for a GROUP.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string GroupName </em></code>:
The name of the GROUP.</p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the GROUP.</p>
</li>
<li>
<p><code><em><a href="Core.Base.html##(BASE)">Core.Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
<li>
<p><code><em> EventID </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEventForTemplate" >
<strong>EVENT:OnEventForTemplate(EventTemplate, EventFunction, EventClass, OnEventFunction)</strong>
</a>
</dt>
<dd>
<p>Create an OnDead event handler for a group</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table EventTemplate </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em> EventClass </em></code>:
The instance of the class for which the event is.</p>
</li>
<li>
<p><code><em>#function OnEventFunction </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEventForUnit" >
<strong>EVENT:OnEventForUnit(UnitName, EventFunction, EventClass, EventID)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>X event for a UNIT.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string UnitName </em></code>:
The name of the UNIT.</p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the GROUP.</p>
</li>
<li>
<p><code><em><a href="Core.Base.html##(BASE)">Core.Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
<li>
<p><code><em> EventID </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnEventGeneric" >
<strong>EVENT:OnEventGeneric(EventFunction, EventClass, EventID)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>X event independent from a unit or a weapon.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Core.Base.html##(BASE)">Core.Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided.</p>
</li>
<li>
<p><code><em> EventID </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnHit" >
<strong>EVENT:OnHit(EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>HIT event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnHitForUnit" >
<strong>EVENT:OnHitForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>HIT event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnHitRemove" >
<strong>EVENT:OnHitRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>HIT event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnLandForTemplate" >
<strong>EVENT:OnLandForTemplate(EventTemplate, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> EventTemplate </em></code>: </p>
</li>
<li>
<p><code><em> EventFunction </em></code>: </p>
</li>
<li>
<p><code><em> EventClass </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnLandForUnit" >
<strong>EVENT:OnLandForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>LAND event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnLandRemove" >
<strong>EVENT:OnLandRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>LAND event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPilotDead" >
<strong>EVENT:OnPilotDead(EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>PILOT_DEAD event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPilotDeadForUnit" >
<strong>EVENT:OnPilotDeadForUnit(EventDCSUnitName, EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>PILOT_DEAD event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string EventDCSUnitName </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPilotDeadRemove" >
<strong>EVENT:OnPilotDeadRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>PILOT_DEAD event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPlayerEnterRemove" >
<strong>EVENT:OnPlayerEnterRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>PLAYER<em>ENTER</em>UNIT event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPlayerEnterUnit" >
<strong>EVENT:OnPlayerEnterUnit(EventFunction, EventClass)</strong>
</a>
</dt>
<dd>
<p>Set a new listener for an S<em>EVENT</em>PLAYER<em>ENTER</em>UNIT event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#function EventFunction </em></code>:
The function to be called when the event occurs for the unit.</p>
</li>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPlayerLeaveRemove" >
<strong>EVENT:OnPlayerLeaveRemove(EventClass)</strong>
</a>
</dt>
<dd>
<p>Stop listening to S<em>EVENT</em>PLAYER<em>LEAVE</em>UNIT event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Base.html##(BASE)">Base#BASE</a> EventClass </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT)">#EVENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).OnPlayerLeaveUnit" >
<strong>EVENT:OnPlayerLeaveUnit(EventFunction, EventClass)</strong>
>>>>>>> refs/remotes/origin/master
</a>
</dt>
<dd>
@ -1369,18 +2236,24 @@ The self instance of the class for which the event is.</p>
<dl class="function">
<dt>
<a id="#(EVENT).RemoveForUnit" >
<strong>EVENT:RemoveForUnit(EventClass, EventID, UnitName)</strong>
<a id="#(EVENT).RemoveForGroup" >
<strong>EVENT:RemoveForGroup(GroupName, EventClass, EventID)</strong>
</a>
</dt>
<dd>
<p>Removes an Events entry for a Unit</p>
<p>Removes an Events entry for a GROUP.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string GroupName </em></code>:
The name of the GROUP.</p>
</li>
<li>
<p><code><em><a href="Core.Base.html##(BASE)">Core.Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
@ -1390,9 +2263,42 @@ The self instance of the class for which the event is.</p>
<p><code><em><a href="Dcs.DCSWorld.html##(world.event)">Dcs.DCSWorld#world.event</a> EventID </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(EVENT.Events)">#EVENT.Events</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(EVENT).RemoveForUnit" >
<strong>EVENT:RemoveForUnit(UnitName, EventClass, EventID)</strong>
</a>
</dt>
<dd>
<p>Removes an Events entry for a UNIT.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> UnitName </em></code>: </p>
<p><code><em>#string UnitName </em></code>:
The name of the UNIT.</p>
</li>
<li>
<p><code><em><a href="Core.Base.html##(BASE)">Core.Base#BASE</a> EventClass </em></code>:
The self instance of the class for which the event is.</p>
</li>
<li>
<p><code><em><a href="Dcs.DCSWorld.html##(world.event)">Dcs.DCSWorld#world.event</a> EventID </em></code>: </p>
</li>
</ul>

View File

@ -72,10 +72,10 @@
<div id="content">
<h1>Module <code>Fsm</code></h1>
<p>This module contains the <strong>FSM</strong> (<strong>F</strong>inite <strong>S</strong>tate <strong>M</strong>achine) class and derived <strong>FSM_</strong> classes.</p>
<p><strong>Core</strong> - The <strong>FSM</strong> (<strong>F</strong>inite <strong>S</strong>tate <strong>M</strong>achine) class and derived <strong>FSM_</strong> classes
are design patterns allowing efficient (long-lasting) processes and workflows.</p>
<h2>Finite State Machines (FSM) are design patterns allowing efficient (long-lasting) processes and workflows.</h2>
<p><img src="..\Presentations\FSM\Dia1.JPG" alt="Banner Image"/></p>

View File

@ -162,6 +162,9 @@ Use the following Zone validation methods on the group:</p>
<p>Hereby the change log:</p>
<p>2017-03-07: GROUP:<strong>HandleEvent( Event, EventFunction )</strong> added. <br/>
2017-03-07: GROUP:<strong>UnHandleEvent( Event )</strong> added.</p>
<p>2017-01-24: GROUP:<strong>SetAIOnOff( AIOnOff )</strong> added. </p>
<p>2017-01-24: GROUP:<strong>SetAIOn()</strong> added. </p>
@ -376,6 +379,12 @@ Use the following Zone validation methods on the group:</p>
<td class="name" nowrap="nowrap"><a href="##(GROUP).GroupName">GROUP.GroupName</a></td>
<td class="summary">
<p>The name of the group.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(GROUP).HandleEvent">GROUP:HandleEvent(Event, EventFunction)</a></td>
<td class="summary">
<p>Subscribe to a DCS Event.</p>
</td>
</tr>
<tr>
@ -490,6 +499,12 @@ Use the following Zone validation methods on the group:</p>
<td class="name" nowrap="nowrap"><a href="##(GROUP).SetTemplateCountry">GROUP:SetTemplateCountry(CountryID, Template)</a></td>
<td class="summary">
<p>Sets the CountryID of the group in a Template.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(GROUP).UnHandleEvent">GROUP:UnHandleEvent(Event)</a></td>
<td class="summary">
<p>UnSubscribe to a DCS event.</p>
</td>
</tr>
</table>
@ -1139,6 +1154,38 @@ Current Vec3 of the first DCS Unit of the GROUP.</p>
<p>The name of the group.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(GROUP).HandleEvent" >
<strong>GROUP:HandleEvent(Event, EventFunction)</strong>
</a>
</dt>
<dd>
<p>Subscribe to a DCS Event.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Core.Event.html##(EVENTS)">Core.Event#EVENTS</a> Event </em></code>: </p>
</li>
<li>
<p><code><em>#function EventFunction </em></code>:
(optional) The function to be called when the event occurs for the GROUP.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(GROUP)">#GROUP</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -1613,6 +1660,32 @@ The country ID.</p>
<p><em>#table:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(GROUP).UnHandleEvent" >
<strong>GROUP:UnHandleEvent(Event)</strong>
</a>
</dt>
<dd>
<p>UnSubscribe to a DCS event.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Core.Event.html##(EVENTS)">Core.Event#EVENTS</a> Event </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(GROUP)">#GROUP</a>:</em></p>
</dd>
</dl>

View File

@ -72,7 +72,7 @@
<div id="content">
<h1>Module <code>Menu</code></h1>
<p>This module contains the MENU classes.</p>
<p><strong>Core</strong> -- MENU_ classes model the definition of <strong>hierarchical menu structures</strong> and <strong>commands for players</strong> within a mission.</p>

View File

@ -72,29 +72,49 @@
<div id="content">
<h1>Module <code>Message</code></h1>
<p>This module contains the MESSAGE class.</p>
<p><strong>Core</strong> - MESSAGE class takes are of the <strong>real-time notifications</strong> and <strong>messages to players</strong> during a simulation.</p>
<p><img src="..\Presentations\MESSAGE\Dia1.JPG" alt="Banner Image"/></p>
<hr/>
<h1>1) <a href="Message.html##(MESSAGE)">Message#MESSAGE</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>Message System to display Messages to Clients, Coalitions or All.
Messages are shown on the display panel for an amount of seconds, and will then disappear.
Messages can contain a category which is indicating the category of the message.</p>
<h2>1.1) MESSAGE construction methods</h2>
<h2>1.1) MESSAGE construction</h2>
<p>Messages are created with <a href="Message.html##(MESSAGE).New">Message#MESSAGE.New</a>. Note that when the MESSAGE object is created, no message is sent yet.
To send messages, you need to use the To functions.</p>
<h2>1.2) Send messages with MESSAGE To methods</h2>
<p>Messages are sent to:</p>
<h2>1.2) Send messages to an audience</h2>
<p>Messages are sent:</p>
<ul>
<li>Clients with <a href="Message.html##(MESSAGE).ToClient">Message#MESSAGE.ToClient</a>.</li>
<li>Coalitions with <a href="Message.html##(MESSAGE).ToCoalition">Message#MESSAGE.ToCoalition</a>.</li>
<li>All Players with <a href="Message.html##(MESSAGE).ToAll">Message#MESSAGE.ToAll</a>.
</li>
<li>To a <a href="Client.html">Client</a> using <a href="Message.html##(MESSAGE).ToClient">Message#MESSAGE.ToClient</a>().</li>
<li>To a <a href="Group.html">Group</a> using <a href="Message.html##(MESSAGE).ToGroup">Message#MESSAGE.ToGroup</a>()</li>
<li>To a coalition using <a href="Message.html##(MESSAGE).ToCoalition">Message#MESSAGE.ToCoalition</a>().</li>
<li>To the red coalition using <a href="Message.html##(MESSAGE).ToRed">Message#MESSAGE.ToRed</a>().</li>
<li>To the blue coalition using <a href="Message.html##(MESSAGE).ToBlue">Message#MESSAGE.ToBlue</a>().</li>
<li>To all Players using <a href="Message.html##(MESSAGE).ToAll">Message#MESSAGE.ToAll</a>().</li>
</ul>
<h2>1.3) Send conditionally to an audience</h2>
<p>Messages can be sent conditionally to an audience (when a condition is true):</p>
<ul>
<li>To all players using <a href="Message.html##(MESSAGE).ToAllIf">Message#MESSAGE.ToAllIf</a>().</li>
<li>To a coalition using <a href="Message.html##(MESSAGE).ToCoalitionIf">Message#MESSAGE.ToCoalitionIf</a>().</li>
</ul>
<h2>Global(s)</h2>
<table class="function_list">
<tr>

View File

@ -72,7 +72,7 @@
<div id="content">
<h1>Module <code>Point</code></h1>
<p>This module contains the POINT classes.</p>
<p><strong>Core</strong> - <strong>POINT_VEC</strong> classes define an <strong>extensive API</strong> to <strong>manage 3D points</strong> in the simulation space.</p>
@ -1034,6 +1034,22 @@ The new calculated POINT_VEC2.</p>
</dd>
</dl>
<<<<<<< HEAD
=======
<dl class="function">
<dt>
<a id="#(POINT_VEC2).z" >
<strong>POINT_VEC2.z</strong>
</a>
</dt>
<dd>
</dd>
</dl>
>>>>>>> refs/remotes/origin/master
<h2><a id="#(POINT_VEC3)" >Type <code>POINT_VEC3</code></a></h2>

View File

@ -544,7 +544,7 @@ Various methods exist to configure:</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCORING).ScoreCSV">SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)</a></td>
<td class="name" nowrap="nowrap"><a href="##(SCORING).ScoreCSV">SCORING:ScoreCSV(PlayerName, TargetPlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)</a></td>
<td class="summary">
<p>Registers a score for a player.</p>
</td>
@ -1604,7 +1604,7 @@ The player group.</p>
<dt>
<a id="#(SCORING).ScoreCSV" >
<strong>SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)</strong>
<strong>SCORING:ScoreCSV(PlayerName, TargetPlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)</strong>
</a>
</dt>
<dd>
@ -1621,6 +1621,12 @@ The name of the player.</p>
</li>
<li>
<p><code><em>#string TargetPlayerName </em></code>:
The name of the target player.</p>
</li>
<li>
<p><code><em>#string ScoreType </em></code>:
The type of the score.</p>

View File

@ -72,7 +72,7 @@
<div id="content">
<h1>Module <code>Set</code></h1>
<p>This module contains the SET classes.</p>
<p><strong>Core</strong> - SET classes define <strong>collections</strong> of objects to perform <strong>bulk actions</strong> and logically <strong>group</strong> objects.</p>

View File

@ -834,6 +834,12 @@ A coding example is provided at the description of the <a href="##(SPAWN).OnSpaw
<td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SPAWN).uncontrolled">SPAWN.uncontrolled</a></td>
<td class="summary">
</td>
</tr>
</table>
@ -2236,7 +2242,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong>
</a>
@ -2253,7 +2259,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a>
@ -3195,6 +3201,20 @@ True = Continue Scheduler</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SPAWN).uncontrolled" >
<strong>SPAWN.uncontrolled</strong>
</a>
</dt>
<dd>
</dd>
</dl>

View File

@ -71,9 +71,18 @@
<div id="content">
<h1>Module <code>Zone</code></h1>
<<<<<<< HEAD
<p>This module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
=======
<p><strong>Core</strong> - ZONE classes define <strong>zones</strong> within your mission of <strong>various forms</strong>, with <strong>various capabilities</strong>.</p>
<hr/>
>>>>>>> refs/remotes/origin/master
<p>There are essentially two core functions that zones accomodate:</p>
<ul>

View File

@ -161,7 +161,7 @@ and automatically engage any airborne enemies that are within a certain range or
<tr>
<td class="name" nowrap="nowrap"><a href="Base.html">Base</a></td>
<td class="summary">
<p>This module contains the BASE class.</p>
<p><strong>Core</strong> - BASE forms <strong>the basis of the MOOSE framework</strong>.</p>
</td>
</tr>
<tr>
@ -232,14 +232,14 @@ and automatically engage any airborne enemies that are within a certain range or
<tr>
<td class="name" nowrap="nowrap"><a href="Event.html">Event</a></td>
<td class="summary">
<p>This core module models the dispatching of DCS Events to subscribed MOOSE classes,
following a given priority.</p>
<p><strong>Core</strong> - EVENT models DCS <strong>event dispatching</strong> using a <strong>publish-subscribe</strong> model.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="Fsm.html">Fsm</a></td>
<td class="summary">
<p>This module contains the <strong>FSM</strong> (<strong>F</strong>inite <strong>S</strong>tate <strong>M</strong>achine) class and derived <strong>FSM_</strong> classes.</p>
<p><strong>Core</strong> - The <strong>FSM</strong> (<strong>F</strong>inite <strong>S</strong>tate <strong>M</strong>achine) class and derived <strong>FSM_</strong> classes
are design patterns allowing efficient (long-lasting) processes and workflows.</p>
</td>
</tr>
<tr>
@ -257,13 +257,13 @@ following a given priority.</p>
<tr>
<td class="name" nowrap="nowrap"><a href="Menu.html">Menu</a></td>
<td class="summary">
<p>This module contains the MENU classes.</p>
<p><strong>Core</strong> -- MENU_ classes model the definition of <strong>hierarchical menu structures</strong> and <strong>commands for players</strong> within a mission.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="Message.html">Message</a></td>
<td class="summary">
<p>This module contains the MESSAGE class.</p>
<p><strong>Core</strong> - MESSAGE class takes are of the <strong>real-time notifications</strong> and <strong>messages to players</strong> during a simulation.</p>
</td>
</tr>
<tr>
@ -293,7 +293,7 @@ following a given priority.</p>
<tr>
<td class="name" nowrap="nowrap"><a href="Point.html">Point</a></td>
<td class="summary">
<p>This module contains the POINT classes.</p>
<p><strong>Core</strong> - <strong>POINT_VEC</strong> classes define an <strong>extensive API</strong> to <strong>manage 3D points</strong> in the simulation space.</p>
</td>
</tr>
<tr>
@ -363,7 +363,7 @@ and creates a CSV file logging the scoring events and results for use at team or
<tr>
<td class="name" nowrap="nowrap"><a href="Set.html">Set</a></td>
<td class="summary">
<p>This module contains the SET classes.</p>
<p><strong>Core</strong> - SET classes define <strong>collections</strong> of objects to perform <strong>bulk actions</strong> and logically <strong>group</strong> objects.</p>
</td>
</tr>
<tr>
@ -433,7 +433,7 @@ which are excellent tools to be reused in an OO environment!.</p>
<tr>
<td class="name" nowrap="nowrap"><a href="Zone.html">Zone</a></td>
<td class="summary">
<p>This core module contains the ZONE classes, inherited from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>.</p>
<p><strong>Core</strong> - ZONE classes define <strong>zones</strong> within your mission of <strong>various forms</strong>, with <strong>various capabilities</strong>.</p>
</td>
</tr>
<tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB