Module Task

This module contains the TASK_BASE class.

1) #TASK_BASE class, extends Base#BASE

1.1) The #TASK_BASE 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_BASE.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_BASE

Type TASK_BASE

TASK_BASE:AddProcess(TaskUnit, Process)

Add Process to Task with key Unit

TASK_BASE:AddScore(TaskStatus, ScoreText, Score)

Adds a score for the TASK to be achieved.

TASK_BASE:AddStateMachine(TaskUnit, Fsm)

Add a FiniteStateMachine to Task with key Unit

TASK_BASE:AssignToGroup(TaskGroup)

Assign the Taskto a Group.

TASK_BASE:AssignToUnit(TaskUnit)

Assign the Taskto an alive Unit.

TASK_BASE.ClassName
TASK_BASE.Fsm
TASK_BASE:GetCategory()

Gets the Category of the Task

TASK_BASE:GetID()

Gets the ID of the Task

TASK_BASE:GetName()

Gets the Name of the Task

TASK_BASE:GetScoring()

Gets the Scoring of the task

TASK_BASE:GetStateString()

Gets the Task status.

TASK_BASE:GetType()

Gets the Type of the Task

TASK_BASE:HasStateMachine(TaskUnit)

Checks if there is a FiniteStateMachine assigned to Unit for Task

TASK_BASE:IsStateAssigned()

Is the Task status Assigned.

TASK_BASE:IsStateFailed()

Is the Task status Failed.

TASK_BASE:IsStateHold()

Is the Task status Hold.

TASK_BASE:IsStatePlanned()

Is the Task status Planned.

TASK_BASE:IsStateReplanned()

Is the Task status Replanned.

TASK_BASE:IsStateSuccess()

Is the Task status Success.

TASK_BASE.Mission
TASK_BASE:New(Mission, TaskName, TaskType, TaskCategory)

Instantiates a new TASK_BASE.

TASK_BASE:OnStateChange(Fsm, Event, From, To, Event)

StateMachine callback function for a TASK

TASK_BASE.Players
TASK_BASE.Processes
TASK_BASE:RemoveProcesses(TaskUnit, FailProcesses)

Remove Processes from Task with key Unit

TASK_BASE:RemoveStateMachines(TaskUnit)

Remove FiniteStateMachines from Task with key Unit

TASK_BASE.Scores
TASK_BASE:SetBriefing(TaskBriefing)

Sets a Task briefing.

TASK_BASE:SetCategory(TaskCategory)

Sets the Category of the Task

TASK_BASE:SetID(TaskID)

Sets the ID of the Task

TASK_BASE:SetName(TaskName)

Sets the Name of the Task

TASK_BASE:SetType(TaskType)

Sets the Type of the Task

TASK_BASE:StateAssigned()

Sets a Task to status Assigned.

TASK_BASE:StateFailed()

Sets a Task to status Failed.

TASK_BASE:StateHold()

Sets a Task to status Hold.

TASK_BASE:StatePlanned()

Sets a Task to status Planned.

TASK_BASE:StateReplanned()

Sets a Task to status Replanned.

TASK_BASE:StateSuccess()

Sets a Task to status Success.

TASK_BASE.TaskBriefing
TASK_BASE.TaskCategory
TASK_BASE.TaskID
TASK_BASE.TaskName
TASK_BASE.TaskScheduler
TASK_BASE.TaskType
TASK_BASE.TaskUnit
TASK_BASE:UnAssignFromUnit(TaskUnit, FailProcesses)

UnAssign the Task from an alive Unit.

TASK_BASE:_EventAssignUnit(Event)

Register a potential new assignment for a new spawned Unit.

TASK_BASE:_EventUnAssignUnit(Event)

UnAssigns a Unit that is left by a player, crashed, dead, ....

TASK_BASE:_Schedule()
TASK_BASE:_Scheduler()

Global(s)

#TASK_BASE TASK_BASE

Type Task

Type TASK_BASE

The TASK_BASE class

Field(s)

TASK_BASE:AddProcess(TaskUnit, Process)

Add Process to Task with key Unit

Parameters

Return value

#TASK_BASE: self

TASK_BASE:AddScore(TaskStatus, ScoreText, Score)

Adds a score for the TASK to be achieved.

Parameters

  • #string TaskStatus : is the status of the TASK when the score needs to be given.

  • #string ScoreText : is a text describing the score that is given according the status.

  • #number Score : is a number providing the score of the status.

Return value

#TASK_BASE: self

TASK_BASE:AddStateMachine(TaskUnit, Fsm)

Add a FiniteStateMachine to Task with key Unit

Parameters

Return value

#TASK_BASE: self

TASK_BASE:AssignToGroup(TaskGroup)

Assign the Taskto a Group.

Parameter

Return value

#TASK_BASE: self

TASK_BASE:AssignToUnit(TaskUnit)

Assign the Taskto an alive Unit.

Parameter

Return value

#TASK_BASE: self

#string TASK_BASE.ClassName
StateMachine#STATEMACHINE TASK_BASE.Fsm
TASK_BASE:GetCategory()

Gets the Category of the Task

Return value

#string: TaskCategory

TASK_BASE:GetID()

Gets the ID of the Task

Return value

#string: TaskID

TASK_BASE:GetName()

Gets the Name of the Task

Return value

#string: The Task Name

TASK_BASE:GetScoring()

Gets the Scoring of the task

Return value

Scoring#SCORING: Scoring

TASK_BASE:GetStateString()

Gets the Task status.

TASK_BASE:GetType()

Gets the Type of the Task

Return value

#string: TaskType

TASK_BASE:HasStateMachine(TaskUnit)

Checks if there is a FiniteStateMachine assigned to Unit for Task

Parameter

Return value

#TASK_BASE: self

TASK_BASE:IsStateAssigned()

Is the Task status Assigned.

TASK_BASE:IsStateFailed()

Is the Task status Failed.

TASK_BASE:IsStateHold()

Is the Task status Hold.

TASK_BASE:IsStatePlanned()

Is the Task status Planned.

TASK_BASE:IsStateReplanned()

Is the Task status Replanned.

TASK_BASE:IsStateSuccess()

Is the Task status Success.

Mission#MISSION TASK_BASE.Mission
TASK_BASE:New(Mission, TaskName, TaskType, TaskCategory)

Instantiates a new TASK_BASE.

Should never be used. Interface Class.

Parameters

  • Mission :

  • TaskName :

  • TaskType :

  • TaskCategory :

Return value

#TASK_BASE: self

TASK_BASE:OnStateChange(Fsm, Event, From, To, Event)

StateMachine callback function for a TASK

Parameters

TASK_BASE.Players
TASK_BASE.Processes
TASK_BASE:RemoveProcesses(TaskUnit, FailProcesses)

Remove Processes from Task with key Unit

Parameters

  • TaskUnit :

  • FailProcesses :

Return value

#TASK_BASE: self

TASK_BASE:RemoveStateMachines(TaskUnit)

Remove FiniteStateMachines from Task with key Unit

Parameter

  • TaskUnit :

Return value

#TASK_BASE: self

TASK_BASE.Scores
TASK_BASE:SetBriefing(TaskBriefing)

Sets a Task briefing.

Parameter

  • #string TaskBriefing :

Return value

self

TASK_BASE:SetCategory(TaskCategory)

Sets the Category of the Task

Parameter

  • #string TaskCategory :

TASK_BASE:SetID(TaskID)

Sets the ID of the Task

Parameter

  • #string TaskID :

TASK_BASE:SetName(TaskName)

Sets the Name of the Task

Parameter

  • #string TaskName :

TASK_BASE:SetType(TaskType)

Sets the Type of the Task

Parameter

  • #string TaskType :

TASK_BASE:StateAssigned()

Sets a Task to status Assigned.

TASK_BASE:StateFailed()

Sets a Task to status Failed.

TASK_BASE:StateHold()

Sets a Task to status Hold.

TASK_BASE:StatePlanned()

Sets a Task to status Planned.

TASK_BASE:StateReplanned()

Sets a Task to status Replanned.

TASK_BASE:StateSuccess()

Sets a Task to status Success.

TASK_BASE.TaskBriefing
TASK_BASE.TaskCategory
TASK_BASE.TaskID
TASK_BASE.TaskName
Scheduler#SCHEDULER TASK_BASE.TaskScheduler
TASK_BASE.TaskType
TASK_BASE.TaskUnit
TASK_BASE:UnAssignFromUnit(TaskUnit, FailProcesses)

UnAssign the Task from an alive Unit.

Parameters

Return value

#TASK_BASE: self

TASK_BASE:_EventAssignUnit(Event)

Register a potential new assignment for a new spawned Unit.

Tasks only get assigned if there are players in it.

Parameter

Return value

#TASK_BASE: self

TASK_BASE:_EventUnAssignUnit(Event)

UnAssigns a Unit that is left by a player, crashed, dead, ....

There are only assignments if there are players in it.

Parameter

Return value

#TASK_BASE: self

TASK_BASE:_Schedule()
TASK_BASE:_Scheduler()