Banner Image

Module AI.AI_Cargo

AI - Models the intelligent transportation of infantry and other cargo.


Author: FlightControl


Global(s)

Global AI_CARGO

Base class for the dynamic cargo handling capability for AI groups.

#AI_CARGO AI_CARGO

Base class for the dynamic cargo handling capability for AI groups.

Banner Image

Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation. The AI_CARGO module uses the Cargo.Cargo capabilities within the MOOSE framework. CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo. Please consult the Cargo.Cargo module for more information.

The derived classes from this module are:

Developer Note

Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE Therefore, this class is considered to be deprecated

Type(s)

Fields and Methods inherited from AI_CARGO Description

AI_CARGO.CargoCarrier

AI_CARGO.CargoSet

AI_CARGO.Carrier_Cargo

AI_CARGO:Deploy(Coordinate, Speed)

Deploy Trigger for AI_CARGO

AI_CARGO:IsRelocating()

AI_CARGO:IsTransporting()

AI_CARGO:New(Carrier, CargoSet)

Creates a new AI_CARGO object.

AI_CARGO:OnAfterDeploy(From, Event, To, Coordinate, Speed)

Deploy Handler OnAfter for AI_CARGO

AI_CARGO:OnAfterDeployed(Carrier, From, Event, To, DeployZone, Defend)

On after Deployed event.

AI_CARGO:OnAfterLoaded(Carrier, From, Event, To)

Loaded Handler OnAfter for AI_CARGO

AI_CARGO:OnAfterPickup(From, Event, To, Coordinate, Speed)

Pickup Handler OnAfter for AI_CARGO

AI_CARGO:OnAfterUnloaded(Carrier, From, Event, To)

Unloaded Handler OnAfter for AI_CARGO

AI_CARGO:OnBeforeDeploy(From, Event, To, Coordinate, Speed)

Deploy Handler OnBefore for AI_CARGO

AI_CARGO:OnBeforePickup(From, Event, To, Coordinate, Speed)

Pickup Handler OnBefore for AI_CARGO

AI_CARGO:Pickup(Coordinate, Speed)

Pickup Trigger for AI_CARGO

AI_CARGO.Relocating

AI_CARGO.Transporting

AI_CARGO:__Deploy(Delay, Coordinate, Speed)

Deploy Asynchronous Trigger for AI_CARGO

AI_CARGO:__Pickup(Delay, Coordinate, Speed)

Pickup Asynchronous Trigger for AI_CARGO

AI_CARGO:onafterBoard(Carrier, From, Event, To, Cargo, CarrierUnit, PickupZone)

On after Board event.

AI_CARGO:onafterDeploy(APC, From, Event, To, Coordinate, Speed, Height, DeployZone)

On after Deploy event.

AI_CARGO:onafterDeployed(Carrier, From, Event, To, DeployZone, Defend)

On after Deployed event.

AI_CARGO:onafterLoaded(Carrier, From, Event, To, PickupZone, Cargo)

On after Loaded event.

AI_CARGO:onafterPickedUp(Carrier, From, Event, To, PickupZone)

On after PickedUp event.

AI_CARGO:onafterPickup(APC, From, Event, To, Coordinate, Speed, Height, PickupZone)

On after Pickup event.

AI_CARGO:onafterUnboard(Carrier, From, Event, To, Cargo, DeployZone, CarrierUnit, Defend)

On after Unboard event.

AI_CARGO:onafterUnload(Carrier, From, Event, To, DeployZone, Defend)

On after Unload event.

AI_CARGO:onafterUnloaded(Carrier, From, Event, To, Cargo, Deployed, DeployZone, CarrierUnit, Defend)

On after Unloaded event.

AI_CARGO:onbeforeLoad(Carrier, From, Event, To, PickupZone)

On before Load event.

AI_CARGO:onbeforeReload(Carrier, From, Event, To, PickupZone)

On before Reload event.

Fields and Methods inherited from FSM_CONTROLLABLE Description

AI_CARGO.Controllable

AI_CARGO:GetControllable()

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

AI_CARGO:New(FSMT, Controllable)

Creates a new FSM_CONTROLLABLE object.

AI_CARGO:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

AI_CARGO:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

AI_CARGO:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

AI_CARGO:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

AI_CARGO:SetControllable(FSMControllable)

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

AI_CARGO:Stop()

Synchronous Event Trigger for Event Stop.

AI_CARGO:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

AI_CARGO:_call_handler(step, trigger, params, EventName)

Fields and Methods inherited from FSM Description

AI_CARGO:AddEndState(State)

Adds an End state.

AI_CARGO:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

AI_CARGO:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

AI_CARGO:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

AI_CARGO:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

AI_CARGO.CallScheduler

AI_CARGO.Events

AI_CARGO:GetCurrentState()

Get current state.

AI_CARGO:GetEndStates()

Returns the End states.

AI_CARGO:GetProcess(From, Event)

AI_CARGO:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

AI_CARGO:GetScores()

Returns a table with the scores defined.

AI_CARGO:GetStartState()

Returns the start state of the FSM.

AI_CARGO:GetState()

Get current state.

AI_CARGO:GetSubs()

Returns a table with the Subs defined.

AI_CARGO:GetTransitions()

Returns a table of the transition rules defined within the FSM.

AI_CARGO:Is(State)

Check if FSM is in state.

AI_CARGO:LoadCallBacks(CallBackTable)

Load call backs.

AI_CARGO:New()

Creates a new FSM object.

AI_CARGO.Scores

AI_CARGO:SetProcess(From, Event, Fsm)

AI_CARGO:SetStartState(State)

Sets the start state of the FSM.

AI_CARGO._EndStates

AI_CARGO._EventSchedules

AI_CARGO._Processes

AI_CARGO._Scores

AI_CARGO._StartState

AI_CARGO._Transitions

AI_CARGO:_add_to_map(Map, Event)

Add to map.

AI_CARGO:_call_handler(step, trigger, params, EventName)

Call handler.

AI_CARGO:_create_transition(EventName)

Create transition.

AI_CARGO:_delayed_transition(EventName)

Delayed transition.

AI_CARGO:_eventmap(Events, EventStructure)

Event map.

AI_CARGO:_gosub(ParentFrom, ParentEvent)

Go sub.

AI_CARGO:_handler(EventName, ...)

Handler.

AI_CARGO:_isendstate(Current)

Is end state.

AI_CARGO:_submap(subs, sub, name)

Sub maps.

AI_CARGO:can(e)

Check if can do an event.

AI_CARGO:cannot(e)

Check if cannot do an event.

AI_CARGO.current

AI_CARGO.endstates

AI_CARGO:is(State, state)

Check if FSM is in state.

AI_CARGO.options

AI_CARGO.subs

Field(s)

Function(s)

Deploy Trigger for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Defined in:

AI_CARGO

Defined in:

AI_CARGO

Creates a new AI_CARGO object.

Defined in:

AI_CARGO

Parameters:

Cargo carrier group.

Set of cargo(s) to transport.

Return value:

self

Deploy Handler OnAfter for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

On after Deployed event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

#boolean Defend

Defend for APCs.

Loaded Handler OnAfter for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

Pickup Handler OnAfter for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Unloaded Handler OnAfter for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

Deploy Handler OnBefore for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Return value:

#boolean:

Pickup Handler OnBefore for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#string From

#string Event

#string To

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Return value:

#boolean:

Pickup Trigger for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Deploy Asynchronous Trigger for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#number Delay

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

Pickup Asynchronous Trigger for AI_CARGO

Defined in:

AI_CARGO

Parameters:

#number Delay

Pickup place. If not given, loading starts at the current location.

#number Speed

Speed in km/h. Default is 50% of max possible speed the group can do.

On after Board event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Cargo object.

Wrapper.Unit#UNIT CarrierUnit

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Deploy event.

Defined in:

AI_CARGO

Parameters:

From

Event

To

Deploy place.

#number Speed

Speed in km/h to drive to the depoly coordinate. Default is 50% of max possible speed the unit can go.

#number Height

Height in meters to move to the deploy coordinate.

Core.Zone#ZONE DeployZone

The zone where the cargo will be deployed.

On after Deployed event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

#boolean Defend

Defend for APCs.

On after Loaded event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

Cargo

Return value:

#boolean:

Cargo loaded.

On after PickedUp event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Pickup event.

Defined in:

AI_CARGO

Parameters:

From

Event

To

of the pickup point.

#number Speed

Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.

#number Height

Height in meters to move to the home coordinate.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On after Unboard event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

#string Cargo

Cargo#CARGO Cargo Cargo object.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

CarrierUnit

Defend

On after Unload event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

Defend

On after Unloaded event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

#string Cargo

Cargo#CARGO Cargo Cargo object.

#boolean Deployed

Cargo is deployed.

Core.Zone#ZONE DeployZone

The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.

CarrierUnit

Defend

On before Load event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

On before Reload event.

Defined in:

AI_CARGO

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Core.Zone#ZONE PickupZone

(optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.

Field(s)

Function(s)

Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Creates a new FSM_CONTROLLABLE object.

Defined in:

Parameters:

#table FSMT

Finite State Machine Table

(optional) The CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Return value:

OnAfter Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnBefore Transition Handler for Event Stop.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

OnEnter Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

OnLeave Transition Handler for State Stopped.

Defined in:

Parameters:

The Controllable Object managed by the FSM.

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

Return value:

#boolean:

Return false to cancel Transition.

Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.

Defined in:

Parameter:

Return value:

Synchronous Event Trigger for Event Stop.

Asynchronous Event Trigger for Event Stop.

Defined in:

Parameter:

#number Delay

The delay in seconds.

Defined in:

Parameters:

step

trigger

params

EventName

Field(s)

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#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:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#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:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.