Module Task

This module contains the TASK class.

1) #TASK class, extends Core.Base#BASE

1.1) The #TASK class implements the methods for task orchestration within MOOSE.

The class provides a couple of methods to:

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 is if 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.


Authors: FlightControl - Design and Programming

Global(s)

TASK

Type TASK

TASK:Abort()

FSM Abort synchronous event function for TASK.

TASK:AbortUnit(PlayerUnit)

Abort a PlayerUnit from a Task.

TASK:AssignToGroup(TaskGroup)

Assign the Taskto a Group.

TASK:AssignToUnit(TaskUnit)

Assign the Task to an alive Unit.

TASK:Cancel()

FSM Cancel synchronous event function for TASK.

TASK.ClassName
TASK.CommandCenter
TASK:CrashUnit(PlayerUnit)

A PlayerUnit crashed in a Task.

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: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()

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:IsStateAssigned()

Is the Task status Assigned.

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)

Add a PlayerUnit to join the Task.

TASK.Menu
TASK.MenuAssignToGroup(MenuParam)
TASK.MenuTaskAbort(MenuParam)
TASK.MenuTaskStatus(MenuParam)
TASK:MessageToGroups(Message)

Send a message of the Task to the assigned Groups.

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.Players
TASK.ProcessClasses
TASK.Processes
TASK:RemoveMenu()

Remove the menu options of the Task to all the groups in the SetGroup.

TASK:RemoveMenuForGroup(TaskGroup)

Remove the menu option of the Task for a Group.

TASK:RemoveStateMachine(TaskUnit)

Remove FiniteStateMachines from Task with key 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.Scores
TASK:SendBriefingToAssignedGroups()

Send the briefng message of the Task to the assigned Groups.

TASK:SetAssignedMenuForGroup(TaskGroup)

Set the assigned menu options of the Task.

TASK:SetBriefing(TaskBriefing)

Sets a Task briefing.

TASK.SetGroup

The Set of Groups assigned to the Task

TASK:SetID(TaskID)

Sets the ID of the Task

TASK:SetMenu()

Set the menu options of the Task to all the groups in the SetGroup.

TASK:SetMenuForGroup(TaskGroup)

Set the Menu for a Group

TASK:SetName(TaskName)

Sets the Name of the Task

TASK:SetPlannedMenuForGroup(TaskGroup, MenuText)

Set the planned menu option of the Task.

TASK:SetStateMachine(TaskUnit, Fsm)

Add a FiniteStateMachine to Task with key TaskUnit

TASK:SetType(TaskType)

Sets the Type of the Task

TASK:SetUnitProcess(Core, FsmTemplate)

Sets the Task FSM Process Template

TASK:StateAssigned()

Sets a Task to status Assigned.

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:UnAssignFromGroups()

Assign the Task from the Groups.

TASK:UnAssignFromUnit(TaskUnit)

UnAssign the Task from an alive Unit.

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:onenterAborted(Event, From, To)

FSM function for a TASK

TASK:onenterAssigned(Event, From, To)

FSM function for a TASK

TASK:onenterFailed(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

Type Task

Type TASK

The TASK class

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

Return value

#boolean: true if Unit is part of the Task.

TASK:AssignToGroup(TaskGroup)

Assign the Taskto a Group.

Parameter

Return value

#TASK:

TASK:AssignToUnit(TaskUnit)

Assign the Task to an alive Unit.

Parameter

Return value

#TASK: self

TASK:Cancel()

FSM Cancel synchronous event function for TASK.

Use this event to Cancel the Task.

#string TASK.ClassName
Tasking.CommandCenter#COMMANDCENTER TASK.CommandCenter
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

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 :

Core.Fsm#FSM_PROCESS TASK.FsmTemplate
TASK:GetGroups()

Gets the SET_GROUP assigned to the TASK.

Return value

Core.Set#SET_GROUP:

TASK:GetID()

Gets the ID of the Task

Return value

#string: TaskID

TASK:GetMission()

Gets the Mission to where the TASK belongs.

Return value

Tasking.Mission#MISSION:

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

Core.Fsm#FSM_PROCESS:

TASK:GetScoring()

Gets the Scoring of the task

Return value

Functional.Scoring#SCORING: Scoring

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()

Get the Task FSM Process Template

Return value

Core.Fsm#FSM_PROCESS:

TASK:HasAliveUnits()

Returns if the Task has still alive and assigned Units.

Return value

#boolean:

TASK:HasGroup(FindGroup)

Parameter

Return value

#boolean:

TASK:HasStateMachine(TaskUnit)

Checks if there is a FiniteStateMachine assigned to TaskUnit for Task

Parameter

Return value

#TASK: self

TASK:IsAssignedToGroup(TaskGroup)

Returns if the Task is assigned to the Group.

Parameter

Return value

#boolean:

TASK:IsStateAssigned()

Is the Task status Assigned.

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)

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.

Parameter

  • Wrapper.Unit#UNIT PlayerUnit : The CLIENT or UNIT of the Player joining the Mission.

Return value

#boolean: true if Unit is part of the Task.

TASK.Menu
TASK.MenuAssignToGroup(MenuParam)

Parameter

  • MenuParam :

TASK.MenuTaskAbort(MenuParam)

Parameter

  • MenuParam :

TASK.MenuTaskStatus(MenuParam)

Parameter

  • MenuParam :

TASK:MessageToGroups(Message)

Send a message of the Task to the assigned Groups.

Parameter

  • Message :

Tasking.Mission#MISSION TASK.Mission
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.Players
TASK.ProcessClasses
TASK.Processes
TASK:RemoveMenu()

Remove the menu options of the Task to all the groups in the SetGroup.

Return value

#TASK: self

TASK:RemoveMenuForGroup(TaskGroup)

Remove the menu option of the Task for a Group.

Parameter

Return value

#TASK: self

TASK:RemoveStateMachine(TaskUnit)

Remove FiniteStateMachines from Task with key TaskUnit

Parameter

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.Scores
TASK:SendBriefingToAssignedGroups()

Send the briefng message of the Task to the assigned Groups.

TASK:SetAssignedMenuForGroup(TaskGroup)

Set the assigned menu options of the Task.

Parameter

Return value

#TASK: self

TASK:SetBriefing(TaskBriefing)

Sets a Task briefing.

Parameter

  • #string TaskBriefing :

Return value

#TASK: self

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()

Set the menu options of the Task to all the groups in the SetGroup.

TASK:SetMenuForGroup(TaskGroup)

Set the Menu for a Group

Parameter

  • TaskGroup :

TASK:SetName(TaskName)

Sets the Name of the Task

Parameter

  • #string TaskName :

TASK:SetPlannedMenuForGroup(TaskGroup, MenuText)

Set the planned menu option of the Task.

Parameters

Return value

#TASK: self

TASK:SetStateMachine(TaskUnit, Fsm)

Add a FiniteStateMachine to Task with key TaskUnit

Parameters

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:StateAssigned()

Sets a Task to status Assigned.

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.TaskBriefing
TASK.TaskID
TASK.TaskName
Core.Scheduler#SCHEDULER TASK.TaskScheduler
TASK.TaskType
TASK:UnAssignFromGroups()

Assign the Task from the Groups.

TASK:UnAssignFromUnit(TaskUnit)

UnAssign the Task from an alive Unit.

Parameter

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:onenterAborted(Event, From, To)

FSM function for a TASK

Parameters

  • #string Event :

  • #string From :

  • #string To :

TASK:onenterAssigned(Event, From, To)

FSM function for a TASK

Parameters

  • #string Event :

  • #string From :

  • #string To :

TASK:onenterFailed(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 :