Module Task
Tasking -- This module contains the TASK class, the main engine to run human taskings.
Author: Sven Van de Velde (FlightControl)
Contributions:
Global(s)
| TASK |
TASK class, extends Base#BASEThe TASK class implements the methods for task orchestration within MOOSE. |
Type 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:AbortGroup(PlayerUnit, PlayerGroup)
-
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.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player aborting the Task. -
PlayerGroup:
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)
-
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:ClearGroupAssignment(TaskGroup)
-
Clear the Group assignment from the Task.
Parameter
-
Wrapper.Group#GROUP TaskGroup:
Return value
-
- TASK:CrashGroup(PlayerUnit, PlayerGroup)
-
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.
Parameters
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player aborting the Task. -
PlayerGroup:
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 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:GetInfo(TaskInfo)
-
Gets the Information of the Task
Parameter
-
#string TaskInfo: The key and title of the task information.
Return value
#string: TaskInfoText The Task info text.
-
- 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 TaskUnit
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: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 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 TaskUnit for Task
Parameter
-
Wrapper.Unit#UNIT TaskUnit:
Return value
#TASK: self
-
- 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 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 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 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 Group.
Parameters
-
Wrapper.Group#GROUP TaskGroup: -
#number MenuTime:
Return value
#TASK: self
-
- 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: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(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 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:SetDetection(Detection, DetectedItemIndex)
-
Set detection of a task
Parameters
-
Function.Detection#DETECTION_BASE Detection: -
#number DetectedItemIndex:
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 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:SetInfo(TaskInfo, TaskInfoText, TaskInfoOrder)
-
Sets the Information on the Task
Parameters
-
#string TaskInfo: The key and title of the task information. -
#string TaskInfoText: The Task info text. -
#number TaskInfoOrder: The ordering, a number between 0 and 99.
-
- 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 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
-
Wrapper.Group#GROUP 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:__Goal(Delay, PlayerUnit, PlayerName)
-
Goal Asynchronous Trigger for TASK
Parameters
-
#number Delay: -
Wrapper.Unit#UNIT PlayerUnit: The 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:
-