Class standardOperatingProcedure
Represents a standard operating procedure (SOP).
Each SOP contains an array of airplane ICAO codes, an array of challenge and response voices, an array of checklists and an active checklist. The airplace ICAO codes indicates the airplances the SOP is intended for. The challenge and response voices allow an alternate immersion of the SOP. The active checklist indicates the currently executed checklist.
A SOP can have callbacks for the do_often and do_every_frame functions of the FlyWithLua framework. The callbacks are executed accordingly.
Callbacks can be added to react to the SOP getting activated and deactivated.
Info:
- Copyright: 2022 Patrick Lang
- Author: Patrick Lang
Methods
Methods
- standardOperatingProcedure:new (name)
-
Creates a new standard operating procedure.
Parameters:
- name string The name of the SOP.
Returns:
-
standardOperatingProcedure
The created SOP.
- standardOperatingProcedure:getName ()
-
Gets the name of the SOP.
Returns:
-
string
The name of the SOP.
- standardOperatingProcedure:addAirplane (planeIcao)
-
Adds an ICAO code to the array of supported airplanes.
Parameters:
- planeIcao string The ICAO code to add.
- standardOperatingProcedure:getAirplanes ()
-
Gets the ICAO codes of the supported airplanes.
Returns:
-
tab
An array which contains the ICAO codes of the supported airplances.
- standardOperatingProcedure:addChallengeVoice (voice)
-
Adds a voice to the list of challenge voices.
The first added voice is automatically set as the active challenge voice.
Parameters:
- voice voice The voice to add.
- standardOperatingProcedure:getChallengeVoices ()
-
Gets the challenge voices of the SOP.
Returns:
-
tab
An array which contains the challenge voices.
- standardOperatingProcedure:setActiveChallengeVoice (voice)
-
Sets the active challenge voice of the SOP.
The voice must have been added to the challenge voices.
Parameters:
- voice
optional voice
The new active challenge voice. Can be
nil.
Raises:
An error is thrown if the voice is not in the list of challenge voices. - voice
optional voice
The new active challenge voice. Can be
- standardOperatingProcedure:getActiveChallengeVoice ()
-
Gets the active challenge voice of the SOP.
Returns:
-
optional voice
The active challenge voice of the SOP.
- standardOperatingProcedure:addResponseVoice (voice)
-
Adds a voice to the list of response voices.
The first added voice is automatically set as the active response voice.
Parameters:
- voice voice The voice to add.
- standardOperatingProcedure:getResponseVoices ()
-
Gets the response voices of the SOP.
Returns:
-
tab
An array which contains the response voices.
- standardOperatingProcedure:setActiveResponseVoice (voice)
-
Sets the active response voice of the SOP.
The voice must have been added to the response voices.
Parameters:
- voice
optional voice
The new active response voice. Can be
nil.
Raises:
An error is thrown if the voice is not in the list of response voices. - voice
optional voice
The new active response voice. Can be
- standardOperatingProcedure:getActiveResponseVoice ()
-
Gets the active response voice of the SOP.
Returns:
-
optional voice
The active response voice of the SOP.
- standardOperatingProcedure:addChecklist (checklist)
-
Adds a checklist to the SOP.
Parameters:
- checklist checklist The checklist to add.
- standardOperatingProcedure:getAllChecklists ()
-
Returns all checklists of the SOP.
Returns:
-
tab
An array which contains all checklists.
- standardOperatingProcedure:setActiveChecklist (checklist)
-
Sets the active checklist of the SOP.
The checklist must have been added to the SOP.
Parameters:
- checklist
optional checklist
The new active checklist. Can be
nil.
Raises:
An error is thrown if the checklist does not belong to the SOP. - checklist
optional checklist
The new active checklist. Can be
- standardOperatingProcedure:getActiveChecklist ()
-
Gets the active checklist of the SOP.
Returns:
-
optional checklist
The active checklist.
- standardOperatingProcedure:reset ()
-
Resets the state of all checklist and their checklist items.
Also sets the active checklist to
nil. - standardOperatingProcedure:addActivatedCallback (callback)
-
Adds a callback which is executed if the SOP is activated.
Parameters:
- callback func The callback to add.
Usage:
mySOP:addActivatedCallback(function() end)
- standardOperatingProcedure:addDeactivatedCallback (callback)
-
Adds a callback which is executed if the SOP is deactivated.
Parameters:
- callback func The callback to add.
Usage:
mySOP:addDeactivatedCallback(function() end)
- standardOperatingProcedure:onActivated ()
- Executes the activated callbacks.
- standardOperatingProcedure:onDeactivated ()
- Executes the deactivated callbacks.
- standardOperatingProcedure:addDoOftenCallback (callback)
-
Adds a callback for the
do_oftenfunction.Parameters:
- callback func The callback to add.
Usage:
mySOP:addDoOftenCallback(function() end)
- standardOperatingProcedure:addDoEveryFrameCallback (callback)
-
Adds a callback for the
do_every_framefunction.Parameters:
- callback func The callback to add.
Usage:
mySOP:addDoEveryFrameCallback(function() end)
- standardOperatingProcedure:doOften ()
-
Executes the callbacks for the
do_oftenfunction. - standardOperatingProcedure:doEveryFrame ()
-
Executes the callbacks for the
do_every_framefunction.