diff --git a/README.md b/README.md index affbc44a..c1ab73b8 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Please report these errors to [the issues page](issues). ## Contributing -All are welcome to make pull requests and issues for this scenario, if you are in any doubt, please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. All our docs can be found [here][docs]. Please keep in mind while making code changes: +All are welcome to make pull requests and issues for this scenario, if you are in any doubt, please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. To find out what we already have please read our [docs]. Please keep in mind while making code changes: * New features should have the branch names: `feature/feature-name` * New features are merged into `dev` after it has been completed, this can be done through a pull request. diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 6c6c0c0d..35a07946 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -55,5 +55,4 @@ return { '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 } \ No newline at end of file diff --git a/config/action_buttons.lua b/config/action_buttons.lua index 2ce10565..b5306cf1 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -22,13 +22,6 @@ local function set_store_uids(player,action) selected_action_store = action end --- common style used by all action buttons -local function tool_button_style(style) - Gui.set_padding_style(style,-1,-1,-1,-1) - style.height = 28 - style.width = 28 -end - -- auth that will only allow when on player's of lower roles local function auth_lower_role(player,selected_player_name) local player_highest = Roles.get_player_highest_role(player) @@ -56,14 +49,23 @@ local function teleport(from_player,to_player) return true end +local function new_button(sprite,tooltip) + return Gui.element{ + type = 'sprite-button', + style = 'tool_button', + sprite = sprite, + tooltip = tooltip + }:style{ + padding = -1, + height = 28, + width = 28 + } +end + --- Teleports the user to the action player -- @element goto_player -local goto_player = -Gui.new_button() -:set_sprites('utility/export') -:set_tooltip{'player-list.goto-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local goto_player = new_button('utility/export',{'player-list.goto-player'}) +:on_click(function(player) local selected_player_name = get_action_player_name(player) local selected_player = Game.get_player_from_any(selected_player_name) if not player.character or not selected_player.character then @@ -75,12 +77,8 @@ end) --- Teleports the action player to the user -- @element bring_player -local bring_player = -Gui.new_button() -:set_sprites('utility/import') -:set_tooltip{'player-list.bring-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local bring_player = new_button('utility/import',{'player-list.bring-player'}) +:on_click(function(player) local selected_player_name = get_action_player_name(player) local selected_player = Game.get_player_from_any(selected_player_name) if not player.character or not selected_player.character then @@ -92,12 +90,8 @@ end) --- Kills the action player, if there are alive -- @element kill_player -local kill_player = -Gui.new_button() -:set_sprites('utility/too_far') -:set_tooltip{'player-list.kill-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local kill_player = new_button('utility/too_far',{'player-list.kill-player'}) +:on_click(function(player) local selected_player_name = get_action_player_name(player) local selected_player = Game.get_player_from_any(selected_player_name) if selected_player.character then @@ -109,12 +103,8 @@ end) --- Reports the action player, requires a reason to be given -- @element report_player -local report_player = -Gui.new_button() -:set_sprites('utility/spawn_flag') -:set_tooltip{'player-list.report-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local report_player = new_button('utility/spawn_flag',{'player-list.report-player'}) +:on_click(function(player) local selected_player_name = get_action_player_name(player) if Reports.is_reported(selected_player_name,player.name) then player.print({'expcom-report.already-reported'},Colors.orange_red) @@ -133,12 +123,8 @@ end --- Gives the action player a warning, requires a reason -- @element warn_player -local warn_player = -Gui.new_button() -:set_sprites('utility/spawn_flag') -:set_tooltip{'player-list.warn-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local warn_player = new_button('utility/spawn_flag',{'player-list.warn-player'}) +:on_click(function(player) Store.set(selected_action_store,player,'command/give-warning') end) @@ -151,12 +137,8 @@ end --- Jails the action player, requires a reason -- @element jail_player -local jail_player = -Gui.new_button() -:set_sprites('utility/item_editor_icon') -:set_tooltip{'player-list.jail-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local jail_player = new_button('utility/multiplayer_waiting_icon',{'player-list.jail-player'}) +:on_click(function(player) local selected_player_name, selected_player_color = get_action_player_name(player) if Jail.is_jailed(selected_player_name) then player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red) @@ -174,12 +156,8 @@ end --- Temp bans the action player, requires a reason -- @element temp_ban_player -local temp_ban_player = -Gui.new_button() -:set_sprites('utility/clock') -:set_tooltip{'player-list.temp-ban-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local temp_ban_player = new_button('utility/warning_white',{'player-list.temp-ban-player'}) +:on_click(function(player) local selected_player_name, selected_player_color = get_action_player_name(player) if Jail.is_jailed(selected_player_name) then player.print({'expcom-jail.already-banned', selected_player_color},Colors.orange_red) @@ -197,12 +175,8 @@ end --- Kicks the action player, requires a reason -- @element kick_player -local kick_player = -Gui.new_button() -:set_sprites('utility/warning_icon') -:set_tooltip{'player-list.kick-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local kick_player = new_button('utility/warning_icon',{'player-list.kick-player'}) +:on_click(function(player) Store.set(selected_action_store,player,'command/kick') end) @@ -213,12 +187,8 @@ end --- Bans the action player, requires a reason -- @element ban_player -local ban_player = -Gui.new_button() -:set_sprites('utility/danger_icon') -:set_tooltip{'player-list.ban-player'} -:set_style('tool_button',tool_button_style) -:on_click(function(player,element) +local ban_player = new_button('utility/danger_icon',{'player-list.ban-player'}) +:on_click(function(player) Store.set(selected_action_store,player,'command/ban') end) diff --git a/config/roles.lua b/config/roles.lua index b25704a6..ff40131f 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -61,7 +61,8 @@ Roles.new_role('Administrator','Admin') :set_flag('instance-respawn') :set_parent('Moderator') :allow{ - 'gui/warp-list/no-limit', + 'gui/warp-list/bypass-cooldown', + 'gui/warp-list/bypass-proximity', } Roles.new_role('Moderator','Mod') @@ -181,7 +182,9 @@ Roles.new_role('Member','Mem') :set_custom_color{r=24,g=172,b=188} :set_parent('Regular') :allow{ + 'gui/task-list/add', 'gui/task-list/edit', + 'gui/warp-list/add', 'gui/warp-list/edit' } @@ -217,7 +220,7 @@ local default = Roles.new_role('Guest','') 'gui/rocket-info', 'gui/science-info', 'gui/task-list', - 'gui/warp-list', + 'gui/warp-list' } --- Jail role diff --git a/config/tasks.lua b/config/tasks.lua index 95165ee0..f7968e8e 100644 --- a/config/tasks.lua +++ b/config/tasks.lua @@ -2,8 +2,12 @@ -- @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 + -- Adding tasks + allow_add_task = 'all', --- @setting allow_add_task dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none + expcore_roles_allow_add_task = 'gui/task-list/add', --- @setting expcore_roles_allow_add_task if expcore.roles is used then this is the required permission + + -- Editing tasks + 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_allow_edit_task = 'gui/task-list/edit', --- @setting expcore_roles_allow_edit_task 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 } \ No newline at end of file diff --git a/config/warps.lua b/config/warps.lua index fb620108..d1710ba8 100644 --- a/config/warps.lua +++ b/config/warps.lua @@ -2,24 +2,39 @@ -- @config Warps return { - recharge_time = 60, --- @setting recharge_time The amount of time in seconds that the player must wait between warps, acts as a balance - update_smoothing = 10, --- @setting update_smoothing Higher is better, the amount of smoothing applied to recharge timer and other gui updates, max is 60 - minimum_distance = 100, --- @setting minimum_distance The minimum distance that must be between warp points, creating new ones is blocked when too close - activation_range = 4, --- @setting activation_range The distance the player must be to a warp in order to use the warp gui, gui can still be viewed but not used - spawn_activation_range = 20, --- @setting spawn_activation_range A second activation range which is used for the forces spawn point - default_icon = 'discharge-defense-equipment', --- @setting default_icon The default icon which is used by warps; must be an item name - user_can_edit_own_warps = false, --- @setting user_can_edit_own_warps When true the user can always edit warps which they created regardless of other settings - any_user_can_add_new_warp = false, --- @setting any_user_can_add_new_warp When true any user is able to create new warps, however editing may still be restricted - only_admins_can_edit = false, --- @setting only_admins_can_edit When true only admins can edit warps - edit_warps_role_permission = 'gui/warp-list/edit', --- @setting edit_warps_role_permission Role permission used by the role system to allow editing warps - bypass_warp_limits_permission = 'gui/warp-list/no-limit', --- @setting bypass_warp_limits_permission Role permission used by the role system to allow bypassing the time and distance restrictions - entities = { --- @setting entities The entities which are created for warps + -- General config + update_smoothing = 10, --- @setting update_smoothing the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60 + minimum_distance = 100, --- @setting minimum_distance the minimum distance that is allowed between warps on the same force + default_icon = 'discharge-defense-equipment', --- @setting default_icon the default icon that will be used for warps + + -- Warp cooldowns + bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none + expcore_roles_bypass_warp_cooldown = 'gui/warp-list/bypass-cooldown', --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission + cooldown_duraction = 60, --- @setting cooldown_duraction the duration of the warp cooldown in seconds + + -- Warp proximity + bypass_warp_proximity = 'expcore.roles', --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none + expcore_roles_bypass_warp_proximity = 'gui/warp-list/bypass-proximity', --- @setting expcore_roles_bypass_warp_proximity if expcore.roles is used then this is the required permission + standard_proximity_radius = 4, --- @setting standard_proximity_radius the minimum distance a player is allowed to be to a warp in order to use it + spawn_proximity_radius = 20, --- @setting spawn_proximity_radius the minimum distance a player is allowed to be from they spawn point to use warps + + -- Adding warps + allow_add_warp = 'expcore.roles', --- @setting allow_add_warp dictates who is allowed to add warps; values: all, admin, expcore.roles, none + expcore_roles_allow_add_warp = 'gui/warp-list/add', --- @setting expcore_roles_allow_add_warp if expcore.roles is used then this is the required permission + + -- Editing warps + allow_edit_warp = 'expcore.roles', --- @setting allow_edit_warp dictates who is allowed to edit warps; values: all, admin, expcore.roles, none + expcore_roles_allow_edit_warp = 'gui/warp-list/edit', --- @setting expcore_roles_allow_edit_warp if expcore.roles is used then this is the required permission + user_can_edit_own_warps = false, --- @settings user_can_edit_own_warps if true then the user who made the warp can edit it regardless of the allow_edit_warp setting + + -- Warp area generation + entities = { --- @setting entities The entities which are created for warp areas {'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2}, {'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3}, {'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3} }, - base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warps - tiles = { --- @setting tiles The tiles which are created for warps + base_tile = 'tutorial-grid', --- @setting base_tile The tile which is used for the warp areas + tiles = { --- @setting tiles The tiles which are created for warp areas {-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2}, {-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3} } diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 8fc6a44a..e06593f6 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -348,7 +348,7 @@ generated by LDoc
diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index c9ea0f82..7cb0c9b2 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index d6eda160..6c368f68 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 4fafcaa9..135ff83a 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index a445fe5a..df0b8737 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -349,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index faadc765..4f94aece 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index e0ecba4b..12bccc87 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -460,7 +460,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 8a60609c..0682c770 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 46baddb7..8ecf95bf 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index c4f4487d..84ea1706 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 6b3002a3..9cd696ab 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 04b6b9fe..7967ea77 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 3786a596..f0b1fc7b 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 81523c11..680b91e8 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index a250f390..7026f517 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 0af8bb1c..6667e00b 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 0f1ae48d..e95e5332 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 024c376f..deb9aa2a 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index d4881527..e9b13bfd 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -458,7 +458,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index eeaf7d3d..89212f3b 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 67d43bef..2c670b45 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -611,7 +611,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 967cb7e1..f6e57348 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index fbba050f..59c4534a 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index f30d335d..6c90fe3f 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 361a22d7..004ec4bd 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -321,7 +321,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index f94af164..2f71921c 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 3bc1f04d..ba0318c7 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -557,7 +557,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 257da669..fda9f645 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 63606adc..9cf7157a 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -443,7 +443,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 472651ba..e9131888 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index a62c9b8e..ac587916 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -569,7 +569,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 02b2965a..75ce3491 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -506,7 +506,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 2e3966d2..cc4d5595 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 727827bc..d7ae726a 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index fd824730..4a48d6da 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -294,7 +294,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 4f49a827..ed1c5b7f 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -320,7 +320,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 9aacac5f..e72d1a81 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 64d71e20..f9d62d80 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 574f8aa4..d1d21e74 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -338,7 +338,7 @@ see ./expcore/commands.lua for more details generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 98043b31..7dc0e1b5 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 859cf7d9..ab9a69db 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -416,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 4139d6e6..40ee9ed3 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -237,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 8aa4661f..11aeb9af 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -240,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 305e744d..6329eb61 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -295,7 +295,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 2c9fc83f..2d23727d 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -812,7 +812,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 64d7f6f0..2c6dc312 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -384,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 114b8348..bf97ecf9 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 824291f5..3fd3eca5 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -324,7 +324,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index e61920c5..82dcaa12 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -414,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 929fbf4c..a318f0cd 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -834,7 +834,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 5c7aabf3..c324a6ac 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -292,7 +292,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index c9c7fd1c..f5dca812 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 3c038550..f011372b 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -388,7 +388,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 4395fc07..fac7d663 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -744,7 +744,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 1bd48171..4e84ef99 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -241,16 +241,16 @@when false only people with edit permission can make new reports
+dictates who is allowed to add new tasks; values: all, admin, expcore.roles, none
@@ -291,15 +291,15 @@when false only people with edit permission can edit reports
+if expcore.roles is used then this is the required permission
@@ -318,15 +318,15 @@true will hide the edit and delete buttons from non (game) admins
+dictates who is allowed to edit existing tasks; values: all, admin, expcore.roles, none
@@ -345,15 +345,15 @@value used with custom permission system
+if expcore.roles is used then this is the required permission
@@ -384,7 +384,7 @@ generated by LDocThe amount of time in seconds that the player must wait between warps, acts as a balance
- - - - - - - - - - - - - - - -Higher is better, the amount of smoothing applied to recharge timer and other gui updates, max is 60
+the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60
@@ -356,61 +338,7 @@The minimum distance that must be between warp points, creating new ones is blocked when too close
- - - - - - - - - - - - - - - -The distance the player must be to a warp in order to use the warp gui, gui can still be viewed but not used
- - - - - - - - - - - - - - - -A second activation range which is used for the forces spawn point
+the minimum distance that is allowed between warps on the same force
@@ -437,7 +365,7 @@The default icon which is used by warps; must be an item name
+the default icon that will be used for warps
@@ -456,15 +384,15 @@When true the user can always edit warps which they created regardless of other settings
+dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none
@@ -483,15 +411,15 @@When true any user is able to create new warps, however editing may still be restricted
+if expcore.roles is used then this is the required permission
@@ -510,15 +438,15 @@When true only admins can edit warps
+the duration of the warp cooldown in seconds
@@ -537,15 +465,15 @@Role permission used by the role system to allow editing warps
+dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none
@@ -564,15 +492,177 @@Role permission used by the role system to allow bypassing the time and distance restrictions
+if expcore.roles is used then this is the required permission
+ + + + + + + + + + + + + + + +the minimum distance a player is allowed to be to a warp in order to use it
+ + + + + + + + + + + + + + + +the minimum distance a player is allowed to be from they spawn point to use warps
+ + + + + + + + + + + + + + + +dictates who is allowed to add warps; values: all, admin, expcore.roles, none
+ + + + + + + + + + + + + + + +if expcore.roles is used then this is the required permission
+ + + + + + + + + + + + + + + +dictates who is allowed to edit warps; values: all, admin, expcore.roles, none
+ + + + + + + + + + + + + + + +if expcore.roles is used then this is the required permission
@@ -599,7 +689,7 @@The entities which are created for warps
+The entities which are created for warp areas
@@ -626,7 +716,7 @@The tile which is used for the warps
+The tile which is used for the warp areas
@@ -653,7 +743,7 @@The tiles which are created for warps
+The tiles which are created for warp areas
@@ -684,7 +774,7 @@ generated by LDocCore Module - Gui - - This file is used to require all the different elements of the gui module - - each module has an outline here but for more details see their separate files in ./gui - - please read the files for more documentation that cant be shown here - - please note there is a rework planned but not started
+- Used to define new gui elements and gui event handlers @@ -263,6 +244,66 @@ +-- Defining a button that prints the player's name
+local example_button =
+Gui.element{
+ type = 'button',
+ caption = 'Example Button'
+}
+:on_click(function(player,element,event)
+ player.print(player.name)
+end)
+ -- 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)
+ -- Defining a button using a custom function
+local example_flow_with_button =
+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: '..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(player,element,event)
+ player.print(player.name)
+end)
+ -- Drawing an element
+local exmple_button_element = example_button(parent)
+local example_flow_with_button = example_flow_with_button(parent)
@@ -275,840 +316,222 @@
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| expcore.gui.concepts.toolbar | -|
| utils.game | -|
| CenterFrames.get_flow(player) | -Gets the center flow for a player | -
| CenterFrames.clear_flow(player) | -Clears the center flow for a player | -
| CenterFrames.draw_frame(player, name) | -Draws the center frame for a player, if already open then will do nothing | -
| CenterFrames.redraw_frame(player, name) | -Draws the center frame for a player, if already open then will destroy it and redraw | -
| CenterFrames.toggle_frame(player, name[, state]) | -Toggles if the frame is currently open or not, will open if closed and close if open | -
| CenterFrames.new_frame(permission_name) | -Creates a new center frame define | -
| CenterFrames._prototype:set_auto_focus([state=true]) | -Sets the frame to be the current active gui when opened and closes all other frames | -
| CenterFrames._prototype:draw_frame(player) | -Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) | -
| CenterFrames._prototype:redraw_frame(player) | -Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame) | -
| CenterFrames._prototype:toggle_frame(player) | -Toggles if the frame is open, if open it will close it and if closed it will open it | -
| CenterFrames._prototype:event_handler([action=update]) | -Creates an event handler that will trigger one of its functions, use with Event.add | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| expcore.gui.concepts.toolbar | -|
| expcore.gui.elements.buttons | +utils.event |
| mod-gui |
| utils.game | +top_elements | +Contains the uids of the elements that will show on the top flow and the auth function | |
| utils.event | +left_elements | +Contains the uids of the elements that will show on the left flow and the open on join function | |
| LeftFrames.get_flow(player) | -Gets the left frame flow for a player | +defines | +Table of all the elements which have been registed with the draw function and event handlers |
| LeftFrames.get_frame(name, player) | -Gets one frame from the left flow by its name | +file_paths | +An index used for debuging to find the file where different elements where registered |
| LeftFrames.get_open(player) | -Gets all open frames for a player, if non are open it will remove the close all button | +_prototype_element | +The element prototype which is returned from Gui.element |
| LeftFrames.toggle_frame(name, player[, state]) | -Toggles the visibility of a left frame, or sets its visibility state | -||
| LeftFrames.new_frame(permission_name) | -Creates a new left frame define | -||
| LeftFrames._prototype:set_open_by_default([state=true]) | -Sets if the frame is visible when a player joins, can also be a function to return a boolean | -||
| LeftFrames._prototype:set_direction(direction) | -Sets the direction of the frame, either vertical or horizontal | -||
| LeftFrames._prototype:_internal_draw(player) | -Creates the gui for the first time, used internally | -||
| LeftFrames._prototype:get_frame(player) | -Gets the frame for this define from the left frame flow | -||
| LeftFrames._prototype:is_open(player) | -Returns if the player currently has this define visible | -||
| LeftFrames._prototype:toggle(player) | -Toggles the visibility of the left frame | -||
| LeftFrames._prototype:update(player) | -Updates the contents of the left frame, first tries update callback, other wise will clear and redraw | -||
| LeftFrames._prototype:update_all([update_offline=false]) | -Updates the frame for all players, see update | -||
| LeftFrames._prototype:redraw(player) | -Redraws the frame by calling on_draw, will always clear the frame | -||
| LeftFrames._prototype:redraw_all([update_offline=false]) | -Redraws the frame for all players, see redraw | -||
| LeftFrames._prototype:event_handler([action=update]) | -Creates an event handler that will trigger one of its functions, use with Event.add | +_mt_element | +The prototype metatable applied to new element defines |
| expcore.gui.core | -|||
| expcore.gui.prototype | -|||
| utils.game | -|||
| utils.event | -|||
| expcore.gui.elements.progress-bar | -|||
| expcore.gui.elements.buttons | -|||
| mod-gui | -|||
| resources.color_presets | -|||
| utils.global | -|||
| PopupFrames.get_flow(player) | -Gets the left flow that contains the popup frames | -||
| PopupFrames.open(define_name, player[, open_time], ...) | -Opens a popup for the player, can give the amount of time it is open as well as params for the draw function | -||
| PopupFrames.close_progress | -Progress bar which when depleted will close the popup frame | -||
| PopupFrames.close_button | -A button which can be used to close the gui before the timer runs out | -||
| PopupFrames.new_popup([name]) | -Creates a new popup frame define | -||
| PopupFrames._prototype:set_default_open_time(amount) | -Sets the default open time for the popup, will be used if non is provided with open | -||
| PopupFrames._prototype:open(player[, open_time], ...) | -Opens this define for a player, can be given open time and any other params for the draw function | +uid | +The current highest uid that is being used, will not increase during runtime |
| expcore.gui.core | +element(element_define) | +Base function used to define new elements, can be used with a table or with a function | |
| expcore.gui.elements.buttons | +Gui._prototype_element:style(style_define) | +Extension of Gui.element when using the table method, values applied after the element is drawn | |
| expcore.roles | +Gui._prototype_element:add_to_top_flow([authenticator]) | +Adds an element to be drawn to the top flow when a player joins | |
| utils.event | -|||
| utils.game | -|||
| mod-gui | -|||
| Toolbar.new_button([name]) | -Adds a new button to the toolbar | -||
| Toolbar.add_button(button) | -Adds an existing buttton to the toolbar | -||
| Toolbar.update(player) | -Updates the player's toolbar with an new buttons or expected change in auth return | +Gui._prototype_element:add_to_left_flow([open_on_join]) | +Adds an element to be drawn to the left flow when a player joins |
| utils.gui | +Gui._prototype_element.on_opened | +Called when the player opens a GUI. | |
| utils.game | +Gui._prototype_element.on_closed | +Called when the player closes the GUI they have open. | |
| new_define(prototype[, debug_name]) | -Used to create new element defines from a class prototype, please use the own given by the class | +Gui._prototype_element.on_click | +Called when LuaGuiElement is clicked. |
| get_define(name[, internal]) | -Gets an element define give the uid, debug name or a copy of the element define | +Gui._prototype_element.on_confirmed | +Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield. |
| categorize_by_player(element) | -A categorize function to be used with add_store, each player has their own value | +Gui._prototype_element.on_checked_changed | +Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons). |
| categorize_by_force(element) | -A categorize function to be used with add_store, each force has its own value | +Gui._prototype_element.on_elem_changed | +Called when LuaGuiElement element value is changed (related to choose element buttons). |
| categorize_by_surface(element) | -A categorize function to be used with add_store, each surface has its own value | +Gui._prototype_element.on_location_changed | +Called when LuaGuiElement element location is changed (related to frames in player.gui.screen). |
| draw(name, element) | -Draws a copy of the element define to the parent element, see draw_to | +Gui._prototype_element.on_tab_changed | +Called when LuaGuiElement selected tab is changed (related to tabbed-panes). |
| toggle_enabled(element) | -Will toggle the enabled state of an element | +Gui._prototype_element.on_selection_changed | +Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes). |
| toggle_visible(element) | -Will toggle the visiblity of an element | +Gui._prototype_element.on_switch_changed | +Called when LuaGuiElement switch state is changed (related to switches). |
| set_padding(element[, up=0][, down=0][, left=0][, right=0]) | -Sets the padding for a gui element | +Gui._prototype_element.on_text_change | +Called when LuaGuiElement text is changed by the player. |
| set_padding_style(style[, up=0][, down=0][, left=0][, right=0]) | -Sets the padding for a gui style | +Gui._prototype_element.on_value_changed | +Called when LuaGuiElement slider value is changed (related to the slider element). | +
| toggle_top_flow | +Button which toggles the top flow elements | ||
| create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center']) | -Allows the creation of an alignment flow to place elements into | +top_flow_button_style | +The style that should be used for buttons on the top flow | +
| get_top_flow(player) | +Gets the flow which contains the elements for the top flow | +||
| update_top_flow(player) | +Updates the visible states of all the elements on a players top flow | +||
| toggle_top_flow(player[, state]) | +Toggles the visible states of all the elements on a players top flow | +
| hide_left_flow | +Button which hides the elements in the left flow | +
| get_left_flow(player) | +Gets the flow which contains the elements for the left flow | +
| hide_left_flow(player) | +Hides all left elements for a player | +
| toggle_left_element(player, element_define[, state]) | +Toggles the visible state of all a left element for a player | +
| get_player_from_element(element) | +Get the player that owns a gui element | +||
| toggle_enabled_state(element[, state]) | +Will toggle the enabled state of an element or set it to the one given | +||
| toggle_visible_state(element[, state]) | +Will toggle the visible state of an element or set it to the one given | ||
| destroy_if_valid(element) | -Destroies an element but tests for it being present and valid first | +Destory a gui element without causing any errors, likly if the element may have already been removed | |
| create_scroll_table(element, table_size, maximal_height[, name='scroll']) | -Creates a scroll area with a table inside, table can be any size | +alignment(parent[, horizontal_align='right'][, vertical_align='center'][, name='alignment']) | +Draw a flow that has custom element alignments, default is right align |
| create_header(element, caption[, tooltip][, right_align][, name='header']) | -Creates a header section with a label and button area | +scroll_table(parent, height, column_count[, name='scroll']) | +Draw a scroll pane that has a table inside of it |
| mod-gui | -|
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| Button.new_button([name]) | -Creates a new button element define | -
| Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) | -Adds sprites to a button making it a sprite button | -
| Button._prototype:set_click_filter(filter[, ...]) | -Adds a click / mouse button filter to the button | -
| Button._prototype:set_key_filter(filter[, ...]) | -Adds a control key filter to the button | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| expcore.store | -|
| utils.game | -|
| Checkbox.new_checkbox([name]) | -Creates a new checkbox element define | -
| Checkbox.new_radiobutton([name]) | -Creates a new radiobutton element define, has all functions checkbox has | -
| Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) | -Adds this radiobutton to be an option in the given option set (only one can be true at a time) | -
| Checkbox._prototype_radiobutton:get_store(category, internal) | -Gets the stored value of the radiobutton or the option set if present | -
| Checkbox._prototype_radiobutton:set_store(category, value, internal) | -Sets the stored value of the radiobutton or the option set if present | -
| Checkbox.new_option_set(callback, categorize) | -Registers a new option set that can be linked to radiobuttons (only one can be true at a time) | -
| Checkbox.draw_option_set(name, element) | -Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) | -
| Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) | -Sets all radiobutton in a element to false (unless excluded) and can act recursively | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| utils.game | -|
| Dropdown.new_dropdown([name]) | -Creates a new dropdown element define | -
| Dropdown.new_list_box([name]) | -Creates a new list box element define | -
| Dropdown._prototype:new_static_options(options[, ...], the) | -Adds new static options to the dropdown which will trigger the general callback | -
| Dropdown._prototype:new_dynamic_options(callback) | -Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options) | -
| Dropdown._prototype:add_option_callback(option, callback) | -Adds a case specific callback which will only run when that option is selected (general case still triggered) | -
| Dropdown.select_value(element, value) | -Selects the option from a dropdown or list box given the value rather than key | -
| Dropdown.get_selected_value(element) | -Returns the currently selected value rather than index | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| utils.game | -|
| ElemButton.new_elem_button([name]) | -Creates a new elem button element define | -
| ElemButton._prototype.set_type | -Sets the type of the elem button, the type is required so this must be called at least once | -
| ElemButton._prototype:set_default(value) | -Sets the default value for the elem button, this may be a function or a string | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| utils.global | -|
| utils.game | -|
| ProgressBar.set_maximum(element, amount) | -Sets the maximum value that represents the end value of the progress bar | -
| ProgressBar.increment(element[, amount=1]) | -Increases the value of the progressbar, if a define is given all of its instances have incremented | -
| ProgressBar.decrement(element[, amount=1]) | -Decreases the value of the progressbar, if a define is given all of its instances have decremented | -
| ProgressBar.new_progressbar([name]) | -Creates a new progressbar element define | -
| ProgressBar._prototype:set_default_maximum(amount) | -Sets the maximum value that represents the end value of the progress bar | -
| ProgressBar._prototype:use_count_down([state=true]) | -Will set the progress bar to start at 1 and trigger when it hits 0 | -
| ProgressBar._prototype:increment([amount=1][, category]) | -Increases the value of the progressbar | -
| ProgressBar._prototype:increment_filtered([amount=1], filter) | -Increases the value of the progressbar, if the filter condition is met, does not work with store | -
| ProgressBar._prototype:decrement([amount=1][, category]) | -Decreases the value of the progressbar | -
| ProgressBar._prototype:decrement_filtered([amount=1], filter) | -Decreases the value of the progressbar, if the filter condition is met, does not work with store | -
| ProgressBar._prototype:add_element(element[, maximum]) | -Adds an element into the list of instances that will are waiting to complete, does not work with store - note use store if you want persistent data, this only stores the elements not the values which they have | -
| ProgressBar._prototype:reset_element(element) | -Resets an element, or its store, to be back at the start, either 1 or 0 | -
| ProgressBar._prototype:event_counter([filter]) | -Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented | -
| ProgressBar._prototype:event_countdown([filter]) | -Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| expcore.gui.instances | -|
| utils.game | -|
| Slider.new_slider([name]) | -Creates a new slider element define | -
| Slider._prototype:set_range([min][, max]) | -Sets the range of a slider, if not used will use default values for a slider | -
| Slider._prototype:draw_label(element) | -Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player | -
| Slider._prototype:enable_auto_draw_label([state=true]) | -Enables auto draw of the label, the label will share the same parent element as the slider | -
| expcore.gui.core | -|
| expcore.gui.prototype | -|
| utils.game | -|
| Text.new_text_field([name]) | -Creates a new text field element define | -
| Text.new_text_box([name]) | -Creates a new text box element define | -
| Text._prototype_box:set_selectable([state=true]) | -Sets the text box to be selectable | -
| Text._prototype_box:set_word_wrap([state=true]) | -Sets the text box to have word wrap | -
| Text._prototype_box:set_read_only([state=true]) | -Sets the text box to be read only | -
| utils.global | -|
| Instances.has_categories(name) | -Returns if a instance group has a serializer function; must be registered | -
| Instances.is_registered(name) | -Returns if the given name is a registered instance group | -
| Instances.register(name[, serializer]) | -Registers the name of an instance group to allow for storing element instances | -
| Instances.add_element(name, element) | -Adds an element to the instance group under the correct category; must be registered | -
| Instances.get_elements_raw(name[, category]) | -Gets all element instances without first removing any invalid ones; used internally and must be registered | -
| Instances.get_valid_elements(name[, category][, callback]) | -Gets all valid element instances and has the option of running a callback on those that are valid | -
| Instances.unregistered_add_element(name, category, element) | -A version of add_element that does not require the group to be registered | -
| Instances.unregistered_get_elements(name, category[, callback]) | -A version of get_elements that does not require the group to be registered | -
| utils.game | -|
| expcore.store | -|
| expcore.gui.instances | -|
| Constructor.event(event_name) | -Creates a new function to add functions to an event handler | -
| Constructor.extend(new_prototype) | -Extents a prototype with the base functions of all gui prototypes, no metatables | -
| Constructor.store(callback) | -Creates a new function which adds a store to a gui define | -
| Constructor.setter(value_type, key[, second_key]) | -Creates a setter function that checks the type when a value is set | -
| Prototype:uid() | -Gets the uid for the element define | -
| Prototype.debug_name | -Sets a debug alias for the define | -
| Prototype.set_caption | -Sets the caption for the element define | -
| Prototype.set_tooltip | -Sets the tooltip for the element define | -
| Prototype.set_pre_authenticator | -Sets an authenticator that blocks the draw function if check fails | -
| Prototype.set_post_authenticator | -Sets an authenticator that disables the element if check fails | -
| Prototype.on_draw | -Registers a callback to the on_draw event | -
| Prototype.on_style_update | -Registers a callback to the on_style_update event | -
| Prototype:set_style(style[, callback]) | -Sets the style for the element define | -
| Prototype:set_embedded_flow(state) | -Sets the element to be drawn inside a nameless flow, can be given a name using a function | -
| Prototype:raise_event(event_name, ...) | -Raises a custom event for this define, any number of params can be given | -
| Prototype:draw_to(element) | -The main function for defines, when called will draw an instance of this define to the given element - what is drawn is based on the data in draw_data which is set using other functions | -
| Prototype:get_store(category) | -Gets the value in this elements store, category needed if serializer function used | -
| Prototype:set_store(category, value) | -Sets the value in this elements store, category needed if serializer function used | -
| Prototype:clear_store([category]) | -Sets the value in this elements store to nil, category needed if serializer function used | -
| expcore.gui | -||
| expcore.common | -||
| resources.color_presets | -||
| utils.event | -||
| expcore.store | +header(parent, caption[, tooltip][, add_alignment=false][, name='header']) | +Used to add a header to a frame, this has the option for a custom right alignment flow for buttons |
Gets the center flow for a player
- - - - Parameters: - -Clears the center flow for a player
- - - - Parameters: - -Draws the center frame for a player, if already open then will do nothing
- - - - Parameters: - -Draws the center frame for a player, if already open then will destroy it and redraw
- - - - Parameters: - -Toggles if the frame is currently open or not, will open if closed and close if open
- - - - Parameters: - -Creates a new center frame define
- - - - Parameters: - -Sets the frame to be the current active gui when opened and closes all other frames
- - - - Parameters: - -Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
- - - - Parameters: - -Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
- - - - Parameters: - -Toggles if the frame is open, if open it will close it and if closed it will open it
- - - - Parameters: - -Creates an event handler that will trigger one of its functions, use with Event.add
- - - - Parameters: - -Contains the uids of the elements that will show on the top flow and the auth function
+ @@ -2376,13 +625,15 @@Contains the uids of the elements that will show on the left flow and the open on join function
+ @@ -2401,14 +652,196 @@Gets the left frame flow for a player
+Table of all the elements which have been registed with the draw function and event handlers
+ + + + + + + + + + + + + + + + +An index used for debuging to find the file where different elements where registered
+ + + + + + + + + + + + + + + + +The element prototype which is returned from Gui.element
+ + + + + + + + + + + + + + + + +The prototype metatable applied to new element defines
+ + + + Fields: + +The current highest uid that is being used, will not increase during runtime
+ + + + +Base function used to define new elements, can be used with a table or with a function
@@ -2422,143 +855,13 @@Gets one frame from the left flow by its name
- - - - Parameters: - -Gets all open frames for a player, if non are open it will remove the close all button
- - - - Parameters: - --- Defining an element with a table
+local example_button =
+Gui.element{
+ type = 'button',
+ caption = 'Example Button'
+}
+ -- Defining an element with a function
+local example_flow_with_button =
+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,
+ type = 'button',
+ 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)
Toggles the visibility of a left frame, or sets its visibility state
+Extension of Gui.element when using the table method, values applied after the element is drawn
@@ -2609,107 +945,98 @@-- Setting the height and width of the example button
+local example_button =
+Gui.element{
+ type = 'button',
+ caption = 'Example Button'
+}
+:style{
+ height = 25,
+ width = 100
+}
+ -- 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)
+
+
+
+ Adds an element to be drawn to the top flow when a player joins
+ + + + Parameters: + +Creates a new left frame define
- - - - Parameters: - --- Adding the example button
+example_button:add_to_top_flow(function(player)
+ -- example button will only show when game time is less than 1 minute
+ return player.online_time < 3600
+end)
Sets if the frame is visible when a player joins, can also be a function to return a boolean
+Adds an element to be drawn to the left flow when a player joins
@@ -2756,118 +1089,15 @@Sets the direction of the frame, either vertical or horizontal
- - - - Parameters: - -Creates the gui for the first time, used internally
- - - - Parameters: - -Gets the frame for this define from the left frame flow
- - - - Parameters: - -Returns if the player currently has this define visible
- - - - Parameters: - -Toggles the visibility of the left frame
- - - - Parameters: - -Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
- - - - Parameters: - -Updates the frame for all players, see update
- - - - Parameters: - -Redraws the frame by calling on_draw, will always clear the frame
- - - - Parameters: - -Redraws the frame for all players, see redraw
- - - - Parameters: - -Creates an event handler that will trigger one of its functions, use with Event.add
- - - - Parameters: - --- Adding the example button
+example_flow_with_button:add_to_left_flow(true)
- Gets the left flow that contains the popup frames
+Called when the player opens a GUI.
- Parameters:Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
+Called when the player closes the GUI they have open.
- Parameters:Progress bar which when depleted will close the popup frame
+Called when LuaGuiElement is clicked.
+ +A button which can be used to close the gui before the timer runs out
+Called when a LuaGuiElement is confirmed, for example by pressing Enter in a textfield.
+ +Creates a new popup frame define
+Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).
- Parameters:Sets the default open time for the popup, will be used if non is provided with open
+Called when LuaGuiElement element value is changed (related to choose element buttons).
- Parameters:Opens this define for a player, can be given open time and any other params for the draw function
+Called when LuaGuiElement element location is changed (related to frames in player.gui.screen).
- Parameters:Adds a new button to the toolbar
+Called when LuaGuiElement selected tab is changed (related to tabbed-panes).
- Parameters:Adds an existing buttton to the toolbar
- - - - Parameters: - -Updates the player's toolbar with an new buttons or expected change in auth return
+Called when LuaGuiElement selection state is changed (related to drop-downs and listboxes).
- Parameters:Called when LuaGuiElement switch state is changed (related to switches).
+ + + + +Called when LuaGuiElement text is changed by the player.
+ + + + +Called when LuaGuiElement slider value is changed (related to the slider element).
+ + + + +Button which toggles the top flow elements
+ @@ -4309,13 +1750,15 @@The style that should be used for buttons on the top flow
+ @@ -4334,14 +1777,74 @@Used to create new element defines from a class prototype, please use the own given by the class
+Gets the flow which contains the elements for the top flow
+(player)
+ + + Parameters: + +-- Geting your top element flow
+local top_flow = Gui.get_top_flow(game.player)
+
+
+
+ Updates the visible states of all the elements on a players top flow
@@ -4355,13 +1858,66 @@-- Update your flow
+Gui.update_top_flow(game.player)
+
+
+
+ Toggles the visible states of all the elements on a players top flow
+ + + + Parameters: + +-- Toggle your flow
+Gui.toggle_top_flow(game.player)
+ -- Open your top flow
+Gui.toggle_top_flow(game.player,true)
+
+
+
+
+ Button which hides the elements in the left flow
+ + + + + + + + + @@ -4408,14 +1999,74 @@Gets an element define give the uid, debug name or a copy of the element define
+Gets the flow which contains the elements for the left flow
+(player)
+ + + Parameters: + +-- Geting your left element flow
+local left_flow = Gui.get_left_flow(game.player)
+
+
+
+ Hides all left elements for a player
@@ -4429,13 +2080,66 @@-- Hide your left elements
+Gui.hide_left_flow(game.player)
+
+
+
+ Toggles the visible state of all a left element for a player
+ + + + Parameters: + +A categorize function to be used with add_store, each player has their own value
- - - - Parameters: - -A categorize function to be used with add_store, each force has its own value
- - - - Parameters: - -A categorize function to be used with add_store, each surface has its own value
- - - - Parameters: - -Draws a copy of the element define to the parent element, see draw_to
- - - - Parameters: - -Will toggle the enabled state of an element
- - - - Parameters: - --- Toggle your example button
+Gui.toggle_top_flow(game.player,example_flow_with_button)
+ -- Open your example button
+Gui.toggle_top_flow(game.player,example_flow_with_button,true)
+
+ Will toggle the visiblity of an element
+Get the player that owns a gui element
@@ -4810,7 +2237,7 @@ (LuaGuiElement) - the gui element to toggle + the element that you want to get the owner of @@ -4823,308 +2250,272 @@ Returns:-- Geting the owner of an element
+local player = Gui.get_player_from_element(element)
+
+
+
+ Will toggle the enabled state of an element or set it to the one given
+ + + + Parameters: + +Sets the padding for a gui element
- - - - Parameters: - -Sets the padding for a gui style
- - - - Parameters: - -Allows the creation of an alignment flow to place elements into
- - - - Parameters: - --- Toggling the the enabled state
+local new_enabled_state = Gui.toggle_enabled_state(element)
+
+
+
+ Will toggle the visible state of an element or set it to the one given
+ + + + Parameters: + +-- Toggling the the visible state
+local new_visible_state = Gui.toggle_visible_state(element)
+
+
+
+ Destory a gui element without causing any errors, likly if the element may have already been removed
+ + + + Parameters: + +-- Likely use case for element not existing
+Gui.destroy_if_valid(element[child_name])
+
+
+
+ Draw a flow that has custom element alignments, default is right align
+ + + + Parameters: + +-- Adding a right align flow
+local alignment = Gui.alignment(element,'example_right_alignment')
+ -- Adding a horizontal center and top align flow
+local alignment = Gui.alignment(element,'example_center_top_alignment','center','top')
Destroies an element but tests for it being present and valid first
+Draw a scroll pane that has a table inside of it
@@ -5205,70 +2618,13 @@Creates a scroll area with a table inside, table can be any size
- - - - Parameters: - --- 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)
Creates a header section with a label and button area
+Used to add a header to a frame, this has the option for a custom right alignment flow for buttons
@@ -5368,13 +2727,13 @@Creates a new button element define
- - - - Parameters: - -Adds sprites to a button making it a sprite button
- - - - Parameters: - -Adds a click / mouse button filter to the button
- - - - Parameters: - -Adds a control key filter to the button
- - - - Parameters: - -