Module Task
Tasking -- This module contains the TASK class.
Authors: FlightControl - Design and Programming
Global(s)
| TASK |
TASK class, extends Base#BASEThe TASK class implements the methods for task orchestration within MOOSE. |
Type TASK
| TASK:Abort() |
FSM Abort synchronous event function for TASK. |
| TASK:AbortUnit(PlayerUnit) |
Abort a PlayerUnit from a Task. |
| TASK:AssignToGroup(TaskGroup) | |
| TASK:AssignToUnit(TaskUnit) | |
| TASK:Cancel() |
FSM Cancel synchronous event function for TASK. |
| TASK.CommandCenter | |
| TASK:CrashUnit(PlayerUnit) |
A PlayerUnit crashed in a Task. |
| TASK.Dispatcher | |
| TASK:Fail() |
FSM Fail synchronous event function for TASK. |
| TASK:FailProcesses(TaskUnitName) | |
| TASK.FsmTemplate | |
| TASK:GetGroups() |
Gets the SET_GROUP assigned to the TASK. |
| TASK:GetID() |
Gets the ID of the Task |
| TASK:GetMission() |
Gets the Mission to where the TASK belongs. |
| TASK:GetName() |
Gets the Name of the Task |
| TASK:GetProcessTemplate(ProcessName) |
Get the default or currently assigned Process template with key ProcessName. |
| TASK:GetScoring() |
Gets the Scoring of the task |
| TASK:GetStateMachine(TaskUnit) | |
| TASK:GetStateString() |
Gets the Task status. |
| TASK:GetTaskIndex() |
Gets the Task Index, which is a combination of the Task type, the Task name. |
| TASK:GetTaskName() |
Returns the Task name. |
| TASK:GetType() |
Gets the Type of the Task |
| TASK:GetUnitProcess(TaskUnit) |
Get the Task FSM Process Template |
| TASK:HasAliveUnits() |
Returns if the Task has still alive and assigned Units. |
| TASK:HasGroup(FindGroup) | |
| TASK:HasStateMachine(TaskUnit) |
Checks if there is a FiniteStateMachine assigned to TaskUnit for Task |
| TASK:IsAssignedToGroup(TaskGroup) |
Returns if the Task is assigned to the Group. |
| TASK:IsStateAborted() |
Is the Task status Aborted. |
| TASK:IsStateAssigned() |
Is the Task status Assigned. |
| TASK:IsStateCancelled() |
Is the Task status Cancelled. |
| TASK:IsStateFailed() |
Is the Task status Failed. |
| TASK:IsStateHold() |
Is the Task status Hold. |
| TASK:IsStatePlanned() |
Is the Task status Planned. |
| TASK:IsStateReplanned() |
Is the Task status Replanned. |
| TASK:IsStateSuccess() |
Is the Task status Success. |
| TASK:JoinUnit(PlayerUnit, PlayerGroup) |
Add a PlayerUnit to join the Task. |
| TASK.MenuAssignToGroup(MenuParam) | |
| TASK:MenuTaskAbort(TaskGroup) |
Report the task status. |
| TASK:MenuTaskStatus(TaskGroup) |
Report the task status. |
| TASK:MessageToGroups(Message) | |
| TASK.Mission | |
| TASK:New(Mission, SetGroupAssign, TaskName, TaskType) |
Instantiates a new TASK. |
| TASK:OnAfterPlayerAborted(PlayerUnit, PlayerName) |
FSM PlayerAborted event handler prototype for TASK. |
| TASK:OnAfterPlayerCrashed(PlayerUnit, PlayerName) |
FSM PlayerCrashed event handler prototype for TASK. |
| TASK:OnAfterPlayerDead(PlayerUnit, PlayerName) |
FSM PlayerDead event handler prototype for TASK. |
| TASK:RemoveAssignedMenuForGroup(TaskGroup, MenuTime) | |
| TASK:RemoveMenu(MenuTime) |
Remove the menu options of the Task to all the groups in the SetGroup. |
| TASK:RemovePlannedMenuForGroup(TaskGroup, MenuTime) | |
| TASK:RemoveStateMachine(TaskUnit) | |
| TASK:Replan() |
FSM Replan synchronous event function for TASK. |
| TASK:ReportDetails() |
Create a detailed report of the Task. |
| TASK:ReportSummary() |
Create a summary report of the Task. |
| TASK:SendBriefingToAssignedGroups() |
Send the briefng message of the Task to the assigned Groups. |
| TASK:SetAssignedMenuForGroup(TaskGroup, MenuTime) |
Set the assigned menu options of the Task. |
| TASK:SetBriefing(TaskBriefing) |
Sets a Task briefing. |
| TASK:SetDispatcher(Dispatcher) |
Set dispatcher of a task |
| TASK.SetGroup |
The Set of Groups assigned to the Task |
| TASK:SetID(TaskID) |
Sets the ID of the Task |
| TASK:SetMenu(MenuTime) |
Set the menu options of the Task to all the groups in the SetGroup. |
| TASK:SetMenuForGroup(MenuTime, TaskGroup) |
Set the Menu for a Group |
| TASK:SetName(TaskName) |
Sets the Name of the Task |
| TASK:SetPlannedMenuForGroup(TaskGroup, MenuText, MenuTime) |
Set the planned menu option of the Task. |
| TASK:SetStateMachine(TaskUnit, Fsm) | |
| TASK:SetTimeOut(Timer) |
Sets the TimeOut for the Task. |
| TASK:SetType(TaskType) |
Sets the Type of the Task |
| TASK:SetUnitProcess(Core, FsmTemplate) |
Sets the Task FSM Process Template |
| TASK:StateAborted() |
Sets a Task to status Aborted. |
| TASK:StateAssigned() |
Sets a Task to status Assigned. |
| TASK:StateCancelled() |
Sets a Task to status Cancelled. |
| TASK:StateFailed() |
Sets a Task to status Failed. |
| TASK:StateHold() |
Sets a Task to status Hold. |
| TASK:StatePlanned() |
Sets a Task to status Planned. |
| TASK:StateReplanned() |
Sets a Task to status Replanned. |
| TASK:StateSuccess() |
Sets a Task to status Success. |
| TASK:Success() |
FSM Success synchronous event function for TASK. |
| TASK.TaskBriefing | |
| TASK.TaskID | |
| TASK.TaskName | |
| TASK.TaskScheduler | |
| TASK.TaskType | |
| TASK.TimeOut | |
| TASK:UnAssignFromGroup(TaskGroup) | |
| TASK:UnAssignFromGroups() | |
| TASK:UnAssignFromUnit(TaskUnit) | |
| TASK:__Abort() |
FSM Abort asynchronous event function for TASK. |
| TASK:__Cancel() |
FSM Cancel asynchronous event function for TASK. |
| TASK:__Fail() |
FSM Fail asynchronous event function for TASK. |
| TASK:__Replan() |
FSM Replan asynchronous event function for TASK. |
| TASK:__Success() |
FSM Success asynchronous event function for TASK. |
| TASK:onafterReplan(From, Event, To) |
FSM function for a TASK |
| TASK:onbeforeTimeOut(Event, From, To) |
FSM function for a TASK |
| TASK:onenterAborted(From, Event, To) |
FSM function for a TASK |
| TASK:onenterAssigned(Event, From, To, PlayerUnit, PlayerName) |
FSM function for a TASK |
| TASK:onenterFailed(From, Event, To) |
FSM function for a TASK |
| TASK:onenterPlanned(Event, From, To) |
FSM function for a TASK |
| TASK:onenterSuccess(Event, From, To) |
FSM function for a TASK |
| TASK:onstatechange(Event, From, To) |
FSM function for a TASK |
Global(s)
- #TASK TASK
-
TASK class, extends Base#BASE
The TASK class implements the methods for task orchestration within MOOSE.
The class provides a couple of methods to:
- TASK.AssignToGroup():Assign a task to a group (of players).
- TASK.AddProcess():Add a Process to a task.
- TASK.RemoveProcesses():Remove a running Process from a running task.
- TASK.SetStateMachine():Set a Fsm to a task.
- TASK.RemoveStateMachine():Remove Fsm from a task.
- TASK.HasStateMachine():Enquire if the task has a Fsm
- TASK.AssignToUnit(): Assign a task to a unit. (Needs to be implemented in the derived classes from #TASK.
- TASK.UnAssignFromUnit(): Unassign the task from a unit.
- TASK.SetTimeOut(): Set timer in seconds before task gets cancelled if not assigned.
1.2) Set and enquire task status (beyond the task state machine processing).
A task needs to implement as a minimum the following task states:
- Success: Expresses the successful execution and finalization of the task.
- Failed: Expresses the failure of a task.
- Planned: Expresses that the task is created, but not yet in execution and is not assigned yet.
- Assigned: Expresses that the task is assigned to a Group of players, and that the task is in execution mode.
A task may also implement the following task states:
- Rejected: Expresses that the task is rejected by a player, who was requested to accept the task.
- Cancelled: Expresses that the task is cancelled by HQ or through a logical situation where a cancellation of the task is required.
A task can implement more statusses than the ones outlined above. Please consult the documentation of the specific tasks to understand the different status modelled.
The status of tasks can be set by the methods State followed by the task status. An example is
StateAssigned(). The status of tasks can be enquired by the methods IsState followed by the task status name. An example isif IsStateAssigned() then.1.3) Add scoring when reaching a certain task status:
Upon reaching a certain task status in a task, additional scoring can be given. If the Mission has a scoring system attached, the scores will be added to the mission scoring. Use the method TASK.AddScore() to add scores when a status is reached.
1.4) Task briefing:
A task briefing can be given that is shown to the player when he is assigned to the task.
Type Task
Type TASK
Field(s)
- TASK:Abort()
-
FSM Abort synchronous event function for TASK.
Use this event to Abort the Task.
- TASK:AbortUnit(PlayerUnit)
-
Abort a PlayerUnit from a Task.
If the Unit was not part of the Task, false is returned. If the Unit is part of the Task, true is returned.
Parameter
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player aborting the Task.
Return value
#boolean: true if Unit is part of the Task.
-
- TASK:AssignToGroup(TaskGroup)
-
Parameter
-
Wrapper.Group#GROUP TaskGroup:
Return value
-
- TASK:AssignToUnit(TaskUnit)
-
Assign the Task to an alive Unit.
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
#TASK: self
-
- TASK:Cancel()
-
FSM Cancel synchronous event function for TASK.
Use this event to Cancel the Task.
- TASK:CrashUnit(PlayerUnit)
-
A PlayerUnit crashed in a Task.
Abort the Player. If the Unit was not part of the Task, false is returned. If the Unit is part of the Task, true is returned.
Parameter
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player aborting the Task.
Return value
#boolean: true if Unit is part of the Task.
-
- TASK:Fail()
-
FSM Fail synchronous event function for TASK.
Use this event to Fail the Task.
- TASK:FailProcesses(TaskUnitName)
-
TODO: Obscolete? - Fail processes from Task with key Unit @param #TASK self @param #string TaskUnitName @return #TASK self
Parameter
-
TaskUnitName:
-
- TASK:GetGroups()
-
Gets the SET_GROUP assigned to the TASK.
Return value
- TASK:GetID()
-
Gets the ID of the Task
Return value
#string: TaskID
- TASK:GetMission()
-
Gets the Mission to where the TASK belongs.
Return value
- TASK:GetName()
-
Gets the Name of the Task
Return value
#string: The Task Name
- TASK:GetProcessTemplate(ProcessName)
-
Get the default or currently assigned Process template with key ProcessName.
Parameter
-
#string ProcessName:
Return value
-
- TASK:GetScoring()
-
Gets the Scoring of the task
Return value
Functional.Scoring#SCORING: Scoring
- TASK:GetStateMachine(TaskUnit)
-
Gets the FiniteStateMachine of Task with key TaskUnit
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
-
- TASK:GetStateString()
-
Gets the Task status.
- TASK:GetTaskIndex()
-
Gets the Task Index, which is a combination of the Task type, the Task name.
Return value
#string: The Task ID
- TASK:GetTaskName()
-
Returns the Task name.
Return value
#string: TaskName
- TASK:GetType()
-
Gets the Type of the Task
Return value
#string: TaskType
- TASK:GetUnitProcess(TaskUnit)
-
Get the Task FSM Process Template
Parameter
-
TaskUnit:
Return value
-
- TASK:HasAliveUnits()
-
Returns if the Task has still alive and assigned Units.
Return value
#boolean:
- TASK:HasGroup(FindGroup)
-
Parameter
-
Wrapper.Group#GROUP FindGroup:
Return value
#boolean:
-
- TASK:HasStateMachine(TaskUnit)
-
Checks if there is a FiniteStateMachine assigned to TaskUnit for Task
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
#TASK: self
-
- TASK:IsAssignedToGroup(TaskGroup)
-
Returns if the Task is assigned to the Group.
Parameter
-
Wrapper.Group#GROUP TaskGroup:
Return value
#boolean:
-
- TASK:IsStateAborted()
-
Is the Task status Aborted.
- TASK:IsStateAssigned()
-
Is the Task status Assigned.
- TASK:IsStateCancelled()
-
Is the Task status Cancelled.
- TASK:IsStateFailed()
-
Is the Task status Failed.
- TASK:IsStateHold()
-
Is the Task status Hold.
- TASK:IsStatePlanned()
-
Is the Task status Planned.
- TASK:IsStateReplanned()
-
Is the Task status Replanned.
- TASK:IsStateSuccess()
-
Is the Task status Success.
- TASK:JoinUnit(PlayerUnit, PlayerGroup)
-
Add a PlayerUnit to join the Task.
For each Group within the Task, the Unit is check if it can join the Task. If the Unit was not part of the Task, false is returned. If the Unit is part of the Task, true is returned.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player joining the Mission. -
Wrapper.Group#GROUP PlayerGroup: The GROUP of the player joining the Mission.
Return value
#boolean: true if Unit is part of the Task.
-
- TASK.MenuAssignToGroup(MenuParam)
-
Parameter
-
MenuParam:
-
- TASK:MenuTaskAbort(TaskGroup)
-
Report the task status.
Parameter
-
TaskGroup:
-
- TASK:MenuTaskStatus(TaskGroup)
-
Report the task status.
Parameter
-
TaskGroup:
-
- TASK:MessageToGroups(Message)
-
Send a message of the Task to the assigned Groups.
Parameter
-
Message:
-
- TASK:New(Mission, SetGroupAssign, TaskName, TaskType)
-
Instantiates a new TASK.
Should never be used. Interface Class.
Parameters
-
Tasking.Mission#MISSION Mission: The mission wherein the Task is registered. -
Core.Set#SET_GROUP SetGroupAssign: The set of groups for which the Task can be assigned. -
#string TaskName: The name of the Task -
#string TaskType: The type of the Task
Return value
#TASK: self
-
- TASK:OnAfterPlayerAborted(PlayerUnit, PlayerName)
-
FSM PlayerAborted event handler prototype for TASK.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The Unit of the Player when he went back to spectators or left the mission. -
#string PlayerName: The name of the Player.
-
- TASK:OnAfterPlayerCrashed(PlayerUnit, PlayerName)
-
FSM PlayerCrashed event handler prototype for TASK.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The Unit of the Player when he crashed in the mission. -
#string PlayerName: The name of the Player.
-
- TASK:OnAfterPlayerDead(PlayerUnit, PlayerName)
-
FSM PlayerDead event handler prototype for TASK.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The Unit of the Player when he died in the mission. -
#string PlayerName: The name of the Player.
-
- TASK:RemoveAssignedMenuForGroup(TaskGroup, MenuTime)
-
Remove the assigned menu option of the Task for a Group.
Parameters
-
Wrapper.Group#GROUP TaskGroup: -
#number MenuTime:
Return value
#TASK: self
-
- TASK:RemoveMenu(MenuTime)
-
Remove the menu options of the Task to all the groups in the SetGroup.
Parameter
-
#number MenuTime:
Return value
-
- TASK:RemovePlannedMenuForGroup(TaskGroup, MenuTime)
-
Remove the menu option of the Task for a Group.
Parameters
-
Wrapper.Group#GROUP TaskGroup: -
#number MenuTime:
Return value
#TASK: self
-
- TASK:RemoveStateMachine(TaskUnit)
-
Remove FiniteStateMachines from Task with key TaskUnit
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
#TASK: self
-
- TASK:Replan()
-
FSM Replan synchronous event function for TASK.
Use this event to Replan the Task.
- TASK:ReportDetails()
-
Create a detailed report of the Task.
List the Task Status, and the Players assigned to the Task.
Return value
#string:
- TASK:ReportSummary()
-
Create a summary report of the Task.
List the Task Name and Status
Return value
#string:
- TASK:SendBriefingToAssignedGroups()
-
Send the briefng message of the Task to the assigned Groups.
- TASK:SetAssignedMenuForGroup(TaskGroup, MenuTime)
-
Set the assigned menu options of the Task.
Parameters
-
Wrapper.Group#GROUP TaskGroup: -
#number MenuTime:
Return value
#TASK: self
-
- TASK:SetBriefing(TaskBriefing)
-
Sets a Task briefing.
Parameter
-
#string TaskBriefing:
Return value
#TASK: self
-
- TASK:SetDispatcher(Dispatcher)
-
Set dispatcher of a task
Parameter
-
Tasking.DetectionManager#DETECTION_MANAGER Dispatcher:
Return value
-
- Core.Set#SET_GROUP TASK.SetGroup
-
The Set of Groups assigned to the Task
- TASK:SetID(TaskID)
-
Sets the ID of the Task
Parameter
-
#string TaskID:
-
- TASK:SetMenu(MenuTime)
-
Set the menu options of the Task to all the groups in the SetGroup.
Parameter
-
#number MenuTime:
Return value
-
- TASK:SetMenuForGroup(MenuTime, TaskGroup)
-
Set the Menu for a Group
Parameters
-
#number MenuTime: -
TaskGroup:
Return value
-
- TASK:SetName(TaskName)
-
Sets the Name of the Task
Parameter
-
#string TaskName:
-
- TASK:SetPlannedMenuForGroup(TaskGroup, MenuText, MenuTime)
-
Set the planned menu option of the Task.
Parameters
-
Wrapper.Group#GROUP TaskGroup: -
#string MenuText: The menu text. -
#number MenuTime:
Return value
#TASK: self
-
- TASK:SetStateMachine(TaskUnit, Fsm)
-
Add a FiniteStateMachine to Task with key TaskUnit
Parameters
-
Wrapper.Unit#UNIT TaskUnit: -
Core.Fsm#FSM_PROCESS Fsm:
Return value
#TASK: self
-
- TASK:SetTimeOut(Timer)
-
Sets the TimeOut for the Task.
If Task stayed planned for longer than TimeOut, it gets into Cancelled status.
Parameter
-
#integer Timer: in seconds
Return value
#TASK: self
-
- TASK:SetType(TaskType)
-
Sets the Type of the Task
Parameter
-
#string TaskType:
-
- TASK:SetUnitProcess(Core, FsmTemplate)
-
Sets the Task FSM Process Template
Parameters
-
Core: Fsm#FSM_PROCESS -
FsmTemplate:
-
- TASK:StateAborted()
-
Sets a Task to status Aborted.
- TASK:StateAssigned()
-
Sets a Task to status Assigned.
- TASK:StateCancelled()
-
Sets a Task to status Cancelled.
- TASK:StateFailed()
-
Sets a Task to status Failed.
- TASK:StateHold()
-
Sets a Task to status Hold.
- TASK:StatePlanned()
-
Sets a Task to status Planned.
- TASK:StateReplanned()
-
Sets a Task to status Replanned.
- TASK:StateSuccess()
-
Sets a Task to status Success.
- TASK:Success()
-
FSM Success synchronous event function for TASK.
Use this event to make the Task a Success.
- TASK:UnAssignFromGroup(TaskGroup)
-
UnAssign the Task from a Group.
Parameter
-
TaskGroup:
-
- TASK:UnAssignFromUnit(TaskUnit)
-
UnAssign the Task from an alive Unit.
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
#TASK: self
-
- TASK:__Abort()
-
FSM Abort asynchronous event function for TASK.
Use this event to Abort the Task.
- TASK:__Cancel()
-
FSM Cancel asynchronous event function for TASK.
Use this event to Cancel the Task.
- TASK:__Fail()
-
FSM Fail asynchronous event function for TASK.
Use this event to Fail the Task.
- TASK:__Replan()
-
FSM Replan asynchronous event function for TASK.
Use this event to Replan the Task.
- TASK:__Success()
-
FSM Success asynchronous event function for TASK.
Use this event to make the Task a Success.
- TASK:onafterReplan(From, Event, To)
-
FSM function for a TASK
Parameters
-
#string From: -
#string Event: -
#string To:
-
- TASK:onbeforeTimeOut(Event, From, To)
-
FSM function for a TASK
Parameters
-
#string Event: -
#string From: -
#string To:
-
- TASK:onenterAborted(From, Event, To)
-
FSM function for a TASK
Parameters
-
#string From: -
#string Event: -
#string To:
-
- TASK:onenterAssigned(Event, From, To, PlayerUnit, PlayerName)
-
FSM function for a TASK
Parameters
-
#string Event: -
#string From: -
#string To: -
PlayerUnit: -
PlayerName:
-
- TASK:onenterFailed(From, Event, To)
-
FSM function for a TASK
Parameters
-
#string From: -
#string Event: -
#string To:
-
- TASK:onenterPlanned(Event, From, To)
-
FSM function for a TASK
Parameters
-
#string Event: -
#string From: -
#string To:
-
- TASK:onenterSuccess(Event, From, To)
-
FSM function for a TASK
Parameters
-
#string Event: -
#string From: -
#string To:
-
- TASK:onstatechange(Event, From, To)
-
FSM function for a TASK
Parameters
-
#string Event: -
#string From: -
#string To:
-