Module Task
Tasking -- This module contains the TASK class, the main engine to run human taskings.
Author: FlightControl
Contributions:
Global(s)
TASK |
TASK class, extends Core.Base#BASEThe TASK class implements the methods for task orchestration within MOOSE. |
Type TASK
Global(s)
- #TASK TASK
-
TASK class, extends Core.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
Extends Core.Fsm#FSM_TASK
Field(s)
- TASK:Abort()
-
FSM Abort synchronous event function for TASK.
Use this event to Abort the Task.
- TASK:AbortGroup(PlayerGroup)
-
A group aborting the task.
Parameter
-
Wrapper.Group#GROUP PlayerGroup
: The group aborting the task.
Return value
-
- TASK:AddGroups(GroupSet)
-
Gets the SET_GROUP assigned to the TASK.
Parameter
-
Core.Set#SET_GROUP GroupSet
:
Return value
-
- TASK:AddProgress(PlayerName, ProgressText, ProgressTime, ProgressPoints)
-
Add Task Progress for a Player Name
Parameters
-
#string PlayerName
: The name of the player. -
#string ProgressText
: The text that explains the Progress achieved. -
#number ProgressTime
: The time the progress was achieved. -
ProgressPoints
:
Return value
-
- TASK:AssignToGroup(TaskGroup)
-
Assign the Task to a Wrapper.Group.
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
Return value
-
- TASK:AssignToUnit(TaskUnit)
-
Assign the Task to an alive Wrapper.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:ClearGroupAssignment(TaskGroup)
-
Clear the Wrapper.Group assignment from the Task.
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
Return value
-
- TASK:CrashGroup(PlayerGroup)
-
A group crashing and thus aborting from the task.
Parameter
-
Wrapper.Group#GROUP PlayerGroup
: The group aborting the task.
Return value
-
- 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 Wrapper.Unit @param #TASK self @param #string TaskUnitName @return #TASK self
Parameter
-
TaskUnitName
:
-
- TASK:GetBriefing()
-
Gets the Task briefing.
Return value
#string: The briefing text.
- 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:GetPlayerCount()
-
Create a count of the players in the Task.
Return value
#number: The total number of players in the task.
- TASK:GetPlayerNames()
-
Create a list of the players in the Task.
Return value
#map<#string,Wrapper.Group#GROUP>: A map of the players
- TASK:GetPlayerProgress(PlayerName)
-
Parameter
-
PlayerName
:
-
- 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 TaskWrapper.Unit
Parameter
-
Wrapper.Unit#UNIT TaskUnit
:
Return value
-
- TASK:GetStateString()
-
Gets the Task status.
- TASK:GetTaskBriefing()
-
Returns the Task briefing.
Return value
#string: Task briefing.
- TASK:GetTaskControlMenu(TaskUnit, TaskName)
-
Get Task Control Menu
Parameters
-
Wrapper.Unit#UNIT TaskUnit
: The Wrapper.Unit that contains a player. -
TaskName
:
Return value
Core.Menu#MENU_GROUP: TaskControlMenu The Task Control Menu
-
- 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:Goal(PlayerUnit, PlayerName)
-
Goal Trigger for TASK
Parameters
-
Wrapper.Unit#UNIT PlayerUnit
: The Wrapper.Unit of the player. -
#string PlayerName
: The name of the player.
-
- 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 TaskWrapper.Unit for Task
Parameter
-
Wrapper.Unit#UNIT TaskUnit
:
Return value
#TASK: self
-
- TASK:InitTaskControlMenu(TaskUnit)
-
Init Task Control Menu
Parameter
-
Wrapper.Unit#UNIT TaskUnit
: The Wrapper.Unit that contains a player.
Return value
Task Control Menu Refresh ID
-
- TASK:IsGroupAssigned(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 checked 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(TaskGroup)
-
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
-
- TASK:MenuMarkToGroup(TaskGroup)
-
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
-
- 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 Wrapper.Groups.
Parameter
-
Message
:
-
- TASK:New(Mission, SetGroupAssign, TaskName, TaskType, TaskBriefing)
-
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 -
TaskBriefing
:
Return value
#TASK: self
-
- TASK:OnAfterGoal(From, Event, To, PlayerUnit, PlayerName)
-
Goal Handler OnAfter for TASK
Parameters
-
#string From
: -
#string Event
: -
#string To
: -
Wrapper.Unit#UNIT PlayerUnit
: The Wrapper.Unit of the player. -
#string PlayerName
: The name of the player.
-
- 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:OnBeforeGoal(From, Event, To, PlayerUnit, PlayerName)
-
Goal Handler OnBefore for TASK
Parameters
-
#string From
: -
#string Event
: -
#string To
: -
Wrapper.Unit#UNIT PlayerUnit
: The Wrapper.Unit of the player. -
#string PlayerName
: The name of the player.
Return value
#boolean:
-
- TASK:RefreshMenus(TaskGroup, MenuTime)
-
Remove the menu option of the Task for a Wrapper.Group.
Parameters
-
Wrapper.Group#GROUP TaskGroup
: -
#number MenuTime
:
Return value
#TASK: self
-
- TASK:RefreshTaskControlMenu(TaskUnit, MenuTime, MenuTag)
-
Refresh Task Control Menu
Parameters
-
Wrapper.Unit#UNIT TaskUnit
: The Wrapper.Unit that contains a player. -
MenuTime
: The refresh time that was used to refresh the Task Control Menu items. -
MenuTag
: The tag.
-
- TASK:RejectGroup(PlayerGroup)
-
A group rejecting a planned task.
Parameter
-
Wrapper.Group#GROUP PlayerGroup
: The group rejecting the task.
Return value
-
- TASK:RemoveAssignedMenuForGroup(TaskGroup, MenuTime)
-
Remove the assigned menu option of the Task for a Wrapper.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:RemoveStateMachine(TaskUnit)
-
Remove FiniteStateMachines from Task with key TaskWrapper.Unit
Parameter
-
Wrapper.Unit#UNIT TaskUnit
:
Return value
#TASK: self
-
- TASK:RemoveTaskControlMenu(TaskUnit)
-
Remove Task Control Menu
Parameter
-
Wrapper.Unit#UNIT TaskUnit
: The Wrapper.Unit that contains a player.
-
- TASK:Replan()
-
FSM Replan synchronous event function for TASK.
Use this event to Replan the Task.
- TASK:ReportDetails(TaskGroup, ReportGroup)
-
Create a detailed report of the Task.
List the Task Status, and the Players assigned to the Task.
Parameters
-
Wrapper.Group#GROUP TaskGroup
: -
ReportGroup
:
Return value
#string:
-
- TASK:ReportOverview(ReportGroup)
-
Create an overiew report of the Task.
List the Task Name and Status
Parameter
-
ReportGroup
:
Return value
#string:
-
- TASK:ReportSummary(ReportGroup)
-
Create a summary report of the Task.
List the Task Name and Status
Parameter
-
Wrapper.Group#GROUP ReportGroup
:
Return value
#string:
-
- TASK:SendBriefingToAssignedGroups()
-
Send the briefng message of the Task to the assigned Wrapper.Groups.
- TASK:SetAssignMethod(AcceptClass)
-
Parameter
-
Actions.ActAssign#ACTASSIGN AcceptClass
:
-
- 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:SetDetection(Detection, DetectedItem)
-
Set detection of a task
Parameters
-
Function.Detection#DETECTION_BASE Detection
: -
DetectedItem
:
Return value
-
- 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:SetGroupAssigned(TaskGroup)
-
Set Wrapper.Group assigned to the Task.
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
Return value
-
- 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:SetScoreOnFail(PlayerName, Penalty, TaskUnit)
-
Set a penalty when the A2A attack has failed.
Parameters
-
#string PlayerName
: The name of the player. -
#number Penalty
: The penalty in points, must be a negative value! -
Wrapper.Unit#UNIT TaskUnit
:
Return value
-
- TASK:SetScoreOnProgress(PlayerName, Score, TaskUnit)
-
Set a score when progress has been made by the player.
Parameters
-
#string PlayerName
: The name of the player. -
#number Score
: The score in points to be granted when task process has been achieved. -
Wrapper.Unit#UNIT TaskUnit
:
Return value
-
- TASK:SetScoreOnSuccess(PlayerName, Score, TaskUnit)
-
Set a score when all the targets in scope of the A2A attack, have been destroyed.
Parameters
-
#string PlayerName
: The name of the player. -
#number Score
: The score in points. -
Wrapper.Unit#UNIT TaskUnit
:
Return value
-
- TASK:SetStateMachine(TaskUnit, Fsm)
-
Add a FiniteStateMachine to Task with key TaskWrapper.Unit
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 Wrapper.Group.
Parameter
-
Wrapper.Group#GROUP TaskGroup
:
-
- TASK:UnAssignFromGroups()
-
UnAssign the Task from the Wrapper.Groups.
- TASK:UnAssignFromUnit(TaskUnit)
-
UnAssign the Task from an alive Wrapper.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:__Goal(Delay, PlayerUnit, PlayerName)
-
Goal Asynchronous Trigger for TASK
Parameters
-
#number Delay
: -
Wrapper.Unit#UNIT PlayerUnit
: The Wrapper.Unit of the player. -
#string PlayerName
: The name of the player.
-
- 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:onenterCancelled(From, Event, To)
-
FSM function for a TASK
Parameters
-
#string From
: -
#string Event
: -
#string To
:
-
- 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
:
-