Control Module - Tasks - Stores tasks for each force.
-- Making and then editing a new task
local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name)
Tasks.update_task(task_id, 'We need more iron!', game.player.name)
expcore.datastore |
utils.global |
get_task(task_id) | Gets the task information that is linked with this id |
get_force_task_ids(force_name) | Gets all the task ids that a force has |
get_editing(task_id, player_name) | Gets the editing state for a player |
add_task(force_name[, player_name][, task_title][, task_body]) | Add a new task for a force, the task can be placed into a certain position for that force |
remove_task(task_id) | Removes a task and any data that is linked with it |
update_task(task_id, player_name, task_title, task_body) | Update the message and last edited information for a task |
set_editing(task_id, player_name, state) | Set the editing state for a player, can be used as a warning or to display a text field |
on_update(handler) | Adds an update handler for when a task is added, removed, or updated |
Gets the task information that is linked with this id
Parameters:-- Getting task information outside of on_update
local task = Tasks.get_task(task_id)
Gets all the task ids that a force has
Parameters:-- Getting the task ids for a force
local task_ids = Tasks.get_force_task_ids(game.player.force.name)
Gets the editing state for a player
Parameters:-- Check if a player is editing a task or not
local editing = Tasks.get_editing(task_id, game.player.name)
Add a new task for a force, the task can be placed into a certain position for that force
Parameters:-- Adding a new task for your force
local task_id = Tasks.add_task(game.player.force.name, game.player.name, nil, nil)
Removes a task and any data that is linked with it
Parameters:-- Removing a task
Tasks.remove_task(task_id)
Update the message and last edited information for a task
Parameters:-- Updating the message for on a task
Task.update_task(task_id, game.player.name, 'We need more iron!', 'Build more iron outposts.')
Set the editing state for a player, can be used as a warning or to display a text field
Parameters:-- Setting your editing state to true
Tasks.set_editing(task_id, game.player.name, true)
Adds an update handler for when a task is added, removed, or updated
Parameters:-- Add a game print when a task is updated
Tasks.on_update(function(task)
game.print(task.force_name..' now has the task: '..task.message)
end)