mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Merge pull request #195 from bbassie/feature/task-list-update
Tasklist redesign
This commit is contained in:
@@ -67,18 +67,26 @@ net-tooltip=Total net: __1__
|
|||||||
no-packs=You have not made any science packs yet
|
no-packs=You have not made any science packs yet
|
||||||
|
|
||||||
[task-list]
|
[task-list]
|
||||||
main-caption=Task List
|
main-caption=Task List [img=info]
|
||||||
main-tooltip=Task List
|
main-tooltip=Task List
|
||||||
sub-tooltip=Tasks that remain to be done
|
sub-tooltip=Tasks that remain to be done\n- You can use richtext to include images [img=utility/not_enough_repair_packs_icon] or [color=blue]color[/color] your tasks.
|
||||||
no-tasks=You have no tasks
|
no-tasks=No tasks found!
|
||||||
|
no-tasks-tooltip=Click on the plus button to the top right of this window to add a new task!
|
||||||
last-edit=Last edited by __1__ at __2__
|
last-edit=Last edited by __1__ at __2__
|
||||||
add-tooltip=Add new task
|
add-tooltip=Add new task
|
||||||
confirm-tooltip=Save changes
|
confirm=Confirm
|
||||||
cancel-tooltip=Discard changes
|
confirm-tooltip=Save task (minimum of 5 characters long)
|
||||||
|
discard=Discard
|
||||||
|
discard-tooltip=Discard task/changes
|
||||||
|
delete=Delete
|
||||||
|
delete-tooltip=Delete task
|
||||||
|
close-tooltip=Close task details
|
||||||
|
edit=Edit task
|
||||||
edit-tooltip=Currently being edited by: __1__
|
edit-tooltip=Currently being edited by: __1__
|
||||||
edit-tooltip-none=Currently being edited by: Nobody
|
edit-tooltip-none=Currently being edited by: Nobody
|
||||||
discard-tooltip=Remove task
|
create-footer-header=Create task
|
||||||
|
edit-footer-header=Edit task
|
||||||
|
view-footer-header=Task details
|
||||||
[autofill]
|
[autofill]
|
||||||
main-tooltip=Autofill settings
|
main-tooltip=Autofill settings
|
||||||
toggle-section-caption=__1__ __2__
|
toggle-section-caption=__1__ __2__
|
||||||
|
|||||||
@@ -31,49 +31,39 @@ end)
|
|||||||
|
|
||||||
--[[-- Add a new task for a force, the task can be placed into a certain position for that force
|
--[[-- Add a new task for a force, the task can be placed into a certain position for that force
|
||||||
@tparam string force_name the name of the force to add the task for
|
@tparam string force_name the name of the force to add the task for
|
||||||
@tparam[opt] number task_number the order place to add the task to, appends to end if omited
|
|
||||||
@tparam[opt] string player_name the player who added this task, will cause them to be listed under editing
|
@tparam[opt] string player_name the player who added this task, will cause them to be listed under editing
|
||||||
@tparam[opt] string task_message the message that is used for this task, if not given default is used
|
@tparam[opt] string task_title the task title, if not given default is used
|
||||||
|
@tparam[opt] string task_body the task body, if not given default is used
|
||||||
@treturn string the uid of the task which was created
|
@treturn string the uid of the task which was created
|
||||||
|
|
||||||
@usage-- Adding a new task for your force
|
@usage-- Adding a new task for your force
|
||||||
local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name)
|
local task_id = Tasks.add_task(game.player.force.name, game.player.name, nil, nil)
|
||||||
|
|
||||||
]]
|
]]
|
||||||
function Tasks.add_task(force_name, task_number, player_name, task_message)
|
function Tasks.add_task(force_name, player_name, task_title, task_body)
|
||||||
-- Get a new task id
|
-- Get a new task id
|
||||||
local task_id = tostring(force_tasks._uid)
|
local task_id = tostring(force_tasks._uid)
|
||||||
task_message = task_message or 'New Task'
|
|
||||||
force_tasks._uid = force_tasks._uid + 1
|
force_tasks._uid = force_tasks._uid + 1
|
||||||
|
|
||||||
-- Get the existing tasks for this force
|
-- Get the existing tasks for this force
|
||||||
local tasks = force_tasks[force_name]
|
local task_ids = force_tasks[force_name]
|
||||||
if not tasks then
|
if not task_ids then
|
||||||
force_tasks[force_name] = {}
|
task_ids = {}
|
||||||
tasks = force_tasks[force_name]
|
force_tasks[force_name] = task_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Insert the task id into the forces tasks
|
-- Insert the task id into the forces tasks
|
||||||
if task_number then
|
table.insert(task_ids, task_id)
|
||||||
table.insert(tasks, task_number, task_id)
|
|
||||||
else
|
|
||||||
table.insert(tasks, task_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create the editing table
|
|
||||||
local editing = {}
|
|
||||||
if player_name then
|
|
||||||
editing[player_name] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add the new task to the store
|
-- Add the new task to the store
|
||||||
TaskData:set(task_id, {
|
TaskData:set(task_id, {
|
||||||
task_id = task_id,
|
task_id = task_id,
|
||||||
force_name = force_name,
|
force_name = force_name,
|
||||||
message = task_message,
|
title = task_title or '',
|
||||||
|
body = task_body or '',
|
||||||
last_edit_name = player_name or '<server>',
|
last_edit_name = player_name or '<server>',
|
||||||
last_edit_time = game.tick,
|
last_edit_time = game.tick,
|
||||||
currently_editing = editing
|
currently_editing = {}
|
||||||
})
|
})
|
||||||
|
|
||||||
return task_id
|
return task_id
|
||||||
@@ -94,19 +84,21 @@ function Tasks.remove_task(task_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--[[-- Update the message and last edited information for a task
|
--[[-- Update the message and last edited information for a task
|
||||||
@tparam string task_id the uid of the task that you want to update
|
@tparam string task_id the uid of the task to update
|
||||||
@tparam string new_message the message that you want to have for the task
|
@tparam string player_name the name of the player who made the edit
|
||||||
@tparam[opt='server'] string player_name the name of the player who made the edit
|
@tparam string task_title the title of the task to update to
|
||||||
|
@tparam string task_body the body of the task to update to
|
||||||
|
|
||||||
@usage-- Updating the message for on a task
|
@usage-- Updating the message for on a task
|
||||||
Task.update_task(task_id, 'We need more iron!', game.player.name)
|
Task.update_task(task_id, game.player.name, 'We need more iron!', 'Build more iron outposts.')
|
||||||
|
|
||||||
]]
|
]]
|
||||||
function Tasks.update_task(task_id, new_message, player_name)
|
function Tasks.update_task(task_id, player_name, task_title, task_body)
|
||||||
TaskData:update(task_id, function(_, task)
|
TaskData:update(task_id, function(_, task)
|
||||||
task.last_edit_name = player_name or '<server>'
|
task.last_edit_name = player_name
|
||||||
task.last_edit_time = game.tick
|
task.last_edit_time = game.tick
|
||||||
task.message = new_message
|
task.title = task_title
|
||||||
|
task.body = task_body
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user