Module Ops.RescueHelo
Ops - Rescue helicopter for carrier operations.
Recue helicopter for carrier operations.
Main Features:
- Close formation with carrier.
- No restrictions regarding carrier waypoints and heading.
- Automatic respawning on empty fuel for 24/7 operations.
- Automatic rescuing of crashed or ejected pilots in the vicinity of the carrier.
- Multiple helos at different carriers due to object oriented approach.
- Finite State Machine (FSM) implementation.
Known (DCS) Issues
- CH-53E does only report 27.5% fuel even if fuel is set to 100% in the ME. See bug report
- CH-53E does not accept USS Tarawa as landing airbase (even it can be spawned on it).
- Helos dont move away from their landing position on carriers.
Author: funkyfranky
Contributions: Flightcontrol (AI.AI_Formation class being used here)
Global(s)
Global RESCUEHELO |
Rescue Helo Recue HeloThe rescue helo will fly in close formation with another unit, which is typically an aircraft carrier. |
Rescue Helo
Recue Helo
The rescue helo will fly in close formation with another unit, which is typically an aircraft carrier.
It's mission is to rescue crashed or ejected pilots. Well, and to look cool...
Simple Script
In the mission editor you have to set up a carrier unit, which will act as "mother". In the following, this unit will be named "USS Stennis".
Secondly, you need to define a rescue helicopter group in the mission editor and set it to "LATE ACTIVATED". The name of the group we'll use is "Recue Helo".
The basic script is very simple and consists of only two lines.
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:Start()
The first line will create a new #RESCUEHELO object via RESCUEHELO.New and the second line starts the process by calling RESCUEHELO.Start.
NOTE that it is very important to define the RESCUEHELO object as global variable. Otherwise, the lua garbage collector will kill the formation for unknown reasons!
By default, the helo will be spawned on the USS Stennis with hot engines. Then it will take off and go on station on the starboard side of the boat.
Once the helo is out of fuel, it will return to the carrier. When the helo lands, it will be respawned immidiately and go back on station.
If a unit crashes or a pilot ejects within a radius of 30 km from the USS Stennis, the helo will automatically fly to the crash side and rescue to pilot. This will take around 5 minutes. After that, the helo will return to the Stennis, land there and bring back the poor guy. When this is done, the helo will go back on station.
Fine Tuning
The implementation allows to customize quite a few settings easily via user API functions.
Takeoff Type
By default, the helo is spawned with running engines on the carrier. The mission designer has set option to set the take off type via the RESCUEHELO.SetTakeoff function. Or via shortcuts
- RESCUEHELO.SetTakeoffHot(): Will set the takeoff to hot, which is also the default.
- RESCUEHELO.SetTakeoffCold(): Will set the takeoff type to cold, i.e. with engines off.
- RESCUEHELO.SetTakeoffAir(): Will set the takeoff type to air, i.e. the helo will be spawned in air near the unit which he follows.
For example,
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:SetTakeoffAir()
RescueheloStennis:Start()
will spawn the helo near the USS Stennis in air.
Spawning in air is not as realistic but can be useful do avoid DCS bugs and shortcomings like aircraft crashing into each other on the flight deck.
Note that when spawning in air is set, the helo will also not return to the boat, once it is out of fuel. Instead it will be respawned in air.
If only the first spawning should happen on the carrier, one use the RESCUEHELO.SetRespawnInAir() function to command that all subsequent spawning will happen in air.
If the helo should no be respawned at all, one can set RESCUEHELO.SetRespawnOff().
Home Base
It is possible to define a "home base" other than the aircraft carrier using the RESCUEHELO.SetHomeBase(airbase) function, where airbase is a Wrapper.Airbase#AIRBASE object or simply the name of the airbase.
For example, one could imagine a strike group, and the helo will be spawned from another ship which has a helo pad.
RescueheloStennis=RESCUEHELO:New(UNIT:FindByName("USS Stennis"), "Rescue Helo")
RescueheloStennis:SetHomeBase(AIRBASE:FindByName("USS Normandy"))
RescueheloStennis:Start()
In this case, the helo will be spawned on the USS Normandy and then make its way to the USS Stennis to establish the formation. Note that the distance to the mother ship should be rather small since the helo will go there very slowly.
Once the helo runs out of fuel, it will return to the USS Normandy and not the Stennis for respawning.
Formation Position
The position of the helo relative to the mother ship can be tuned via the functions
- RESCUEHELO.SetAltitude(altitude), where altitude is the altitude the helo flies at in meters. Default is 70 meters.
- RESCUEHELO.SetOffsetX(distance), where *distance is the distance in the direction of movement of the carrier. Default is 200 meters.
- RESCUEHELO.SetOffsetZ(distance), where *distance is the distance on the starboard side. Default is 100 meters.
Rescue Operations
By default the rescue helo will start a rescue operation if an aircraft crashes or a pilot ejects in the vicinity of the carrier. This is restricted to aircraft of the same coalition as the rescue helo. Enemy (or neutral) pilots will be left on their own.
The standard "rescue zone" has a radius of 15 NM (~28 km) around the carrier. The radius can be adjusted via the RESCUEHELO.SetRescueZone(radius) functions, where radius is the radius of the zone in nautical miles. If you use multiple rescue helos in the same mission, you might want to ensure that the radii are not overlapping so that two helos try to rescue the same pilot. But it should not hurt either way.
Once the helo reaches the crash site, the rescue operation will last 5 minutes. This time can be changed by RESCUEHELO.SetRescueDuration(speed), where the speed is given in knots.
If no rescue operations should be carried out by the helo, this option can be completely disabled by using RESCUEHELO.SetRescueOff().
Finite State Machine
The implementation uses a Finite State Machine (FSM). This allows the mission designer to hook in to certain events.
- RESCUEHELO.Start: This eventfunction starts the FMS process and initialized parameters and spawns the helo. DCS event handling is started.
- RESCUEHELO.Status: This eventfunction is called in regular intervals (~60 seconds) and checks the status of the helo and carrier. It triggers other events if necessary.
- RESCUEHELO.Rescue: This eventfunction commands the helo to go on a rescue operation at a certain coordinate.
- RESCUEHELO.RTB: This eventsfunction sends the helo to its home base (usually the carrier). This is called once the helo runs low on gas.
- RESCUEHELO.Run: This eventfunction is called when the helo resumes normal operations and goes back on station.
- RESCUEHELO.Stop: This eventfunction stops the FSM by unhandling DCS events.
The mission designer can capture these events by RESCUEHELO.OnAfterEventname functions, e.g. RESCUEHELO.OnAfterRescue.
Debugging
In case you have problems, it is always a good idea to have a look at your DCS log file. You find it in your "Saved Games" folder, so for example in
C:\Users\<yourname>\Saved Games\DCS\Logs\dcs.log
All output concerning the #RESCUEHELO class should have the string "RESCUEHELO" in the corresponding line. Searching for lines that contain the string "error" or "nil" can also give you a hint what's wrong.
The verbosity of the output can be increased by adding the following lines to your script:
BASE:TraceOnOff(true)
BASE:TraceLevel(1)
BASE:TraceClass("RESCUEHELO")
To get even more output you can increase the trace level to 2 or even 3, c.f. Core.Base#BASE for more details.
Debug Mode
You have the option to enable the debug mode for this class via the RESCUEHELO.SetDebugModeON function. If enabled, text messages about the helo status will be displayed on screen and marks of the pattern created on the F10 map.
Global _RESCUEHELOID |
Type(s)
Fields and Methods inherited from RESCUEHELO | Description |
---|---|
Name of the class. |
|
Debug mode on/off. |
|
Alias of helo spawn group. |
|
Get unit name of the spawned helo. |
|
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function. |
|
Check if helo is on a rescue mission. |
|
Check if helo is returning to base. |
|
Check if helo is operating. |
|
Check if FMS was stopped. |
|
Create a new RESCUEHELO object. |
|
On after "RTB" event user function. |
|
On after "Rescue" event user function. |
|
On after "Returned" event user function. |
|
On after "Start" event function. |
|
Handle landing event of rescue helo. |
|
Triggers the FSM event "RTB" that sends the helo home. |
|
Triggers the FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate. |
|
Triggers the FSM event "Returned" after the helo has landed. |
|
Route helo back to its home base. |
|
Triggers the FSM event "Run". |
|
Set altitude of helo. |
|
Deactivate debug mode. |
|
Activate debug mode. |
|
Set follow time update interval. |
|
Set home airbase of the helo. |
|
Set low fuel state of helo. |
|
Set modex (tail number) of the helo. |
|
Set offset parallel to orientation of carrier. |
|
Set offset perpendicular to orientation to carrier. |
|
Set rescue duration. |
|
Set rescue hover speed. |
|
Deactivate rescue option. |
|
Activate rescue option. |
|
Do not stop carrier during rescue operations. |
|
Stop carrier during rescue operations. |
|
Set rescue zone radius. |
|
Helo will be respawned in air, even it was initially spawned on the carrier. |
|
Disable respawning of helo. |
|
Enable respawning of helo. |
|
Set whether helo shall be respawned or not. |
|
Set takeoff type. |
|
Set takeoff in air near the carrier. |
|
Set takeoff with engines off (cold). |
|
Set takeoff with engines running (hot). |
|
Use an uncontrolled aircraft already present in the mission rather than spawning a new helo as initial rescue helo. |
|
Triggers the FSM event "Start" that starts the rescue helo. |
|
Triggers the FSM event "Status" that updates the helo status. |
|
Triggers the FSM event "Stop" that stops the rescue helo. |
|
A unit crashed or a player ejected. |
|
Task to send the helo RTB. |
|
Triggers the FSM event "RTB" that sends the helo home after a delay. |
|
Triggers the delayed FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate. |
|
Triggers the delayed FSM event "Returned" after the helo has landed. |
|
Triggers the delayed FSM event "Run". |
|
Triggers the FSM event "Start" that starts the rescue helo after a delay. |
|
Triggers the delayed FSM event "Status" that updates the helo status. |
|
Triggers the FSM event "Stop" that stops the rescue helo after a delay. |
|
The airbase object acting as home base of the helo. |
|
Alias of the spawn group. |
|
Altitude of helo in meters. |
|
The carrier the helo is attached to. |
|
If true, route of carrier was stopped. |
|
Carrier type. |
|
Follow time update interval in seconds. Default 1.0 sec. |
|
Follow group set. |
|
AI_FORMATION object. |
|
Helo group. |
|
Name of the late activated helo template group. |
|
Unit ID of the helo group. (Global) Running number. |
|
Log debug id text. |
|
Low fuel threshold of helo in percent. |
|
Tail number of the helo. |
|
Offset in meters to carrier in longitudinal direction. |
|
Offset in meters to carrier in latitudinal direction. |
|
On after RTB event. |
|
On after "Rescue" event. |
|
On after Returned event. |
|
On after "Run" event. |
|
On after Start event. |
|
On after Status event. |
|
On after Stop event. |
|
Time the rescue helicopter hovers over the crash site in seconds. |
|
If true, helo will rescue crashed pilots. If false, no recuing will happen. |
|
Speed in m/s the rescue helicopter hovers at over the crash site. |
|
If true, stop carrier during rescue operations. |
|
Zone around the carrier in which helo will rescue crashed or ejected units. |
|
If true, helo be respawned (default). If false, no respawning will happen. |
|
If true, helo will always be respawned in air. This has no impact on the initial spawn setting. |
|
If true, Helo will be return to base on the next status check. |
|
Takeoff type. |
|
Unique ID of this helo. |
|
If true, use and uncontrolled helo group already present in the mission. |
|
Class version. |
Fields and Methods inherited from FSM | Description |
---|---|
Adds an End 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. |
|
Adds a score for the FSM to be achieved. |
|
RESCUEHELO:AddScoreProcess(From, Event, State, ScoreText, Score) |
Adds a score for the FSM_PROCESS to be achieved. |
Add a new transition rule to the FSM. |
|
Get current state. |
|
Returns the End states. |
|
Returns a table of the SubFSM rules defined within the FSM. |
|
Returns a table with the scores defined. |
|
Returns the start state of the FSM. |
|
Get current state. |
|
Returns a table with the Subs defined. |
|
Returns a table of the transition rules defined within the FSM. |
|
Check if FSM is in state. |
|
Load call backs. |
|
Creates a new FSM object. |
|
Sets the start state of the FSM. |
|
Add to map. |
|
Call handler. |
|
Create transition. |
|
Delayed transition. |
|
Event map. |
|
Go sub. |
|
Handler. |
|
Is end state. |
|
Sub maps. |
|
Check if can do an event. |
|
Check if cannot do an event. |
|
Check if FSM is in state. |
|
RESCUEHELO class.
Field(s)
Name of the class.
Debug mode on/off.
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function.
Alias of the spawn group.
Altitude of helo in meters.
If true, route of carrier was stopped.
Carrier type.
Follow time update interval in seconds. Default 1.0 sec.
Name of the late activated helo template group.
Unit ID of the helo group. (Global) Running number.
Log debug id text.
Low fuel threshold of helo in percent.
Tail number of the helo.
Offset in meters to carrier in longitudinal direction.
Offset in meters to carrier in latitudinal direction.
Time the rescue helicopter hovers over the crash site in seconds.
If true, helo will rescue crashed pilots. If false, no recuing will happen.
Speed in m/s the rescue helicopter hovers at over the crash site.
If true, stop carrier during rescue operations.
Zone around the carrier in which helo will rescue crashed or ejected units.
If true, helo be respawned (default). If false, no respawning will happen.
If true, helo will always be respawned in air. This has no impact on the initial spawn setting.
If true, Helo will be return to base on the next status check.
Takeoff type.
Unique ID of this helo.
If true, use and uncontrolled helo group already present in the mission.
Class version.
Function(s)
Alias of helo spawn group.
Defined in:
RESCUEHELO
Return value:
#string:
Alias of the helo.
Get unit name of the spawned helo.
Defined in:
RESCUEHELO
Return value:
#string:
Name of the helo unit or nil if it does not exist.
Check if helo is on a rescue mission.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is rescuing somebody.
Check if helo is returning to base.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is returning to base.
Check if helo is operating.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, helo is operating.
Check if FMS was stopped.
Defined in:
RESCUEHELO
Return value:
#boolean:
If true, is stopped.
Create a new RESCUEHELO object.
Defined in:
RESCUEHELO
Parameters:
Wrapper.Unit#UNIT carrierunit
Carrier unit object or simply the unit name.
#string helogroupname
Name of the late activated rescue helo template group.
Return value:
RESCUEHELO object.
On after "RTB" event user function.
Called when a the the helo returns to its home base.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
On after "Rescue" event user function.
Called when a the the helo goes on a rescue mission.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Point#COORDINATE RescueCoord
Crash site where the rescue operation takes place.
On after "Returned" event user function.
Called when a the the helo has landed at an airbase.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The airbase the helo has landed.
On after "Start" event function.
Called when FSM is started.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Handle landing event of rescue helo.
Triggers the FSM event "RTB" that sends the helo home.
Defined in:
RESCUEHELO
Parameter:
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
Triggers the FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate.
Defined in:
RESCUEHELO
Parameter:
Core.Point#COORDINATE RescueCoord
Coordinate where the resue mission takes place.
Triggers the FSM event "Returned" after the helo has landed.
Route helo back to its home base.
Set altitude of helo.
Defined in:
RESCUEHELO
Parameter:
#number alt
Altitude in meters. Default 70 m.
Return value:
self
Deactivate debug mode.
This is also the default setting.
Activate debug mode.
Display debug messages on screen.
Set follow time update interval.
Defined in:
RESCUEHELO
Parameter:
#number dt
Time interval in seconds. Default 1.0 sec.
Return value:
self
Set home airbase of the helo.
This is the airbase where the helo is spawned (if not in air) and will go when it is out of fuel.
Defined in:
RESCUEHELO
Parameter:
Wrapper.Airbase#AIRBASE airbase
The home airbase. Can be the airbase name (passed as a string) or a Moose AIRBASE object.
Return value:
self
Set low fuel state of helo.
When fuel is below this threshold, the helo will RTB or be respawned if takeoff type is in air.
Defined in:
RESCUEHELO
Parameter:
#number threshold
Low fuel threshold in percent. Default 5%.
Return value:
self
Set modex (tail number) of the helo.
Set offset parallel to orientation of carrier.
Defined in:
RESCUEHELO
Parameter:
#number distance
Offset distance in meters. Default 200 m (~660 ft).
Return value:
self
Set offset perpendicular to orientation to carrier.
Defined in:
RESCUEHELO
Parameter:
#number distance
Offset distance in meters. Default 240 m (~780 ft).
Return value:
self
Set rescue duration.
This is the time it takes to rescue a pilot at the crash site.
Defined in:
RESCUEHELO
Parameter:
#number duration
Duration in minutes. Default 5 min.
Return value:
self
Set rescue hover speed.
Defined in:
RESCUEHELO
Parameter:
#number speed
Speed in knots. Default 5 kts.
Return value:
self
Deactivate rescue option.
Crashed and ejected pilots will not be rescued.
Activate rescue option.
Crashed and ejected pilots will be rescued. This is the default setting.
Do not stop carrier during rescue operations.
This is the default setting.
Stop carrier during rescue operations.
NOT WORKING!
Set rescue zone radius.
Crashed or ejected units inside this radius of the carrier will be rescued if possible.
Defined in:
RESCUEHELO
Parameter:
#number radius
Radius of rescue zone in nautical miles. Default is 15 NM.
Return value:
self
Helo will be respawned in air, even it was initially spawned on the carrier.
So only the first spawn will be on the carrier while all subsequent spawns will happen in air. This allows for undisrupted operations and less problems on the carrier deck.
Disable respawning of helo.
Enable respawning of helo.
Note that this is the default behaviour.
Set whether helo shall be respawned or not.
Defined in:
RESCUEHELO
Parameter:
#boolean switch
If true (or nil), helo will be respawned. If false, helo will not be respawned.
Return value:
self
Set takeoff type.
Defined in:
RESCUEHELO
Parameter:
#number takeofftype
Takeoff type. Default SPAWN.Takeoff.Hot.
Return value:
self
Set takeoff in air near the carrier.
Set takeoff with engines off (cold).
Set takeoff with engines running (hot).
Use an uncontrolled aircraft already present in the mission rather than spawning a new helo as initial rescue helo.
This can be useful when interfaced with, e.g., a warehouse. The group name is the one specified in the RESCUEHELO.New function.
Triggers the FSM event "Start" that starts the rescue helo.
Initializes parameters and starts event handlers.
Defined in:
RESCUEHELO
Triggers the FSM event "Status" that updates the helo status.
Defined in:
RESCUEHELO
Triggers the FSM event "Stop" that stops the rescue helo.
Event handlers are stopped.
Defined in:
RESCUEHELO
A unit crashed or a player ejected.
Task to send the helo RTB.
Triggers the FSM event "RTB" that sends the helo home after a delay.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Wrapper.Airbase#AIRBASE airbase
The airbase to return to. Default is the home base.
Triggers the delayed FSM event "Rescue" that sends the helo on a rescue mission to a specifc coordinate.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Core.Point#COORDINATE RescueCoord
Coordinate where the resue mission takes place.
Triggers the delayed FSM event "Returned" after the helo has landed.
Defined in:
RESCUEHELO
Parameters:
#number delay
Delay in seconds.
Wrapper.Airbase#AIRBASE airbase
The airbase the helo has landed.
Triggers the delayed FSM event "Run".
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Start" that starts the rescue helo after a delay.
Initializes parameters and starts event handlers.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the delayed FSM event "Status" that updates the helo status.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
Triggers the FSM event "Stop" that stops the rescue helo after a delay.
Event handlers are stopped.
Defined in:
RESCUEHELO
Parameter:
#number delay
Delay in seconds.
On after RTB event.
Send helo back to carrier.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The base to return to. Default is the home base.
On after "Rescue" event.
Helo will fly to the given coordinate, orbit there for 5 minutes and then return to the carrier.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Core.Point#COORDINATE RescueCoord
Coordinate where the rescue should happen.
On after Returned event.
Helo has landed.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Wrapper.Airbase#AIRBASE airbase
The base to which the helo has returned.
On after "Run" event.
FSM will go to "Running" state. If formation is stopped, it will be started again.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Start event.
Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Status event.
Checks player status.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
On after Stop event.
Unhandle events and stop status updates. If helo is alive, it is despawned.
Defined in:
RESCUEHELO
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
Field(s)
Name of the class.
Debug mode on/off.
Initial fuel of helo in percent. Necessary due to DCS bug that helo with full tank does not return fuel via API function.
Alias of the spawn group.
Altitude of helo in meters.
If true, route of carrier was stopped.
Carrier type.
Follow time update interval in seconds. Default 1.0 sec.
Name of the late activated helo template group.
Unit ID of the helo group. (Global) Running number.
Log debug id text.
Low fuel threshold of helo in percent.
Tail number of the helo.
Offset in meters to carrier in longitudinal direction.
Offset in meters to carrier in latitudinal direction.
Time the rescue helicopter hovers over the crash site in seconds.
If true, helo will rescue crashed pilots. If false, no recuing will happen.
Speed in m/s the rescue helicopter hovers at over the crash site.
If true, stop carrier during rescue operations.
Zone around the carrier in which helo will rescue crashed or ejected units.
If true, helo be respawned (default). If false, no respawning will happen.
If true, helo will always be respawned in air. This has no impact on the initial spawn setting.
If true, Helo will be return to base on the next status check.
Takeoff type.
Unique ID of this helo.
If true, use and uncontrolled helo group already present in the mission.
Class version.
Function(s)
Adds an End 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.
Core.Fsm#FSM_PROCESS Process
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.
Returns the End states.
Returns a table of the SubFSM rules defined within the FSM.
Returns a table with the scores defined.
Returns the start state of the FSM.
Get current state.
Returns a table with the Subs defined.
Returns a table of the transition rules defined within the FSM.
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.
Sets the start state of the FSM.
Add to map.
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.
Go sub.
Defined in:
Parameters:
#string ParentFrom
Parent from state.
#string ParentEvent
Parent event name.
Return value:
#table:
Subs.
Handler.
Is end state.
Defined in:
Parameter:
#string Current
Current state name.
Return values:
#table:
FSM parent.
#string:
Event name.
Sub maps.
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.