Task List Updated

This commit is contained in:
Cooldude2606
2019-10-24 01:44:41 +01:00
parent 886fb2c226
commit f7cff8b236
98 changed files with 1849 additions and 488 deletions

View File

@@ -42,15 +42,13 @@ return {
--'modules.gui.rocket-info',
--'modules.gui.science-info',
--'modules.gui.warp-list',
--'modules.gui.task-list',
'modules.gui.task-list',
--'modules.gui.player-list',
--'modules.commands.debug',
'expcore.gui',
-- Config Files
'config.expcore-commands.auth_admin', -- commands tagged with admin_only are blocked for non admins
'config.expcore-commands.auth_roles', -- commands must be allowed via the role config
'config.expcore-commands.auth_runtime_disable', -- allows commands to be enabled and disabled during runtime
'config.permission_groups', -- loads some predefined permission groups
'config.roles', -- loads some predefined roles
--'expcore.gui.test' -- loads multiple gui defines to test the gui system
}

View File

@@ -2,8 +2,11 @@
-- @config Tasks
return {
any_user_can_add_new_task = true, --- @setting any_user_can_add_new_task when false only people with edit permission can make new reports
user_can_edit_own_tasks = true, --- @setting user_can_edit_own_tasks when false only people with edit permission can edit reports
only_admins_can_edit = false, --- @setting only_admins_can_edit true will hide the edit and delete buttons from non (game) admins
edit_tasks_role_permission = 'gui/task-list/edit' --- @setting edit_tasks_role_permission value used with custom permission system
-- values can be all, admin, expcore.roles, none
allow_add_task = 'all', --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
expcore_roles_add_permission = 'gui/task-list/add', --- @setting expcore_roles_add_permission if expcore.roles is used then this is the required permission
-- values can be all, admin, expcore.roles, none
allow_edit_task = 'expcore.roles', --- @setting allow_edit_task dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
expcore_roles_edit_permission = 'gui/task-list/edit', --- @setting expcore_roles_edit_permission if expcore.roles is used then this is the required permission
user_can_edit_own_tasks = true --- @settings if true then the user who made the task can edit it regardless of the allow_edit_task setting
}

View File

@@ -348,7 +348,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -349,7 +349,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -376,7 +376,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -585,7 +585,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -349,7 +349,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -460,7 +460,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -320,7 +320,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -376,7 +376,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -500,7 +500,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -361,7 +361,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -365,7 +365,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -360,7 +360,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -404,7 +404,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -458,7 +458,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -416,7 +416,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -611,7 +611,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -389,7 +389,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -360,7 +360,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -321,7 +321,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -585,7 +585,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -557,7 +557,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -389,7 +389,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -443,7 +443,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -484,7 +484,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -569,7 +569,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -506,7 +506,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -237,7 +237,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -485,7 +485,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -294,7 +294,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -320,7 +320,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -442,7 +442,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -338,7 +338,7 @@ see ./expcore/commands.lua for more details</p>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -416,7 +416,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -237,7 +237,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -240,7 +240,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -295,7 +295,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -812,7 +812,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -384,7 +384,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -414,7 +414,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -324,7 +324,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -414,7 +414,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -834,7 +834,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -292,7 +292,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -354,7 +354,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -388,7 +388,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -744,7 +744,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -241,16 +241,16 @@
</thead>
<tbody>
<tr>
<td class="name"><a href="#any_user_can_add_new_task">any_user_can_add_new_task</a></td>
<td class="name"><a href="#allow_add_task">allow_add_task</a></td>
</tr>
<tr>
<td class="name"><a href="#user_can_edit_own_tasks">user_can_edit_own_tasks</a></td>
<td class="name"><a href="#expcore_roles_add_permission">expcore_roles_add_permission</a></td>
</tr>
<tr>
<td class="name"><a href="#only_admins_can_edit">only_admins_can_edit</a></td>
<td class="name"><a href="#allow_edit_task">allow_edit_task</a></td>
</tr>
<tr>
<td class="name"><a href="#edit_tasks_role_permission">edit_tasks_role_permission</a></td>
<td class="name"><a href="#expcore_roles_edit_permission">expcore_roles_edit_permission</a></td>
</tr>
</tbody>
</table>
@@ -264,15 +264,15 @@
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#any_user_can_add_new_task" class="fragment-hashtag">#</a>
<span class="section-item-title" id="any_user_can_add_new_task">any_user_can_add_new_task</span>
<a href="#allow_add_task" class="fragment-hashtag">#</a>
<span class="section-item-title" id="allow_add_task">allow_add_task</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary"></p>
<p class="section-item-description"> when false only people with edit permission can make new reports</p>
<p class="section-item-description"> dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none</p>
<!-- parameters start -->
<!-- parameters end -->
@@ -291,15 +291,16 @@
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#user_can_edit_own_tasks" class="fragment-hashtag">#</a>
<span class="section-item-title" id="user_can_edit_own_tasks">user_can_edit_own_tasks</span>
<a href="#expcore_roles_add_permission" class="fragment-hashtag">#</a>
<span class="section-item-title" id="expcore_roles_add_permission">expcore_roles_add_permission</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary"></p>
<p class="section-item-description"> when false only people with edit permission can edit reports</p>
<p class="section-item-description"> if expcore.roles is used then this is the required permission
values can be all, admin, expcore.roles, none</p>
<!-- parameters start -->
<!-- parameters end -->
@@ -318,15 +319,15 @@
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#only_admins_can_edit" class="fragment-hashtag">#</a>
<span class="section-item-title" id="only_admins_can_edit">only_admins_can_edit</span>
<a href="#allow_edit_task" class="fragment-hashtag">#</a>
<span class="section-item-title" id="allow_edit_task">allow_edit_task</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary"></p>
<p class="section-item-description"> true will hide the edit and delete buttons from non (game) admins</p>
<p class="section-item-description"> dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none</p>
<!-- parameters start -->
<!-- parameters end -->
@@ -345,15 +346,15 @@
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#edit_tasks_role_permission" class="fragment-hashtag">#</a>
<span class="section-item-title" id="edit_tasks_role_permission">edit_tasks_role_permission</span>
<a href="#expcore_roles_edit_permission" class="fragment-hashtag">#</a>
<span class="section-item-title" id="expcore_roles_edit_permission">expcore_roles_edit_permission</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary"></p>
<p class="section-item-description"> value used with custom permission system</p>
<p class="section-item-description"> if expcore.roles is used then this is the required permission</p>
<!-- parameters start -->
<!-- parameters end -->
@@ -384,7 +385,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -355,7 +355,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -684,7 +684,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1208,7 +1208,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1329,7 +1329,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1110,7 +1110,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -984,7 +984,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -998,7 +998,7 @@ Tasks.update_task(task_id,<span class="string">'We need more iron!'</span>,game.
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1465,7 +1465,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1563,7 +1563,7 @@ Warps.make_warp_tag(warp_id)</code></pre>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1972,7 +1972,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -2746,7 +2746,7 @@ Common.table_insert(tbl,<span class="number">50</span>,tbl2)</code></pre>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -1432,7 +1432,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -3152,7 +3152,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -262,7 +262,7 @@ Store.set(scenario_diffculty,<span class="string">'hard'</span>) <span class="co
<span class="keyword">end</span>)
<span class="comment">-- When any key in the store is changed this function will trigger
</span>Store.watch(player_scores,<span class="keyword">function</span>(value,key)
</span>Store.watch(player_scores,<span class="keyword">function</span>(value,key,old_value)
game.<span class="global">print</span>(key..<span class="string">' now has a score of '</span>..value)
<span class="keyword">end</span>)
@@ -370,7 +370,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<td class="summary">Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set</td>
</tr>
<tr>
<td class="name"><a href="#raw_trigger">raw_trigger(store[, key][, value])</a></td>
<td class="name"><a href="#raw_trigger">raw_trigger(store[, key][, value][, old_value])</a></td>
<td class="summary">Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct</td>
</tr>
</tbody>
@@ -791,7 +791,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<span class="keyword">end</span>)
<span class="comment">-- Register the watcher so that when we change the value the message is printed
</span>Store.watch(player_scores,<span class="keyword">function</span>(value,key)
</span>Store.watch(player_scores,<span class="keyword">function</span>(value,key,old_value)
game.<span class="global">print</span>(key..<span class="string">' now has a score of '</span>..value)
<span class="keyword">end</span>)
@@ -1361,7 +1361,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#raw_trigger" class="fragment-hashtag">#</a>
<span class="section-item-title" id="raw_trigger">raw_trigger(store[, key][, value])</span>
<span class="section-item-title" id="raw_trigger">raw_trigger(store[, key][, value][, old_value])</span>
</div>
</dt>
<dd>
@@ -1426,6 +1426,23 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
</li>
<li class="section-subitem-li">
<strong><em>old_value</em></strong>
<strong> : </strong>
(<span class="types"><span class="type">any</span></span>)
the old value that was at this key or store often the same if value is a table, passed directly to the watcher
(<em>optional</em>)
</li>
</ul>
<!-- parameters end -->
@@ -1445,7 +1462,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<span class="comment">-- Trigger the watchers with a fake change of diffculty
</span><span class="comment">-- This is mostly used internally but it can be useful in other cases
</span>Store.raw_trigger(scenario_diffculty,<span class="keyword">nil</span>,<span class="string">'normal'</span>)</code></pre>
</span>Store.raw_trigger(scenario_diffculty,<span class="keyword">nil</span>,<span class="string">'normal'</span>,<span class="string">'normal'</span>)</code></pre>
<!-- usage end -->
</dd>
@@ -1464,7 +1481,7 @@ Store.set(player_scores,game.player,<span class="number">10</span>) <span class=
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -544,7 +544,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -626,7 +626,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -629,7 +629,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -449,7 +449,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -271,27 +271,43 @@
<tbody>
<tr>
<td class="name"><a href="#add_new_task">add_new_task</a></td>
<td class="summary">Button in the header to add a new task</td>
<td class="summary">Button displayed in the ehader bar, used to add a new task</td>
</tr>
<tr>
<td class="name"><a href="#confirm_edit">confirm_edit</a></td>
<td class="summary">Used to save changes to a task</td>
<td class="summary">Button displayed next to tasks which the user is currently editing, used to save changes</td>
</tr>
<tr>
<td class="name"><a href="#cancel_edit">cancel_edit</a></td>
<td class="summary">Used to cancel any changes you made to a task</td>
<td class="summary">Button displayed next to tasks which the user is currently editing, used to discard changes</td>
</tr>
<tr>
<td class="name"><a href="#discard_task">discard_task</a></td>
<td class="summary">Removes the task from the list</td>
<td class="summary">Button displayed next to tasks which the user is can edit, used to delete a task from the list</td>
</tr>
<tr>
<td class="name"><a href="#edit_task">edit_task</a></td>
<td class="summary">Opens edit mode for the task</td>
<td class="summary">Button displayed next to tasks which the user is can edit, used to start editing a task</td>
</tr>
<tr>
<td class="name"><a href="#task_list">task_list</a></td>
<td class="summary">Registers the task list</td>
<td class="name"><a href="#add_task_base">add_task_base</a></td>
<td class="summary">Set of three elements which make up each row of the task table</td>
</tr>
<tr>
<td class="name"><a href="#task_label">task_label</a></td>
<td class="summary">Default state for a task, contains only a label with the task message</td>
</tr>
<tr>
<td class="name"><a href="#task_editing">task_editing</a></td>
<td class="summary">Editing state for a task, contrins a text field and the two edit buttons</td>
</tr>
<tr>
<td class="name"><a href="#task_list_container">task_list_container</a></td>
<td class="summary">Main task list container for the left flow</td>
</tr>
<tr>
<td class="name"><a href="#task_list_toggle">task_list_toggle</a></td>
<td class="summary">Button on the top flow used to toggle the task list container</td>
</tr>
</tbody>
</table>
@@ -465,7 +481,7 @@
<dd>
<div class="section-item-body">
<p class="section-item-summary">Button in the header to add a new task</p>
<p class="section-item-summary">Button displayed in the ehader bar, used to add a new task</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -492,7 +508,7 @@
<dd>
<div class="section-item-body">
<p class="section-item-summary">Used to save changes to a task</p>
<p class="section-item-summary">Button displayed next to tasks which the user is currently editing, used to save changes</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -519,7 +535,7 @@
<dd>
<div class="section-item-body">
<p class="section-item-summary">Used to cancel any changes you made to a task</p>
<p class="section-item-summary">Button displayed next to tasks which the user is currently editing, used to discard changes</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -546,7 +562,7 @@
<dd>
<div class="section-item-body">
<p class="section-item-summary">Removes the task from the list</p>
<p class="section-item-summary">Button displayed next to tasks which the user is can edit, used to delete a task from the list</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -573,7 +589,7 @@
<dd>
<div class="section-item-body">
<p class="section-item-summary">Opens edit mode for the task</p>
<p class="section-item-summary">Button displayed next to tasks which the user is can edit, used to start editing a task</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -593,14 +609,122 @@
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#task_list" class="fragment-hashtag">#</a>
<span class="section-item-title" id="task_list">task_list</span>
<a href="#add_task_base" class="fragment-hashtag">#</a>
<span class="section-item-title" id="add_task_base">add_task_base</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Registers the task list</p>
<p class="section-item-summary">Set of three elements which make up each row of the task table</p>
<p class="section-item-description"></p>
<!-- parameters start -->
<!-- parameters end -->
<!-- returns start -->
<!-- returns end -->
<!-- see also start -->
<!-- see also end -->
<!-- usage start -->
<!-- usage end -->
</dd>
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#task_label" class="fragment-hashtag">#</a>
<span class="section-item-title" id="task_label">task_label</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Default state for a task, contains only a label with the task message</p>
<p class="section-item-description"></p>
<!-- parameters start -->
<!-- parameters end -->
<!-- returns start -->
<!-- returns end -->
<!-- see also start -->
<!-- see also end -->
<!-- usage start -->
<!-- usage end -->
</dd>
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#task_editing" class="fragment-hashtag">#</a>
<span class="section-item-title" id="task_editing">task_editing</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Editing state for a task, contrins a text field and the two edit buttons</p>
<p class="section-item-description"></p>
<!-- parameters start -->
<!-- parameters end -->
<!-- returns start -->
<!-- returns end -->
<!-- see also start -->
<!-- see also end -->
<!-- usage start -->
<!-- usage end -->
</dd>
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#task_list_container" class="fragment-hashtag">#</a>
<span class="section-item-title" id="task_list_container">task_list_container</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Main task list container for the left flow</p>
<p class="section-item-description"></p>
<!-- parameters start -->
<!-- parameters end -->
<!-- returns start -->
<!-- returns end -->
<!-- see also start -->
<!-- see also end -->
<!-- usage start -->
<!-- usage end -->
</dd>
<dt>
<div class="divider divider-custom"></div>
<div class="block section-item-header">
<a href="#task_list_toggle" class="fragment-hashtag">#</a>
<span class="section-item-title" id="task_list_toggle">task_list_toggle</span>
</div>
</dt>
<dd>
<div class="section-item-body">
<p class="section-item-summary">Button on the top flow used to toggle the task list container</p>
<p class="section-item-description"></p>
<!-- parameters start -->
@@ -632,7 +756,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -837,7 +837,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -511,7 +511,7 @@ see ./expcore/commands.lua for more details</span></td>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -351,7 +351,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -419,7 +419,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1164,7 +1164,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -654,7 +654,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -323,7 +323,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1292,7 +1292,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -434,7 +434,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -353,7 +353,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -441,7 +441,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -752,7 +752,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -1418,7 +1418,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -651,7 +651,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -442,7 +442,7 @@
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -789,7 +789,7 @@ Public License instead of this License. But first, please read
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -338,7 +338,7 @@ Please report these errors to [the issues page](issues).
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc </a></i>
</div>
<div class="content-footer column col-9 col-sm-12">
<i>Last updated 2019-10-21 22:17:42 UTC</i>
<i>Last updated 2019-10-24 01:44:32 UTC</i>
</div>
</div>
</div>

View File

@@ -5,35 +5,60 @@
@usage-- Defining a button that prints the player's name
local example_button =
Gui.new_element{
Gui.element{
type = 'button',
caption = 'Example Button'
}
:on_click(function(event)
local player = event.player
:on_click(function(player,element,event)
player.print(player.name)
end)
@usage-- Defining using a custom function
@usage-- Defining a button with a custom style
local example_button =
Gui.element{
type = 'button',
caption = 'Example Button'
}
:style{
height = 25,
width = 100
}
:on_click(function(player,element,event)
player.print(player.name)
end)
@usage-- Defining a button using a custom function
local example_flow_with_button =
Gui.new_element(function(event_trigger,parent)
Gui.element(function(event_trigger,parent)
-- Add the flow the button is in
local flow =
parent.add{
name = 'example_flow',
type = 'flow'
}
-- Get the players name
local player = game.players[parent.player_index]
local player_name = player.name
-- Add the button
local element =
flow.add{
name = event_trigger,
type = 'button',
caption = 'Example Button'
caption = 'Example Button: '..player_name
}
-- Set the style of the button
local style = element.style
style.height = 25
style.width = 100]
style.font_color = player.color
-- Return the element
return element
end)
:on_click(function(event)
local player = event.player
:on_click(function(player,element,event)
player.print(player.name)
end)
@@ -62,14 +87,16 @@ local Gui = {
--- An index used for debuging to find the file where different elements where registered
-- @table file_paths
file_paths = {},
--- The element prototype which is returned from Gui.new_element
--- The element prototype which is returned from Gui.element
-- @table _prototype_element
_prototype_element = {},
--- The prototype metatable applied to new element defines
-- @table _mt_element
_mt_element = {
__call = function(self,parent,...)
return self._draw(self.name,parent,...)
local element = self._draw(self.name,parent,...)
if self._style then self._style(element.style,element,...) end
return element
end
}
}
@@ -85,20 +112,22 @@ Gui._mt_element.__index = Gui._prototype_element
@usage-- Defining an element with a table
local example_button =
Gui.new_element{
Gui.element{
type = 'button',
caption = 'Example Button'
}
@usage-- Defining an element with a function
local example_flow_with_button =
Gui.new_element(function(event_trigger,parent)
Gui.element(function(event_trigger,parent,...)
-- Add the flow the button is in
local flow =
parent.add{
name = 'example_flow',
type = 'flow'
}
-- Add the button
local element =
flow.add{
name = event_trigger,
@@ -106,11 +135,17 @@ Gui.new_element(function(event_trigger,parent)
caption = 'Example Button'
}
-- Set the style of the button
local style = element.style
style.height = 25
style.width = 100
-- Return the element
return element
end)
]]
function Gui.new_element(element_define)
function Gui.element(element_define)
-- Set the metatable to allow access to register events
local element = setmetatable({}, Gui._mt_element)
@@ -139,8 +174,54 @@ function Gui.new_element(element_define)
return element
end
--[[-- Extension of Gui.element when using the table method, values applied after the element is drawn
@tparam ?table|function style_define used to define how the style is applied, using a table is the simplist way of doing this
@treturn table the new element define that is used to register events to this element
@usage-- Setting the height and width of the example button
local example_button =
Gui.element{
type = 'button',
caption = 'Example Button'
}
:style{
height = 25,
width = 100
}
@usage-- Using a function to set the style
local example_button =
Gui.element{
type = 'button',
caption = 'Example Button'
}
:style(function(style,element,...)
local player = game.players[element.player_index]
style.height = 25
style.width = 100
style.font_color = player.color
end)
]]
function Gui._prototype_element:style(style_define)
-- Add the defination function
if type(style_define) == 'table' then
self._style = function(style)
for key,value in pairs(style_define) do
style[key] = value
end
end
else
self._style = style_define
end
-- Return the element so event handers can be accessed
return self
end
--[[-- Adds an element to be drawn to the top flow when a player joins
@tparam[opt] function authenticator called during toggle or update to decide if the element should be visible
@treturn table the new element define that is used to register events to this element
@usage-- Adding the example button
example_button:add_to_top_flow(function(player)
@@ -151,10 +232,12 @@ end)
]]
function Gui._prototype_element:add_to_top_flow(authenticator)
Gui.top_elements[self.name] = authenticator or true
return self
end
--[[-- Adds an element to be drawn to the left flow when a player joins
@tparam[opt] ?boolean|function open_on_join called during first darw to decide if the element is visible
@treturn table the new element define that is used to register events to this element
@usage-- Adding the example button
example_flow_with_button:add_to_left_flow(true)
@@ -162,6 +245,7 @@ example_flow_with_button:add_to_left_flow(true)
]]
function Gui._prototype_element:add_to_left_flow(open_on_join)
Gui.left_elements[self.name] = open_on_join or false
return self
end
-- This function is called for event event
@@ -186,7 +270,7 @@ local function general_event_handler(event)
end
event.player = player
local success, err = pcall(handler,event)
local success, err = pcall(handler,player,element,event)
if not success then
error('There as been an error with an event handler for a gui element:\n\t'..err)
end
@@ -259,31 +343,23 @@ Gui._prototype_element.on_value_changed = event_handler_factory(defines.events.o
--- Button which toggles the top flow elements
-- @element toggle_top_flow
local toggle_top_flow =
Gui.new_element(function(event_trigger,parent)
-- Draw the element
local element =
parent.add{
name = event_trigger,
type = 'button',
style = mod_gui.button_style,
caption = '<',
tooltip = {'gui_util.button_tooltip'}
}
-- Change its style
local style = element.style
style.width = 18
style.height = 36
style.padding = 0
style.font = 'default-small-bold'
-- Return the element
return element
end)
:on_click(function(event)
Gui.toggle_top_flow(event.player)
Gui.element{
type = 'button',
style = 'back_button',
tooltip = {'gui_util.button_tooltip'}
}
:style{
width = 18,
height = 36
}
:on_click(function(player,_,_)
Gui.toggle_top_flow(player)
end)
--- The style that should be used for buttons on the top flow
-- @field Gui.top_flow_button_style
Gui.top_flow_button_style = mod_gui.button_style
--[[-- Gets the flow which contains the elements for the top flow
@function Gui.get_top_flow(player)
@tparam LuaPlayer player the player that you want to get the flow for
@@ -305,7 +381,7 @@ Gui.update_top_flow(game.player)
function Gui.update_top_flow(player)
local top_flow = Gui.get_top_flow(player)
local toggle_button = top_flow[toggle_top_flow.name]
local is_visible = toggle_button.caption == '<'
local is_visible = toggle_button.style.name == 'back_button'
-- Set the visible state of all elements in the flow
for name,authenticator in pairs(Gui.top_elements) do
@@ -335,7 +411,7 @@ Gui.toggle_top_flow(game.player,true)
function Gui.toggle_top_flow(player,state)
local top_flow = Gui.get_top_flow(player)
local toggle_button = top_flow[toggle_top_flow.name]
local new_state = state or toggle_button.caption == '>'
local new_state = state or toggle_button.style.name == 'forward_button'
-- Set the visible state of all elements in the flow
for name,authenticator in pairs(Gui.top_elements) do
@@ -344,11 +420,15 @@ function Gui.toggle_top_flow(player,state)
-- Change the style of the toggle button
if new_state then
toggle_button.caption = '<'
toggle_button.style.height = 34
toggle_button.style = 'back_button'
local style = toggle_button.style
style.height = 36
style.width = 18
else
toggle_button.caption = '>'
toggle_button.style.height = 24
toggle_button.style = 'forward_button'
local style = toggle_button.style
style.height = 20
style.width = 18
end
return new_state
@@ -360,29 +440,17 @@ end
--- Button which hides the elements in the left flow
-- @element hide_left_flow
local hide_left_flow =
Gui.new_element(function(event_trigger,parent)
-- Draw the element
local element =
parent.add{
name = event_trigger,
type = 'button',
style = mod_gui.button_style,
caption = '<',
tooltip = {'expcore-gui.left-button-tooltip'}
}
-- Change its style
local style = element.style
style.width = 18
style.height = 36
style.padding = 0
style.font = 'default-small-bold'
-- Return the element
return element
end)
:on_click(function(event)
Gui.hide_left_flow(event.player)
Gui.element{
type = 'button',
style = 'back_button',
tooltip = {'expcore-gui.left-button-tooltip'}
}
:style{
width = 18,
height = 36
}
:on_click(function(player,_,_)
Gui.hide_left_flow(player)
end)
--[[-- Gets the flow which contains the elements for the left flow
@@ -486,4 +554,195 @@ Event.add(defines.events.on_player_joined_game,function(event)
hide_left.visible = show_hide_left
end)
--- Helper Functions.
-- @section helperFunctions
--[[-- Get the player that owns a gui element
@tparam LuaGuiElement element the element that you want to get the owner of
@treturn LuaPlayer the player that owns this element
@usage-- Geting the owner of an element
local player = Gui.get_player_from_element(element)
]]
function Gui.get_player_from_element(element)
if not element or not element.valid then return end
return game.players[element.player_index]
end
--[[-- Will toggle the enabled state of an element or set it to the one given
@tparam LuaGuiElement element the element that you want to toggle the state of
@tparam[opt] boolean state the state that you want to set
@treturn boolean the new enabled state that the element has
@usage-- Toggling the the enabled state
local new_enabled_state = Gui.toggle_enabled_state(element)
]]
function Gui.toggle_enabled_state(element,state)
if not element or not element.valid then return end
local new_state = state or not element.enabled
element.enabled = new_state
return new_state
end
--[[-- Will toggle the visible state of an element or set it to the one given
@tparam LuaGuiElement element the element that you want to toggle the state of
@tparam[opt] boolean state the state that you want to set
@treturn boolean the new visible state that the element has
@usage-- Toggling the the visible state
local new_visible_state = Gui.toggle_visible_state(element)
]]
function Gui.toggle_visible_state(element,state)
if not element or not element.valid then return end
local new_state = state or not element.visible
element.visible = new_state
return new_state
end
--[[-- Destory a gui element without causing any errors, likly if the element may have already been removed
@tparam LuaGuiElement element the element that you want to remove
@treturn boolean true if the element was valid and has been removed
@usage-- Likely use case for element not existing
Gui.destroy_if_valid(element[child_name])
]]
function Gui.destroy_if_valid(element)
if not element or not element.valid then return false end
element.destroy()
return true
end
--[[-- Draw a flow that has custom element alignments, default is right align
@tparam LuaGuiElement parent the parent element that the alignment flow will be added to
@tparam[opt='right'] string horizontal_align the horizontal alignment of the elements in the flow
@tparam[opt='center'] string vertical_align the vertical alignment of the elements in the flow
@tparam[opt='alignment'] string name the name of the alignment flow
@treturn LuaGuiElement the alignment flow that was created
@usage-- Adding a right align flow
local alignment = Gui.alignment(element,'example_right_alignment')
@usage-- Adding a horizontal center and top align flow
local alignment = Gui.alignment(element,'example_center_top_alignment','center','top')
]]
function Gui.alignment(parent,horizontal_align,vertical_align,name)
-- Draw the alignment flow
local alignment =
parent.add{
name = name or 'alignment',
type = 'flow',
}
-- Change its style
local style = alignment.style
style.padding = {1,2}
style.vertical_align = vertical_align or 'center'
style.horizontal_align = horizontal_align or 'right'
style.vertically_stretchable = style.vertical_align ~= 'center'
style.horizontally_stretchable = style.horizontal_align ~= 'center'
-- Return the flow
return alignment
end
--[[-- Draw a scroll pane that has a table inside of it
@tparam LuaGuiElement parent the parent element that the scroll table will be added to
@tparam number height the maximum height for the scroll pane
@tparam number column_count the number of columns that the table will have
@tparam[opt='scroll'] string name the name of the scroll pane that is added, the table is always called 'table'
@treturn LuaGuiElement the table that was created
@usage-- Adding a scroll table with max height of 200 and column count of 3
local scroll_table = Gui.scroll_table(element,'example_scroll_table',200,3)
]]
function Gui.scroll_table(parent,height,column_count,name)
-- Draw the scroll
local scroll =
parent.add{
name = name or 'scroll',
type = 'scroll-pane',
direction = 'vertical',
horizontal_scroll_policy = 'never',
vertical_scroll_policy = 'auto-and-reserve-space',
style = 'scroll_pane_under_subheader'
}
-- Change the style of the scroll
local scroll_style = scroll.style
scroll_style.padding = {1,2}
scroll_style.maximal_height = height
scroll_style.horizontally_stretchable = true
-- Draw the table
local scroll_table =
scroll.add{
type = 'table',
name = 'table',
column_count = column_count
}
-- Change the style of the table
local table_style = scroll_table.style
table_style.padding = 0
table_style.cell_padding = 0
table_style.vertical_align = 'center'
table_style.horizontally_stretchable = true
-- Return the scroll table
return scroll_table
end
--[[-- Used to add a header to a frame, this has the option for a custom right alignment flow for buttons
@tparam LuaGuiElement parent the parent element that the header will be added to
@tparam ?string|Concepts.LocalizedString caption the caption that will be shown on the header
@tparam[opt] ?string|Concepts.LocalizedString tooltip the tooltip that will be shown on the header
@tparam[opt=false] boolean add_alignment when true an alignment flow will be added for buttons
@tparam[opt='header'] string name the name of the header that is being added, the alignment is always called 'alignment'
@treturn LuaGuiElement either the header or the header alignment if add_alignment is true
@usage-- Adding a custom header
local header_alignment = Gui.header(
element,
'example_header',
'Example Caption',
'Example Tooltip',
true
)
]]
function Gui.header(parent,caption,tooltip,add_alignment,name)
-- Draw the header
local header =
parent.add{
name = name or 'header',
type = 'frame',
style = 'subheader_frame'
}
-- Change the style of the header
local style = header.style
style.padding = {2,4}
style.use_header_filler = false
style.horizontally_stretchable = true
-- Draw the caption label
header.add{
name = 'header_label',
type = 'label',
style = 'heading_1_label',
caption = caption,
tooltip = tooltip
}
-- Return either the header or the added alignment
return add_alignment and Gui.alignment(header) or header
end
-- Module return
return Gui

View File

@@ -27,7 +27,7 @@ local player_scores = Store.register(function(player) -- Use player name as the
end)
-- When any key in the store is changed this function will trigger
Store.watch(player_scores,function(value,key)
Store.watch(player_scores,function(value,key,old_value)
game.print(key..' now has a score of '..value)
end)
@@ -175,7 +175,7 @@ local player_scores = Store.register(function(player)
end)
-- Register the watcher so that when we change the value the message is printed
Store.watch(player_scores,function(value,key)
Store.watch(player_scores,function(value,key,old_value)
game.print(key..' now has a score of '..value)
end)
@@ -274,18 +274,21 @@ Store.clear(player_scores)
]]
function Store.clear(store,key)
key = Store.validate(store,key,2)
local old_value
-- Check if there is a key being used
if key then
if type(data_store[store]) == 'table' then
old_value = data_store[store][key]
data_store[store][key] = nil
end
else
old_value = data_store[store]
data_store[store] = nil
end
-- Trigger any watch functions
Store.raw_trigger(store,key,nil)
Store.raw_trigger(store,key,nil,old_value)
end
--[[-- Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them
@@ -325,19 +328,22 @@ function Store.set(store,key,value)
-- Check the store is valid
key = Store.validate(store,key,2)
local old_value
-- If there is a key being used then the store must be a able
if key then
if type(data_store[store]) ~= 'table' then
data_store[store] = {_value = data_store[store]}
end
old_value = data_store[store][key]
data_store[store][key] = value
else
old_value = data_store[store]
data_store[store] = value
end
-- Trigger any watchers
Store.raw_trigger(store,key,value)
Store.raw_trigger(store,key,value,old_value)
end
--[[-- Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them
@@ -386,7 +392,7 @@ function Store.update(store,key,updater)
-- Check the store is valid
key = Store.validate(store,key,2)
local value
local value, old_value
-- If a key is used then the store must be a table
if key then
@@ -397,6 +403,7 @@ function Store.update(store,key,updater)
-- Call the updater and if it returns a value then set this value
local rtn = updater(data_store[store][key])
if rtn then
old_value = data_store[store][key]
data_store[store][key] = rtn
end
value = data_store[store][key]
@@ -405,6 +412,7 @@ function Store.update(store,key,updater)
-- Call the updater and if it returns a value then set this value
local rtn = updater(data_store[store])
if rtn then
old_value = data_store[store][key]
data_store[store] = rtn
end
value = data_store[store]
@@ -412,7 +420,7 @@ function Store.update(store,key,updater)
end
-- Trigger any watchers
Store.raw_trigger(store,key,value)
Store.raw_trigger(store,key,value,old_value)
end
--[[-- Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present
@@ -455,7 +463,7 @@ function Store.map(store,updater)
if rtn then
data[key] = rtn
end
Store.raw_trigger(store,key,data[key])
Store.raw_trigger(store,key,data[key],value)
end
end
@@ -476,9 +484,10 @@ function Store.trigger(store,key)
-- Get the data from the data store
local data = data_store[store]
if key then
Store.raw_trigger(store,key,data[key])
data = data[key]
Store.raw_trigger(store,key,data,data)
else
Store.raw_trigger(store,key,data)
Store.raw_trigger(store,key,data,data)
end
end
@@ -486,6 +495,7 @@ end
@tparam number store the uid of the store that you want to trigger
@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer
@tparam[opt] any value the new value that is at this key or store, passed directly to the watcher
@tparam[opt] any old_value the old value that was at this key or store often the same if value is a table, passed directly to the watcher
@usage-- Triggering a manule call of the watchers
-- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting
@@ -493,16 +503,16 @@ local scenario_diffculty = Store.register()
-- Trigger the watchers with a fake change of diffculty
-- This is mostly used internally but it can be useful in other cases
Store.raw_trigger(scenario_diffculty,nil,'normal')
Store.raw_trigger(scenario_diffculty,nil,'normal','normal')
]]
function Store.raw_trigger(store,key,value)
function Store.raw_trigger(store,key,value,old_value)
key = Store.validate(store,key,2)
-- Get the watchers and then loop over them
local watchers = Store.watchers[store] or {}
for _,watcher in pairs(watchers) do
local success, err = pcall(watcher,value,key)
local success, err = pcall(watcher,value,key,old_value)
if not success then
error('Store watcher casued an error:\n\t'..err)
end

View File

@@ -89,8 +89,8 @@ Tasks.remove_task(task_id)
function Tasks.remove_task(task_id)
local task = Store.get(task_store,task_id)
local force_name = task.force_name
Store.clear(task_store,task_id)
table.remove_element(force_tasks[force_name],task_id)
Store.clear(task_store,task_id)
end
--[[-- Update the message and last edited information for a task

View File

@@ -12,337 +12,455 @@ local format_time,table_keys = ext_require('expcore.common','format_time','table
local Tasks = require 'modules.control.tasks' --- @dep modules.control.tasks
--- If a player is allowed to use the edit buttons
local function player_allowed_edit(player,task)
local function check_player_permissions(player,task)
if task then
-- When a task is given check if the player can edit it
local allow_edit_task = config.allow_edit_task
-- Check if the player being the last to edit will override existing permisisons
if config.user_can_edit_own_tasks and task.last_edit_name == player.name then
return true
end
else
if config.any_user_can_add_new_task then
-- Check player has permisison based on value in the config
if allow_edit_task == 'all' then
return true
elseif allow_edit_task == 'admin' then
return player.admin
elseif allow_edit_task == 'expcore.roles' then
return Roles.player_allowed(player,config.edit_tasks_role_permission)
end
end
if config.only_admins_can_edit and not player.admin then
-- Return false as all other condidtions have not been met
return false
else
-- When a task is not given check if the player can add a new task
local allow_add_task = config.allow_add_task
-- Check player has permisison based on value in the config
if allow_add_task == 'all' then
return true
elseif allow_add_task == 'admin' then
return player.admin
elseif allow_add_task == 'expcore.roles' then
return Roles.player_allowed(player,config.expcore_roles_add_permission)
end
-- Return false as all other condidtions have not been met
return false
end
if config.edit_tasks_role_permission and not Roles.player_allowed(player,config.edit_tasks_role_permission) then
return false
end
return true
end
--- Button in the header to add a new task
--- Button displayed in the ehader bar, used to add a new task
-- @element add_new_task
local add_new_task =
Gui.new_button()
:set_sprites('utility/add')
:set_tooltip{'task-list.add-tooltip'}
:set_style('tool_button',function(style)
Gui.set_padding_style(style,-2,-2,-2,-2)
style.height = 20
style.width = 20
end)
:on_click(function(player,element)
Gui.element{
type = 'sprite-button',
sprite = 'utility/add',
tooltip = {'task-list.add-tooltip'},
style = 'tool_button'
}
:style{
padding = -2,
height = 20,
width = 20
}
:on_click(function(player,_,_)
Tasks.add_task(player.force.name,nil,player.name)
end)
--- Used to save changes to a task
--- Button displayed next to tasks which the user is currently editing, used to save changes
-- @element confirm_edit
local confirm_edit =
Gui.new_button()
:set_sprites('utility/downloaded')
:set_tooltip{'task-list.confirm-tooltip'}
:set_style('tool_button',function(style)
Gui.set_padding_style(style,-2,-2,-2,-2)
style.height = 20
style.width = 20
end)
:on_click(function(player,element)
Gui.element{
type = 'sprite-button',
sprite = 'utility/downloaded',
tooltip = {'task-list.confirm-tooltip'},
style = 'tool_button'
}
:style{
padding = -2,
height = 20,
width = 20
}
:on_click(function(player,element,_)
local task_id = element.parent.name
local new_message = element.parent.task.text
local new_message = element.parent.task_entry.text
Tasks.set_editing(task_id,player.name)
Tasks.update_task(task_id,new_message,player.name)
end)
--- Used to cancel any changes you made to a task
--- Button displayed next to tasks which the user is currently editing, used to discard changes
-- @element cancel_edit
local cancel_edit =
Gui.new_button()
:set_sprites('utility/close_black')
:set_tooltip{'task-list.cancel-tooltip'}
:set_style('tool_button',function(style)
Gui.set_padding_style(style,-2,-2,-2,-2)
style.height = 20
style.width = 20
end)
:on_click(function(player,element)
Gui.element{
type = 'sprite-button',
sprite = 'utility/close_black',
tooltip = {'task-list.cancel-tooltip'},
style = 'tool_button'
}
:style{
padding = -2,
height = 20,
width = 20
}
:on_click(function(player,element,_)
local task_id = element.parent.name
Tasks.set_editing(task_id,player.name)
end)
--- Removes the task from the list
--- Button displayed next to tasks which the user is can edit, used to delete a task from the list
-- @element discard_task
local discard_task =
Gui.new_button()
:set_sprites('utility/trash')
:set_tooltip{'task-list.discard-tooltip'}
:set_style('tool_button',function(style)
Gui.set_padding_style(style,-2,-2,-2,-2)
style.height = 20
style.width = 20
end)
:on_click(function(player,element)
local task_id = element.parent.name
Gui.element{
type = 'sprite-button',
sprite = 'utility/trash',
tooltip = {'task-list.discard-tooltip'},
style = 'tool_button'
}
:style{
padding = -2,
height = 20,
width = 20
}
:on_click(function(_,element,_)
local task_id = element.parent.name:sub(6)
Tasks.remove_task(task_id)
end)
--- Opens edit mode for the task
--- Button displayed next to tasks which the user is can edit, used to start editing a task
-- @element edit_task
local edit_task =
Gui.new_button()
:set_sprites('utility/rename_icon_normal')
:set_tooltip{'task-list.edit-tooltip-none'}
:set_style('tool_button',function(style)
Gui.set_padding_style(style,-2,-2,-2,-2)
style.height = 20
style.width = 20
end)
:on_click(function(player,element)
local task_id = element.parent.name
Gui.element{
type = 'sprite-button',
sprite = 'utility/rename_icon_normal',
tooltip = {'task-list.edit-tooltip-none'},
style = 'tool_button'
}
:style{
padding = -2,
height = 20,
width = 20
}
:on_click(function(player,element,_)
local task_id = element.parent.name:sub(6)
Tasks.set_editing(task_id,player.name,true)
end)
--[[ Generates each task, handles both view and edit mode
element
> count-"task_id"
>> label
> "task_id"
>> task
>> cancel_edit (edit mode)
>> confirm_edit (edit mode)
> edit-"task_id"
>> edit_task
>> discard_task
]]
local function generate_task(player,element,task_id)
--- Set of three elements which make up each row of the task table
-- @element add_task_base
local add_task_base =
Gui.element(function(_,parent,task_id)
-- Add the task number label
parent.add{
name = 'count-'..task_id,
type = 'label',
caption = '0)'
}
-- Add a flow which will contain the task message and edit buttons
local task_flow =
parent.add{
name = task_id,
type = 'flow',
}
-- Set the padding on the task flow
local task_flow_style = task_flow.style
task_flow_style.padding = 0
-- Add the two edit buttons outside the task flow
local edit_flow = Gui.alignment(parent,nil,nil,'edit-'..task_id)
edit_task(edit_flow)
discard_task(edit_flow)
-- Return the task flow as the main element
return task_flow
end)
-- Removes the three elements that are added as part of the task base
local function remove_task_base(parent,task_id)
Gui.destroy_if_valid(parent['count-'..task_id])
Gui.destroy_if_valid(parent['edit-'..task_id])
Gui.destroy_if_valid(parent[task_id])
end
--- Default state for a task, contains only a label with the task message
-- @element task_label
local task_label =
Gui.element(function(_,parent,task)
local message = task.message
local last_edit_name = task.last_edit_name
local last_edit_time = task.last_edit_time
-- Draw the element
local element =
parent.add{
name = 'task_entry',
type = 'label',
caption = message,
tooltip = {'task-list.last-edit', last_edit_name, format_time(last_edit_time)}
}
-- Change the style
local style = element.style
style.single_line = false
style.maximal_width = 150
-- Return the element
return element
end)
--- Editing state for a task, contrins a text field and the two edit buttons
-- @element task_editing
local task_editing =
Gui.element(function(_,parent,task)
local message = task.message
-- Draw the element
local element =
parent.add{
name = 'task_entry',
type = 'textfield',
text = message
}
-- Change the style
local style = element.style
style.maximal_width = 150
style.height = 20
-- Add the edit buttons
cancel_edit(parent)
confirm_edit(parent)
-- Return the element
return element
end)
--- Updates a task for a player
local function update_task(player,task_table,task_id)
local task = Tasks.get_task(task_id)
local task_ids = Tasks.get_force_task_ids(player.force.name)
local task_number = table.index_of(task_ids, task_id)
-- Task no longer exists so should be removed from the list
if not task then
-- task is nil so remove it from the list
element.parent.no_tasks.visible = #task_ids == 1
Gui.destroy_if_valid(element['count-'..task_id])
Gui.destroy_if_valid(element['edit-'..task_id])
Gui.destroy_if_valid(element[task_id])
else
local message = task.message
local editing = task.curently_editing[player.name]
local last_edit_name = task.last_edit_name
local last_edit_time = task.last_edit_time
element.parent.no_tasks.visible = false
-- if it is not already present then add it now
local task_area = element[task_id]
if not task_area then
-- label to show the task number
element.add{
name='count-'..task_id,
type='label',
caption=task_number..')'
}
-- area which stores the task and buttons
task_area =
element.add{
name=task_id,
type='flow',
}
Gui.set_padding(task_area)
-- if the player can edit then it adds the edit and delete button
local flow = Gui.create_alignment(element,'edit-'..task_id)
local sub_flow = flow.add{type='flow',name=task_id}
edit_task(sub_flow)
discard_task(sub_flow)
end
-- update the number indexes and the current editing players
element['count-'..task_id].caption = task_number..')'
local edit_area = element['edit-'..task_id][task_id]
local players = table_keys(task.editing)
local allowed = player_allowed_edit(player,task)
edit_area.visible = allowed
if #players > 0 then
edit_area[edit_task.name].tooltip = {'task-list.edit-tooltip',table.concat(players,', ')}
else
edit_area[edit_task.name].tooltip = {'task-list.edit-tooltip-none'}
end
-- draws/updates the task area
local element_type = task_area.task and task_area.task.type or nil
if not editing and element_type == 'label' then
-- update the label already present
task_area.task.caption = message
task_area.task.tooltip = {'task-list.last-edit',last_edit_name,format_time(last_edit_time)}
elseif not editing then
-- create the label, view mode
if edit_area then
edit_area[edit_task.name].enabled = true
end
task_area.clear()
local label =
task_area.add{
name='task',
type='label',
caption=message,
tooltip={'task-list.last-edit',last_edit_name,format_time(last_edit_time)}
}
label.style.single_line = false
label.style.maximal_width = 150
elseif editing and element_type ~= 'textfield' then
-- create the text field, edit mode, update it omitted as value is being edited
if edit_area then
edit_area[edit_task.name].enabled = false
end
task_area.clear()
local entry =
task_area.add{
name='task',
type='textfield',
text=message
}
entry.style.maximal_width = 150
entry.style.height = 20
cancel_edit(task_area)
confirm_edit(task_area)
end
task_table.parent.no_tasks.visible = #task_ids == 0
remove_task_base(task_table,task_id)
return
end
-- Get the task flow for this task
local task_flow = task_table[task_id] or add_task_base(task_table,task_id)
task_table.parent.no_tasks.visible = false
task_table['count-'..task_id].caption = task_number..')'
-- Update the edit flow
local edit_flow = task_table['edit-'..task_id]
local player_allowed_edit = check_player_permissions(player,task)
local players_editing = table_keys(task.curently_editing)
local edit_task_element = edit_flow[edit_task.name]
local discard_task_element = edit_flow[discard_task.name]
edit_task_element.visible = player_allowed_edit
discard_task_element.visible = player_allowed_edit
if #players_editing > 0 then
edit_task_element.tooltip = {'task-list.edit-tooltip',table.concat(players_editing,', ')}
else
edit_task_element.tooltip = {'task-list.edit-tooltip-none'}
end
-- Check if the player is was editing and/or currently editing
local task_entry = task_flow.task_entry or task_label(task_flow,task)
local player_was_editing = task_entry.type == 'textfield'
local player_is_editing = task.curently_editing[player.name]
-- Update the task flow
if not player_was_editing and not player_is_editing then
-- Update the task message label
local message = task.message
local last_edit_name = task.last_edit_name
local last_edit_time = task.last_edit_time
task_entry.caption = message
task_entry.tooltip = {'task-list.last-edit', last_edit_name, format_time(last_edit_time)}
elseif player_was_editing and not player_is_editing then
-- Player was editing but is no longer, remove text field and add label
edit_task_element.enabled = true
task_flow.clear()
task_label(task_flow,task)
elseif not player_was_editing and player_is_editing then
-- Player was not editing but now is, remove label and add text field
edit_task_element.enabled = false
task_flow.clear()
task_editing(task_flow,task)
end
end
--[[ generates the main gui structure
element
> container
>> header
>>> right aligned add_new_task
>> scroll
>>> no_tasks
>>> table
]]
local function generate_container(player,element)
Gui.set_padding(element,2,2,2,2)
element.style.minimal_width = 200
local function update_all_tasks(player,scroll_table)
local task_ids = Tasks.get_force_task_ids(player.force.name)
if #task_ids > 0 then
for _,task_id in ipairs(task_ids) do
update_task(player,scroll_table,task_id)
end
end
end
-- main container which contains the other elements
local container =
element.add{
name='container',
type='frame',
direction='vertical',
style='window_content_frame_packed'
--- Main task list container for the left flow
-- @element task_list_container
local task_list_container =
Gui.element(function(event_trigger,parent)
-- Draw the external container
local frame =
parent.add{
name = event_trigger,
type = 'frame'
}
Gui.set_padding(container)
container.style.vertically_stretchable = false
-- main header for the gui
local header_area = Gui.create_header(
-- Set the frame style
frame.style.padding = 2
-- Draw the internal container
local container =
frame.add{
name = 'container',
type = 'frame',
direction = 'vertical',
style = 'window_content_frame_packed'
}
-- Set the container style
local style = container.style
style.vertically_stretchable = false
-- Draw the header
local header = Gui.header(
container,
{'task-list.main-caption'},
{'task-list.sub-tooltip'},
true
)
--- Right aligned button to toggle the section
if player_allowed_edit(player) then
add_new_task(header_area)
end
-- Draw the new task button
local player = Gui.get_player_from_element(parent)
local add_new_task_element = add_new_task(header)
add_new_task_element.visible = check_player_permissions(player)
-- table that stores all the data
local flow_table = Gui.create_scroll_table(container,3,185)
flow_table.draw_horizontal_lines = true
flow_table.vertical_centering = false
flow_table.style.top_cell_padding = 3
flow_table.style.bottom_cell_padding = 3
-- Draw the scroll table for the tasks
local scroll_table = Gui.scroll_table(container,185,3)
scroll_table.draw_horizontal_lines = true
scroll_table.vertical_centering = false
-- message to say that you have no tasks
local non_made =
flow_table.parent.add{
name='no_tasks',
type='label',
caption={'task-list.no-tasks'}
-- Change the style of the scroll table
local scroll_table_style = scroll_table.style
scroll_table_style.top_cell_padding = 3
scroll_table_style.bottom_cell_padding = 3
-- Draw the no tasks label
local no_tasks_label =
scroll_table.parent.add{
name = 'no_tasks',
type = 'label',
caption = {'task-list.no-tasks'}
}
non_made.style.width = 200
non_made.style.single_line = false
return flow_table
end
-- Change the style of the no tasks label
local no_tasks_style = no_tasks_label.style
no_tasks_style.padding = {2,4}
no_tasks_style.single_line = false
no_tasks_style.width = 200
--- Registers the task list
-- @element task_list
local task_list =
Gui.new_left_frame('gui/task-list')
:set_sprites('utility/not_enough_repair_packs_icon')
:set_direction('vertical')
:set_tooltip{'task-list.main-tooltip'}
:set_open_by_default()
:on_creation(function(player,element)
local data_table = generate_container(player,element)
-- Add any existing tasks
local task_ids = Tasks.get_force_task_ids(player.force.name)
for _,task_id in pairs(task_ids) do
generate_task(player,data_table,task_id)
if #task_ids > 0 then
no_tasks_style.visible = false
for _,task_id in ipairs(task_ids) do
update_task(player,scroll_table,task_id)
end
end
-- Return the exteral container
return frame
end)
:on_update(function(player,element)
local data_table = element.container.scroll.table
:add_to_left_flow(function(player)
local task_ids = Tasks.get_force_task_ids(player.force.name)
return #task_ids > 0
end)
for _,task_id in pairs(task_ids) do
generate_task(player,data_table,task_id)
end
--- Button on the top flow used to toggle the task list container
-- @element task_list_toggle
Gui.element{
type = 'sprite-button',
sprite = 'utility/not_enough_repair_packs_icon',
tooltip = {'task-list.main-tooltip'},
style = Gui.top_flow_button_style
}
:style{
padding = -2
}
:add_to_top_flow(function(player)
return Roles.player_allowed(player,'gui/task-list')
end)
:on_click(function(player,_,_)
Gui.toggle_left_element(player, task_list_container)
end)
--- When a new task is added it will udpate the task list for everyone on that force
Tasks.on_update(function(task,task_id)
local players
Tasks.on_update(function(task,task_id,removed_task)
-- Get the force to update, task is nil when removed
local force
if task then
local force = game.forces[task.force_name]
players = force.connected_players
force = game.forces[task.force_name]
else
players = game.connected_players
force = game.forces[removed_task.force_name]
end
for _,player in pairs(players) do
local frame = task_list:get_frame(player)
local element = frame.container.scroll.table
generate_task(player,element,task_id)
-- Update the task for all the players on the force
local task_ids = Tasks.get_force_task_ids(force.name)
for _,player in pairs(force.connected_players) do
local left_flow = Gui.get_left_flow(player)
local frame = left_flow[task_list_container.name]
local scroll_table = frame.container.scroll.table
-- Update the task that was changed
update_task(player,scroll_table,task_id)
-- Update the numbering of the other tasks if the task was removed
if not task then
for task_number, next_task_id in pairs(task_ids) do
scroll_table['count-'..next_task_id].caption = task_number..')'
end
end
end
end)
--- Update the tasks when the player joins
Event.add(defines.events.on_player_joined_game,task_list 'redraw')
Event.add(defines.events.on_player_joined_game,function(event)
local player = game.players[event.player_index]
local left_flow = Gui.get_left_flow(player)
local frame = left_flow[task_list_container.name]
local scroll_table = frame.container.scroll.table
update_all_tasks(player,scroll_table)
end)
--- Makes sure the right buttons are present when roles change
Event.add(Roles.events.on_role_assigned,task_list 'redraw')
Event.add(Roles.events.on_role_unassigned,task_list 'redraw')
local function role_update_event(event)
local player = game.players[event.player_index]
local left_flow = Gui.get_left_flow(player)
local container = left_flow[task_list_container.name].container
return task_list
-- Update the tasks, incase the user can now edit them
local scroll_table = container.scroll.table
update_all_tasks(player,scroll_table)
-- Update the new task button incase the user can now add them
local add_new_task_element = container.header.alignment[add_new_task.name]
add_new_task_element.visible = check_player_permissions(player)
end
Event.add(Roles.events.on_role_assigned,role_update_event)
Event.add(Roles.events.on_role_unassigned,role_update_event)