Module action-main
[hook-sys] Adds an action-driven crew position menu.
Required hooks: update, newPlayerShip.
This module uses batteries/sort.
For details of the menu item format, see action.
Target arguments: ship, station
Differences from action docs:
- Menu items support a
stationslist; items will only be displayed on stations contained in the list. Items without a list will show on all stations. - Menu items support an
areafield; items will only be displayed on stations that handle the area (see position for details on areas). Items without this field will show on all stations. - Menu items support a
requiredTaskStateboolean; if set, the item will only display when there is (true) or is not (false) a task in progress.
If both stations and area are provided, only stations that match both restrictions will be able to see the item.
To add a station button menu item:
mainMenu:add { info = "Info Text", } mainMenu:add { button = "Button Name", action = function(reopen, ship, station) ... end, }
To set the task that a station is working on:
mainMenu:setTask(task, ship, station)
Task structure:
{
-- Exactly one of the following two fields should be set.
-- The scenario time that the task will be complete at.
completionAt = 42,
-- The time that the task takes, in seconds.
duration = 42,
-- Update the task. This field is optional.
-- If update returns a non-nil value, it will be treated
-- as a failure to complete the task and displayed to the user.
update = function(ship, station) ... end,
-- Complete the task. This field is optional.
-- If complete returns a menu list, it will be used for
-- the 'task complete' menu.
complete = function(ship, station) ... end,
}
Functions
| mainMenu:setTask(task, ship, station) | Set the current task that the operator at the given console is working on. |
Fields
| mainMenu | An instance of action.ActionBase that displays on crew consoles. |
Functions
- mainMenu:setTask(task, ship, station)
-
Set the current task that the operator at the given console is working on.
Parameters:
- task The task to set.
- ship The ship to set the task on.
- station The console to set the task for.
Fields
- mainMenu
- An instance of action.ActionBase that displays on crew consoles.