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:
- TASK_BASE.AssignToGroup():Assign a task to a group (of players).
- TASK_BASE.AddProcess():Add a Process to a task.
- TASK_BASE.RemoveProcesses():Remove a running Process from a running task.
- TASK_BASE.AddStateMachine():Add a StateMachine to a task.
- TASK_BASE.RemoveStateMachines():Remove StateMachines from a task.
- TASK_BASE.HasStateMachine():Enquire if the task has a StateMachine
- TASK_BASE.AssignToUnit(): Assign a task to a unit. (Needs to be implemented in the derived classes from #TASK_BASE.
- TASK_BASE.UnAssignFromUnit(): Unassign the task from a unit.
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
Global(s)
Type Task
Type TASK_BASE
The TASK_BASE class
Field(s)
- TASK_BASE:AddProcess(TaskUnit, Process)
-
Add Process to Task with key Unit
Parameters
-
Unit#UNIT TaskUnit: -
Process:
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
-
Unit#UNIT TaskUnit: -
Fsm:
Return value
#TASK_BASE: self
-
- TASK_BASE:AssignToGroup(TaskGroup)
-
Parameter
-
Group#GROUP TaskGroup:
Return value
#TASK_BASE: self
-
- TASK_BASE:AssignToUnit(TaskUnit)
-
Assign the Taskto an alive Unit.
Parameter
-
Unit#UNIT TaskUnit:
Return value
#TASK_BASE: self
-
- #string TASK_BASE.ClassName
- 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
-
Unit#UNIT TaskUnit:
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.
- 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
-
#string Event: -
#string From: -
#string To: -
Event#EVENTDATA Event:
- 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: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:UnAssignFromUnit(TaskUnit, FailProcesses)
-
UnAssign the Task from an alive Unit.
Parameters
-
Unit#UNIT TaskUnit: -
FailProcesses:
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
-
Event#EVENTDATA Event:
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
-
Event#EVENTDATA Event:
Return value
#TASK_BASE: self
-