From 6432326b1b779680cac28a0133dcfce5e5dd65a5 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 15:32:52 +0100 Subject: [PATCH 01/41] Minor bug fixes --- config/{file_loader.lua => _file_loader.lua} | 10 +- ..._starting_items.lua => advanced_start.lua} | 0 config/config.cfg | 3 - .../auth_admin.lua} | 0 .../auth_roles.lua} | 0 .../auth_runtime_disable.lua} | 0 .../parse_general.lua} | 0 .../parse_roles.lua} | 2 +- control.lua | 2 +- expcore/gui/left.lua | 2 +- expcore/locale/de.cfg | 9 -- expcore/locale/en.cfg | 32 ------- expcore/locale/nl.cfg | 9 -- expcore/locale/sv-SE.cfg | 9 -- locale/en/commands.cfg | 94 +++++++++++-------- locale/en/expcore.cfg | 4 +- ...-starting-items.lua => advanced-start.lua} | 2 +- modules/addons/random-player-colours.lua | 4 +- modules/commands/admin-chat.lua | 4 +- modules/commands/cheat-mode.lua | 2 +- modules/commands/clear-inventory.lua | 2 +- modules/commands/help.lua | 14 +-- modules/commands/jail.lua | 18 ++-- modules/commands/kill.lua | 6 +- modules/commands/repair.lua | 4 +- modules/commands/reports.lua | 24 ++--- modules/commands/roles.lua | 12 +-- modules/commands/spawn.lua | 6 +- modules/commands/tag.lua | 4 +- modules/commands/teleport.lua | 14 +-- modules/commands/warnings.lua | 12 +-- 31 files changed, 130 insertions(+), 174 deletions(-) rename config/{file_loader.lua => _file_loader.lua} (77%) rename config/{advanced_starting_items.lua => advanced_start.lua} (100%) delete mode 100644 config/config.cfg rename config/{command_auth_admin.lua => expcore-commands/auth_admin.lua} (100%) rename config/{command_auth_roles.lua => expcore-commands/auth_roles.lua} (100%) rename config/{command_auth_runtime_disable.lua => expcore-commands/auth_runtime_disable.lua} (100%) rename config/{command_parse_general.lua => expcore-commands/parse_general.lua} (100%) rename config/{command_parse_roles.lua => expcore-commands/parse_roles.lua} (97%) delete mode 100644 expcore/locale/de.cfg delete mode 100644 expcore/locale/en.cfg delete mode 100644 expcore/locale/nl.cfg delete mode 100644 expcore/locale/sv-SE.cfg rename modules/addons/{advanced-starting-items.lua => advanced-start.lua} (95%) diff --git a/config/file_loader.lua b/config/_file_loader.lua similarity index 77% rename from config/file_loader.lua rename to config/_file_loader.lua index 744c058c..0c1b476c 100644 --- a/config/file_loader.lua +++ b/config/_file_loader.lua @@ -26,7 +26,7 @@ return { 'modules.addons.chat-popups', 'modules.addons.damage-popups', 'modules.addons.death-logger', - 'modules.addons.advanced-starting-items', + 'modules.addons.advanced-start', 'modules.addons.spawn-area', 'modules.addons.compilatron', 'modules.addons.scorched-earth', @@ -35,10 +35,10 @@ return { -- GUI 'modules.commands.debug', -- Config Files - 'config.command_auth_admin', -- commands tagged with admin_only are blocked for non admins - 'config.command_auth_roles', -- commands must be allowed via the role config - 'config.command_auth_runtime_disable', -- allows commands to be enabled and disabled during runtime + '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' + 'expcore.gui.test' -- loads multiple gui defines to test the gui system } \ No newline at end of file diff --git a/config/advanced_starting_items.lua b/config/advanced_start.lua similarity index 100% rename from config/advanced_starting_items.lua rename to config/advanced_start.lua diff --git a/config/config.cfg b/config/config.cfg deleted file mode 100644 index b12b17cf..00000000 --- a/config/config.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[command-auth] -admin-only=This command is for (game) admins only! -command-disabled=This command has been disabled by management! \ No newline at end of file diff --git a/config/command_auth_admin.lua b/config/expcore-commands/auth_admin.lua similarity index 100% rename from config/command_auth_admin.lua rename to config/expcore-commands/auth_admin.lua diff --git a/config/command_auth_roles.lua b/config/expcore-commands/auth_roles.lua similarity index 100% rename from config/command_auth_roles.lua rename to config/expcore-commands/auth_roles.lua diff --git a/config/command_auth_runtime_disable.lua b/config/expcore-commands/auth_runtime_disable.lua similarity index 100% rename from config/command_auth_runtime_disable.lua rename to config/expcore-commands/auth_runtime_disable.lua diff --git a/config/command_parse_general.lua b/config/expcore-commands/parse_general.lua similarity index 100% rename from config/command_parse_general.lua rename to config/expcore-commands/parse_general.lua diff --git a/config/command_parse_roles.lua b/config/expcore-commands/parse_roles.lua similarity index 97% rename from config/command_parse_roles.lua rename to config/expcore-commands/parse_roles.lua index efdf2a00..3d468aaf 100644 --- a/config/command_parse_roles.lua +++ b/config/expcore-commands/parse_roles.lua @@ -2,7 +2,7 @@ local Commands = require 'expcore.commands' local Roles = require 'expcore.roles' local auto_complete = ext_require('expcore.common','auto_complete') -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' Commands.add_parse('role',function(input,player,reject) if not input then return end diff --git a/control.lua b/control.lua index 48a4fbbc..e4ed6c3f 100644 --- a/control.lua +++ b/control.lua @@ -26,7 +26,7 @@ ext_require = require('expcore.common').ext_require -- Please go to config/file_loader.lua to edit the files that are loaded log('[INFO] Getting file loader config') -local files = require 'config.file_loader' +local files = require 'config._file_loader' -- Loads all files from the config and logs that they are loaded local total_file_count = string.format('%3d',#files) diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index da7f37e4..fb62761c 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -239,7 +239,7 @@ end LeftFrames.toggle_button = Buttons.new_button() -:set_tooltip('Close Windows') +:set_tooltip{'expcore-gui.left-button-tooltip'} :set_caption('<') :on_click(function(player,element) for _,define in pairs(LeftFrames.frames) do diff --git a/expcore/locale/de.cfg b/expcore/locale/de.cfg deleted file mode 100644 index e872b325..00000000 --- a/expcore/locale/de.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Unbefugt: Zugang verweigert. Du hast keinen Zugriff auf diese Befehle! -reject-number-range=ungültige Reichweite, Min: __1__, Max: __2__ -reject-string-max-length=ungültige Länge, Max: __1__ -reject-player=ungültiger Spieler Name, __1__ , Versuche "Tab" zu benutzen, damit sich der Name automatisch vervollständigt. -reject-player-online=Der betroffene Spieler ist offline, Befehl konnte nicht ausgeführt werden. -reject-player-alive=Der betroffene Spieler ist Tod, Befehl konnte nicht ausgeführt werden. -invalid-inputs=ungültige Eingabe, /__1__ __2__ -command-ran=Befehl ausgeführt. \ No newline at end of file diff --git a/expcore/locale/en.cfg b/expcore/locale/en.cfg deleted file mode 100644 index 931ce162..00000000 --- a/expcore/locale/en.cfg +++ /dev/null @@ -1,32 +0,0 @@ -time-symbol-days-short=__1__d - -[expcore-commands] -unauthorized=Unauthorized, Access is denied due to invalid credentials -reject-string-options=Invalid Option, Must be one of: __1__ -reject-string-max-length=Invalid Length, Max: __1__ -reject-number=Invalid Number. -reject-number-range=Invalid Range, Min (inclusive): __1__, Max (inclusive): __2__ -reject-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name -reject-player-online=Player is offline. -reject-player-alive=Player is dead. -reject-force=Invaild Force Name. -reject-surface=Invaild Surface Name. -invalid-inputs=Invalid Input, /__1__ __2__ -invalid-param=Invalid Param "__1__"; __2__ -command-help=__1__ - __2__ -command-ran=Command Complete -command-fail=Command failed to run: __1__ -command-error-log-format=[ERROR] command/__1__ :: __2__ - -[expcore-roles] -error-log-format-flag=[ERROR] roleFlag/__1__ :: __2__ -error-log-format-promote=[ERROR] rolePromote/__1__ :: __2__ -game-message-assign=__1__ has been assigned to __2__ by __3__ -game-message-unassign=__1__ has been unassigned from __2__ by __3__ -reject-role=Invalid Role Name. -reject-player-role=Player has a higher role. - -[gui_util] -button_tooltip=Shows / hides the Toolbar Gui buttons. - -[expcore-gui] diff --git a/expcore/locale/nl.cfg b/expcore/locale/nl.cfg deleted file mode 100644 index 21e1ed58..00000000 --- a/expcore/locale/nl.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Onbevoegd: toegang wordt geweigerd vanwege ongeldige inloggegevens -reject-number-range=Onjuiste radius, Min: __1__, Max: __2__ -reject-string-max-length=Onjuiste lengte, Max: __1__ -reject-player=Onjuiste naam, __1__ , probeer tab te gebruiken om de naam automatisch in te vullen -reject-player-online=Speler is offline. -reject-player-alive=Speler is dood. -invalid-inputs=Onjuiste invoer, /__1__ __2__ -command-ran=Commando uitgevoerd. diff --git a/expcore/locale/sv-SE.cfg b/expcore/locale/sv-SE.cfg deleted file mode 100644 index 078b7f17..00000000 --- a/expcore/locale/sv-SE.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[expcore-commands] -unauthorized=401 - Otillåten: Tillgång nekas på grund av otillräcklig säkerhetsprövning. -reject-number-range=Invalid räckvid, Min: __1__, Max: __2__ -reject-string-max-length=ogiltig längd, Max: __1__ -reject-player=Ogiltigt spelarnamn, __1__ , försök använda tab-tangenten för att auto-slutföra namn. -reject-player-online=Spelare är offline. Kommando misslyckades med att köras. -reject-player-alive=Spelare är död. Kommando misslyckades med att köras. -invalid-inputs=Igiltig inmatning, /__1__ __2__ -command-ran=Kommandot slutfört diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index f987582c..12812c63 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -1,38 +1,56 @@ -[exp-commands] -kill-already-dead=You are already dead. -admin-chat-format=[Admin Chat] __1__: __2__ -tp-no-position-found=No position to teleport to was found, please try again later. -tp-to-self=Player can not be teleported to themselves. -chelp-title=Help results for "__1__": -chelp-footer=[__1__ results found; page __2__ of __3__] -chelp-format=/__1__ __2__ - __3__ __4__ -chelp-alias=Alias: __1__ -chelp-out-of-range=__1__ is an invalid page number. -roles-higher-role=The role you tried to assign is higher than your highest. -roles-list=All roles are: __1__ -roles-list-player=__1__ has: __2__ -roles-list-element=__1__, __2__ -jail-give=__1__ was jailed by __2__. Reason: __3__ -jail-remove=__1__ was unjailed by __2__. -jail-already-jailed=__1__ is already in jail. -jail-not-jailed=__1__ is not currently in jail. -jail-temp-ban=__1__ was temp banned until next reset by __2__. Reason: __3__ -jail-temp-ban-clear=__1__ was cleared from temp banned by __2__. -jail-not-temp-banned=__1__ is not currently temp banned. -jail-already-banned=__1__ is already banned. -report-player-immune=This player can not be reported. -report-non-admin=__1__ was reported for __2__. -report-admin=__1__ was reported by __2__ for __3__. -report-already-reported=You can only report a player once, you can ask a moderator to clear this report. -report-not-reported=The player had no reports on them. -report-player-count-title=The following players have reports against them: -report-player-report-title=__1__ has the following reports agasinst them: -report-list=__1__: __2__ -report-removed=__1__ has one or more reports removed by __2__. -warnings-received=__1__ recived a warning from __2__ for __3__. -warnings-player=__1__ has __2__ warnings and __3__/__4__ script warnings. -warnings-list-tilte=The following player have this many warnings (and this many script warnings): -warnings-list=__1__: __2__ (__3__/__4__) -warnings-cleared=__1__ had all they warnings cleared by __2__. -spawn-unavailable=They was a problem getting you to spawn, please try again later. -repair-result=__1__ entites were revived and __2__ were healed to max health. \ No newline at end of file +[expcom-kill] +already-dead=You are already dead. + +[expcom-admin-chat] +format=[Admin Chat] __1__: __2__ + +[expcom-tp] +no-position-found=No position to teleport to was found, please try again later. +to-self=Player can not be teleported to themselves. + +[expcom-chelp] +title=Help results for "__1__": +footer=[__1__ results found; page __2__ of __3__] +format=/__1__ __2__ - __3__ __4__ +alias=Alias: __1__ +out-of-range=__1__ is an invalid page number. + +[expcom-roles] +higher-role=The role you tried to assign is higher than your highest. +list=All roles are: __1__ +list-player=__1__ has: __2__ +list-element=__1__, __2__ + +[expcom-jail] +give=__1__ was jailed by __2__. Reason: __3__ +remove=__1__ was unjailed by __2__. +already-jailed=__1__ is already in jail. +not-jailed=__1__ is not currently in jail. +temp-ban=__1__ was temp banned until next reset by __2__. Reason: __3__ +temp-ban-clear=__1__ was cleared from temp banned by __2__. +not-temp-banned=__1__ is not currently temp banned. +already-banned=__1__ is already banned. + +[expcom-report] +player-immune=This player can not be reported. +non-admin=__1__ was reported for __2__. +admin=__1__ was reported by __2__ for __3__. +already-reported=You can only report a player once, you can ask a moderator to clear this report. +not-reported=The player had no reports on them. +player-count-title=The following players have reports against them: +player-report-title=__1__ has the following reports agasinst them: +list=__1__: __2__ +removed=__1__ has one or more reports removed by __2__. + +[expcom-warnings] +received=__1__ recived a warning from __2__ for __3__. +player=__1__ has __2__ warnings and __3__/__4__ script warnings. +list-tilte=The following player have this many warnings (and this many script warnings): +list=__1__: __2__ (__3__/__4__) +cleared=__1__ had all they warnings cleared by __2__. + +[expcom-spawn] +unavailable=They was a problem getting you to spawn, please try again later. + +[expcom-repair] +result=__1__ entites were revived and __2__ were healed to max health. \ No newline at end of file diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index 931ce162..58830616 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -1,4 +1,5 @@ time-symbol-days-short=__1__d +color-tag=[color=__1__]__2__[/color] [expcore-commands] unauthorized=Unauthorized, Access is denied due to invalid credentials @@ -27,6 +28,7 @@ reject-role=Invalid Role Name. reject-player-role=Player has a higher role. [gui_util] -button_tooltip=Shows / hides the Toolbar Gui buttons. +button_tooltip=Shows/hides the toolbar. [expcore-gui] +left-button-tooltip=Hide all open windows. \ No newline at end of file diff --git a/modules/addons/advanced-starting-items.lua b/modules/addons/advanced-start.lua similarity index 95% rename from modules/addons/advanced-starting-items.lua rename to modules/addons/advanced-start.lua index f402e5dc..07ed9ddc 100644 --- a/modules/addons/advanced-starting-items.lua +++ b/modules/addons/advanced-start.lua @@ -1,7 +1,7 @@ --- Adds a better method of player starting items based on production levels. local Event = require 'utils.event' local Game = require 'utils.game' -local config = require 'config.advanced_starting_items' +local config = require 'config.advanced_start' local items = config.items Event.add(defines.events.on_player_created, function(event) diff --git a/modules/addons/random-player-colours.lua b/modules/addons/random-player-colours.lua index 0e347997..9c47f8be 100644 --- a/modules/addons/random-player-colours.lua +++ b/modules/addons/random-player-colours.lua @@ -9,15 +9,13 @@ Global.register(config,function(tbl) config = tbl end) -local white = Colours.white -local black = Colours.black Event.add(defines.events.on_player_created,function(event) local player = Game.get_player_by_index(event.player_index) local color = 'white' if config.players[player.name] then color = config.players[player.name] else - while not config.disallow[color] do + while config.disallow[color] do color = table.get_random_dictionary_entry(Colours,true) end color = Colours[color] diff --git a/modules/commands/admin-chat.lua b/modules/commands/admin-chat.lua index e9f32b50..f3038941 100644 --- a/modules/commands/admin-chat.lua +++ b/modules/commands/admin-chat.lua @@ -1,6 +1,6 @@ local Commands = require 'expcore.commands' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' Commands.new_command('admin-chat','Sends a message in chat that only admins can see.') :add_param('message',false) -- the message to send in the admin chat @@ -11,7 +11,7 @@ Commands.new_command('admin-chat','Sends a message in chat that only admins can local player_name_colour = format_chat_player_name(player) for _,return_player in pairs(game.connected_players) do if return_player.admin then - return_player.print{'exp-commands.admin-chat-format',player_name_colour,message} + return_player.print{'expcom-admin-chat.format',player_name_colour,message} end end return Commands.success -- prevents command complete message from showing diff --git a/modules/commands/cheat-mode.lua b/modules/commands/cheat-mode.lua index 6aef5fca..ab40cb30 100644 --- a/modules/commands/cheat-mode.lua +++ b/modules/commands/cheat-mode.lua @@ -1,5 +1,5 @@ local Commands = require 'expcore.commands' -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.') :add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self diff --git a/modules/commands/clear-inventory.lua b/modules/commands/clear-inventory.lua index 0b8a8d26..b33c3029 100644 --- a/modules/commands/clear-inventory.lua +++ b/modules/commands/clear-inventory.lua @@ -1,6 +1,6 @@ local Commands = require 'expcore.commands' local move_items = ext_require('expcore.common','move_items') -require 'config.command_parse_roles' +require 'config.expcore-commands.parse_roles' Commands.new_command('clear-inventory','Clears a players inventory') :add_param('player',false,'player-role-alive') diff --git a/modules/commands/help.lua b/modules/commands/help.lua index 419a23ac..11d2c647 100644 --- a/modules/commands/help.lua +++ b/modules/commands/help.lua @@ -1,6 +1,6 @@ local Commands = require 'expcore.commands' local Global = require 'utils.global' -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' local results_per_page = 5 @@ -42,9 +42,9 @@ Commands.new_command('chelp','Searches for a keyword in all commands you are all -- adds the new command to the page page_count = page_count + 1 found = found + 1 - local alias_format = #command_data.aliases > 0 and {'exp-commands.chelp-alias',table.concat(command_data.aliases,', ')} or '' + local alias_format = #command_data.aliases > 0 and {'expcom-chelp.alias',table.concat(command_data.aliases,', ')} or '' table.insert(pages[current_page],{ - 'exp-commands.chelp-format', + 'expcom-chelp.format', command_data.name, command_data.description, command_data.help, @@ -60,15 +60,15 @@ Commands.new_command('chelp','Searches for a keyword in all commands you are all end -- print the requested page keyword = keyword == '' and '' or keyword - Commands.print({'exp-commands.chelp-title',keyword},'cyan') + Commands.print({'expcom-chelp.title',keyword},'cyan') if pages[page] then for _,command in pairs(pages[page]) do Commands.print(command) end - Commands.print({'exp-commands.chelp-footer',found,page,#pages},'cyan') + Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan') else - Commands.print({'exp-commands.chelp-footer',found,page,#pages},'cyan') - return Commands.error{'exp-commands.chelp-out-of-range',page} + Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan') + return Commands.error{'expcom-chelp.out-of-range',page} end -- blocks command complete message return Commands.success diff --git a/modules/commands/jail.lua b/modules/commands/jail.lua index 6a30789f..a5d7ae37 100644 --- a/modules/commands/jail.lua +++ b/modules/commands/jail.lua @@ -1,7 +1,7 @@ local Commands = require 'expcore.commands' local JailControl = require 'modules.addons.jail-control' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') -require 'config.command_parse_roles' +require 'config.expcore-commands.parse_roles' Commands.new_command('jail','Puts a player into jail and removes all other roles.') :add_param('player',false,'player-role') @@ -12,9 +12,9 @@ Commands.new_command('jail','Puts a player into jail and removes all other roles local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if JailControl.jail_player(action_player,player.name) then - game.print{'exp-commands.jail-give',action_player_name_color,by_player_name_color,reason} + game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} else - return Commands.error{'exp-commands.jail-already-jailed',action_player_name_color} + return Commands.error{'expcom-jail.already-jailed',action_player_name_color} end end) @@ -26,9 +26,9 @@ Commands.new_command('unjail','Puts a player into jail and removes all other rol local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if JailControl.unjail_player(action_player,player.name) then - game.print{'exp-commands.jail-remove',action_player_name_color,by_player_name_color} + game.print{'expcom-jail.remove',action_player_name_color,by_player_name_color} else - return Commands.error{'exp-commands.jail-not-jailed',action_player_name_color} + return Commands.error{'expcom-jail.not-jailed',action_player_name_color} end end) @@ -40,9 +40,9 @@ Commands.new_command('temp-ban','Temp bans a player until the next reset; this r local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if JailControl.temp_ban_player(action_player,player.name,reason) then - game.print{'exp-commands.jail-temp-ban',action_player_name_color,by_player_name_color,reason} + game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} else - return Commands.error{'exp-commands.jail-already-banned',action_player_name_color} + return Commands.error{'expcom-jail.already-banned',action_player_name_color} end end) @@ -54,8 +54,8 @@ Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if JailControl.clear_temp_ban_player(action_player,player.name) then - game.print{'exp-commands.jail-temp-ban-clear',action_player_name_color,by_player_name_color} + game.print{'expcom-jail.temp-ban-clear',action_player_name_color,by_player_name_color} else - return Commands.error{'exp-commands.jail-not-temp-banned',action_player_name_color} + return Commands.error{'expcom-jail.not-temp-banned',action_player_name_color} end end) \ No newline at end of file diff --git a/modules/commands/kill.lua b/modules/commands/kill.lua index 0c36e327..e0076165 100644 --- a/modules/commands/kill.lua +++ b/modules/commands/kill.lua @@ -1,7 +1,7 @@ local Commands = require 'expcore.commands' local Roles = require 'expcore.roles' -require 'config.command_parse_general' -require 'config.command_parse_roles' +require 'config.expcore-commands.parse_general' +require 'config.expcore-commands.parse_roles' Commands.new_command('kill','Kills yourself or another player.') :add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid @@ -14,7 +14,7 @@ end} :register(function(player,action_player,raw) if not action_player then -- can only be nil if no player given and the user is dead - return Commands.error{'exp-commands.kill-already-dead'} + return Commands.error{'expcom-kill.already-dead'} end if player == action_player then action_player.character.die() diff --git a/modules/commands/repair.lua b/modules/commands/repair.lua index 660ec6eb..e1644fb8 100644 --- a/modules/commands/repair.lua +++ b/modules/commands/repair.lua @@ -1,6 +1,6 @@ local Commands = require 'expcore.commands' local config = require 'config.repair' -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' local max_time_to_live = 4294967295 -- unit32 max Commands.new_command('repair','Repairs entities on your force around you') @@ -40,5 +40,5 @@ Commands.new_command('repair','Repairs entities on your force around you') end end end - return Commands.success{'exp-commands.repair-result',revive_count,heal_count} + return Commands.success{'expcom-repair.result',revive_count,heal_count} end) \ No newline at end of file diff --git a/modules/commands/reports.lua b/modules/commands/reports.lua index 3c57f533..98fec56d 100644 --- a/modules/commands/reports.lua +++ b/modules/commands/reports.lua @@ -2,14 +2,14 @@ local Roles = require 'expcore.roles' local Commands = require 'expcore.commands' local ReportsControl = require 'modules.addons.reports-control' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' Commands.new_command('report','Reports a player and notifies moderators') :add_param('player',false,function(input,player,reject) input = Commands.parse('player',input,player,reject) if not input then return end if Roles.player_has_flag(input,'report-immune') then - return reject{'exp-commands.report-player-immune'} + return reject{'expcom-report.player-immune'} else return input end @@ -21,10 +21,10 @@ end) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if ReportsControl.report_player(action_player,reason,player.name) then - game.print{'exp-commands.report-non-admin',action_player_name_color,reason} - Roles.print_to_roles_higher('Trainee',{'exp-commands.report-admin',action_player_name_color,by_player_name_color,reason}) + game.print{'expcom-report.non-admin',action_player_name_color,reason} + Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) else - return Commands.error{'exp-commands.report-already-reported'} + return Commands.error{'expcom-report.already-reported'} end end) @@ -35,18 +35,18 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has if action_player then local reports = ReportsControl.get_player_reports(action_player) local action_player_name_color = format_chat_player_name(action_player) - Commands.print{'exp-commands.report-player-report-title',action_player_name_color} + Commands.print{'expcom-report.player-report-title',action_player_name_color} for player_name,reason in pairs(reports) do local by_player_name_color = format_chat_player_name(player_name) - Commands.print{'exp-commands.report-list',by_player_name_color,reason} + Commands.print{'expcom-report.list',by_player_name_color,reason} end else local user_reports = ReportsControl.user_reports - Commands.print{'exp-commands.report-player-count-title'} + Commands.print{'expcom-report.player-count-title'} for player_name,reports in pairs(user_reports) do local player_name_color = format_chat_player_name(player_name) local report_count = ReportsControl.count_player_reports(player_name) - Commands.print{'exp-commands.report-list',player_name_color,report_count} + Commands.print{'expcom-report.list',player_name_color,report_count} end end end) @@ -57,14 +57,14 @@ Commands.new_command('clear-reports','Clears all reports from a player or just t :register(function(player,action_player,from_player,raw) if from_player then if not ReportsControl.remove_player_report(action_player,from_player.name) then - return Commands.error{'exp-commands.report-not-reported'} + return Commands.error{'expcom-report.not-reported'} end else if not ReportsControl.clear_player_reports(action_player) then - return Commands.error{'exp-commands.report-not-reported'} + return Commands.error{'expcom-report.not-reported'} end end local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'exp-commands.report-removed',action_player_name_color,by_player_name_color} + game.print{'expcom-report.removed',action_player_name_color,by_player_name_color} end) \ No newline at end of file diff --git a/modules/commands/roles.lua b/modules/commands/roles.lua index c8b54f57..d9d3b6d4 100644 --- a/modules/commands/roles.lua +++ b/modules/commands/roles.lua @@ -16,7 +16,7 @@ Commands.new_command('assign-role','Assigns a role to a player') if player_highest.index < role.index then Roles.assign_player(action_player,role,player.name) else - return Commands.error{'exp-commands.roles-higher-role'} + return Commands.error{'expcom-roles.higher-role'} end end) @@ -30,7 +30,7 @@ Commands.new_command('unassign-role','Unassigns a role from a player') if player_highest.index < role.index then Roles.unassign_player(action_player,role,player.name) else - return Commands.error{'exp-commands.roles-higher-role'} + return Commands.error{'expcom-roles.higher-role'} end end) @@ -39,7 +39,7 @@ Commands.new_command('list-roles','Lists all roles in they correct order') :add_alias('lsroles','roles') :register(function(player,action_player,raw) local roles = Roles.config.order - local message = {'exp-commands.roles-list'} + local message = {'expcom-roles.list'} if action_player then roles = Roles.get_player_roles(action_player) end @@ -48,13 +48,13 @@ Commands.new_command('list-roles','Lists all roles in they correct order') local colour = role.custom_color or Colours.white local role_name = format_chat_colour_localized(role.name,colour) if index == 1 then - message = {'exp-commands.roles-list',role_name} + message = {'expcom-roles.list',role_name} if action_player then local player_name_colour = format_chat_player_name(action_player) - message = {'exp-commands.roles-list-player',player_name_colour,role_name} + message = {'expcom-roles.list-player',player_name_colour,role_name} end else - message = {'exp-commands.roles-list-element',message,role_name} + message = {'expcom-roles.list-element',message,role_name} end end return Commands.success(message) diff --git a/modules/commands/spawn.lua b/modules/commands/spawn.lua index 9e27bfbf..cc1fe512 100644 --- a/modules/commands/spawn.lua +++ b/modules/commands/spawn.lua @@ -23,14 +23,14 @@ Commands.new_command('go-to-spawn','Teleport to spawn') :add_alias('spawn','tp-spawn') :register(function(player,action_player) if not action_player then - return Commands.error{'exp-commands.spawn-unavailable'} + return Commands.error{'expcom-spawn.unavailable'} elseif action_player == player then if not teleport(player) then - return Commands.error{'exp-commands.spawn-unavailable'} + return Commands.error{'expcom-spawn.unavailable'} end elseif Roles.player_allowed(player,'command/go-to-spawn/always') then if not teleport(action_player) then - return Commands.error{'exp-commands.spawn-unavailable'} + return Commands.error{'expcom-spawn.unavailable'} end else return Commands.error{'expcore-commands.unauthorized'} diff --git a/modules/commands/tag.lua b/modules/commands/tag.lua index 18c1f0e5..0c5e5cf4 100644 --- a/modules/commands/tag.lua +++ b/modules/commands/tag.lua @@ -1,7 +1,7 @@ local Commands = require 'expcore.commands' local Roles = require 'expcore.roles' -require 'config.command_parse_general' -require 'config.command_parse_roles' +require 'config.expcore-commands.parse_general' +require 'config.expcore-commands.parse_roles' Commands.new_command('tag','Sets your player tag.') :add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char diff --git a/modules/commands/teleport.lua b/modules/commands/teleport.lua index e1fdd893..0f456c9e 100644 --- a/modules/commands/teleport.lua +++ b/modules/commands/teleport.lua @@ -1,5 +1,5 @@ local Commands = require 'expcore.commands' -require 'config.command_parse_general' +require 'config.expcore-commands.parse_general' local function teleport(from_player,to_player) local surface = to_player.surface @@ -18,11 +18,11 @@ Commands.new_command('teleport','Teleports a player to another player.') :register(function(player,from_player,to_player,raw) if from_player.index == to_player.index then -- return if attempting to teleport to self - return Commands.error{'exp-commands.tp-to-self'} + return Commands.error{'expcom-tp.to-self'} end if not teleport(from_player,to_player) then -- return if the teleport failed - return Commands.error{'exp-commands.tp-no-position-found'} + return Commands.error{'expcom-tp.no-position-found'} end end) @@ -32,11 +32,11 @@ Commands.new_command('bring','Teleports a player to you.') :register(function(player,from_player,raw) if from_player.index == player.index then -- return if attempting to teleport to self - return Commands.error{'exp-commands.tp-to-self'} + return Commands.error{'expcom-tp.to-self'} end if not teleport(from_player,player) then -- return if the teleport failed - return Commands.error{'exp-commands.tp-no-position-found'} + return Commands.error{'expcom-tp.no-position-found'} end end) @@ -47,10 +47,10 @@ Commands.new_command('goto','Teleports you to a player.') :register(function(player,to_player,raw) if to_player.index == player.index then -- return if attempting to teleport to self - return Commands.error{'exp-commands.tp-to-self'} + return Commands.error{'expcom-tp.to-self'} end if not teleport(player,to_player) then -- return if the teleport failed - return Commands.error{'exp-commands.tp-no-position-found'} + return Commands.error{'expcom-tp.no-position-found'} end end) \ No newline at end of file diff --git a/modules/commands/warnings.lua b/modules/commands/warnings.lua index ae3c9692..1a86e4bd 100644 --- a/modules/commands/warnings.lua +++ b/modules/commands/warnings.lua @@ -2,7 +2,7 @@ local Commands = require 'expcore.commands' local WarningsControl = require 'modules.addons.warnings-control' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') local config = require 'config.warnings' -require 'config.command_parse_roles' +require 'config.expcore-commands.parse_roles' Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.') :add_param('player',false,'player-role') @@ -13,7 +13,7 @@ Commands.new_command('give-warning','Gives a warning to a player; may lead to au WarningsControl.add_warnings(action_player,player.name) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'exp-commands.warnings-received',action_player_name_color,by_player_name_color,reason} + game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} end) Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.') @@ -24,7 +24,7 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I local warnings = WarningsControl.get_warnings(action_player) local script_warnings = WarningsControl.get_temp_warnings(action_player) local action_player_name_color = format_chat_player_name(action_player) - Commands.print{'exp-commands.warnings-player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit} + Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit} else local rtn = {} local user_warnings = WarningsControl.user_warnings @@ -38,10 +38,10 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I end rtn[player_name][2] = #warnings end - Commands.print{'exp-commands.warnings-list-tilte'} + Commands.print{'expcom-warnings.list-tilte'} for player_name,warnings in pairs(rtn) do local player_name_color = format_chat_player_name(player_name) - Commands.print{'exp-commands.warnings-list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit} + Commands.print{'expcom-warnings.list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit} end end end) @@ -53,5 +53,5 @@ Commands.new_command('clear-warnings','Clears all warnings (and script warnings) WarningsControl.clear_temp_warnings(action_player,player.name) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'exp-commands.warnings-cleared',action_player_name_color,by_player_name_color} + game.print{'expcom-warnings.cleared',action_player_name_color,by_player_name_color} end) \ No newline at end of file From aefdb80dee8d23bc3e902fb3fbd4d439adc15d77 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 19:24:27 +0100 Subject: [PATCH 02/41] Added Player List --- config/_file_loader.lua | 1 + config/action_buttons.lua | 42 +++++++ config/roles.lua | 1 + expcore/gui.lua | 4 + expcore/gui/core.lua | 52 ++++++++ expcore/gui/left.lua | 13 +- locale/en/expcore.cfg | 4 + modules/gui/player-list.lua | 242 ++++++++++++++++++++++++++++++++++++ 8 files changed, 357 insertions(+), 2 deletions(-) create mode 100644 config/action_buttons.lua create mode 100644 modules/gui/player-list.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 0c1b476c..24c135c7 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -33,6 +33,7 @@ return { 'modules.addons.pollution-grading', 'modules.addons.random-player-colours', -- GUI + 'modules.gui.player-list', 'modules.commands.debug', -- Config Files 'config.expcore-commands.auth_admin', -- commands tagged with admin_only are blocked for non admins diff --git a/config/action_buttons.lua b/config/action_buttons.lua new file mode 100644 index 00000000..402d6481 --- /dev/null +++ b/config/action_buttons.lua @@ -0,0 +1,42 @@ +local Gui = require 'expcore.gui' +local Roles = require 'expcore.roles' +local Store = require 'expcore.store' +local Game = require 'utils.game' + +local action_player_store = 'gui.left.player-list.action-player' + +local function tool_button_style(style) + Gui.set_padding_style(style,-1,-1,-1,-1) + style.height = 28 + style.width = 28 +end + +local function auth_lower_role(player,action_player) + local player_highest = Roles.get_player_highest_role(player) + local action_player_highest = Roles.get_player_highest_role(action_player) + if player_highest.index < action_player_highest.index then + return true + end +end + +local function get_action_player(player) + local action_player_name = Store.get_child(action_player_store,player.name) + local action_player = Game.get_player_from_any(action_player_name) + return action_player +end + +local report_player = +Gui.new_button() +:set_sprites('utility/warning') +:set_tooltip('Report player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) +end) + +return { + ['command/report'] = { + auth=auth_lower_role, + report_player + } +} \ No newline at end of file diff --git a/config/roles.lua b/config/roles.lua index b1863ea7..6ea8ddc9 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -181,6 +181,7 @@ local default = Roles.new_role('Guest','') 'command/chelp', 'command/list-roles', 'command/report', + 'gui/player-list', } --- Jail role diff --git a/expcore/gui.lua b/expcore/gui.lua index 5831acf8..70f0ffc3 100644 --- a/expcore/gui.lua +++ b/expcore/gui.lua @@ -13,6 +13,8 @@ local Gui = require 'expcore.gui.core' Gui._prototype:debug_name(name) --- Sets a debug alias for the define Gui._prototype:set_caption(caption) --- Sets the caption for the element define Gui._prototype:set_tooltip(tooltip) --- Sets the tooltip for the element define + Gui._prototype:set_style(style,callback) --- Sets the style for the element define + Gui._prototype:set_embeded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function Gui._prototype:on_element_update(callback) --- Add a hander to run on the general value update event, different classes will handle this event differently Gui._prototype:set_pre_authenticator(callback) --- Sets an authenticator that blocks the draw function if check fails @@ -34,6 +36,7 @@ local Gui = require 'expcore.gui.core' Gui.toggle_enable(element) --- Will toggle the enabled state of an element Gui.toggle_visible(element) --- Will toggle the visiblity of an element + Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element ]] local Instances = require 'expcore.gui.instances' @@ -195,6 +198,7 @@ Gui.classes.left_frames = LeftFrames LeftFrames.new_frame(permision_name) --- Creates a new left frame define LeftFrames._prototype:set_open_by_default(state) --- 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: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 visiblty of the left frame diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 07d7e8f7..8eb407cf 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -128,6 +128,8 @@ Gui._prototype:debug_name(name) --- Sets a debug alias for the define Gui._prototype:set_caption(caption) --- Sets the caption for the element define Gui._prototype:set_tooltip(tooltip) --- Sets the tooltip for the element define + Gui._prototype:set_style(style,callback) --- Sets the style for the element define + Gui._prototype:set_embeded_flow(state) --- Sets the element to be drawn inside a nameless flow, can be given a name using a function Gui._prototype:on_element_update(callback) --- Add a hander to run on the general value update event, different classes will handle this event differently Gui._prototype:set_pre_authenticator(callback) --- Sets an authenticator that blocks the draw function if check fails @@ -149,6 +151,8 @@ Gui.toggle_enable(element) --- Will toggle the enabled state of an element Gui.toggle_visible(element) --- Will toggle the visiblity of an element + Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element + Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style ]] local Gui = require 'utils.gui' local Game = require 'utils.game' @@ -316,6 +320,28 @@ function Gui._prototype:set_tooltip(tooltip) return self end +--- Sets the style for the element define +-- @tparam style string the style that will be used for this element when drawn +-- @tapram[opt] callback function function is called when element is drawn to alter its style +-- @treturn self the element define to allow chaining +function Gui._prototype:set_style(style,callback) + self.draw_data.style = style + self.events.on_style = callback + return self +end + +--- Sets the element to be drawn inside a nameless flow, can be given a name using a function +-- @tparam state ?boolean|function when true a padless flow is created to contain the element +-- @treturn self the element define to allow chaining +function Gui._prototype:set_embeded_flow(state) + if state == false or type(state) == 'function' then + self.embeded_flow = state + else + self.embeded_flow = true + end + return self +end + --- Sets an authenticator that blocks the draw function if check fails -- @tparam callback function the function that will be ran to test if the element should be drawn or not -- callback param - player LuaPlayer - the player that the element is being drawn to @@ -358,8 +384,21 @@ function Gui._prototype:draw_to(element,...) if not self.pre_authenticator(player,self.name) then return end end + if self.embeded_flow then + local embeded_name + if type(self.embeded_flow) == 'function' then + embeded_name = self.embeded_flow(element,...) + end + element = element.add{type='flow',name=embeded_name} + Gui.set_padding(element) + end + local new_element = element.add(self.draw_data) + if self.events.on_style then + self.events.on_style(new_element.style) + end + if self.post_authenticator then new_element.enabled = self.post_authenticator(player,self.name) end @@ -510,4 +549,17 @@ function Gui.set_padding(element,up,down,left,right) style.right_padding = right or 0 end +--- Sets the padding for a gui style +-- @tparam element LuaStyle the element to set the padding for +-- @tparam[opt=0] up number the amount of padding on the top +-- @tparam[opt=0] down number the amount of padding on the bottom +-- @tparam[opt=0] left number the amount of padding on the left +-- @tparam[opt=0] right number the amount of padding on the right +function Gui.set_padding_style(style,up,down,left,right) + style.top_padding = up or 0 + style.bottom_padding = down or 0 + style.left_padding = left or 0 + style.right_padding = right or 0 +end + return Gui \ No newline at end of file diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index fb62761c..63efb267 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -33,6 +33,7 @@ LeftFrames.new_frame(permision_name) --- Creates a new left frame define LeftFrames._prototype:set_open_by_default(state) --- 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: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 visiblty of the left frame @@ -159,6 +160,13 @@ function LeftFrames._prototype:set_open_by_default(state) return self end +--- Sets the direction of the frame, either vertical or horizontal +-- @tparam direction string the direction to have the elements be added to thef frame +function LeftFrames._prototype:set_direction(direction) + self.direction = direction + return self +end + --- Gets the frame for this define from the left frame flow -- @tparam player LuaPlayer the player to get the frame of -- @treturn LuaGuiElement the frame in the left frame flow for this define @@ -212,7 +220,7 @@ end -- @tparam player LuaPlayer the player to update the frame of function LeftFrames._prototype:redraw(player) local frame = self:get_frame(player) - frame.claer() + frame.clear() if self.events.on_draw then self.events.on_draw(player,frame) end @@ -263,7 +271,8 @@ Event.add(defines.events.on_player_created,function(event) for _,define in pairs(LeftFrames.frames) do local frame = flow.add{ type='frame', - name=define.name + name=define.name, + direction=define.direction } if define.events.on_draw then diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index 58830616..ddde52d4 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -1,6 +1,10 @@ time-symbol-days-short=__1__d color-tag=[color=__1__]__2__[/color] +[time-format] +simple-format-tagged=__1__ __2__ +simple-format-div=__1__:__2__ + [expcore-commands] unauthorized=Unauthorized, Access is denied due to invalid credentials reject-string-options=Invalid Option, Must be one of: __1__ diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua new file mode 100644 index 00000000..a434f1eb --- /dev/null +++ b/modules/gui/player-list.lua @@ -0,0 +1,242 @@ +--- Gui left frame define for a player list +local Gui = require 'expcore.gui' +local Roles = require 'expcore.roles' +local Store = require 'expcore.store' +local Game = require 'utils.game' +local Event = require 'utils.event' +local format_time = ext_require('expcore.common','format_time') +local config = require 'config.action_buttons' +local Colors = require 'resources.color_presets' + +local action_player_store = 'gui.left.player-list.action-player' + +--- Button used to open the action bar +local open_action_bar = +Gui.new_button() +:set_sprites('utility/expand_dots_white') +:set_tooltip('Options') +:set_embeded_flow(function(element,action_player_name) + return action_player_name +end) +:set_style('frame_button',function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + style.width = 8 + style.height = 14 +end) +:on_click(function(player,element) + Store.set_child(action_player_store,player.name,element.parent.name) +end) + +--- Button used to close the action bar +local close_action_bar = +Gui.new_button() +:set_sprites('utility/close_black') +:set_tooltip('Close options') +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-1,-1,-1,-1) + style.height = 28 + style.width = 28 +end) +:on_click(function(player,element) + Store.set_child(action_player_store,player.name,nil) +end) + +--[[ Creates the main gui areas for the player list + element + > container + >> scroll + >>> table + >> action_bar +]] +local function generate_container(element) + Gui.set_padding(element,2,2,2,2) + element.style.minimal_width = 200 + + -- main container which contains the other elements + local container = + element.add{ + name='container', + type='frame', + direction='vertical', + style='window_content_frame_packed' + } + Gui.set_padding(container) + + -- a scroll bar which allows 8 players to be seen at once + local list_scroll = + container.add{ + name='scroll', + type='scroll-pane', + direction='vertical', + horizontal_scroll_policy='never', + vertical_scroll_policy='auto-and-reserve-space' + } + Gui.set_padding(list_scroll,1,1,2,2) + list_scroll.style.horizontally_stretchable = true + list_scroll.style.maximal_height = 200 + + -- 3 wide table to contain: action button, player name, and play time + local list_table = + list_scroll.add{ + name='table', + type='table', + column_count=3 + } + Gui.set_padding(list_table) + list_table.style.horizontally_stretchable = true + list_table.style.vertical_align = 'center' + list_table.style.cell_padding = 0 + + -- action bar which contains the different action buttons + local action_bar = + container.add{ + name='action_bar', + type='frame', + style='subfooter_frame' + } + Gui.set_padding(action_bar,1,1,3,3) + action_bar.style.horizontally_stretchable = true + action_bar.style.height = 35 + + return list_table, action_bar +end + +--- Adds buttons and permission flows to the action bar +local function generate_action_bar(player,element) + close_action_bar(element) + local action_player = Store.get_child(action_player_store,player.name) + + for action_name,buttons in pairs(config) do + local permission_flow = + element.add{ + type='flow', + name=action_name + } + + for _,button in ipairs(buttons) do + button(permission_flow) + end + + if not Roles.player_allowed(player,action_name) then + permission_flow.visible = false + end + + if buttons.auth and action_player and not buttons.auth(player,action_player) then + permission_flow.visible = false + end + end + + if not action_player then + element.visible = false + end +end + +--- Updates the action bar +local player_list_name +local function update_action_bar(player) + local frame = Gui.classes.left_frames.get_frame(player_list_name,player) + local element = frame.container.action_bar + local action_player = Store.get_child(action_player_store,player.name) + + if not action_player then + element.visible = false + else + element.visible = true + for action_name,buttons in pairs(config) do + if buttons.auth and not buttons.auth(player,action_player) then + element[action_name].visible = false + else + element[action_name].visible = true + end + end + end +end + +local function add_player(list_table,player,role_name) + open_action_bar(list_table,player.name) + + -- player name with the tooltip of their highest role and in they colour + local player_name = + list_table.add{ + type='label', + caption=player.name, + tooltip=role_name + } + Gui.set_padding(player_name,0,0,0,2) + player_name.style.font_color = player.chat_color + + -- flow which allows right align for the play time + local time_flow = + list_table.add{ + type='flow' + } + Gui.set_padding(time_flow) + time_flow.style.horizontal_align = 'right' + time_flow.style.horizontally_stretchable = true + + -- time given in Xh Ym and is right aligned + local time = + time_flow.add{ + type='label', + caption=format_time(player.online_time) + } + Gui.set_padding(time) +end + +--- Adds fake players to the player list +local function add_fake_players(list_table,count) + local role_name = 'Fake Player' + for i = 1,count do + add_player(list_table,{ + name='Player '..i, + online_time=math.random(0,game.tick), + chat_color=table.get_random_dictionary_entry(Colors) + },role_name) + end +end + +--- Registers the player list +local player_list = +Gui.new_left_frame('gui/player-list') +:set_sprites('entity/character') +:set_open_by_default() +:set_direction('vertical') +:on_draw(function(player,element) + local list_table,action_bar = generate_container(element) + generate_action_bar(player,action_bar) + + local players = {} + for _,next_player in pairs(game.connected_players) do + local highest_role = Roles.get_player_highest_role(next_player) + if not players[highest_role.name] then + players[highest_role.name] = {} + end + table.insert(players[highest_role.name],next_player) + end + + for _,role_name in pairs(Roles.config.order) do + if players[role_name] then + for _,next_player in pairs(players[role_name]) do + add_player(list_table,next_player,role_name) + end + end + end + + add_fake_players(list_table,20) +end) + +player_list_name = player_list:uid() + +--- When the action player is changed the action bar will update +Store.register(action_player_store,function(value,category) + local player = Game.get_player_from_any(category) + update_action_bar(player) +end) + +--- Many events which trigger the gui to be re drawn +Event.add(defines.events.on_player_joined_game,player_list 'redraw_all') +Event.add(defines.events.on_player_left_game,player_list 'redraw_all') +Event.add(Roles.player_role_assigned,player_list 'redraw_all') +Event.add(Roles.player_role_unassigned,player_list 'redraw_all') + +return player_list \ No newline at end of file From 42de74fa4f625de648c74bcdf2a049ab5f0f9898 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 19:57:28 +0100 Subject: [PATCH 03/41] Added Action Buttons --- config/action_buttons.lua | 110 +++++++++++++++++++++++++++++++++++- config/roles.lua | 2 + modules/gui/player-list.lua | 4 +- 3 files changed, 113 insertions(+), 3 deletions(-) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index 402d6481..d6b169e2 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -2,6 +2,8 @@ local Gui = require 'expcore.gui' local Roles = require 'expcore.roles' local Store = require 'expcore.store' local Game = require 'utils.game' +local Reports = require 'modules.addons.reports-control' +local Jail = require 'modules.addons.jail-control' local action_player_store = 'gui.left.player-list.action-player' @@ -25,18 +27,124 @@ local function get_action_player(player) return action_player end +local function teleport(from_player,to_player) + local surface = to_player.surface + local position = surface.find_non_colliding_position('character',to_player.position,32,1) + if not position then return false end -- return false if no new position + if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one + from_player.teleport(position,surface) + return true +end + +local goto_player = +Gui.new_button() +:set_sprites('utility/export') +:set_tooltip('Goto player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + teleport(player,action_player) +end) + +local bring_player = +Gui.new_button() +:set_sprites('utility/import') +:set_tooltip('Bring player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + teleport(action_player,player) +end) + +local kill_player = +Gui.new_button() +:set_sprites('utility/too_far') +:set_tooltip('Kill player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + if action_player.character then + action_player.character.die() + end +end) + local report_player = Gui.new_button() -:set_sprites('utility/warning') +:set_sprites('utility/spawn_flag') :set_tooltip('Report player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) local action_player = get_action_player(player) + Reports.report_player(action_player,reason,player.name) +end) + +local jail_player = +Gui.new_button() +:set_sprites('utility/item_editor_icon') +:set_tooltip('Jail player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + Jail.jail_player(action_player,player.name) +end) + +local temp_ban_player = +Gui.new_button() +:set_sprites('utility/clock') +:set_tooltip('Temp ban player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + Jail.temp_ban_player(action_player,player.name,reason) +end) + +local kick_player = +Gui.new_button() +:set_sprites('utility/warning_icon') +:set_tooltip('Kick player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + game.kick_player(action_player,reason) +end) + +local ban_player = +Gui.new_button() +:set_sprites('utility/danger_icon') +:set_tooltip('Ban player') +:set_style('tool_button',tool_button_style) +:on_click(function(player,element) + local action_player = get_action_player(player) + game.ban_player(action_player,reason) end) return { + ['command/teleport'] = { + goto_player, + bring_player + }, + ['command/kill/always'] = { + auth=auth_lower_role, + kill_player + }, ['command/report'] = { auth=auth_lower_role, report_player + }, + ['command/jail'] = { + auth=auth_lower_role, + jail_player + }, + ['command/temp-ban'] = { + auth=auth_lower_role, + temp_ban_player + }, + ['command/kick'] = { + auth=auth_lower_role, + kick_player + }, + ['command/ban'] = { + auth=auth_lower_role, + ban_player } } \ No newline at end of file diff --git a/config/roles.lua b/config/roles.lua index 6ea8ddc9..3fe9c615 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -94,6 +94,8 @@ Roles.new_role('Trainee','TrMod') 'command/give-warning', 'command/get-warnings', 'command/get-reports', + 'command/kick', + 'command/ban', } --- Trusted Roles diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index a434f1eb..d240fb0a 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -122,7 +122,7 @@ local function generate_action_bar(player,element) end if buttons.auth and action_player and not buttons.auth(player,action_player) then - permission_flow.visible = false + --permission_flow.visible = false end end @@ -144,7 +144,7 @@ local function update_action_bar(player) element.visible = true for action_name,buttons in pairs(config) do if buttons.auth and not buttons.auth(player,action_player) then - element[action_name].visible = false + --element[action_name].visible = false else element[action_name].visible = true end From e7353e331f41710da20824493203e6122eb4983d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 20:38:51 +0100 Subject: [PATCH 04/41] Added reason entry --- config/action_buttons.lua | 49 +++++++++++++++++++++++++----- modules/gui/player-list.lua | 60 +++++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 10 deletions(-) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index d6b169e2..f3e553db 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -4,8 +4,10 @@ local Store = require 'expcore.store' local Game = require 'utils.game' local Reports = require 'modules.addons.reports-control' local Jail = require 'modules.addons.jail-control' +local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') local action_player_store = 'gui.left.player-list.action-player' +local action_name_store = 'gui.left.player-list.action-name' local function tool_button_style(style) Gui.set_padding_style(style,-1,-1,-1,-1) @@ -24,7 +26,8 @@ end local function get_action_player(player) local action_player_name = Store.get_child(action_player_store,player.name) local action_player = Game.get_player_from_any(action_player_name) - return action_player + local action_player_name_color = format_chat_player_name(action_player) + return action_player,action_player_name_color end local function teleport(from_player,to_player) @@ -74,29 +77,46 @@ Gui.new_button() :set_tooltip('Report player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) - Reports.report_player(action_player,reason,player.name) + Store.set_child(action_name_store,player.name,'command/report') end) +local function report_player_callback(player,reason) + local action_player,action_player_name_color = get_action_player(player) + local by_player_name_color = format_chat_player_name(player) + game.print{'expcom-report.non-admin',action_player_name_color,reason} + Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) + Reports.report_player(action_player,reason,player.name) +end + local jail_player = Gui.new_button() :set_sprites('utility/item_editor_icon') :set_tooltip('Jail player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) - Jail.jail_player(action_player,player.name) + Store.set_child(action_name_store,player.name,'command/jail') end) +local function jail_player_callback(player,reason) + local action_player,action_player_name_color = get_action_player(player) + local by_player_name_color = format_chat_player_name(player) + game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} + Jail.jail_player(action_player,player.name) +end + local temp_ban_player = Gui.new_button() :set_sprites('utility/clock') :set_tooltip('Temp ban player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) + Store.set_child(action_name_store,player.name,'command/temp-ban') +end) + +local function temp_ban_player_callback(player,reason) local action_player = get_action_player(player) Jail.temp_ban_player(action_player,player.name,reason) -end) +end local kick_player = Gui.new_button() @@ -104,9 +124,13 @@ Gui.new_button() :set_tooltip('Kick player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) + Store.set_child(action_name_store,player.name,'command/kick') +end) + +local function kick_player_callback(player,reason) local action_player = get_action_player(player) game.kick_player(action_player,reason) -end) +end local ban_player = Gui.new_button() @@ -114,9 +138,13 @@ Gui.new_button() :set_tooltip('Ban player') :set_style('tool_button',tool_button_style) :on_click(function(player,element) + Store.set_child(action_name_store,player.name,'command/ban') +end) + +local function ban_player_callback(player,reason) local action_player = get_action_player(player) game.ban_player(action_player,reason) -end) +end return { ['command/teleport'] = { @@ -129,22 +157,27 @@ return { }, ['command/report'] = { auth=auth_lower_role, + reason_callback=report_player_callback, report_player }, ['command/jail'] = { auth=auth_lower_role, + reason_callback=jail_player_callback, jail_player }, ['command/temp-ban'] = { auth=auth_lower_role, + reason_callback=temp_ban_player_callback, temp_ban_player }, ['command/kick'] = { auth=auth_lower_role, + reason_callback=kick_player_callback, kick_player }, ['command/ban'] = { auth=auth_lower_role, + reason_callback=ban_player_callback, ban_player } } \ No newline at end of file diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index d240fb0a..0b8d1eaa 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -9,6 +9,7 @@ local config = require 'config.action_buttons' local Colors = require 'resources.color_presets' local action_player_store = 'gui.left.player-list.action-player' +local action_name_store = 'gui.left.player-list.action-name' --- Button used to open the action bar local open_action_bar = @@ -39,6 +40,26 @@ Gui.new_button() end) :on_click(function(player,element) Store.set_child(action_player_store,player.name,nil) + Store.set_child(action_name_store,player.name,nil) +end) + +--- Button used to confirm a reason +local reason_confrim = +Gui.new_button() +:set_sprites('utility/confirm_slot') +:set_tooltip('Confirm Reason') +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-1,-1,-1,-1) + style.height = 28 + style.width = 28 +end) +:on_click(function(player,element) + local reason = element.parent.entry.text or 'Non Given' + local action_name = Store.get_child(action_name_store,player.name) + local reason_callback = config[action_name].reason_callback + reason_callback(player,reason) + Store.set_child(action_player_store,player.name,nil) + Store.set_child(action_name_store,player.name,nil) end) --[[ Creates the main gui areas for the player list @@ -48,7 +69,7 @@ end) >>> table >> action_bar ]] -local function generate_container(element) +local function generate_container(player,element) Gui.set_padding(element,2,2,2,2) element.style.minimal_width = 200 @@ -98,6 +119,33 @@ local function generate_container(element) action_bar.style.horizontally_stretchable = true action_bar.style.height = 35 + -- reason bar which contains the reason text field and confirm button + local reason_bar = + container.add{ + name='reason_bar', + type='frame', + style='subfooter_frame' + } + Gui.set_padding(reason_bar,-1,-1,3,3) + reason_bar.style.horizontally_stretchable = true + reason_bar.style.height = 35 + local action_name = Store.get_child(action_name_store,player.name) + reason_bar.visible = action_name ~= nil + + -- text entry for the reason bar + local reason_field = + reason_bar.add{ + name='entry', + type='textfield', + style='stretchable_textfield', + tooltip='Enter reason' + } + Gui.set_padding(reason_field) + reason_field.style.height = 28 + reason_field.style.minimal_width = 160 + + reason_confrim(reason_bar) + return list_table, action_bar end @@ -202,7 +250,7 @@ Gui.new_left_frame('gui/player-list') :set_open_by_default() :set_direction('vertical') :on_draw(function(player,element) - local list_table,action_bar = generate_container(element) + local list_table,action_bar = generate_container(player,element) generate_action_bar(player,action_bar) local players = {} @@ -233,6 +281,14 @@ Store.register(action_player_store,function(value,category) update_action_bar(player) end) +--- When the action name is changed the reason input will update +Store.register(action_name_store,function(value,category) + local player = Game.get_player_from_any(category) + local frame = Gui.classes.left_frames.get_frame(player_list_name,player) + local element = frame.container.reason_bar + element.visible = value ~= nil +end) + --- Many events which trigger the gui to be re drawn Event.add(defines.events.on_player_joined_game,player_list 'redraw_all') Event.add(defines.events.on_player_left_game,player_list 'redraw_all') From 77fc58c8a0472f89dfbb6258a9094cff176e0991 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 21:44:39 +0100 Subject: [PATCH 05/41] Final Touch --- config/action_buttons.lua | 33 +++++++++++++++++---------- expcore/gui/left.lua | 5 ++++- locale/en/gui.cfg | 14 ++++++++++++ modules/gui/player-list.lua | 45 +++++++++++++++++++++++++++---------- 4 files changed, 72 insertions(+), 25 deletions(-) create mode 100644 locale/en/gui.cfg diff --git a/config/action_buttons.lua b/config/action_buttons.lua index f3e553db..401854c8 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -15,9 +15,9 @@ local function tool_button_style(style) style.width = 28 end -local function auth_lower_role(player,action_player) +local function auth_lower_role(player,action_player_name) local player_highest = Roles.get_player_highest_role(player) - local action_player_highest = Roles.get_player_highest_role(action_player) + local action_player_highest = Roles.get_player_highest_role(action_player_name) if player_highest.index < action_player_highest.index then return true end @@ -42,7 +42,7 @@ end local goto_player = Gui.new_button() :set_sprites('utility/export') -:set_tooltip('Goto player') +:set_tooltip{'player-list.goto-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) local action_player = get_action_player(player) @@ -52,7 +52,7 @@ end) local bring_player = Gui.new_button() :set_sprites('utility/import') -:set_tooltip('Bring player') +:set_tooltip{'player-list.bring-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) local action_player = get_action_player(player) @@ -62,7 +62,7 @@ end) local kill_player = Gui.new_button() :set_sprites('utility/too_far') -:set_tooltip('Kill player') +:set_tooltip{'player-list.kill-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) local action_player = get_action_player(player) @@ -74,7 +74,7 @@ end) local report_player = Gui.new_button() :set_sprites('utility/spawn_flag') -:set_tooltip('Report player') +:set_tooltip{'player-list.report-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) Store.set_child(action_name_store,player.name,'command/report') @@ -91,7 +91,7 @@ end local jail_player = Gui.new_button() :set_sprites('utility/item_editor_icon') -:set_tooltip('Jail player') +:set_tooltip{'player-list.jail-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) Store.set_child(action_name_store,player.name,'command/jail') @@ -107,7 +107,7 @@ end local temp_ban_player = Gui.new_button() :set_sprites('utility/clock') -:set_tooltip('Temp ban player') +:set_tooltip{'player-list.temp-ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) Store.set_child(action_name_store,player.name,'command/temp-ban') @@ -121,7 +121,7 @@ end local kick_player = Gui.new_button() :set_sprites('utility/warning_icon') -:set_tooltip('Kick player') +:set_tooltip{'player-list.kick-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) Store.set_child(action_name_store,player.name,'command/kick') @@ -135,7 +135,7 @@ end local ban_player = Gui.new_button() :set_sprites('utility/danger_icon') -:set_tooltip('Ban player') +:set_tooltip{'player-list.ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) Store.set_child(action_name_store,player.name,'command/ban') @@ -148,11 +148,20 @@ end return { ['command/teleport'] = { + auth=function(player,action_player_name) + return player.name ~= action_player_name + end, goto_player, bring_player }, - ['command/kill/always'] = { - auth=auth_lower_role, + ['command/kill'] = { + auth=function(player,action_player_name) + if player.name == action_player_name then + return true + elseif Roles.player_allowed(player,'command/kill/always') then + return auth_lower_role(player,action_player_name) + end + end, kill_player }, ['command/report'] = { diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index 63efb267..aeb528d3 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -240,7 +240,10 @@ end function LeftFrames._prototype:event_handler(action) action = action or 'update' return function(event) - local player = Game.get_player_by_index(event.player_index) + local player + if event.player_index then + player = Game.get_player_by_index(event.player_index) + end self[action](self,player) end end diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg new file mode 100644 index 00000000..bc5ea253 --- /dev/null +++ b/locale/en/gui.cfg @@ -0,0 +1,14 @@ +[player-list] +open-action-bar=Options +close-action-bar=Close Options +reason-confirm=Confirm Reason +reason-entry=Enter Reason +goto-player=Goto player +bring-player=Bring player +kill-player=Kill player +report-player=Report player +jail-player=Jail player +temp-ban-player=Temp ban player +kick-player=Kick player +ban-player=Ban player +afk-time=__1__% of total map time\nLast moved __2__ ago \ No newline at end of file diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 0b8d1eaa..ba976685 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -15,7 +15,7 @@ local action_name_store = 'gui.left.player-list.action-name' local open_action_bar = Gui.new_button() :set_sprites('utility/expand_dots_white') -:set_tooltip('Options') +:set_tooltip{'player-list.open-action-bar'} :set_embeded_flow(function(element,action_player_name) return action_player_name end) @@ -32,7 +32,7 @@ end) local close_action_bar = Gui.new_button() :set_sprites('utility/close_black') -:set_tooltip('Close options') +:set_tooltip{'player-list.close-action-bar'} :set_style('tool_button',function(style) Gui.set_padding_style(style,-1,-1,-1,-1) style.height = 28 @@ -44,10 +44,10 @@ end) end) --- Button used to confirm a reason -local reason_confrim = +local reasonc_confirm = Gui.new_button() :set_sprites('utility/confirm_slot') -:set_tooltip('Confirm Reason') +:set_tooltip{'player-list.reason-confirm'} :set_style('tool_button',function(style) Gui.set_padding_style(style,-1,-1,-1,-1) style.height = 28 @@ -60,6 +60,7 @@ end) reason_callback(player,reason) Store.set_child(action_player_store,player.name,nil) Store.set_child(action_name_store,player.name,nil) + element.parent.entry.text = '' end) --[[ Creates the main gui areas for the player list @@ -138,13 +139,13 @@ local function generate_container(player,element) name='entry', type='textfield', style='stretchable_textfield', - tooltip='Enter reason' + tooltip={'player-list.reason-entry'} } Gui.set_padding(reason_field) reason_field.style.height = 28 reason_field.style.minimal_width = 160 - reason_confrim(reason_bar) + reasonc_confirm(reason_bar) return list_table, action_bar end @@ -170,7 +171,7 @@ local function generate_action_bar(player,element) end if buttons.auth and action_player and not buttons.auth(player,action_player) then - --permission_flow.visible = false + permission_flow.visible = false end end @@ -192,7 +193,7 @@ local function update_action_bar(player) element.visible = true for action_name,buttons in pairs(config) do if buttons.auth and not buttons.auth(player,action_player) then - --element[action_name].visible = false + element[action_name].visible = false else element[action_name].visible = true end @@ -208,7 +209,7 @@ local function add_player(list_table,player,role_name) list_table.add{ type='label', caption=player.name, - tooltip=role_name + tooltip=player.name..' '..player.tag..'\n'..role_name } Gui.set_padding(player_name,0,0,0,2) player_name.style.font_color = player.chat_color @@ -216,6 +217,7 @@ local function add_player(list_table,player,role_name) -- flow which allows right align for the play time local time_flow = list_table.add{ + name='player-time-'..player.index, type='flow' } Gui.set_padding(time_flow) @@ -223,10 +225,14 @@ local function add_player(list_table,player,role_name) time_flow.style.horizontally_stretchable = true -- time given in Xh Ym and is right aligned + local tick = game.tick > 0 and game.tick or 1 + local percent = math.round(player.online_time/tick,3)*100 local time = time_flow.add{ + name='label', type='label', - caption=format_time(player.online_time) + caption=format_time(player.online_time), + tooltip={'player-list.afk-time',percent,format_time(player.afk_time,{minutes=true,long=true})} } Gui.set_padding(time) end @@ -238,6 +244,7 @@ local function add_fake_players(list_table,count) add_player(list_table,{ name='Player '..i, online_time=math.random(0,game.tick), + afk_time=math.random(0,game.tick), chat_color=table.get_random_dictionary_entry(Colors) },role_name) end @@ -270,7 +277,20 @@ Gui.new_left_frame('gui/player-list') end end - add_fake_players(list_table,20) + --add_fake_players(list_table,20) +end) +:on_update(function(player,element) + local list = element.container.scroll.table + for _,next_player in pairs(game.connected_players) do + local time_element_name = 'player-time-'..next_player.index + local time_element = list[time_element_name] + if time_element and time_element.valid then + time_element.label.caption = format_time(next_player.online_time) + local tick = game.tick > 0 and game.tick or 1 + local percent = math.round(player.online_time/tick,3)*100 + time_element.label.tooltip = {'player-list.afk-time',percent,format_time(player.afk_time,{minutes=true,long=true})} + end + end end) player_list_name = player_list:uid() @@ -289,7 +309,8 @@ Store.register(action_name_store,function(value,category) element.visible = value ~= nil end) ---- Many events which trigger the gui to be re drawn +--- Many events which trigger the gui to be re drawn, it will also update the times every 30 seconds +Event.on_nth_tick(1800,player_list 'update_all') Event.add(defines.events.on_player_joined_game,player_list 'redraw_all') Event.add(defines.events.on_player_left_game,player_list 'redraw_all') Event.add(Roles.player_role_assigned,player_list 'redraw_all') From 3c604c304666e956abbb36aa8ec684a7f1be98b3 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 May 2019 22:16:47 +0100 Subject: [PATCH 06/41] Added warn to player list --- config/action_buttons.lua | 28 ++++++++++++++++++- config/warnings.lua | 4 +-- locale/en/gui.cfg | 1 + modules/gui/player-list.lua | 6 ++-- .../Guis}/ExpGamingAdmin/Gui/control.lua | 0 .../Guis}/ExpGamingAdmin/Gui/softmod.json | 0 .../Guis}/ExpGamingAdmin/control.lua | 0 .../Guis}/ExpGamingAdmin/locale/de.cfg | 0 .../Guis}/ExpGamingAdmin/locale/en.cfg | 0 .../Guis}/ExpGamingAdmin/locale/fr.cfg | 0 .../Guis}/ExpGamingAdmin/locale/nl.cfg | 0 .../Guis}/ExpGamingAdmin/locale/sv-SE.cfg | 0 .../Guis}/ExpGamingAdmin/softmod.json | 0 .../Guis}/playerList/control.lua | 0 .../Guis}/playerList/locale/de.cfg | 0 .../Guis}/playerList/locale/en.cfg | 0 .../Guis}/playerList/locale/fr.cfg | 0 .../Guis}/playerList/locale/nl.cfg | 0 .../Guis}/playerList/locale/sv-SE.cfg | 0 .../Guis}/playerList/softmod.json | 0 .../Guis}/playerList/src/ranking.lua | 0 21 files changed, 33 insertions(+), 6 deletions(-) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/Gui/control.lua (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/Gui/softmod.json (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/control.lua (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/locale/de.cfg (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/locale/en.cfg (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/locale/fr.cfg (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/locale/nl.cfg (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/locale/sv-SE.cfg (100%) rename old/modules/{ => DONE/Guis}/ExpGamingAdmin/softmod.json (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/control.lua (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/locale/de.cfg (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/locale/en.cfg (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/locale/fr.cfg (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/locale/nl.cfg (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/locale/sv-SE.cfg (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/softmod.json (100%) rename old/modules/{ExpGamingPlayer => DONE/Guis}/playerList/src/ranking.lua (100%) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index 401854c8..b3da006a 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -3,6 +3,7 @@ local Roles = require 'expcore.roles' local Store = require 'expcore.store' local Game = require 'utils.game' local Reports = require 'modules.addons.reports-control' +local Warnings = require 'modules.addons.warnings-control' local Jail = require 'modules.addons.jail-control' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') @@ -88,6 +89,22 @@ local function report_player_callback(player,reason) Reports.report_player(action_player,reason,player.name) end +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) + Store.set_child(action_name_store,player.name,'command/give-warning') +end) + +local function warn_player_callback(player,reason) + local action_player,action_player_name_color = get_action_player(player) + local by_player_name_color = format_chat_player_name(player) + game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} + Warnings.add_warnings(action_player,player.name) +end + local jail_player = Gui.new_button() :set_sprites('utility/item_editor_icon') @@ -165,10 +182,19 @@ return { kill_player }, ['command/report'] = { - auth=auth_lower_role, + auth=function(player,action_player_name) + if not Roles.player_allowed(player,'command/give-warning') then + return auth_lower_role(player,action_player_name) + end + end, reason_callback=report_player_callback, report_player }, + ['command/give-warning'] = { + auth=auth_lower_role, + reason_callback=warn_player_callback, + warn_player + }, ['command/jail'] = { auth=auth_lower_role, reason_callback=jail_player_callback, diff --git a/config/warnings.lua b/config/warnings.lua index 5beace17..6e6c9211 100644 --- a/config/warnings.lua +++ b/config/warnings.lua @@ -2,8 +2,8 @@ return { actions = { -- what actions are taking at number of warnings -- if a localized string is used then __1__ will by_player_name and __2__ will be the current warning count (auto inserted) - {'warnings.received'}, - {'warnings.received'}, + {'warnings.received',''}, + {'warnings.received',''}, {'warnings.received',{'warnings.pre-kick'}}, function(player,by_player_name,number_of_warnings) game.kick_player(player,{'warnings.received',by_player_name,number_of_warnings,{'warnings.kick'}}) diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index bc5ea253..210f4ad1 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -7,6 +7,7 @@ goto-player=Goto player bring-player=Bring player kill-player=Kill player report-player=Report player +warn-player=Warn player jail-player=Jail player temp-ban-player=Temp ban player kick-player=Kick player diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index ba976685..e5b6e51b 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -44,7 +44,7 @@ end) end) --- Button used to confirm a reason -local reasonc_confirm = +local reason_confirm = Gui.new_button() :set_sprites('utility/confirm_slot') :set_tooltip{'player-list.reason-confirm'} @@ -145,7 +145,7 @@ local function generate_container(player,element) reason_field.style.height = 28 reason_field.style.minimal_width = 160 - reasonc_confirm(reason_bar) + reason_confirm(reason_bar) return list_table, action_bar end @@ -194,7 +194,7 @@ local function update_action_bar(player) for action_name,buttons in pairs(config) do if buttons.auth and not buttons.auth(player,action_player) then element[action_name].visible = false - else + elseif Roles.player_allowed(player,action_name) then element[action_name].visible = true end end diff --git a/old/modules/ExpGamingAdmin/Gui/control.lua b/old/modules/DONE/Guis/ExpGamingAdmin/Gui/control.lua similarity index 100% rename from old/modules/ExpGamingAdmin/Gui/control.lua rename to old/modules/DONE/Guis/ExpGamingAdmin/Gui/control.lua diff --git a/old/modules/ExpGamingAdmin/Gui/softmod.json b/old/modules/DONE/Guis/ExpGamingAdmin/Gui/softmod.json similarity index 100% rename from old/modules/ExpGamingAdmin/Gui/softmod.json rename to old/modules/DONE/Guis/ExpGamingAdmin/Gui/softmod.json diff --git a/old/modules/ExpGamingAdmin/control.lua b/old/modules/DONE/Guis/ExpGamingAdmin/control.lua similarity index 100% rename from old/modules/ExpGamingAdmin/control.lua rename to old/modules/DONE/Guis/ExpGamingAdmin/control.lua diff --git a/old/modules/ExpGamingAdmin/locale/de.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/de.cfg similarity index 100% rename from old/modules/ExpGamingAdmin/locale/de.cfg rename to old/modules/DONE/Guis/ExpGamingAdmin/locale/de.cfg diff --git a/old/modules/ExpGamingAdmin/locale/en.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/en.cfg similarity index 100% rename from old/modules/ExpGamingAdmin/locale/en.cfg rename to old/modules/DONE/Guis/ExpGamingAdmin/locale/en.cfg diff --git a/old/modules/ExpGamingAdmin/locale/fr.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/fr.cfg similarity index 100% rename from old/modules/ExpGamingAdmin/locale/fr.cfg rename to old/modules/DONE/Guis/ExpGamingAdmin/locale/fr.cfg diff --git a/old/modules/ExpGamingAdmin/locale/nl.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/nl.cfg similarity index 100% rename from old/modules/ExpGamingAdmin/locale/nl.cfg rename to old/modules/DONE/Guis/ExpGamingAdmin/locale/nl.cfg diff --git a/old/modules/ExpGamingAdmin/locale/sv-SE.cfg b/old/modules/DONE/Guis/ExpGamingAdmin/locale/sv-SE.cfg similarity index 100% rename from old/modules/ExpGamingAdmin/locale/sv-SE.cfg rename to old/modules/DONE/Guis/ExpGamingAdmin/locale/sv-SE.cfg diff --git a/old/modules/ExpGamingAdmin/softmod.json b/old/modules/DONE/Guis/ExpGamingAdmin/softmod.json similarity index 100% rename from old/modules/ExpGamingAdmin/softmod.json rename to old/modules/DONE/Guis/ExpGamingAdmin/softmod.json diff --git a/old/modules/ExpGamingPlayer/playerList/control.lua b/old/modules/DONE/Guis/playerList/control.lua similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/control.lua rename to old/modules/DONE/Guis/playerList/control.lua diff --git a/old/modules/ExpGamingPlayer/playerList/locale/de.cfg b/old/modules/DONE/Guis/playerList/locale/de.cfg similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/locale/de.cfg rename to old/modules/DONE/Guis/playerList/locale/de.cfg diff --git a/old/modules/ExpGamingPlayer/playerList/locale/en.cfg b/old/modules/DONE/Guis/playerList/locale/en.cfg similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/locale/en.cfg rename to old/modules/DONE/Guis/playerList/locale/en.cfg diff --git a/old/modules/ExpGamingPlayer/playerList/locale/fr.cfg b/old/modules/DONE/Guis/playerList/locale/fr.cfg similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/locale/fr.cfg rename to old/modules/DONE/Guis/playerList/locale/fr.cfg diff --git a/old/modules/ExpGamingPlayer/playerList/locale/nl.cfg b/old/modules/DONE/Guis/playerList/locale/nl.cfg similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/locale/nl.cfg rename to old/modules/DONE/Guis/playerList/locale/nl.cfg diff --git a/old/modules/ExpGamingPlayer/playerList/locale/sv-SE.cfg b/old/modules/DONE/Guis/playerList/locale/sv-SE.cfg similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/locale/sv-SE.cfg rename to old/modules/DONE/Guis/playerList/locale/sv-SE.cfg diff --git a/old/modules/ExpGamingPlayer/playerList/softmod.json b/old/modules/DONE/Guis/playerList/softmod.json similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/softmod.json rename to old/modules/DONE/Guis/playerList/softmod.json diff --git a/old/modules/ExpGamingPlayer/playerList/src/ranking.lua b/old/modules/DONE/Guis/playerList/src/ranking.lua similarity index 100% rename from old/modules/ExpGamingPlayer/playerList/src/ranking.lua rename to old/modules/DONE/Guis/playerList/src/ranking.lua From ac755ba2acf6a71bf411d851007a6d924826c07c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 27 May 2019 14:24:31 +0100 Subject: [PATCH 07/41] New Readme --- README.md | 91 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ecec858d..c7509c63 100644 --- a/README.md +++ b/README.md @@ -16,28 +16,89 @@ CodeFactor - + Discord

-

ExpGaming Scenario Repository

+

ExpGaming Scenario Repository

-

Out Dated; Will be updated in the future

+## Explosive Gaming -#### Use and Installation +Explosive Gaming (often ExpGaming) is a server hosting community with a strong focus on Factorio and games that follow similar ideas. Our factorio server are known for hosting large maps with the main goal of being a "mega base" which can produce as much as possible with in our reset schedule. Although these server tend to the more experienced players our server are open to everyone. You can find us through our [website](website), [discord](discord), [wiki](wiki), or in the public games tab in factorio (ExpGaming S1). -* Download the git repo -* Move files into the scenario folder (C:\Users\User\AppData\Roaming\Factorio\scenarios\ExpGamingScenario) -* Make edits to role and group configs as well as any other configs that you want -* Run the scenario under Play > Multiplayer > Host Scenario > ExpGamingScenario -* All modules will be loaded if you have not removed any, any problems see log file +## Use and Installation -#### Creation of new modules +1) Download this [git repository](https://github.com/explosivegaming/scenario/archive/master.zip) for the stable release. The dev branch can be found [here](https://github.com/explosivegaming/scenario/archive/dev.zip) for those who want the latest features. See [releases](#releases) for other release branches. -* Please see [FactorioSoftmodManager](https://github.com/explosivegaming/FactorioSoftmodManager) for making new modules +2) Extract the downloaded zip file from the branch you downloaded into factorio's scenario directory: + * Windows: `%appdata%\Factorio\scenarios` + * Linux: `~/.factorio/scenarios` -#### Forks and Pull Requests +3) Within the scenario you can find `./config/_file_loader.lua` which contains a list of all the modules that will be loaded by the scenario; simply comment out (or remove) features you do not want but note that some modules may load other modules as dependencies even when removed from the list. -* We are happy for people to make pull requests if you wish to help make our server better -* Your server is a community server, it is all about the people and feedback is good -* Dont be afraid to make a pull request as if it fixes something then its a good change \ No newline at end of file +4) More advanced users may want to play with the other configs files within `./config` but please be aware that some of the config files will require a basic understanding of lua while others may just be a list of values. + +5) Once you have made any config changes that you wish to make open factorio, select play, then start scenario (or host scenario from within multiplayer tab), and select the scenario which will be called `scenario-master` if you have downloaded the latest stable release and have not changed the folder name. + +6) The scenario will now load all the selected modules and start the map, any errors or exceptions raised in the scenario should not cause a game/server crash so if any features don't work as expected then it may be returning an error in the log, 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](discord). If you do not know lua and don't feel like learning you can always make a [feature request](issues). 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. +* After a number of features have been added a release branch is made: `release/X.Y.0`; this branch should have no new features and only bug fixes or localization. +* A release is merged into `master` on the following friday in time for the the weekly reset. +* Patches may be named `patch/X.Y.Z` and fill be merged into `master` and `dev` when appropriate. + +## Releases + +| Scenario Version* | Version Name | Factorio Version** | +|---|---|---| +| [v5.5](s5.5) | Gui System | [v0.17.35](f0.17.35) | +| [v5.4](s5.4) | Admin Controls | [v0.17.32](f0.17.32) | +| [v5.3](s5.3) | Custom Roles | [v0.17.28](f0.17.28) | +| [v5.2](s5.2) | Quality of life | [v0.17.22](f0.17.22) | +| [v5.1](s5.1) | Permission Groups | [v0.17.13](f0.17.13) | +| [v5.0](s5.0) | 0.17 Overhaul| [v0.17](f0.17.9) | +| [v4.0](s4.0) | Softmod Manager | [v0.16.51](f0.16.51) | +| [v3.0](s3.0) | 0.16 Overhaul | [v0.16](f0.16) | +| [v2.0](s2.0) | Localization and clean up | [v0.15](f0.15) | +| [v1.0](s1.0) | Modulation | [v0.15](f0.15) | +| [v0.1](s0.1) | First Tracked Version | [v0.14](f0.14) | +\* Scenario patch versions have been omitted. + +\** Factorio versions show the version they were made for, often the minimum requirement. + +[s5.5]: https://github.com/explosivegaming/scenario/releases/tag/5.5.0 +[s5.4]: https://github.com/explosivegaming/scenario/releases/tag/5.4.0 +[s5.3]: https://github.com/explosivegaming/scenario/releases/tag/5.3.0 +[s5.2]: https://github.com/explosivegaming/scenario/releases/tag/5.2.0 +[s5.1]: https://github.com/explosivegaming/scenario/releases/tag/5.1.0 +[s5.0]: https://github.com/explosivegaming/scenario/releases/tag/5.0.0 +[s4.0]: https://github.com/explosivegaming/scenario/releases/tag/v4.0 +[s3.0]: https://github.com/explosivegaming/scenario/releases/tag/v3.0 +[s2.0]: https://github.com/explosivegaming/scenario/releases/tag/v2.0 +[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 +[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 + +[f0.17.35]: https://wiki.factorio.com/Version_history/0.17.0#0.17.35 +[f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 +[f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 +[f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 +[f0.17.13]: https://wiki.factorio.com/Version_history/0.17.0#0.17.13 +[f0.17.9]: https://wiki.factorio.com/Version_history/0.17.0#0.17.9 +[f0.16.51]: https://wiki.factorio.com/Version_history/0.16.0#0.16.51 +[f0.16]: https://wiki.factorio.com/Version_history/0.16.0 +[f0.15]: https://wiki.factorio.com/Version_history/0.15.0 +[f0.14]: https://wiki.factorio.com/Version_history/0.14.0 + +## License + +The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](https://github.com/explosivegaming/scenario/blob/master/LICENSE) + +[issues]: https://github.com/explosivegaming/scenario/issues/new/choose +[website]: https://explosivegaming.nl +[discord]: https://discord.explosivegaming.nl +[wiki]: https://wiki.explosivegaming.nl \ No newline at end of file From e1ec16ac777cbaea6776f5ef54b053fd4fa9ebb1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 27 May 2019 14:38:23 +0100 Subject: [PATCH 08/41] Added command find --- config/_file_loader.lua | 1 + config/action_buttons.lua | 2 +- config/roles.lua | 1 + modules/commands/find.lua | 11 +++++++++++ modules/gui/player-list.lua | 19 ++++++++++++++++++- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 modules/commands/find.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 24c135c7..ca4405fd 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -22,6 +22,7 @@ return { 'modules.commands.reports', 'modules.commands.spawn', 'modules.commands.warnings', + 'modules.commands.find', -- QoL Addons 'modules.addons.chat-popups', 'modules.addons.damage-popups', diff --git a/config/action_buttons.lua b/config/action_buttons.lua index b3da006a..cd48100d 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -184,7 +184,7 @@ return { ['command/report'] = { auth=function(player,action_player_name) if not Roles.player_allowed(player,'command/give-warning') then - return auth_lower_role(player,action_player_name) + return not Roles.player_has_flag(action_player_name,'report-immune') end end, reason_callback=report_player_callback, diff --git a/config/roles.lua b/config/roles.lua index 3fe9c615..3604d31a 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -182,6 +182,7 @@ local default = Roles.new_role('Guest','') 'command/tag-clear', 'command/chelp', 'command/list-roles', + 'command/find-on-map', 'command/report', 'gui/player-list', } diff --git a/modules/commands/find.lua b/modules/commands/find.lua new file mode 100644 index 00000000..ee242b1b --- /dev/null +++ b/modules/commands/find.lua @@ -0,0 +1,11 @@ +local Commands = require 'expcore.commands' +require 'config.expcore-commands.parse_general' + +Commands.new_command('find-on-map','Find a player on your map.') +:add_param('player',false,'player-online') -- the player to find on the map +:add_alias('find','zoom-to') +:register(function(player,action_player,raw) + local position = action_player.position + player.zoom_to_world(position,2) + return Commands.success -- prevents command complete message from showing +end) \ No newline at end of file diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index e5b6e51b..9987b341 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -11,6 +11,15 @@ local Colors = require 'resources.color_presets' local action_player_store = 'gui.left.player-list.action-player' local action_name_store = 'gui.left.player-list.action-name' +--- used on player name label to allow zoom to map +local zoom_to_map_name = Gui.uid_name() +Gui.on_click(zoom_to_map_name,function(event) + local action_player_name = event.element.caption + local action_player = Game.get_player_from_any(action_player_name) + local position = action_player.position + event.player.zoom_to_world(position,2) +end) + --- Button used to open the action bar local open_action_bar = Gui.new_button() @@ -204,9 +213,17 @@ end local function add_player(list_table,player,role_name) open_action_bar(list_table,player.name) + -- flow to contain player_name to allow all to have trigger for zoom to map + local player_name_flow = + list_table.add{ + type='flow' + } + Gui.set_padding(player_name_flow) + -- player name with the tooltip of their highest role and in they colour local player_name = - list_table.add{ + player_name_flow.add{ + name=zoom_to_map_name, type='label', caption=player.name, tooltip=player.name..' '..player.tag..'\n'..role_name From e57e44d93c27949bf191dc7a16cd21ddf85f9d1d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 27 May 2019 14:41:45 +0100 Subject: [PATCH 09/41] Added click to open to tooltip --- locale/en/gui.cfg | 3 ++- modules/gui/player-list.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 210f4ad1..80a9e80d 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -12,4 +12,5 @@ jail-player=Jail player temp-ban-player=Temp ban player kick-player=Kick player ban-player=Ban player -afk-time=__1__% of total map time\nLast moved __2__ ago \ No newline at end of file +afk-time=__1__% of total map time\nLast moved __2__ ago +open-map=__1__ __2__\n__3__\nClick to open map \ No newline at end of file diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 9987b341..79339dd4 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -226,7 +226,7 @@ local function add_player(list_table,player,role_name) name=zoom_to_map_name, type='label', caption=player.name, - tooltip=player.name..' '..player.tag..'\n'..role_name + tooltip={'player-list.open-map',player.name,player.tag,role_name} } Gui.set_padding(player_name,0,0,0,2) player_name.style.font_color = player.chat_color From 0b9e8b8cd50d284e06c7b2f2b20844a3ff1815bb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 27 May 2019 22:37:59 +0100 Subject: [PATCH 10/41] Looks Sorted --- config/_file_loader.lua | 1 + config/rockets.lua | 37 +++ config/roles.lua | 5 + expcore/gui/core.lua | 21 ++ locale/en/gui.cfg | 1 + modules/gui/player-list.lua | 12 +- modules/gui/rocket-info.lua | 506 ++++++++++++++++++++++++++++++++++++ 7 files changed, 574 insertions(+), 9 deletions(-) create mode 100644 config/rockets.lua create mode 100644 modules/gui/rocket-info.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index ca4405fd..746bbcb7 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -35,6 +35,7 @@ return { 'modules.addons.random-player-colours', -- GUI 'modules.gui.player-list', + 'modules.gui.rocket-info', 'modules.commands.debug', -- Config Files 'config.expcore-commands.auth_admin', -- commands tagged with admin_only are blocked for non admins diff --git a/config/rockets.lua b/config/rockets.lua new file mode 100644 index 00000000..f6e7cb3b --- /dev/null +++ b/config/rockets.lua @@ -0,0 +1,37 @@ +--- This file controls what will show in each section of the rocket info gui +-- each function will be given the player and must return the value to show and a tooltip, nil will not show the stat +local Global = require 'utils.global' +local Event = require 'utils.event' + +return { + stats = { + show_stats=true, + show_first_rocket = true, + show_last_rocket = true, + show_fastest_rocket = true, + show_total_rockets = true, + show_game_avg = true, + rolling_avg = { + 5,10,25 + } + }, + milestones = { + show_milestones=true, + 1,2,5, + 10,20,50, + 100,200,500, + 1000,1500,2000,2500, + 3000,3500,4000,4500, + 5000 + }, + progress = { + show_progress = true, + allow_zoom_to_map = true, + allow_remote_launch = true, + remote_launch_admins_only = false, + remote_launch_role_permision = 'gui/rocket-info/remote_launch', + allow_toggle_active = true, + toggle_active_admins_only = false, + toggle_active_role_permision = 'gui/rocket-info/toggle-active' + } +} \ No newline at end of file diff --git a/config/roles.lua b/config/roles.lua index 3604d31a..532b2db5 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -76,6 +76,8 @@ Roles.new_role('Moderator','Mod') 'command/clear-warnings', 'command/clear-temp-ban', 'command/clear-inventory', + 'gui/rocket-info/toggle-active', + 'gui/rocket-info/remote_launch', } Roles.new_role('Trainee','TrMod') @@ -115,6 +117,8 @@ Roles.new_role('Pay to Win','P2W') :set_flag('report-immune') :set_parent('Donator') :allow{ + 'gui/rocket-info/toggle-active', + 'gui/rocket-info/remote_launch', } Roles.new_role('Donator','Don') @@ -185,6 +189,7 @@ local default = Roles.new_role('Guest','') 'command/find-on-map', 'command/report', 'gui/player-list', + 'gui/rocket-info', } --- Jail role diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 8eb407cf..0415e8a1 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -153,6 +153,7 @@ Gui.toggle_visible(element) --- Will toggle the visiblity of an element Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style + Gui.create_right_align(element,flow_name) --- Allows the creation of a right align flow to place elements into ]] local Gui = require 'utils.gui' local Game = require 'utils.game' @@ -515,6 +516,7 @@ end --- Will toggle the enabled state of an element -- @tparam element LuaGuiElement the gui element to toggle +-- @treturn boolean the new state that the element has function Gui.toggle_enable(element) if not element or not element.valid then return end if not element.enabled then @@ -522,10 +524,12 @@ function Gui.toggle_enable(element) else element.enabled = false end + return element.enabled end --- Will toggle the visiblity of an element -- @tparam element LuaGuiElement the gui element to toggle +-- @treturn boolean the new state that the element has function Gui.toggle_visible(element) if not element or not element.valid then return end if not element.visible then @@ -533,6 +537,7 @@ function Gui.toggle_visible(element) else element.visible = false end + return element.visible end --- Sets the padding for a gui element @@ -562,4 +567,20 @@ function Gui.set_padding_style(style,up,down,left,right) style.right_padding = right or 0 end +--- Allows the creation of a right align flow to place elements into +-- @tparam element LuaGuiElement the element to add this flow to, +-- @tparam[opt] flow_name string the name of the flow can be nil +-- @treturn LuaGuiElement the flow that was created +function Gui.create_right_align(element,flow_name) + local right_flow = + element.add{ + name=flow_name, + type='flow' + } + Gui.set_padding(right_flow,1,1,2,2) + right_flow.style.horizontal_align = 'right' + right_flow.style.horizontally_stretchable = true + return right_flow +end + return Gui \ No newline at end of file diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 80a9e80d..f0ff3cfc 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -1,4 +1,5 @@ [player-list] +main-tooltip=Player list open-action-bar=Options close-action-bar=Close Options reason-confirm=Confirm Reason diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 79339dd4..d2545f5a 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -40,7 +40,7 @@ end) --- Button used to close the action bar local close_action_bar = Gui.new_button() -:set_sprites('utility/close_black') +:set_sprites('utility/close_black','utility/close_white') :set_tooltip{'player-list.close-action-bar'} :set_style('tool_button',function(style) Gui.set_padding_style(style,-1,-1,-1,-1) @@ -232,14 +232,7 @@ local function add_player(list_table,player,role_name) player_name.style.font_color = player.chat_color -- flow which allows right align for the play time - local time_flow = - list_table.add{ - name='player-time-'..player.index, - type='flow' - } - Gui.set_padding(time_flow) - time_flow.style.horizontal_align = 'right' - time_flow.style.horizontally_stretchable = true + local time_flow = Gui.create_right_align(list_table,'player-time-'..player.index) -- time given in Xh Ym and is right aligned local tick = game.tick > 0 and game.tick or 1 @@ -271,6 +264,7 @@ end local player_list = Gui.new_left_frame('gui/player-list') :set_sprites('entity/character') +:set_tooltip{'player-list.main-tooltip'} :set_open_by_default() :set_direction('vertical') :on_draw(function(player,element) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua new file mode 100644 index 00000000..9531e0ab --- /dev/null +++ b/modules/gui/rocket-info.lua @@ -0,0 +1,506 @@ +local Gui = require 'expcore.gui' +local Roles = require 'expcore.roles' +local Event = require 'utils.event' +local config = require 'config.rockets' +local Global = require 'utils.global' +local format_time = ext_require('expcore.common','format_time') +local Colors = require 'resources.color_presets' + +local rocket_times = {} +local rocket_stats = {} +local rocket_silos = {} + +Global.register({ + rocket_times = rocket_times, + rocket_stats = rocket_stats, + rocket_silos = rocket_silos +},function(tbl) + rocket_times = tbl.rocket_times + rocket_stats = tbl.rocket_stats + rocket_silos = tbl.rocket_silos +end) + +local function get_silo_name(entity) + local position = entity.position + return 'X '..math.floor(position.x)..' Y '..math.floor(position.y) +end + +local zoom_to_map_name = Gui.uid_name() +Gui.on_click(zoom_to_map_name,function(event) + local force = event.player.force + local rocket_silo_name = event.element.caption + local rocket_silo = rocket_silos[force.name][rocket_silo_name] + local position = rocket_silo.entity.position + event.player.zoom_to_world(position,2) +end) + +local launch_rocket = +Gui.new_button() +:set_sprites('utility/center') +:set_tooltip('Click to launch rocket') +:set_embeded_flow(function(element,rocket_silo_name) + return 'launch_'..rocket_silo_name +end) +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + style.width = 16 + style.height = 16 +end) +:on_click(function(player,element) + local force = player.force + local rocket_silo_name = element.parent.name:sub(8) + local rocket_silo = rocket_silos[force.name][rocket_silo_name] + rocket_silo.entity.launch_rocket() +end) + +local toggle_rocket = +Gui.new_button() +:set_sprites('utility/play') +:set_tooltip('Click to launch rocket') +:set_embeded_flow(function(element,rocket_silo_name) + return 'toggle_'..rocket_silo_name +end) +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + style.width = 16 + style.height = 16 +end) +:on_click(function(player,element) + local force = player.force + local rocket_silo_name = element.parent.name:sub(7) + local rocket_silo = rocket_silos[force.name][rocket_silo_name] + local status = true + if status then + player.print('WIP; We currently have no way to test or set the auto launch of a rocket so this button does not work!') + else + element.sprite = 'utility/stop' + end +end) + +local header_expand = +Gui.new_button() +:set_sprites('utility/expand_dark','utility/expand') +:set_tooltip('Click to expand') +: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 flow_name = element.parent.name + local flow = element.parent.parent.parent[flow_name] + if Gui.toggle_visible(flow) then + element.sprite = 'utility/collapse_dark' + element.hovered_sprite = 'utility/collapse' + else + element.sprite = 'utility/expand_dark' + element.hovered_sprite = 'utility/expand' + end +end) + +local function create_header_flow_combo(player,element,name,table_size,caption,tooltip) + -- header for the combo + local header = + element.add{ + type='frame', + name=name..'-header', + style='subheader_frame', + } + Gui.set_padding(header,1,1,3,3) + header.style.horizontally_stretchable = true + + -- caption for header bar + header.add{ + type='label', + style='heading_1_label', + caption=caption, + tooltip=tooltip + } + + -- right aligned button to toggle the drop down area + local expand_flow = Gui.create_right_align(header,name) + header_expand(expand_flow) + + -- flow for the combo + local flow = + element.add{ + name=name, + type='scroll-pane', + direction='vertical', + horizontal_scroll_policy='never', + vertical_scroll_policy='auto-and-reserve-space' + } + Gui.set_padding(flow,1,1,2,2) + flow.style.horizontally_stretchable = true + flow.style.maximal_height = 215 + + flow.visible = false + + -- table to allow for nice looking labels + local flow_table = + flow.add{ + name='table', + type='table', + column_count=table_size + } + Gui.set_padding(flow_table) + flow_table.style.horizontally_stretchable = true + flow_table.style.vertical_align = 'center' + flow_table.style.cell_padding = 0 +end + +local function player_allowed(player,action) + if not config.progress['allow_'..action] then + return false + end + + if config.progress[action..'_admins_only'] and not player.admin then + return false + end + + if config.progress[action..'_role_permision'] and not Roles.player_allowed(player,config.progress[action..'_role_permision']) then + return false + end + + return true +end + +local function generate_container(player,element) + Gui.set_padding(element,1,2,2,2) + element.style.minimal_width = 200 + + -- main container which contains the other elements + local container = + element.add{ + name='container', + type='frame', + direction='vertical', + style='window_content_frame_packed' + } + Gui.set_padding(container) + + if config.stats.show_stats then + create_header_flow_combo(player,container,'stats',2,'Statistics','Stats about rockets') + end + + if config.milestones.show_milestones then + create_header_flow_combo(player,container,'milestones',2,'Milestones','Rocket milestones') + end + + if config.progress.show_progress then + local col_count = 2 + if player_allowed(player,'remote_launch') then col_count = col_count+1 end + if player_allowed(player,'toggle_active') then col_count = col_count+1 end + + create_header_flow_combo(player,container,'progress',col_count,'Build Progress','Build progress of rockets') + container.progress.add{ + type='label', + name='no_silos', + caption='Your force has no silos' + } + end + +end + +local function create_label_pair_time(element,name,raw_value,caption,tooltip,no_hours) + local value = no_hours and format_time(raw_value,{minutes=true,seconds=true}) or format_time(raw_value) + local value_tooltip = format_time(raw_value,{hours=not no_hours,minutes=true,seconds=true,long=true}) + if not element[name] then + -- main label to show the name of the value + element.add{ + type='label', + name=name..'-label', + caption=caption, + tooltip=tooltip + } + -- flow which allows right align for the value + local right_flow = Gui.create_right_align(element,name) + right_flow.add{ + type='label', + name='label', + caption=value, + tooltip=value_tooltip + } + else + element[name].label.caption = value + element[name].label.tooltip = value_tooltip + end +end + +local function generate_stats(player,frame) + if not config.stats.show_stats then return end + local element = frame.container.stats.table + local force_rockets = player.force.rockets_launched + + if config.stats.show_first_rocket then + create_label_pair_time(element,'first_launch',rocket_stats.first_launch or 0,'First Launch','The time of launch of the first rocket') + end + + if config.stats.show_last_rocket then + create_label_pair_time(element,'last_launch',rocket_stats.last_launch or 0,'Last Launch','The time that the last rocket was launched') + end + + if config.stats.show_fastest_rocket then + create_label_pair_time(element,'fastest_launch',rocket_stats.fastest_launch or 0,'Fastest Launch','The time taken for the fastest launch',true) + end + + if config.stats.show_total_rockets then + local total_rockets = 0 + + for _,force in pairs(game.forces) do + total_rockets = total_rockets + force.rockets_launched + end + total_rockets = total_rockets > 0 and total_rockets or 1 + local percentage = math.round(force_rockets/total_rockets,3)*100 + + if not element.total_rockets then + -- main label to show the name of the value + element.add{ + type='label', + name='total_rockets-label', + caption='Total Lauched', + tooltip='The total number of rockets launched' + } + -- flow which allows right align for the value + local right_flow = Gui.create_right_align(element,'total_rockets') + right_flow.add{ + type='label', + name='label', + caption=force_rockets, + tooltip=percentage + } + else + element.total_rockets.label.caption = force_rockets + element.total_rockets.label.tooltip = percentage + end + end + + if config.stats.show_game_avg then + local tick = game.tick > 0 and game.tick or 1 + local avg = math.floor(force_rockets/tick) + create_label_pair_time(element,'avg_launch',avg,'Avg Launch','The average time to launch a rocket',true) + end + + for _,over in pairs(config.stats.rolling_avg) do + local total = 0 + local rocket_count = 0 + for i = force_rockets,force_rockets-over,-1 do + if rocket_times[i] then + rocket_count = rocket_count + 1 + total = total + rocket_times[i] + end + end + total = total > 0 and total or 1 + local avg = math.floor(rocket_count/total) + create_label_pair_time(element,'avg_launch_'..over,avg,'Avg Launch '..over,'The rolling average time to launch a rocket for the past '..over..' rockets',true) + end + +end + +local function generate_milestones(player,frame) + if not config.milestones.show_milestones then return end + local element = frame.container.milestones.table + local force_rockets = player.force.rockets_launched + + for _,milestone in ipairs(config.milestones) do + if milestone <= force_rockets and not element['milstone-'..milestone] then + create_label_pair_time(element,'milstone-'..milestone,rocket_times[player.force.name][milestone],'Milestone '..milestone,'Time taken to launch '..milestone..' rockets') + end + end +end + +local function generate_progress(player,frame) + if not config.progress.show_progress then return end + local element = frame.container.progress.table + local force = player.force.name + + if not rocket_silos[force] or table.size(rocket_silos[force]) == 0 then + element.parent.no_silos.visible = true + + else + element.parent.no_silos.visible = false + for rocket_silo_name,rocket_silo in pairs(rocket_silos[force]) do + if not rocket_silo.entity or not rocket_silo.entity.valid then + rocket_silos[force][rocket_silo_name] = nil + if element['label_'..rocket_silo_name] then element['label_'..rocket_silo_name].destroy() end + if element['launch_'..rocket_silo_name] then element['launch_'..rocket_silo_name].destroy() end + if element['toggle_'..rocket_silo_name] then element['toggle_'..rocket_silo_name].destroy() end + if element[rocket_silo_name] then element[rocket_silo_name].destroy() end + + elseif not element[rocket_silo_name] then + local progress = rocket_silo.entity.rocket_parts + local status = rocket_silo.entity.status == 21 + local active = false -- need way to check this + + if player_allowed(player,'toggle_active') then + local toggle_rocket_element = toggle_rocket(element,rocket_silo_name) + toggle_rocket_element.enabled = false -- remove when done + if active then + toggle_rocket_element.sprite = 'utility/stop' + else + toggle_rocket_element.sprite = 'utility/play' + end + end + + if player_allowed(player,'remote_launch') then + local launch_rocket_element = launch_rocket(element,rocket_silo_name) + launch_rocket_element.enabled = status + end + + -- main label to show the name of the value + local flow = element.add{type='flow',name='label_'..rocket_silo_name} + Gui.set_padding(flow,0,0,2,0) + flow.add{ + type='label', + name=zoom_to_map_name, + caption=rocket_silo_name, + tooltip='Click to view on map' + } + + -- flow which allows right align for the value + local right_flow = Gui.create_right_align(element,rocket_silo_name) + right_flow.add{ + type='label', + name='label', + caption=progress..'%', + tooltip=rocket_silo.launched or 0 + } + + else + local progress = rocket_silo.entity.rocket_parts + local status = rocket_silo.entity.status == 21 + local active = false -- need way to check this + + local label = element[rocket_silo_name].label + label.caption = progress..'%' + label.tooltip = rocket_silo.launched or 0 + + if status then + label.caption = '100%' + label.style.font_color = Colors.cyan + else + label.style.font_color = Colors.white + end + + if player_allowed(player,'toggle_active') then + local toggle_rocket_element = element['toggle_'..rocket_silo_name] + if active then + toggle_rocket_element[toggle_rocket.name].sprite = 'utility/stop' + else + toggle_rocket_element[toggle_rocket.name].sprite = 'utility/play' + end + end + + if player_allowed(player,'remote_launch') then + local launch_rocket_element = element['launch_'..rocket_silo_name] + launch_rocket_element[launch_rocket.name].enabled = status + end + + + + end + end + + end +end + +local rocket_info = +Gui.new_left_frame('gui/rocket-info') +:set_sprites('entity/rocket-silo') +:set_post_authenticator(function(player,define_name) + return true + --return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name) +end) +:set_open_by_default(function(player,define_name) + return true + --return player.force.rockets_launched > 0 +end) +:set_direction('vertical') +:on_draw(function(player,element) + generate_container(player,element) + generate_stats(player,element) + generate_milestones(player,element) + generate_progress(player,element) +end) +:on_update(function(player,element) + generate_stats(player,element) + generate_milestones(player,element) + generate_progress(player,element) +end) + +Event.add(defines.events.on_rocket_launched,function(event) + local force = event.rocket_silo.force + local force_name = force.name + local rockets_launched = force.rockets_launched + + if not rocket_stats[force_name] then + rocket_stats[force_name] = {} + end + + if rockets_launched == 1 then + rocket_stats.first_launch = event.tick + rocket_stats.fastest_launch = event.tick + elseif event.tick-rocket_stats.last_launch < rocket_stats.fastest_launch then + rocket_stats.fastest_launch = event.tick-rocket_stats.last_launch + end + + rocket_stats.last_launch = event.tick + + if not rocket_times[force_name] then + rocket_times[force_name] = {} + end + + rocket_times[force_name][rockets_launched] = event.tick + + local silo_name = get_silo_name(event.rocket_silo) + + if not rocket_silos[force_name] then + rocket_silos[force_name] = {} + end + + if not rocket_silos[force_name][silo_name] then + rocket_silos[force_name][silo_name] = {entity=event.rocket_silo,launched=0} + end + + rocket_silos[force_name][silo_name].launched = rocket_silos[force_name][silo_name].launched+1 + + for _,player in pairs(force.players) do + rocket_info:update(player) + Gui.update_toolbar(player) + end +end) + +local function on_built(event) + local entity = event.created_entity + if entity.valid and entity.name == 'rocket-silo' then + local force = entity.force + local force_name = force.name + local silo_name = get_silo_name(entity) + + if not rocket_silos[force_name] then + rocket_silos[force_name] = {} + end + + rocket_silos[force_name][silo_name] = {entity=entity,launched=0} + + for _,player in pairs(force.players) do + rocket_info:update(player) + end + end +end + +Event.add(defines.events.on_built_entity,on_built) +Event.add(defines.events.on_robot_built_entity,on_built) +Event.on_nth_tick(150,function() + for _,force in pairs(game.forces) do + local silos = rocket_silos[force.name] + if silos then + for _,player in pairs(force.connected_players) do + local frame = rocket_info:get_frame(player) + generate_progress(player,frame) + end + end + end +end) + +return rocket_info \ No newline at end of file From 56b102d823c6bf2977bfa5d175966d9fc2e42899 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 01:08:09 +0100 Subject: [PATCH 11/41] Finished Rocket Gui --- expcore/gui.lua | 3 + expcore/gui/core.lua | 11 + locale/en/gui.cfg | 39 ++- modules/gui/rocket-info.lua | 631 ++++++++++++++++++++---------------- 4 files changed, 411 insertions(+), 273 deletions(-) diff --git a/expcore/gui.lua b/expcore/gui.lua index 70f0ffc3..7f38e777 100644 --- a/expcore/gui.lua +++ b/expcore/gui.lua @@ -37,6 +37,9 @@ local Gui = require 'expcore.gui.core' Gui.toggle_enable(element) --- Will toggle the enabled state of an element Gui.toggle_visible(element) --- Will toggle the visiblity of an element Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element + Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style + Gui.create_right_align(element,flow_name) --- Allows the creation of a right align flow to place elements into + Gui.destory_if_valid(element) --- Destroies an element but tests for it being present and valid first ]] local Instances = require 'expcore.gui.instances' diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index 0415e8a1..c58de2e3 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -154,6 +154,7 @@ Gui.set_padding(element,up,down,left,right) --- Sets the padding for a gui element Gui.set_padding_style(style,up,down,left,right) --- Sets the padding for a gui style Gui.create_right_align(element,flow_name) --- Allows the creation of a right align flow to place elements into + Gui.destory_if_valid(element) --- Destroies an element but tests for it being present and valid first ]] local Gui = require 'utils.gui' local Game = require 'utils.game' @@ -583,4 +584,14 @@ function Gui.create_right_align(element,flow_name) return right_flow end +--- Destroies an element but tests for it being present and valid first +-- @tparam element LuaGuiElement the element to be destroied +-- @treturn boolean true if it was destoried +function Gui.destory_if_valid(element) + if element and element.valid then + element.destroy() + return true + end +end + return Gui \ No newline at end of file diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index f0ff3cfc..e7e2aee4 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -14,4 +14,41 @@ temp-ban-player=Temp ban player kick-player=Kick player ban-player=Ban player afk-time=__1__% of total map time\nLast moved __2__ ago -open-map=__1__ __2__\n__3__\nClick to open map \ No newline at end of file +open-map=__1__ __2__\n__3__\nClick to open map + +[rocket-info] +main-tooltip=Rocket info +launch-tooltip=Launch rocket +launch-tooltip-disabled=Launch rocket (not ready) +toggle-rocket-tooltip=Disable auto launch +toggle-rocket-tooltip-disabled=Enable auto launch +toggle-section-tooltip=Expand Section +toggle-section-collapse-tooltip=Collapse Section +section-caption-stats=Statistics +section-tooltip-stats=Statistics about how rockets are launched +section-caption-milestones=Milestones +section-tooltip-milestones=The times when milestones were met +section-caption-progress=Build Progress +section-tooltip-progress=The progress for your rocket silos +progress-no-silos=You have no rocket silos +data-caption-first-launch=First Launch +data-tooltip-first-launch=The time of the first launch +data-caption-last-launch=Last Launch +data-tooltip-last-launch=The time of the last launch +data-caption-fastest-launch=Fastest Launch +data-tooltip-fastest-launch=The time taken for the fastest launch +data-caption-total-rockets=Total Launched +data-tooltip-total-rockets=Total number of rockets launched by your force +value-tooltip-total-rockets=__1__% of all rockets on this map +data-caption-avg-launch=Avg Time +data-tooltip-avg-launch=The average amount of time taken to launch a rocket +data-caption-avg-launch-n=Avg Time __1__ +data-tooltip-avg-launch-n=The average amount of time taken to launch the last __1__ rockets +data-caption-milstone-n=Milestone __1__ +data-tooltip-milstone-n=Time taken to each __1__ rockets +progress-x-pos=X __1__ +progress-y-pos=Y __1__ +progress-label-tooltip=View on map +progress-launched=Launched +progress-caption=__1__% +progress-tooltip=This silo has launched __1__ rockets \ No newline at end of file diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 9531e0ab..3171643d 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -20,135 +20,13 @@ Global.register({ rocket_silos = tbl.rocket_silos end) +--- Gets the name used to refrence the the rocket silo local function get_silo_name(entity) local position = entity.position - return 'X '..math.floor(position.x)..' Y '..math.floor(position.y) -end - -local zoom_to_map_name = Gui.uid_name() -Gui.on_click(zoom_to_map_name,function(event) - local force = event.player.force - local rocket_silo_name = event.element.caption - local rocket_silo = rocket_silos[force.name][rocket_silo_name] - local position = rocket_silo.entity.position - event.player.zoom_to_world(position,2) -end) - -local launch_rocket = -Gui.new_button() -:set_sprites('utility/center') -:set_tooltip('Click to launch rocket') -:set_embeded_flow(function(element,rocket_silo_name) - return 'launch_'..rocket_silo_name -end) -:set_style('tool_button',function(style) - Gui.set_padding_style(style,-2,-2,-2,-2) - style.width = 16 - style.height = 16 -end) -:on_click(function(player,element) - local force = player.force - local rocket_silo_name = element.parent.name:sub(8) - local rocket_silo = rocket_silos[force.name][rocket_silo_name] - rocket_silo.entity.launch_rocket() -end) - -local toggle_rocket = -Gui.new_button() -:set_sprites('utility/play') -:set_tooltip('Click to launch rocket') -:set_embeded_flow(function(element,rocket_silo_name) - return 'toggle_'..rocket_silo_name -end) -:set_style('tool_button',function(style) - Gui.set_padding_style(style,-2,-2,-2,-2) - style.width = 16 - style.height = 16 -end) -:on_click(function(player,element) - local force = player.force - local rocket_silo_name = element.parent.name:sub(7) - local rocket_silo = rocket_silos[force.name][rocket_silo_name] - local status = true - if status then - player.print('WIP; We currently have no way to test or set the auto launch of a rocket so this button does not work!') - else - element.sprite = 'utility/stop' - end -end) - -local header_expand = -Gui.new_button() -:set_sprites('utility/expand_dark','utility/expand') -:set_tooltip('Click to expand') -: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 flow_name = element.parent.name - local flow = element.parent.parent.parent[flow_name] - if Gui.toggle_visible(flow) then - element.sprite = 'utility/collapse_dark' - element.hovered_sprite = 'utility/collapse' - else - element.sprite = 'utility/expand_dark' - element.hovered_sprite = 'utility/expand' - end -end) - -local function create_header_flow_combo(player,element,name,table_size,caption,tooltip) - -- header for the combo - local header = - element.add{ - type='frame', - name=name..'-header', - style='subheader_frame', - } - Gui.set_padding(header,1,1,3,3) - header.style.horizontally_stretchable = true - - -- caption for header bar - header.add{ - type='label', - style='heading_1_label', - caption=caption, - tooltip=tooltip - } - - -- right aligned button to toggle the drop down area - local expand_flow = Gui.create_right_align(header,name) - header_expand(expand_flow) - - -- flow for the combo - local flow = - element.add{ - name=name, - type='scroll-pane', - direction='vertical', - horizontal_scroll_policy='never', - vertical_scroll_policy='auto-and-reserve-space' - } - Gui.set_padding(flow,1,1,2,2) - flow.style.horizontally_stretchable = true - flow.style.maximal_height = 215 - - flow.visible = false - - -- table to allow for nice looking labels - local flow_table = - flow.add{ - name='table', - type='table', - column_count=table_size - } - Gui.set_padding(flow_table) - flow_table.style.horizontally_stretchable = true - flow_table.style.vertical_align = 'center' - flow_table.style.cell_padding = 0 + return math.floor(position.x)..':'..math.floor(position.y) end +--- Gets if a player is allowed to use the action buttons local function player_allowed(player,action) if not config.progress['allow_'..action] then return false @@ -165,6 +43,166 @@ local function player_allowed(player,action) return true end +--- Used on the name label to allow zoom to map +local zoom_to_map_name = Gui.uid_name() +Gui.on_click(zoom_to_map_name,function(event) + local force = event.player.force + local rocket_silo_name = event.element.parent.caption + local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] + local position = rocket_silo_data.entity.position + event.player.zoom_to_world(position,2) +end) + +--- Used to launch the rocket, when it is ready +local launch_rocket = +Gui.new_button() +:set_sprites('utility/center') +:set_tooltip{'rocket-info.launch-tooltip'} +:set_embeded_flow(function(element,rocket_silo_name) + return 'launch-'..rocket_silo_name +end) +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + style.width = 16 + style.height = 16 +end) +:on_click(function(player,element) + local force = player.force + local rocket_silo_name = element.parent.name:sub(8) + local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] + if rocket_silo_data.entity.launch_rocket() then + rocket_silo_data.awaiting_reset = true + element.enabled = false + end +end) + +--- Used to toggle the auto launch on a rocket +local toggle_rocket = +Gui.new_button() +:set_sprites('utility/play') +:set_tooltip{'rocket-info.toggle-rocket-tooltip'} +:set_embeded_flow(function(element,rocket_silo_name) + return 'toggle-'..rocket_silo_name +end) +:set_style('tool_button',function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + style.width = 16 + style.height = 16 +end) +:on_click(function(player,element) + local force = player.force + local rocket_silo_name = element.parent.name:sub(7) + local rocket_silo = rocket_silos[force.name][rocket_silo_name] + local active = true -- need to test for auto launch + if active then + player.print('WIP; We currently have no way to test or set the auto launch of a rocket so this button does not work!') + element.sprite = 'utility/play' + element.tooltip = {'rocket-info.toggle-rocket-tooltip'} + -- insert function to disable auto launch + else + element.sprite = 'utility/stop' + element.tooltip = {'rocket-info.toggle-rocket-tooltip-disabled'} + -- insert function to enable auto launch + end +end) + +--- Used to toggle the visiblty of the different sections +local toggle_section = +Gui.new_button() +:set_sprites('utility/expand_dark','utility/expand') +:set_tooltip{'rocket-info.toggle-section-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 flow_name = element.parent.name + local flow = element.parent.parent.parent[flow_name] + if Gui.toggle_visible(flow) then + element.sprite = 'utility/collapse_dark' + element.hovered_sprite = 'utility/collapse' + element.tooltip = {'rocket-info.toggle-section-collapse-tooltip'} + else + element.sprite = 'utility/expand_dark' + element.hovered_sprite = 'utility/expand' + element.tooltip = {'rocket-info.toggle-section-tooltip'} + end +end) + +--- Used to create the three different sections +local function create_section(container,section_name,table_size) + --- Header for the section + local header = + container.add{ + type='frame', + name=section_name..'-header', + style='subheader_frame', + } + Gui.set_padding(header,1,1,3,3) + header.style.horizontally_stretchable = true + + --- Caption for the header bar + header.add{ + type='label', + style='heading_1_label', + caption={'rocket-info.section-caption-'..section_name}, + tooltip={'rocket-info.section-tooltip-'..section_name} + } + + --- Right aligned button to toggle the section + local expand_flow = Gui.create_right_align(header,section_name) + toggle_section(expand_flow) + + --- The area which contains the section content + local flow = + container.add{ + name=section_name, + type='scroll-pane', + direction='vertical', + horizontal_scroll_policy='never', + vertical_scroll_policy='auto-and-reserve-space' + } + Gui.set_padding(flow,1,1,2,2) + flow.style.horizontally_stretchable = true + flow.style.maximal_height = 215 + flow.visible = false + + --- Table used to store the data + local flow_table = + flow.add{ + name='table', + type='table', + column_count=table_size + } + Gui.set_padding(flow_table) + flow_table.style.horizontally_stretchable = true + flow_table.style.vertical_align = 'center' + flow_table.style.cell_padding = 0 +end + +--[[ Creates the main structure for the gui + element + > container + + >> stats-header + >>> stats + >>>> toggle_section.name + >> stats + >>> table + + >> milestones-header + >>> milestones + >>>> toggle_section.name + >> milestones + >>> table + + >> progress-header + >>> progress + >>>> toggle_section.name + >> progress + >>> table +]] local function generate_container(player,element) Gui.set_padding(element,1,2,2,2) element.style.minimal_width = 200 @@ -180,223 +218,257 @@ local function generate_container(player,element) Gui.set_padding(container) if config.stats.show_stats then - create_header_flow_combo(player,container,'stats',2,'Statistics','Stats about rockets') + create_section(container,'stats',2) end if config.milestones.show_milestones then - create_header_flow_combo(player,container,'milestones',2,'Milestones','Rocket milestones') + create_section(container,'milestones',2) end if config.progress.show_progress then - local col_count = 2 + local col_count = 3 if player_allowed(player,'remote_launch') then col_count = col_count+1 end if player_allowed(player,'toggle_active') then col_count = col_count+1 end - - create_header_flow_combo(player,container,'progress',col_count,'Build Progress','Build progress of rockets') + create_section(container,'progress',col_count) + --- label used when no active silos container.progress.add{ type='label', name='no_silos', - caption='Your force has no silos' + caption={'rocket-info.progress-no-silos'} } end end -local function create_label_pair_time(element,name,raw_value,caption,tooltip,no_hours) - local value = no_hours and format_time(raw_value,{minutes=true,seconds=true}) or format_time(raw_value) - local value_tooltip = format_time(raw_value,{hours=not no_hours,minutes=true,seconds=true,long=true}) - if not element[name] then - -- main label to show the name of the value +--- Creates a text label followed by a data label, or updates them if already present +local function create_label_value_pair(element,data_name,value,tooltip,extra) + local data_name_extra = extra and data_name..extra or data_name + if element[data_name_extra] then + element[data_name_extra].label.caption = value + element[data_name_extra].label.tooltip = tooltip + else + --- Label used with the data element.add{ type='label', - name=name..'-label', - caption=caption, - tooltip=tooltip + name=data_name_extra..'-label', + caption={'rocket-info.data-caption-'..data_name,extra}, + tooltip={'rocket-info.data-tooltip-'..data_name,extra} } - -- flow which allows right align for the value - local right_flow = Gui.create_right_align(element,name) + --- Right aligned label to store the data + local right_flow = Gui.create_right_align(element,data_name_extra) right_flow.add{ type='label', name='label', caption=value, - tooltip=value_tooltip + tooltip=tooltip } - else - element[name].label.caption = value - element[name].label.tooltip = value_tooltip end end +--- Creates a text and data label using times as the data +local function create_label_value_pair_time(element,data_name,raw_value,no_hours,extra) + local value = no_hours and format_time(raw_value,{minutes=true,seconds=true}) or format_time(raw_value) + local tooltip = format_time(raw_value,{hours=not no_hours,minutes=true,seconds=true,long=true}) + create_label_value_pair(element,data_name,value,tooltip,extra) +end + +--- Adds the data to the stats section local function generate_stats(player,frame) if not config.stats.show_stats then return end local element = frame.container.stats.table local force_rockets = player.force.rockets_launched if config.stats.show_first_rocket then - create_label_pair_time(element,'first_launch',rocket_stats.first_launch or 0,'First Launch','The time of launch of the first rocket') + create_label_value_pair_time(element,'first-launch',rocket_stats.first_launch or 0) end if config.stats.show_last_rocket then - create_label_pair_time(element,'last_launch',rocket_stats.last_launch or 0,'Last Launch','The time that the last rocket was launched') + create_label_value_pair_time(element,'last-launch',rocket_stats.last_launch or 0) end if config.stats.show_fastest_rocket then - create_label_pair_time(element,'fastest_launch',rocket_stats.fastest_launch or 0,'Fastest Launch','The time taken for the fastest launch',true) + create_label_value_pair_time(element,'fastest-launch',rocket_stats.fastest_launch or 0,true) end if config.stats.show_total_rockets then - local total_rockets = 0 - - for _,force in pairs(game.forces) do - total_rockets = total_rockets + force.rockets_launched + local total_rockets = 1 + if force_rockets > 0 then + total_rockets = 0 + for _,force in pairs(game.forces) do + total_rockets = total_rockets + force.rockets_launched + end end - total_rockets = total_rockets > 0 and total_rockets or 1 local percentage = math.round(force_rockets/total_rockets,3)*100 - - if not element.total_rockets then - -- main label to show the name of the value - element.add{ - type='label', - name='total_rockets-label', - caption='Total Lauched', - tooltip='The total number of rockets launched' - } - -- flow which allows right align for the value - local right_flow = Gui.create_right_align(element,'total_rockets') - right_flow.add{ - type='label', - name='label', - caption=force_rockets, - tooltip=percentage - } - else - element.total_rockets.label.caption = force_rockets - element.total_rockets.label.tooltip = percentage - end + create_label_value_pair(element,'total-rockets',force_rockets,{'rocket-info.value-tooltip-total-rockets',percentage}) end if config.stats.show_game_avg then - local tick = game.tick > 0 and game.tick or 1 - local avg = math.floor(force_rockets/tick) - create_label_pair_time(element,'avg_launch',avg,'Avg Launch','The average time to launch a rocket',true) + local avg = force_rockets > 0 and math.floor(game.tick/force_rockets) or 0 + create_label_value_pair_time(element,'avg-launch',avg,true) end - for _,over in pairs(config.stats.rolling_avg) do - local total = 0 - local rocket_count = 0 - for i = force_rockets,force_rockets-over,-1 do - if rocket_times[i] then - rocket_count = rocket_count + 1 - total = total + rocket_times[i] - end + for _,avg_over in pairs(config.stats.rolling_avg) do + local rocket_count = avg_over + local first_rocket = 0 + if avg_over < force_rockets then + first_rocket = rocket_times[player.force.name][force_rockets-avg_over] + else + rocket_count = force_rockets end - total = total > 0 and total or 1 - local avg = math.floor(rocket_count/total) - create_label_pair_time(element,'avg_launch_'..over,avg,'Avg Launch '..over,'The rolling average time to launch a rocket for the past '..over..' rockets',true) + local avg = rocket_count > 0 and math.floor((game.tick-first_rocket)/rocket_count) or 0 + create_label_value_pair_time(element,'avg-launch-n',avg,true,avg_over) end end +--- Creates the list of milestones local function generate_milestones(player,frame) if not config.milestones.show_milestones then return end local element = frame.container.milestones.table local force_rockets = player.force.rockets_launched for _,milestone in ipairs(config.milestones) do - if milestone <= force_rockets and not element['milstone-'..milestone] then - create_label_pair_time(element,'milstone-'..milestone,rocket_times[player.force.name][milestone],'Milestone '..milestone,'Time taken to launch '..milestone..' rockets') + if milestone <= force_rockets then + local time = rocket_times[player.force.name][milestone] + create_label_value_pair_time(element,'milstone-n',time,true,milestone) + else + create_label_value_pair_time(element,'milstone-n',0,true,milestone) + break end end end +--- Creats the different action buttons +local function generate_progress_buttons(player,element,rocket_silo_data) + local silo_name = rocket_silo_data.name + local status = rocket_silo_data.entity.status == 21 + local active = false -- need way to check this + + if player_allowed(player,'toggle_active') then + local button_element = element['toggle-'..silo_name] + + if button_element then + button_element = button_element[toggle_rocket.name] + else + button_element = toggle_rocket(element,silo_name) + end + + button_element.enabled = false -- remove once check is added + if active then + button_element.sprite = 'utility/stop' + else + button_element.sprite = 'utility/play' + end + end + + if player_allowed(player,'remote_launch') then + local button_element = element['launch-'..silo_name] + + if button_element then + button_element = button_element[launch_rocket.name] + else + button_element = launch_rocket(element,silo_name) + end + + if rocket_silo_data.awaiting_reset then + button_element.enabled = false + else + button_element.enabled = status + end + end + +end + +--- Creates build progress section local function generate_progress(player,frame) if not config.progress.show_progress then return end local element = frame.container.progress.table - local force = player.force.name + local force = player.force + local force_name = force.name + local force_silo_data = rocket_silos[force_name] - if not rocket_silos[force] or table.size(rocket_silos[force]) == 0 then + if not force_silo_data or table.size(force_silo_data) == 0 then element.parent.no_silos.visible = true else element.parent.no_silos.visible = false - for rocket_silo_name,rocket_silo in pairs(rocket_silos[force]) do - if not rocket_silo.entity or not rocket_silo.entity.valid then - rocket_silos[force][rocket_silo_name] = nil - if element['label_'..rocket_silo_name] then element['label_'..rocket_silo_name].destroy() end - if element['launch_'..rocket_silo_name] then element['launch_'..rocket_silo_name].destroy() end - if element['toggle_'..rocket_silo_name] then element['toggle_'..rocket_silo_name].destroy() end - if element[rocket_silo_name] then element[rocket_silo_name].destroy() end - elseif not element[rocket_silo_name] then - local progress = rocket_silo.entity.rocket_parts - local status = rocket_silo.entity.status == 21 - local active = false -- need way to check this + for silo_name,rocket_silo_data in pairs(force_silo_data) do + if not rocket_silo_data.entity or not rocket_silo_data.entity.valid then + force_silo_data[silo_name] = nil + Gui.destory_if_valid(element['toggle-'..silo_name]) + Gui.destory_if_valid(element['launch-'..silo_name]) + Gui.destory_if_valid(element['label-x-'..silo_name]) + Gui.destory_if_valid(element['label-y-'..silo_name]) + Gui.destory_if_valid(element[silo_name]) - if player_allowed(player,'toggle_active') then - local toggle_rocket_element = toggle_rocket(element,rocket_silo_name) - toggle_rocket_element.enabled = false -- remove when done - if active then - toggle_rocket_element.sprite = 'utility/stop' - else - toggle_rocket_element.sprite = 'utility/play' - end - end - - if player_allowed(player,'remote_launch') then - local launch_rocket_element = launch_rocket(element,rocket_silo_name) - launch_rocket_element.enabled = status - end - - -- main label to show the name of the value - local flow = element.add{type='flow',name='label_'..rocket_silo_name} - Gui.set_padding(flow,0,0,2,0) - flow.add{ - type='label', - name=zoom_to_map_name, - caption=rocket_silo_name, - tooltip='Click to view on map' + elseif not element[silo_name] then + local entity = rocket_silo_data.entity + local progress = entity.rocket_parts + local pos = { + x=entity.position.x, + y=entity.position.y } - -- flow which allows right align for the value - local right_flow = Gui.create_right_align(element,rocket_silo_name) + generate_progress_buttons(player,element,rocket_silo_data) + + --- Creats two flows and two labels for the X and Y position + local flow_x = element.add{ + type='flow', + name='label-x-'..silo_name, + caption=silo_name + } + Gui.set_padding(flow_x,0,0,1,2) + flow_x.add{ + type='label', + name=zoom_to_map_name, + caption={'rocket-info.progress-x-pos',pos.x}, + tooltip={'rocket-info.progress-label-tooltip'} + } + + local flow_y = element.add{ + type='flow', + name='label-y-'..silo_name, + caption=silo_name + } + Gui.set_padding(flow_y,0,0,1,2) + flow_y.add{ + type='label', + name=zoom_to_map_name, + caption={'rocket-info.progress-y-pos',pos.y}, + tooltip={'rocket-info.progress-label-tooltip'} + } + + --- Creates the progress value which is right aligned + local right_flow = Gui.create_right_align(element,silo_name) right_flow.add{ type='label', name='label', - caption=progress..'%', - tooltip=rocket_silo.launched or 0 + caption={'rocket-info.progress-caption',progress}, + tooltip={'rocket-info.progress-tooltip',rocket_silo_data.launched or 0} } else - local progress = rocket_silo.entity.rocket_parts - local status = rocket_silo.entity.status == 21 - local active = false -- need way to check this + local entity = rocket_silo_data.entity + local progress = entity.rocket_parts + local status = entity.status == 21 - local label = element[rocket_silo_name].label - label.caption = progress..'%' - label.tooltip = rocket_silo.launched or 0 + local label = element[silo_name].label + label.caption = {'rocket-info.progress-caption',progress} + label.tooltip = {'rocket-info.progress-tooltip',rocket_silo_data.launched or 0} - if status then - label.caption = '100%' + if status and rocket_silo_data.awaiting_reset then + label.caption = {'rocket-info.progress-launched'} + label.style.font_color = Colors.green + elseif status then + label.caption = {'rocket-info.progress-caption',100} label.style.font_color = Colors.cyan else + rocket_silo_data.awaiting_reset = false label.style.font_color = Colors.white end - if player_allowed(player,'toggle_active') then - local toggle_rocket_element = element['toggle_'..rocket_silo_name] - if active then - toggle_rocket_element[toggle_rocket.name].sprite = 'utility/stop' - else - toggle_rocket_element[toggle_rocket.name].sprite = 'utility/play' - end - end - - if player_allowed(player,'remote_launch') then - local launch_rocket_element = element['launch_'..rocket_silo_name] - launch_rocket_element[launch_rocket.name].enabled = status - end - - + generate_progress_buttons(player,element,rocket_silo_data) end end @@ -408,12 +480,10 @@ local rocket_info = Gui.new_left_frame('gui/rocket-info') :set_sprites('entity/rocket-silo') :set_post_authenticator(function(player,define_name) - return true - --return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name) + return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name) end) :set_open_by_default(function(player,define_name) - return true - --return player.force.rockets_launched > 0 + return player.force.rockets_launched > 0 end) :set_direction('vertical') :on_draw(function(player,element) @@ -429,15 +499,20 @@ end) end) Event.add(defines.events.on_rocket_launched,function(event) + local entity = event.rocket_silo + local silo_name = get_silo_name(entity) local force = event.rocket_silo.force local force_name = force.name + local force_silo_data = rocket_silos[force_name] local rockets_launched = force.rockets_launched + local first_rocket = rockets_launched == 1 + --- Handles updates to the rocket stats if not rocket_stats[force_name] then rocket_stats[force_name] = {} end - if rockets_launched == 1 then + if first_rocket then rocket_stats.first_launch = event.tick rocket_stats.fastest_launch = event.tick elseif event.tick-rocket_stats.last_launch < rocket_stats.fastest_launch then @@ -446,30 +521,34 @@ Event.add(defines.events.on_rocket_launched,function(event) rocket_stats.last_launch = event.tick + --- Appends the new rocket into the array if not rocket_times[force_name] then rocket_times[force_name] = {} end rocket_times[force_name][rockets_launched] = event.tick - local silo_name = get_silo_name(event.rocket_silo) - - if not rocket_silos[force_name] then - rocket_silos[force_name] = {} - end - - if not rocket_silos[force_name][silo_name] then - rocket_silos[force_name][silo_name] = {entity=event.rocket_silo,launched=0} - end - - rocket_silos[force_name][silo_name].launched = rocket_silos[force_name][silo_name].launched+1 + --- Adds this 1 to the launch count for this silo + force_silo_data[silo_name].launched = force_silo_data[silo_name].launched+1 + --- Updates all the guis (and toolbar since the button may now be visible) for _,player in pairs(force.players) do rocket_info:update(player) - Gui.update_toolbar(player) + if first_rocket then Gui.update_toolbar(player) end end end) +--- When a launch is reiggered it will await reset +Event.add(defines.events.on_rocket_launch_ordered,function(event) + local entity = event.rocket_silo + local silo_name = get_silo_name(entity) + local force = event.rocket_silo.force + local force_name = force.name + local force_silo_data = rocket_silos[force_name] + force_silo_data[silo_name].awaiting_reset = true +end) + +--- Adds a silo to the list when it is built local function on_built(event) local entity = event.created_entity if entity.valid and entity.name == 'rocket-silo' then @@ -481,16 +560,24 @@ local function on_built(event) rocket_silos[force_name] = {} end - rocket_silos[force_name][silo_name] = {entity=entity,launched=0} + rocket_silos[force_name][silo_name] = { + name=silo_name, + entity=entity, + launched=0, + awaiting_reset=false + } for _,player in pairs(force.players) do - rocket_info:update(player) + local frame = rocket_info:get_frame(player) + generate_progress(player,frame) end end end Event.add(defines.events.on_built_entity,on_built) Event.add(defines.events.on_robot_built_entity,on_built) + +--- Optimised update for only the build progress Event.on_nth_tick(150,function() for _,force in pairs(game.forces) do local silos = rocket_silos[force.name] From 0ddf4676fe3bc0e38c3b918f1b7ccbd4786aa890 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 01:20:58 +0100 Subject: [PATCH 12/41] Added config for silo script --- config/advanced_start.lua | 3 +++ modules/addons/advanced-start.lua | 10 ++++++++ modules/factorio-control.lua | 39 ++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/config/advanced_start.lua b/config/advanced_start.lua index 0847ac6d..586530ad 100644 --- a/config/advanced_start.lua +++ b/config/advanced_start.lua @@ -62,6 +62,9 @@ end return { skip_intro=true, -- skips the intro given in the default factorio free play scenario + skip_victory=true, -- will skip the victory screen when a rocket is launched + disable_base_game_silo_script=true, -- will not load the silo script at all + research_queue_from_start=true, -- when true the research queue is useible from the start friendly_fire=false, -- weather players will be able to attack each other on the same force enemy_expansion=false, -- a catch all for in case the map settings file fails to load chart_radius=10*32, -- the number of tiles that will be charted when the map starts diff --git a/modules/addons/advanced-start.lua b/modules/addons/advanced-start.lua index 07ed9ddc..5379705b 100644 --- a/modules/addons/advanced-start.lua +++ b/modules/addons/advanced-start.lua @@ -31,4 +31,14 @@ Event.on_init(function() remote.call('freeplay','set_created_items',{}) remote.call('freeplay','set_chart_distance',0) remote.call('freeplay','set_skip_intro',config.skip_intro) + if config.research_queue_from_start then + for _,force in pairs(game.forces) do + force.research_queue_enabled = true + end + end + if not config.disable_base_game_silo_script then + if config.skip_victory then + remote.call('silo_script','set_no_victory',true) + end + end end) \ No newline at end of file diff --git a/modules/factorio-control.lua b/modules/factorio-control.lua index 13557506..20394547 100644 --- a/modules/factorio-control.lua +++ b/modules/factorio-control.lua @@ -1,8 +1,13 @@ local Event = require 'utils.event' local Global = require 'utils.global' +local config = require 'config.advanced_start' +local use_silo_script = not config.disable_base_game_silo_script local util = require("util") -local silo_script = require("silo-script") +local silo_script +if use_silo_script then + silo_script = require("silo-script") +end local global = {} Global.register(global,function(tbl) @@ -29,8 +34,10 @@ local respawn_items = function() } end -for k,v in pairs(silo_script.get_events()) do - Event.add(k, v) +if use_silo_script then + for k,v in pairs(silo_script.get_events()) do + Event.add(k, v) + end end Event.add(defines.events.on_player_created, function(event) @@ -48,27 +55,37 @@ Event.add(defines.events.on_player_created, function(event) end end - silo_script.on_event(event) + if use_silo_script then + silo_script.on_event(event) + end end) Event.add(defines.events.on_player_respawned, function(event) local player = game.players[event.player_index] util.insert_safe(player, global.respawn_items) - silo_script.on_event(event) + if use_silo_script then + silo_script.on_event(event) + end end) -Event.on_load(function() - silo_script.on_load() -end) +if use_silo_script then + Event.on_load(function() + silo_script.on_load() + end) +end Event.on_init(function() global.created_items = created_items() global.respawn_items = respawn_items() - silo_script.on_init() + if use_silo_script then + silo_script.on_init() + end end) -silo_script.add_remote_interface() -silo_script.add_commands() +if use_silo_script then + silo_script.add_remote_interface() + silo_script.add_commands() +end remote.add_interface("freeplay", { From 84a377f4e57e81dccc18728f4d207e8c5b2510d0 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 01:37:43 +0100 Subject: [PATCH 13/41] Updated config for rocket Gui --- config/rockets.lua | 42 +++++++++++++++++-------------------- modules/gui/rocket-info.lua | 15 +++++++------ 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/config/rockets.lua b/config/rockets.lua index f6e7cb3b..7025ae16 100644 --- a/config/rockets.lua +++ b/config/rockets.lua @@ -1,22 +1,18 @@ --- This file controls what will show in each section of the rocket info gui --- each function will be given the player and must return the value to show and a tooltip, nil will not show the stat -local Global = require 'utils.global' -local Event = require 'utils.event' - return { - stats = { - show_stats=true, - show_first_rocket = true, - show_last_rocket = true, - show_fastest_rocket = true, - show_total_rockets = true, - show_game_avg = true, - rolling_avg = { + stats = { --- The data that will show in the stats section + show_stats=true, -- false will hide this section all together + show_first_rocket = true, -- false will not show when the first rocket was launched + show_last_rocket = true, -- false will not show when the last rocket was launched + show_fastest_rocket = true, -- false will not show the time taken for the fastest rocket + show_total_rockets = true, -- false will not show the total number of rockets launched + show_game_avg = true, -- false will hide the avg across the entire map time + rolling_avg = { -- each number will be one stat; 5 means the avg time taken for the last 5 rockets 5,10,25 } }, - milestones = { - show_milestones=true, + milestones = { -- each number will be one stat; 5 means the time that the 5th rocket was launched + show_milestones=true, -- false will hide this section all together 1,2,5, 10,20,50, 100,200,500, @@ -24,14 +20,14 @@ return { 3000,3500,4000,4500, 5000 }, - progress = { - show_progress = true, - allow_zoom_to_map = true, - allow_remote_launch = true, - remote_launch_admins_only = false, - remote_launch_role_permision = 'gui/rocket-info/remote_launch', - allow_toggle_active = true, - toggle_active_admins_only = false, - toggle_active_role_permision = 'gui/rocket-info/toggle-active' + progress = { --- The data and buttons in the build progress section + show_progress = true, -- false will hide this section altogether + allow_zoom_to_map = true, -- false will disable the zoom to map feature + allow_remote_launch = true, -- false removes the remote launch button for all players + remote_launch_admins_only = false, -- true will remove the remote launch button for all non (game) admins + remote_launch_role_permision = 'gui/rocket-info/remote_launch', -- value used by custom permission system to allow or disllow the button + allow_toggle_active = true, -- false removes the remote toggle auto launch button for all players + toggle_active_admins_only = false, -- true will remove the toggle auto launch button for all non (game) admins + toggle_active_role_permision = 'gui/rocket-info/toggle-active' -- value used by custom permission system to allow or disllow the button } } \ No newline at end of file diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 3171643d..53734299 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -139,7 +139,7 @@ local function create_section(container,section_name,table_size) name=section_name..'-header', style='subheader_frame', } - Gui.set_padding(header,1,1,3,3) + Gui.set_padding(header,4,1,4,4) header.style.horizontally_stretchable = true --- Caption for the header bar @@ -413,6 +413,8 @@ local function generate_progress(player,frame) generate_progress_buttons(player,element,rocket_silo_data) --- Creats two flows and two labels for the X and Y position + local name = config.progress.allow_zoom_to_map and zoom_to_map_name or nil + local tooltip = config.progress.allow_zoom_to_map and {'rocket-info.progress-label-tooltip'} or nil local flow_x = element.add{ type='flow', name='label-x-'..silo_name, @@ -421,9 +423,9 @@ local function generate_progress(player,frame) Gui.set_padding(flow_x,0,0,1,2) flow_x.add{ type='label', - name=zoom_to_map_name, + name=name, caption={'rocket-info.progress-x-pos',pos.x}, - tooltip={'rocket-info.progress-label-tooltip'} + tooltip=tooltip } local flow_y = element.add{ @@ -434,9 +436,9 @@ local function generate_progress(player,frame) Gui.set_padding(flow_y,0,0,1,2) flow_y.add{ type='label', - name=zoom_to_map_name, + name=name, caption={'rocket-info.progress-y-pos',pos.y}, - tooltip={'rocket-info.progress-label-tooltip'} + tooltip=tooltip } --- Creates the progress value which is right aligned @@ -483,7 +485,8 @@ Gui.new_left_frame('gui/rocket-info') return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name) end) :set_open_by_default(function(player,define_name) - return player.force.rockets_launched > 0 + return true + --return player.force.rockets_launched > 0 end) :set_direction('vertical') :on_draw(function(player,element) From 361438400f5ef52a19469b1e79a8cc269e7cb19d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 01:38:42 +0100 Subject: [PATCH 14/41] Removed debug open by deafult --- modules/gui/rocket-info.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 53734299..6a62a6f4 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -485,8 +485,7 @@ Gui.new_left_frame('gui/rocket-info') return player.force.rockets_launched > 0 and Gui.classes.toolbar.allowed(player,define_name) end) :set_open_by_default(function(player,define_name) - return true - --return player.force.rockets_launched > 0 + return player.force.rockets_launched > 0 end) :set_direction('vertical') :on_draw(function(player,element) From 53ebc00631c8d6f2c7a8f48779ce274602c997eb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 19:39:13 +0100 Subject: [PATCH 15/41] Added science info --- config/_file_loader.lua | 3 +- config/roles.lua | 1 + expcore/common.lua | 12 +- expcore/gui/left.lua | 4 +- locale/en/gui.cfg | 13 +- modules/gui/science-info.lua | 329 +++++++++++++++++++++++++++++++++++ 6 files changed, 357 insertions(+), 5 deletions(-) create mode 100644 modules/gui/science-info.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 746bbcb7..38857d22 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -34,8 +34,9 @@ return { 'modules.addons.pollution-grading', 'modules.addons.random-player-colours', -- GUI - 'modules.gui.player-list', 'modules.gui.rocket-info', + 'modules.gui.science-info', + 'modules.gui.player-list', 'modules.commands.debug', -- Config Files 'config.expcore-commands.auth_admin', -- commands tagged with admin_only are blocked for non admins diff --git a/config/roles.lua b/config/roles.lua index 532b2db5..dab32e8f 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -190,6 +190,7 @@ local default = Roles.new_role('Guest','') 'command/report', 'gui/player-list', 'gui/rocket-info', + 'gui/science-info', } --- Jail role diff --git a/expcore/common.lua b/expcore/common.lua index 8e8c6e72..41adffd5 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -171,7 +171,8 @@ function Public.format_time(ticks,options) seconds=false, long=false, time=false, - string=false + string=false, + null=false } -- Basic numbers that are used in calculations local max_days, max_hours, max_minutes, max_seconds = ticks/5184000, ticks/216000, ticks/3600, ticks/60 @@ -188,6 +189,13 @@ function Public.format_time(ticks,options) if not options.minutes then rtn_seconds = rtn_seconds + rtn_minutes*60 end + -- Creates the null time format, does not work with long + if options.null and not options.long then + rtn_days='--' + rtn_hours='--' + rtn_minutes='--' + rtn_seconds='--' + end -- Format options local suffix = 'time-symbol-' local suffix_2 = '-short' @@ -215,7 +223,7 @@ function Public.format_time(ticks,options) rtn_minutes = {suffix..'minutes'..suffix_2,rtn_minutes} rtn_seconds = {suffix..'seconds'..suffix_2,rtn_seconds} end - else + elseif not options.null then -- weather string or not it has same format rtn_days = string.format('%02d',rtn_days) rtn_hours = string.format('%02d',rtn_hours) diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index aeb528d3..b96e587c 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -154,6 +154,8 @@ end function LeftFrames._prototype:set_open_by_default(state) if state == false then self.open_by_default = false + elseif state == nil then + self.open_by_default = true else self.open_by_default = state end @@ -282,7 +284,7 @@ Event.add(defines.events.on_player_created,function(event) define.events.on_draw(player,frame) end - if define.open_by_default == false then + if not define.open_by_default then frame.visible = false elseif type(define.open_by_default) == 'function' then if not define.open_by_default(player,define.name) then diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index e7e2aee4..32b8088a 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -51,4 +51,15 @@ progress-y-pos=Y __1__ progress-label-tooltip=View on map progress-launched=Launched progress-caption=__1__% -progress-tooltip=This silo has launched __1__ rockets \ No newline at end of file +progress-tooltip=This silo has launched __1__ rockets + +[science-info] +main-caption=Science Packs +main-tooltip=Science Info +eta-caption=ETA: +eta-tooltip=The estimated time left for the current research +eta-time=T- __1__ +unit=__1__spm +pos-tooltip=Total made: __1__ +neg-tooltip=Total used: __1__ +net-tooltip=Total net: __1__ \ No newline at end of file diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua new file mode 100644 index 00000000..2775a168 --- /dev/null +++ b/modules/gui/science-info.lua @@ -0,0 +1,329 @@ +local Gui = require 'expcore.gui' +local Event = require 'utils.event' +local Colors = require 'resources.color_presets' +local format_time = ext_require('expcore.common','format_time') +local format_number = ext_require('util','format_number') + +local null_time_short = {'science-info.eta-time',format_time(0,{hours=true,minutes=true,seconds=true,time=true,null=true})} +local null_time_long = format_time(0,{hours=true,minutes=true,seconds=true,long=true,null=true}) + +local science_packs ={ + red='automation-science-pack', + green='logistic-science-pack', + grey='military-science-pack', + blue='chemical-science-pack', + purple='production-science-pack', + yellow='utility-science-pack', + white='space-science-pack', +} + +local function get_production_stats(player,science_pack) + local item_name = science_packs[science_pack] + local force = player.force + local stats = force.item_production_statistics + local total_made = stats.get_input_count(item_name) + local total_used = stats.get_output_count(item_name) + local minute_made = stats.get_flow_count{ + name=item_name, + input=true, + precision_index=defines.flow_precision_index.one_minute, + } + local minute_used = stats.get_flow_count{ + name=item_name, + input=false, + precision_index=defines.flow_precision_index.one_minute, + } + return { + total_made=total_made, + total_used=total_used, + total_net=total_made-total_used, + minute_made=minute_made, + minute_used=minute_used, + minute_net=minute_made-minute_used + } +end + +local function get_font_colour(value,secondary) + if value > 1 then + return Colors.light_green + elseif value < -1 then + return Colors.indian_red + elseif secondary and secondary > 0 or not secondary and value ~= 0 then + return Colors.orange + else + return Colors.grey + end +end + +local function generate_container(player,element) + Gui.set_padding(element,1,2,2,2) + element.style.minimal_width = 200 + + -- main container which contains the other elements + local container = + element.add{ + name='container', + type='frame', + direction='vertical', + style='window_content_frame_packed' + } + Gui.set_padding(container) + + -- main header for the gui + local header = + container.add{ + name='header', + type='frame', + caption={'science-info.main-caption'}, + style='subheader_frame' + } + Gui.set_padding(header,2,2,4,4) + header.style.horizontally_stretchable = true + + -- main flow for the data + local flow = + container.add{ + name='scroll', + type='scroll-pane', + direction='vertical', + horizontal_scroll_policy='never', + vertical_scroll_policy='auto-and-reserve-space' + } + Gui.set_padding(flow,1,1,2,2) + flow.style.horizontally_stretchable = true + flow.style.maximal_height = 185 + + -- table that stores all the data + local flow_table = + flow.add{ + name='table', + type='table', + column_count=4 + } + Gui.set_padding(flow_table) + flow_table.style.horizontally_stretchable = true + flow_table.style.vertical_align = 'center' + + -- footer used to store the eta + local footer = + container.add{ + name='footer', + type='frame', + style='subheader_frame' + } + Gui.set_padding(footer,2,2,4,4) + footer.style.horizontally_stretchable = true + + -- label for the footer + footer.add{ + name='eta-label', + type='label', + caption={'science-info.eta-caption'}, + tooltip={'science-info.eta-tooltip'}, + style='heading_1_label' + } + + -- data for the footer + local right_align = Gui.create_right_align(footer,'eta') + local eta = + right_align.add{ + name='label', + type='label', + caption=null_time_short, + tooltip=null_time_long, + style='heading_1_label' + } + + return flow_table, eta +end + +local function add_data_pair(element,name,value,secondary,tooltip) + local data_colour = get_font_colour(value,secondary) + local caption = format_number(math.round(value,1),true) + + local surfix = caption:sub(-1) + if not tonumber(surfix) then + caption = caption:sub(1,-2) + else + surfix = '' + end + + if value > 0 then + caption = '+'..caption + elseif value == 0 and caption:sub(1,1) == '-' then + caption = caption:sub(2) + end + + if element[name] then + local data = element[name].label + data.caption = caption + data.tooltip = tooltip + data.style.font_color = data_colour + local label = element['spm-'..name] + label.caption = {'science-info.unit',surfix} + label.tooltip = tooltip + label.style.font_color = data_colour + + else + -- right aligned number + local right_align = Gui.create_right_align(element,name) + local data = + right_align.add{ + name='label', + type='label', + caption=caption, + tooltip=tooltip + } + data.style.font_color = data_colour + + -- adds the unit onto the end + local label = + element.add{ + name='spm-'..name, + type='label', + caption={'science-info.unit',surfix}, + tooltip=tooltip + } + label.style.font_color = data_colour + end +end + +local function generate_science_pack(player,element,pack_name) + local stats = get_production_stats(player,pack_name) + local item_name = science_packs[pack_name] + if stats.total_made > 0 then + local icon_style = 'quick_bar_slot_button' + if stats.minute_net > 1 then + icon_style = 'green_slot_button' + elseif stats.minute_net < -1 then + icon_style = 'red_slot_button' + elseif stats.minute_made > 0 then + icon_style = 'selected_slot_button' + end + + local icon = element['icon-'..pack_name] + + if icon then + icon.style = icon_style + icon.style.height = 55 + if icon_style == 'quick_bar_slot_button' then + icon.style.width = 36 + Gui.set_padding(icon,0,0,-2,-2) + end + + else + icon = + element.add{ + name='icon-'..pack_name, + type='sprite-button', + sprite='item/'..item_name, + tooltip={'item-name.'..item_name}, + style=icon_style + } + icon.style.height = 55 + if icon_style == 'quick_bar_slot_button' then + icon.style.width = 36 + Gui.set_padding(icon,0,0,-2,-2) + end + + end + + local delta = element['delta-'..pack_name] + + if not delta then + delta = + element.add{ + name='delta-'..pack_name, + type='frame', + style='bordered_frame' + } + Gui.set_padding(delta,0,0,3,3) + + local delta_table = + delta.add{ + name='table', + type='table', + column_count=2 + } + Gui.set_padding(delta_table) + end + + add_data_pair(delta.table,'pos-'..pack_name,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) + add_data_pair(delta.table,'neg-'..pack_name,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) + add_data_pair(element,'net-'..pack_name,stats.minute_net,stats.minute_made,{'science-info.net-tooltip',stats.total_net}) + end +end + +local function generate_eta(player,element) + local force = player.force + local research = force.current_research + if not research then + element.caption = null_time_short + element.tooltip = null_time_long + + else + local progress = force.research_progress + local remaining = research.research_unit_count*(1-progress) + local limit + + local stats = player.force.item_production_statistics + for _,ingredient in pairs(research.research_unit_ingredients) do + local pack_name = ingredient.name + local required = ingredient.amount * remaining + local consumed = stats.get_flow_count{ + name=pack_name, + input=false, + precision_index=defines.flow_precision_index.one_minute, + } + if consumed == 0 then + limit = -1 + break + end + local minutes = required / consumed + if not limit or limit < minutes then + limit = minutes + end + end + + if not limit or limit == -1 then + element.caption = null_time_short + element.tooltip = null_time_long + + else + local ticks = limit*3600 + element.caption = {'science-info.eta-time',format_time(ticks,{hours=true,minutes=true,seconds=true,time=true})} + element.tooltip = format_time(ticks,{hours=true,minutes=true,seconds=true,long=true}) + + end + end +end + +local science_info = +Gui.new_left_frame('gui/science-info') +:set_sprites('entity/lab') +:set_direction('vertical') +:set_tooltip{'science-info.main-tooltip'} +:on_draw(function(player,element) + local table, eta = generate_container(player,element) + + for pack_name,item_name in pairs(science_packs) do + generate_science_pack(player,table,pack_name) + end + + generate_eta(player,eta) +end) +:on_update(function(player,element) + local container = element.container + local table = container.scroll.table + local eta = container.footer.eta.label + + for pack_name,item_name in pairs(science_packs) do + generate_science_pack(player,table,pack_name) + end + + generate_eta(player,eta) +end) + +Event.on_nth_tick(60,science_info 'update_all') + +return science_info \ No newline at end of file From 81b99162989f1032d26c2547810b7ccc59af8516 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 28 May 2019 19:55:57 +0100 Subject: [PATCH 16/41] Small changes to science info --- config/science.lua | 10 +++ locale/en/gui.cfg | 3 +- modules/gui/science-info.lua | 126 ++++++++++++++++++----------------- 3 files changed, 78 insertions(+), 61 deletions(-) create mode 100644 config/science.lua diff --git a/config/science.lua b/config/science.lua new file mode 100644 index 00000000..9fd7334a --- /dev/null +++ b/config/science.lua @@ -0,0 +1,10 @@ +return { + show_eta=true, + 'automation-science-pack', + 'logistic-science-pack', + 'military-science-pack', + 'chemical-science-pack', + 'production-science-pack', + 'utility-science-pack', + 'space-science-pack', +} \ No newline at end of file diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 32b8088a..d38a2e9c 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -62,4 +62,5 @@ eta-time=T- __1__ unit=__1__spm pos-tooltip=Total made: __1__ neg-tooltip=Total used: __1__ -net-tooltip=Total net: __1__ \ No newline at end of file +net-tooltip=Total net: __1__ +no-packs=You have not made any science packs yet \ No newline at end of file diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua index 2775a168..a0f63fcf 100644 --- a/modules/gui/science-info.lua +++ b/modules/gui/science-info.lua @@ -3,33 +3,23 @@ local Event = require 'utils.event' local Colors = require 'resources.color_presets' local format_time = ext_require('expcore.common','format_time') local format_number = ext_require('util','format_number') +local config = require 'config.science' local null_time_short = {'science-info.eta-time',format_time(0,{hours=true,minutes=true,seconds=true,time=true,null=true})} local null_time_long = format_time(0,{hours=true,minutes=true,seconds=true,long=true,null=true}) -local science_packs ={ - red='automation-science-pack', - green='logistic-science-pack', - grey='military-science-pack', - blue='chemical-science-pack', - purple='production-science-pack', - yellow='utility-science-pack', - white='space-science-pack', -} - local function get_production_stats(player,science_pack) - local item_name = science_packs[science_pack] local force = player.force local stats = force.item_production_statistics - local total_made = stats.get_input_count(item_name) - local total_used = stats.get_output_count(item_name) + local total_made = stats.get_input_count(science_pack) + local total_used = stats.get_output_count(science_pack) local minute_made = stats.get_flow_count{ - name=item_name, + name=science_pack, input=true, precision_index=defines.flow_precision_index.one_minute, } local minute_used = stats.get_flow_count{ - name=item_name, + name=science_pack, input=false, precision_index=defines.flow_precision_index.one_minute, } @@ -44,9 +34,9 @@ local function get_production_stats(player,science_pack) end local function get_font_colour(value,secondary) - if value > 1 then + if value > 5 then return Colors.light_green - elseif value < -1 then + elseif value < -5 then return Colors.indian_red elseif secondary and secondary > 0 or not secondary and value ~= 0 then return Colors.orange @@ -79,6 +69,7 @@ local function generate_container(player,element) } Gui.set_padding(header,2,2,4,4) header.style.horizontally_stretchable = true + header.style.use_header_filler = false -- main flow for the data local flow = @@ -93,6 +84,16 @@ local function generate_container(player,element) flow.style.horizontally_stretchable = true flow.style.maximal_height = 185 + -- message to say that you have not made any packs yet + local non_made = + flow.add{ + name='non_made', + type='label', + caption={'science-info.no-packs'} + } + non_made.style.width = 200 + non_made.style.single_line = false + -- table that stores all the data local flow_table = flow.add{ @@ -104,35 +105,38 @@ local function generate_container(player,element) flow_table.style.horizontally_stretchable = true flow_table.style.vertical_align = 'center' - -- footer used to store the eta - local footer = - container.add{ - name='footer', - type='frame', - style='subheader_frame' - } - Gui.set_padding(footer,2,2,4,4) - footer.style.horizontally_stretchable = true + local eta + if config.show_eta then + -- footer used to store the eta + local footer = + container.add{ + name='footer', + type='frame', + style='subheader_frame' + } + Gui.set_padding(footer,2,2,4,4) + footer.style.horizontally_stretchable = true - -- label for the footer - footer.add{ - name='eta-label', - type='label', - caption={'science-info.eta-caption'}, - tooltip={'science-info.eta-tooltip'}, - style='heading_1_label' - } + -- label for the footer + footer.add{ + name='eta-label', + type='label', + caption={'science-info.eta-caption'}, + tooltip={'science-info.eta-tooltip'}, + style='heading_1_label' + } - -- data for the footer - local right_align = Gui.create_right_align(footer,'eta') - local eta = - right_align.add{ - name='label', - type='label', - caption=null_time_short, - tooltip=null_time_long, - style='heading_1_label' - } + -- data for the footer + local right_align = Gui.create_right_align(footer,'eta') + eta = + right_align.add{ + name='label', + type='label', + caption=null_time_short, + tooltip=null_time_long, + style='heading_1_label' + } + end return flow_table, eta end @@ -188,10 +192,11 @@ local function add_data_pair(element,name,value,secondary,tooltip) end end -local function generate_science_pack(player,element,pack_name) - local stats = get_production_stats(player,pack_name) - local item_name = science_packs[pack_name] +local function generate_science_pack(player,element,science_pack) + local stats = get_production_stats(player,science_pack) if stats.total_made > 0 then + element.parent.non_made.visible = false + local icon_style = 'quick_bar_slot_button' if stats.minute_net > 1 then icon_style = 'green_slot_button' @@ -201,7 +206,7 @@ local function generate_science_pack(player,element,pack_name) icon_style = 'selected_slot_button' end - local icon = element['icon-'..pack_name] + local icon = element['icon-'..science_pack] if icon then icon.style = icon_style @@ -214,10 +219,10 @@ local function generate_science_pack(player,element,pack_name) else icon = element.add{ - name='icon-'..pack_name, + name='icon-'..science_pack, type='sprite-button', - sprite='item/'..item_name, - tooltip={'item-name.'..item_name}, + sprite='item/'..science_pack, + tooltip={'item-name.'..science_pack}, style=icon_style } icon.style.height = 55 @@ -228,12 +233,12 @@ local function generate_science_pack(player,element,pack_name) end - local delta = element['delta-'..pack_name] + local delta = element['delta-'..science_pack] if not delta then delta = element.add{ - name='delta-'..pack_name, + name='delta-'..science_pack, type='frame', style='bordered_frame' } @@ -248,13 +253,14 @@ local function generate_science_pack(player,element,pack_name) Gui.set_padding(delta_table) end - add_data_pair(delta.table,'pos-'..pack_name,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) - add_data_pair(delta.table,'neg-'..pack_name,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) - add_data_pair(element,'net-'..pack_name,stats.minute_net,stats.minute_made,{'science-info.net-tooltip',stats.total_net}) + add_data_pair(delta.table,'pos-'..science_pack,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) + add_data_pair(delta.table,'neg-'..science_pack,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) + add_data_pair(element,'net-'..science_pack,stats.minute_net,stats.minute_made,{'science-info.net-tooltip',stats.total_net}) end end local function generate_eta(player,element) + if not config.show_eta then return end local force = player.force local research = force.current_research if not research then @@ -306,8 +312,8 @@ Gui.new_left_frame('gui/science-info') :on_draw(function(player,element) local table, eta = generate_container(player,element) - for pack_name,item_name in pairs(science_packs) do - generate_science_pack(player,table,pack_name) + for _,science_pack in ipairs(config) do + generate_science_pack(player,table,science_pack) end generate_eta(player,eta) @@ -317,8 +323,8 @@ end) local table = container.scroll.table local eta = container.footer.eta.label - for pack_name,item_name in pairs(science_packs) do - generate_science_pack(player,table,pack_name) + for _,science_pack in ipairs(config) do + generate_science_pack(player,table,science_pack) end generate_eta(player,eta) From df014a12077ce7d223d0712161d25cab04102afc Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 19:01:32 +0100 Subject: [PATCH 17/41] Added task list --- config/_file_loader.lua | 1 + config/roles.lua | 2 + config/tasks.lua | 4 + expcore/gui/left.lua | 2 +- locale/en/gui.cfg | 15 +- modules/gui/task-list.lua | 371 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 393 insertions(+), 2 deletions(-) create mode 100644 config/tasks.lua create mode 100644 modules/gui/task-list.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 38857d22..23eb99dd 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -36,6 +36,7 @@ return { -- GUI 'modules.gui.rocket-info', 'modules.gui.science-info', + 'modules.gui.task-list', 'modules.gui.player-list', 'modules.commands.debug', -- Config Files diff --git a/config/roles.lua b/config/roles.lua index dab32e8f..ebc40583 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -159,6 +159,7 @@ Roles.new_role('Member','Mem') :set_custom_color{r=24,g=172,b=188} :set_parent('Regular') :allow{ + 'gui/task-list/edit' } Roles.new_role('Regular','Reg') @@ -191,6 +192,7 @@ local default = Roles.new_role('Guest','') 'gui/player-list', 'gui/rocket-info', 'gui/science-info', + 'gui/task-list', } --- Jail role diff --git a/config/tasks.lua b/config/tasks.lua new file mode 100644 index 00000000..0a1a3d13 --- /dev/null +++ b/config/tasks.lua @@ -0,0 +1,4 @@ +return { + only_admins_can_edit = false, + edit_tasks_role_permision = 'gui/task-list/edit' +} \ No newline at end of file diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index b96e587c..35a8b66b 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -243,7 +243,7 @@ function LeftFrames._prototype:event_handler(action) action = action or 'update' return function(event) local player - if event.player_index then + if event and event.player_index then player = Game.get_player_by_index(event.player_index) end self[action](self,player) diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index d38a2e9c..882562a3 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -63,4 +63,17 @@ unit=__1__spm pos-tooltip=Total made: __1__ neg-tooltip=Total used: __1__ net-tooltip=Total net: __1__ -no-packs=You have not made any science packs yet \ No newline at end of file +no-packs=You have not made any science packs yet + +[task-list] +main-caption=Task List +main-tooltip=Task list +sub-tooltip=Tasks that remain to be done +no-tasks=You have no tasks +last-edit=Last edited by __1__ at __2__ +add-tooltip=Add new task +confirm-tooltip=Save changes +cancel-tooltip=Discard changes +edit-tooltip=Currently being edited by: __1__ +edit-tooltip-none=Currently being edited by: Nobody +discord-tooltip=Remove task \ No newline at end of file diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua new file mode 100644 index 00000000..6a1b82c8 --- /dev/null +++ b/modules/gui/task-list.lua @@ -0,0 +1,371 @@ +local Gui = require 'expcore.gui' +local Store = require 'expcore.store' +local Global = require 'utils.global' +local Roles = require 'expcore.roles' +local Token = require 'utils.token' +local config = require 'config.tasks' +local format_time,table_keys = ext_require('expcore.common','format_time','table_keys') + +local task_store = 'gui.left.task-list.tasks' + +local task_details = {} +local force_tasks = {} +Global.register({ + task_details=task_details, + force_tasks=force_tasks +},function(tbl) + task_details = tbl.task_details + force_tasks = tbl.force_tasks +end) + +local function add_task(player,task_number) + local task_id = tostring(Token.uid()) + + if not force_tasks[player.force.name] then + force_tasks[player.force.name] = {} + end + if task_number then + table.insert(force_tasks[player.force.name],task_number,task_id) + else + table.insert(force_tasks[player.force.name],task_id) + end + + task_details[task_id] = { + task_id=task_id, + force=player.force.name, + last_edit_player=player.name, + last_edit_time=game.tick, + editing={[player.name]=true} + } + + Store.set_child(task_store,task_id,'test') +end + +local function remove_task(task_id) + local force_name = task_details[task_id].force + Store.set_child(task_store,task_id) + task_details[task_id] = nil + table.remove_element(force_tasks[force_name],task_id) +end + +local function player_allowed_edit(player) + if config.only_admins_can_edit and not player.admin then + return false + end + + if config.edit_tasks_role_permision and not Roles.player_allowed(player,config.edit_tasks_role_permision) then + return false + end + + return true +end + +local update_all +local add_new_task_end = +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) + add_task(player) +end) + +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) + local task_id = element.parent.name + local task = element.parent.task.text + local details = task_details[task_id] + details.editing[player.name] = nil + Store.set_child(task_store,task_id,task) +end) + +local generate_task +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) + local task_id = element.parent.name + local details = task_details[task_id] + details.editing[player.name] = nil + generate_task(player,element.parent.parent,task_id) +end) + +local discard_task = +Gui.new_button() +:set_sprites('utility/trash') +:set_tooltip{'task-list.discord-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.caption + remove_task(task_id) + update_all() +end) + +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.caption + local details = task_details[task_id] + details.editing[player.name] = true + generate_task(player,element.parent.parent,task_id) +end) + +function generate_task(player,element,task_id) + local task = Store.get_child(task_store,task_id) + local details = task_details[task_id] + local editing = details.editing[player.name] + local last_edit_player = details.last_edit_player + local last_edit_time = details.last_edit_time + local tasks = force_tasks[player.force.name] + local task_number = table.index_of(tasks, task_id) + + if not task then + element.parent.no_tasks.visible = #tasks == 01 + Gui.destory_if_valid(element['count-'..task_id]) + Gui.destory_if_valid(element['edit-'..task_id]) + Gui.destory_if_valid(element[task_id]) + + else + element.parent.no_tasks.visible = false + local task_area = element[task_id] + if not task_area then + -- label to show the task number + local top_align = element.add{ + name='count-'..task_id, + type='flow' + } + top_align.style.vertical_align = 'top' + top_align.style.vertically_stretchable = true + top_align.add{ + name='label', + 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) + task_area.style.vertical_align = 'top' + + if player_allowed_edit(player) then + local flow = Gui.create_right_align(element,'edit-'..task_id) + flow.caption = task_id + flow.style.vertical_align = 'top' + flow.style.vertically_stretchable = true + + edit_task(flow) + discard_task(flow) + end + + end + + element['count-'..task_id].label.caption = task_number..')' + if element['edit-'..task_id] then + local players = table_keys(details.editing) + if #players > 0 then + element['edit-'..task_id][edit_task.name].tooltip = {'task-list.edit-tooltip',table.concat(players,', ')} + else + element['edit-'..task_id][edit_task.name].tooltip = {'task-list.edit-tooltip-none'} + end + end + + 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 = task + task_area.task.tooltip = {'task-list.last-edit',last_edit_player,format_time(last_edit_time)} + + elseif not editing then + -- create the label + if element['edit-'..task_id] then + element['edit-'..task_id][edit_task.name].enabled = true + end + + task_area.clear() + + local label = + task_area.add{ + name='task', + type='label', + caption=task, + tooltip={'task-list.last-edit',last_edit_player,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 + if element['edit-'..task_id] then + element['edit-'..task_id][edit_task.name].enabled = false + end + + task_area.clear() + + local entry = + task_area.add{ + name='task', + type='textfield', + text=task + } + entry.style.maximal_width = 150 + entry.style.height = 20 + + cancel_edit(task_area) + confirm_edit(task_area) + + end + + end + +end + +local function generate_container(player,element) + Gui.set_padding(element,2,2,2,2) + element.style.minimal_width = 200 + + -- main container which contains the other elements + local container = + element.add{ + name='container', + type='frame', + direction='vertical', + style='window_content_frame_packed' + } + Gui.set_padding(container) + container.style.vertically_stretchable = false + + -- main header for the gui + local header = + container.add{ + name='header', + type='frame', + style='subheader_frame' + } + Gui.set_padding(header,2,2,4,4) + header.style.horizontally_stretchable = true + header.style.use_header_filler = false + + --- Caption for the header bar + header.add{ + type='label', + style='heading_1_label', + caption={'task-list.main-caption'}, + tooltip={'task-list.sub-tooltip'} + } + + --- Right aligned button to toggle the section + local right_align = Gui.create_right_align(header) + add_new_task_end(right_align) + + -- main flow for the data + local flow = + container.add{ + name='scroll', + type='scroll-pane', + direction='vertical', + horizontal_scroll_policy='never', + vertical_scroll_policy='auto-and-reserve-space' + } + Gui.set_padding(flow,1,1,2,2) + flow.style.horizontally_stretchable = true + flow.style.maximal_height = 185 + + -- message to say that you have no tasks + local non_made = + flow.add{ + name='no_tasks', + type='label', + caption={'task-list.no-tasks'} + } + non_made.style.width = 200 + non_made.style.single_line = false + + -- table that stores all the data + local col_count = 2 + if player_allowed_edit(player) then col_count = col_count+1 end + local flow_table = + flow.add{ + name='table', + type='table', + column_count=col_count, + draw_horizontal_lines=true + } + Gui.set_padding(flow_table) + flow_table.style.horizontally_stretchable = true + flow_table.style.top_cell_padding = 3 + flow_table.style.bottom_cell_padding = 3 + + return flow_table +end + +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_draw(function(player,element) + local data_table = generate_container(player,element) + local force_name = player.force.name + + local tasks = force_tasks[force_name] or {} + for _,task_id in pairs(tasks) do + generate_task(player,data_table,task_id) + end +end) +:on_update(function(player,element) + local data_table = element.container.scroll.table + local force_name = player.force.name + + local tasks = force_tasks[force_name] or {} + for _,task_id in pairs(tasks) do + generate_task(player,data_table,task_id) + end +end) + +update_all = task_list 'update_all' + +Store.register(task_store,function(value,task_id) + local details = task_details[task_id] + local force = game.forces[details.force] + + for _,player in pairs(force.players) do + local frame = task_list:get_frame(player) + local element = frame.container.scroll.table + generate_task(player,element,task_id) + end +end) + +return task_list \ No newline at end of file From a79440a840407ab00f20382718a1eeeff9949194 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 19:11:23 +0100 Subject: [PATCH 18/41] Added comments --- config/tasks.lua | 4 ++-- modules/gui/task-list.lua | 43 +++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/config/tasks.lua b/config/tasks.lua index 0a1a3d13..7b1502e5 100644 --- a/config/tasks.lua +++ b/config/tasks.lua @@ -1,4 +1,4 @@ return { - only_admins_can_edit = false, - edit_tasks_role_permision = 'gui/task-list/edit' + only_admins_can_edit = false, -- true will hide the edit and delete buttons from non (game) admins + edit_tasks_role_permision = 'gui/task-list/edit' -- value used with custom permision system } \ No newline at end of file diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 6a1b82c8..713435c3 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -18,6 +18,7 @@ Global.register({ force_tasks = tbl.force_tasks end) +--- Adds a new task for this force with this players name attached local function add_task(player,task_number) local task_id = tostring(Token.uid()) @@ -41,6 +42,7 @@ local function add_task(player,task_number) Store.set_child(task_store,task_id,'test') end +--- Removes all refrences to a task local function remove_task(task_id) local force_name = task_details[task_id].force Store.set_child(task_store,task_id) @@ -48,6 +50,7 @@ local function remove_task(task_id) table.remove_element(force_tasks[force_name],task_id) end +--- If a player is allowed to use the edit buttons local function player_allowed_edit(player) if config.only_admins_can_edit and not player.admin then return false @@ -60,8 +63,9 @@ local function player_allowed_edit(player) return true end +--- Button in the header to add a new task local update_all -local add_new_task_end = +local add_new_task = Gui.new_button() :set_sprites('utility/add') :set_tooltip{'task-list.add-tooltip'} @@ -74,6 +78,7 @@ end) add_task(player) end) +--- Used to save changes to a task local confirm_edit = Gui.new_button() :set_sprites('utility/downloaded') @@ -91,6 +96,7 @@ end) Store.set_child(task_store,task_id,task) end) +--- Used to cancel any changes you made to a task local generate_task local cancel_edit = Gui.new_button() @@ -108,6 +114,7 @@ end) generate_task(player,element.parent.parent,task_id) end) +--- Removes the task from the list local discard_task = Gui.new_button() :set_sprites('utility/trash') @@ -123,6 +130,7 @@ end) update_all() end) +--- Opens edit mode for the task local edit_task = Gui.new_button() :set_sprites('utility/rename_icon_normal') @@ -139,6 +147,18 @@ end) generate_task(player,element.parent.parent,task_id) 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 +]] function generate_task(player,element,task_id) local task = Store.get_child(task_store,task_id) local details = task_details[task_id] @@ -149,6 +169,7 @@ function generate_task(player,element,task_id) local task_number = table.index_of(tasks, task_id) if not task then + -- task is nil so remove it from the list element.parent.no_tasks.visible = #tasks == 01 Gui.destory_if_valid(element['count-'..task_id]) Gui.destory_if_valid(element['edit-'..task_id]) @@ -156,6 +177,7 @@ function generate_task(player,element,task_id) else 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 @@ -170,6 +192,7 @@ function generate_task(player,element,task_id) type='label', caption=task_number..')' } + -- area which stores the task and buttons task_area = element.add{ @@ -179,6 +202,7 @@ function generate_task(player,element,task_id) Gui.set_padding(task_area) task_area.style.vertical_align = 'top' + -- if the player can edit then it adds the edit and delete button if player_allowed_edit(player) then local flow = Gui.create_right_align(element,'edit-'..task_id) flow.caption = task_id @@ -191,6 +215,7 @@ function generate_task(player,element,task_id) end + -- update the number indexes and the current editing players element['count-'..task_id].label.caption = task_number..')' if element['edit-'..task_id] then local players = table_keys(details.editing) @@ -201,6 +226,7 @@ function generate_task(player,element,task_id) end 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 @@ -208,7 +234,7 @@ function generate_task(player,element,task_id) task_area.task.tooltip = {'task-list.last-edit',last_edit_player,format_time(last_edit_time)} elseif not editing then - -- create the label + -- create the label, view mode if element['edit-'..task_id] then element['edit-'..task_id][edit_task.name].enabled = true end @@ -226,7 +252,7 @@ function generate_task(player,element,task_id) label.style.maximal_width = 150 elseif editing and element_type ~= 'textfield' then - -- create the text field + -- create the text field, edit mode, update it omited as value is being edited if element['edit-'..task_id] then element['edit-'..task_id][edit_task.name].enabled = false end @@ -251,6 +277,15 @@ function generate_task(player,element,task_id) 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 @@ -287,7 +322,7 @@ local function generate_container(player,element) --- Right aligned button to toggle the section local right_align = Gui.create_right_align(header) - add_new_task_end(right_align) + add_new_task(right_align) -- main flow for the data local flow = From 31e67f8a1c999fe25fb74f7f3603181ecca673cd Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 19:35:16 +0100 Subject: [PATCH 19/41] Added comments to config files --- config/action_buttons.lua | 26 ++++++++++++++++++++++---- config/compilatron.lua | 1 + config/preset_player_colours.lua | 1 + config/repair.lua | 11 ++++++----- config/science.lua | 5 +++-- config/tasks.lua | 1 + 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index cd48100d..10002094 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -1,3 +1,8 @@ +--- Config for the different action buttons that show on the player list +-- each button has the button define(s) given along side an auth function, and optional reason callback +-- if a reason callback is used then Store.set_child(action_name_store,player.name,'BUTTON_NAME') should be called during on_click +-- buttons can be removed from the gui by commenting them out of the config at the bottom of this file +-- the key used for the name of the button is the permision name used by the role system local Gui = require 'expcore.gui' local Roles = require 'expcore.roles' local Store = require 'expcore.store' @@ -10,12 +15,14 @@ local format_chat_player_name = ext_require('expcore.common','format_chat_player local action_player_store = 'gui.left.player-list.action-player' local action_name_store = 'gui.left.player-list.action-name' +-- 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,action_player_name) local player_highest = Roles.get_player_highest_role(player) local action_player_highest = Roles.get_player_highest_role(action_player_name) @@ -24,6 +31,7 @@ local function auth_lower_role(player,action_player_name) end end +-- gets the action player and a coloured name for the action to be used on local function get_action_player(player) local action_player_name = Store.get_child(action_player_store,player.name) local action_player = Game.get_player_from_any(action_player_name) @@ -31,6 +39,7 @@ local function get_action_player(player) return action_player,action_player_name_color end +-- telports one player to another local function teleport(from_player,to_player) local surface = to_player.surface local position = surface.find_non_colliding_position('character',to_player.position,32,1) @@ -40,6 +49,7 @@ local function teleport(from_player,to_player) return true end +-- teleports the user to the action player local goto_player = Gui.new_button() :set_sprites('utility/export') @@ -50,6 +60,7 @@ Gui.new_button() teleport(player,action_player) end) +-- teleports the action player to the user local bring_player = Gui.new_button() :set_sprites('utility/import') @@ -60,6 +71,7 @@ Gui.new_button() teleport(action_player,player) end) +-- kills the action player, if there are alive local kill_player = Gui.new_button() :set_sprites('utility/too_far') @@ -72,6 +84,7 @@ Gui.new_button() end end) +-- reports the action player, requires a reason to be given local report_player = Gui.new_button() :set_sprites('utility/spawn_flag') @@ -89,6 +102,7 @@ local function report_player_callback(player,reason) Reports.report_player(action_player,reason,player.name) end +-- gives the action player a warning, requires a reason local warn_player = Gui.new_button() :set_sprites('utility/spawn_flag') @@ -105,6 +119,7 @@ local function warn_player_callback(player,reason) Warnings.add_warnings(action_player,player.name) end +-- jails the action player, requires a reason local jail_player = Gui.new_button() :set_sprites('utility/item_editor_icon') @@ -121,6 +136,7 @@ local function jail_player_callback(player,reason) Jail.jail_player(action_player,player.name) end +-- temp bans the action player, requires a reason local temp_ban_player = Gui.new_button() :set_sprites('utility/clock') @@ -135,6 +151,7 @@ local function temp_ban_player_callback(player,reason) Jail.temp_ban_player(action_player,player.name,reason) end +-- kicks the action player, requires a reason local kick_player = Gui.new_button() :set_sprites('utility/warning_icon') @@ -149,6 +166,7 @@ local function kick_player_callback(player,reason) game.kick_player(action_player,reason) end +-- bans the action player, requires a reason local ban_player = Gui.new_button() :set_sprites('utility/danger_icon') @@ -167,7 +185,7 @@ return { ['command/teleport'] = { auth=function(player,action_player_name) return player.name ~= action_player_name - end, + end, -- cant teleport to your self goto_player, bring_player }, @@ -178,7 +196,7 @@ return { elseif Roles.player_allowed(player,'command/kill/always') then return auth_lower_role(player,action_player_name) end - end, + end, -- player must be lower role, or your self kill_player }, ['command/report'] = { @@ -186,12 +204,12 @@ return { if not Roles.player_allowed(player,'command/give-warning') then return not Roles.player_has_flag(action_player_name,'report-immune') end - end, + end, -- can report any player that isnt immune and you arnt able to give warnings reason_callback=report_player_callback, report_player }, ['command/give-warning'] = { - auth=auth_lower_role, + auth=auth_lower_role, -- warn a lower user, replaces report reason_callback=warn_player_callback, warn_player }, diff --git a/config/compilatron.lua b/config/compilatron.lua index a4980f92..47ffccb3 100644 --- a/config/compilatron.lua +++ b/config/compilatron.lua @@ -1,3 +1,4 @@ +-- config file for the compliatrons including where they spawn and what messages they show return { message_cycle=60*15, -- 15 seconds default, how often (in ticks) the messages will cycle locations={ -- defines the spawn locations for all compilatrons diff --git a/config/preset_player_colours.lua b/config/preset_player_colours.lua index 527ad065..d10fd64a 100644 --- a/config/preset_player_colours.lua +++ b/config/preset_player_colours.lua @@ -1,3 +1,4 @@ +-- preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed) return { players={ BADgamerNL={r=255,g=20,b=147}, diff --git a/config/repair.lua b/config/repair.lua index dd58d8be..5980c8c2 100644 --- a/config/repair.lua +++ b/config/repair.lua @@ -1,13 +1,14 @@ +-- config file for the repair command return { - disallow = { + disallow = { -- items in this list will never be repaired ['loader']=true, ['fast-loader']=true, ['express-loader']=true, ['electric-energy-interface']=true, ['infinity-chest']=true }, - max_range=50, - allow_blueprint_repair=false, - allow_ghost_revive=true, - allow_heal_entities=true + max_range=50, -- the max range that can be used with the repair command + allow_blueprint_repair=false, -- when true will allow blueprints (things not destroied by biters) to be build instently using the repair command + allow_ghost_revive=true, -- when true will allow ghosts (things destoried by biters) to be build instently using the repair command + allow_heal_entities=true -- when true will heal entities to full health that are within range } \ No newline at end of file diff --git a/config/science.lua b/config/science.lua index 9fd7334a..194303f3 100644 --- a/config/science.lua +++ b/config/science.lua @@ -1,5 +1,6 @@ -return { - show_eta=true, +-- config file for the science info gui +return { -- list of all science packs to be shown in the gui + show_eta=true, -- when true the eta for research completion will be shown 'automation-science-pack', 'logistic-science-pack', 'military-science-pack', diff --git a/config/tasks.lua b/config/tasks.lua index 7b1502e5..4c6bd54a 100644 --- a/config/tasks.lua +++ b/config/tasks.lua @@ -1,3 +1,4 @@ +-- config file for the tasks gui return { only_admins_can_edit = false, -- true will hide the edit and delete buttons from non (game) admins edit_tasks_role_permision = 'gui/task-list/edit' -- value used with custom permision system From 420dd4789d2ff8393c9d0910af9ba0f3dd4a0127 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 19:56:40 +0100 Subject: [PATCH 20/41] Added missing comments to gui defines --- modules/gui/player-list.lua | 1 + modules/gui/rocket-info.lua | 26 +++++++++++++++++--- modules/gui/science-info.lua | 47 ++++++++++++++++++++++++++++++------ modules/gui/task-list.lua | 3 +++ 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index d2545f5a..c10fab2f 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -210,6 +210,7 @@ local function update_action_bar(player) end end +--- Adds a player to the player list local function add_player(list_table,player,role_name) open_action_bar(list_table,player.name) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 6a62a6f4..a2e9c161 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -1,3 +1,4 @@ +--- Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets local Gui = require 'expcore.gui' local Roles = require 'expcore.roles' local Event = require 'utils.event' @@ -240,7 +241,12 @@ local function generate_container(player,element) end ---- Creates a text label followed by a data label, or updates them if already present +--[[ Creates a text label followed by a data label, or updates them if already present + element + > "data_name_extra"-label + > "data_name_extra" + >> label +]] local function create_label_value_pair(element,data_name,value,tooltip,extra) local data_name_extra = extra and data_name..extra or data_name if element[data_name_extra] then @@ -272,7 +278,7 @@ local function create_label_value_pair_time(element,data_name,raw_value,no_hours create_label_value_pair(element,data_name,value,tooltip,extra) end ---- Adds the data to the stats section +--- Adds the different data values to the stats section local function generate_stats(player,frame) if not config.stats.show_stats then return end local element = frame.container.stats.table @@ -338,7 +344,7 @@ local function generate_milestones(player,frame) end end ---- Creats the different action buttons +--- Creats the different buttons used with the rocket silos local function generate_progress_buttons(player,element,rocket_silo_data) local silo_name = rocket_silo_data.name local status = rocket_silo_data.entity.status == 21 @@ -379,7 +385,17 @@ local function generate_progress_buttons(player,element,rocket_silo_data) end ---- Creates build progress section +--[[ Creates build progress section + element + > toggle-"silo_name" (generate_progress_buttons) + > launch-"silo_name" (generate_progress_buttons) + > label-x-"silo_name" + >> "silo_name" + > label-y-"silo_name" + >> "silo_name" + > "silo_name" + >> label +]] local function generate_progress(player,frame) if not config.progress.show_progress then return end local element = frame.container.progress.table @@ -478,6 +494,7 @@ local function generate_progress(player,frame) end end +--- Registers the new left gui local rocket_info = Gui.new_left_frame('gui/rocket-info') :set_sprites('entity/rocket-silo') @@ -500,6 +517,7 @@ end) generate_progress(player,element) end) +--- Event used to update the stats and the hui when a rocket is launched Event.add(defines.events.on_rocket_launched,function(event) local entity = event.rocket_silo local silo_name = get_silo_name(entity) diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua index a0f63fcf..8637e559 100644 --- a/modules/gui/science-info.lua +++ b/modules/gui/science-info.lua @@ -1,3 +1,4 @@ +--- Adds a science info gui that shows production usage and net for the different science packs as well as an eta local Gui = require 'expcore.gui' local Event = require 'utils.event' local Colors = require 'resources.color_presets' @@ -8,6 +9,7 @@ local config = require 'config.science' local null_time_short = {'science-info.eta-time',format_time(0,{hours=true,minutes=true,seconds=true,time=true,null=true})} local null_time_long = format_time(0,{hours=true,minutes=true,seconds=true,long=true,null=true}) +--- Gets the production stats for a certain science pack local function get_production_stats(player,science_pack) local force = player.force local stats = force.item_production_statistics @@ -33,6 +35,7 @@ local function get_production_stats(player,science_pack) } end +--- Gets the font colour for a certain level of production local function get_font_colour(value,secondary) if value > 5 then return Colors.light_green @@ -45,6 +48,18 @@ local function get_font_colour(value,secondary) end end +--[[ Generates the main structure for the gui + element + > container + >> header + >> scroll + >>> non_made + >>> table + >> footer (when eta is enabled) + >>> eta-label + >>> eta + >>>> label +]] local function generate_container(player,element) Gui.set_padding(element,1,2,2,2) element.style.minimal_width = 200 @@ -141,7 +156,13 @@ local function generate_container(player,element) return flow_table, eta end -local function add_data_pair(element,name,value,secondary,tooltip) +--[[ Adds two labels where one is right aligned and the other is a unit + element + > "name" + >> label + > spm-"name" +]] +local function add_data_label(element,name,value,secondary,tooltip) local data_colour = get_font_colour(value,secondary) local caption = format_number(math.round(value,1),true) @@ -192,6 +213,15 @@ local function add_data_pair(element,name,value,secondary,tooltip) end end +--[[ Adds a science pack to the list + element + > icon-"science_pack" + > delta-"science_pack" + >> table + >>> pos-"science_pack" (add_data_label) + >>> neg-"science_pack" (add_data_label) + > net-"science_pack" (add_data_label) +]] local function generate_science_pack(player,element,science_pack) local stats = get_production_stats(player,science_pack) if stats.total_made > 0 then @@ -253,13 +283,14 @@ local function generate_science_pack(player,element,science_pack) Gui.set_padding(delta_table) end - add_data_pair(delta.table,'pos-'..science_pack,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) - add_data_pair(delta.table,'neg-'..science_pack,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) - add_data_pair(element,'net-'..science_pack,stats.minute_net,stats.minute_made,{'science-info.net-tooltip',stats.total_net}) + add_data_label(delta.table,'pos-'..science_pack,stats.minute_made,nil,{'science-info.pos-tooltip',stats.total_made}) + add_data_label(delta.table,'neg-'..science_pack,-stats.minute_used,nil,{'science-info.neg-tooltip',stats.total_used}) + add_data_label(element,'net-'..science_pack,stats.minute_net,stats.minute_made,{'science-info.net-tooltip',stats.total_net}) end end -local function generate_eta(player,element) +--- Updates the eta label that was created with generate_container +local function update_eta(player,element) if not config.show_eta then return end local force = player.force local research = force.current_research @@ -304,6 +335,7 @@ local function generate_eta(player,element) end end +--- Registerse the new science info gui local science_info = Gui.new_left_frame('gui/science-info') :set_sprites('entity/lab') @@ -316,7 +348,7 @@ Gui.new_left_frame('gui/science-info') generate_science_pack(player,table,science_pack) end - generate_eta(player,eta) + update_eta(player,eta) end) :on_update(function(player,element) local container = element.container @@ -327,9 +359,10 @@ end) generate_science_pack(player,table,science_pack) end - generate_eta(player,eta) + update_eta(player,eta) end) +--- Updates the gui every 1 second Event.on_nth_tick(60,science_info 'update_all') return science_info \ No newline at end of file diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 713435c3..9dad2e48 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -1,3 +1,4 @@ +--- Adds a task list to the game which players can add remove and edit items on local Gui = require 'expcore.gui' local Store = require 'expcore.store' local Global = require 'utils.global' @@ -365,6 +366,7 @@ local function generate_container(player,element) return flow_table end +--- Registeres the task list local task_list = Gui.new_left_frame('gui/task-list') :set_sprites('utility/not_enough_repair_packs_icon') @@ -392,6 +394,7 @@ end) update_all = task_list 'update_all' +--- When a new task is added it will udpate the task list for everyone on that force Store.register(task_store,function(value,task_id) local details = task_details[task_id] local force = game.forces[details.force] From f22f62db47a94034b6158a3cef54c4f589c5583b Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 19:58:06 +0100 Subject: [PATCH 21/41] Fixed server not being able to use role bassed commands --- expcore/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index a2dca09e..ec088fef 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -321,7 +321,7 @@ end -- @treturn table a table where the values are the roles which the player has function Roles.get_player_roles(player) player = Game.get_player_from_any(player) - if not player then return end + if not player then return {Roles.config.internal.root} end local roles = Roles.config.players[player.name] or {} local default = Roles.config.roles[Roles.config.internal.default] local rtn = {default} From 87497ee0f35b25dd649cfec9aa9766c42c723b7a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:04:19 +0100 Subject: [PATCH 22/41] Made toolbar icons bigger --- expcore/gui/toolbar.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/expcore/gui/toolbar.lua b/expcore/gui/toolbar.lua index 87843f5a..4c384dcc 100644 --- a/expcore/gui/toolbar.lua +++ b/expcore/gui/toolbar.lua @@ -19,6 +19,7 @@ local Gui = require 'expcore.gui.core' local Roles = require 'expcore.roles' local Event = require 'utils.event' local Game = require 'utils.game' +local mod_gui = require 'mod-gui' local Toolbar = { permisison_names = {}, @@ -38,8 +39,12 @@ end -- @tparam[opt] name string when given allows an alias to the button for the permission system -- @treturn table the button define function Toolbar.new_button(name) - local button = Buttons.new_button() - button:set_post_authenticator(Toolbar.allowed) + local button = + Buttons.new_button() + :set_post_authenticator(Toolbar.allowed) + :set_style(mod_gui.button_style,function(style) + Gui.set_padding_style(style,-2,-2,-2,-2) + end) Toolbar.add_button(button) Toolbar.permission_alias(button.name,name) return button From 7dbe18a88d32f5105cb8225ff096724a7e535d81 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:18:22 +0100 Subject: [PATCH 23/41] Optimised rocket gui --- modules/gui/rocket-info.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index a2e9c161..6510ec06 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -7,6 +7,13 @@ local Global = require 'utils.global' local format_time = ext_require('expcore.common','format_time') local Colors = require 'resources.color_presets' +local largest_rolling_avg = 0 +for _,avg_over in pairs(config.stats.rolling_avg) do + if avg_over > largest_rolling_avg then + largest_rolling_avg = avg_over + end +end + local rocket_times = {} local rocket_stats = {} local rocket_silos = {} @@ -548,13 +555,21 @@ Event.add(defines.events.on_rocket_launched,function(event) rocket_times[force_name][rockets_launched] = event.tick + local remove_rocket = rockets_launched-largest_rolling_avg + if remove_rocket > 0 and not table.includes(config.milestones,remove_rocket) then + rocket_times[force_name][remove_rocket] = nil + end + --- Adds this 1 to the launch count for this silo force_silo_data[silo_name].launched = force_silo_data[silo_name].launched+1 --- Updates all the guis (and toolbar since the button may now be visible) for _,player in pairs(force.players) do rocket_info:update(player) - if first_rocket then Gui.update_toolbar(player) end + if first_rocket then + Gui.update_toolbar(player) + rocket_info:toggle(player) + end end end) From 38a1ff2199e8ec929476b59d1d26a2439cce192a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:20:46 +0100 Subject: [PATCH 24/41] Added text colour to confix --- config/science.lua | 2 ++ modules/gui/science-info.lua | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/science.lua b/config/science.lua index 194303f3..3cd3ce5f 100644 --- a/config/science.lua +++ b/config/science.lua @@ -1,6 +1,8 @@ -- config file for the science info gui return { -- list of all science packs to be shown in the gui show_eta=true, -- when true the eta for research completion will be shown + required_for_green=5, -- the amount required for the text to show as green + required_for_red=-5, -- the amount required for the text to show as red 'automation-science-pack', 'logistic-science-pack', 'military-science-pack', diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua index 8637e559..572bfc3b 100644 --- a/modules/gui/science-info.lua +++ b/modules/gui/science-info.lua @@ -37,9 +37,9 @@ end --- Gets the font colour for a certain level of production local function get_font_colour(value,secondary) - if value > 5 then + if value > config.required_for_green then return Colors.light_green - elseif value < -5 then + elseif value < config.required_for_red then return Colors.indian_red elseif secondary and secondary > 0 or not secondary and value ~= 0 then return Colors.orange @@ -228,9 +228,9 @@ local function generate_science_pack(player,element,science_pack) element.parent.non_made.visible = false local icon_style = 'quick_bar_slot_button' - if stats.minute_net > 1 then + if stats.minute_net > config.required_for_green then icon_style = 'green_slot_button' - elseif stats.minute_net < -1 then + elseif stats.minute_net < config.required_for_red then icon_style = 'red_slot_button' elseif stats.minute_made > 0 then icon_style = 'selected_slot_button' From 9f00de8ae264bb85a2ea1eea91a44fdabb913cc2 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:37:41 +0100 Subject: [PATCH 25/41] Made launch button more responsive --- modules/gui/rocket-info.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 6510ec06..129b7c73 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -81,6 +81,9 @@ end) if rocket_silo_data.entity.launch_rocket() then rocket_silo_data.awaiting_reset = true element.enabled = false + local progress_label = element.parent.parent[rocket_silo_name].label + progress_label.caption = {'rocket-info.progress-launched'} + progress_label.style.font_color = Colors.green end end) From aa46e33a5a0293739d0714987208046f63d0f51b Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:51:49 +0100 Subject: [PATCH 26/41] Fixed gui closing when pressing them --- expcore/gui/center.lua | 20 ++++++++++---------- expcore/gui/left.lua | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/expcore/gui/center.lua b/expcore/gui/center.lua index b849075a..59c978c2 100644 --- a/expcore/gui/center.lua +++ b/expcore/gui/center.lua @@ -75,8 +75,8 @@ function CenterFrames.toggle_frame(player,name,state) return true elseif state == false then local flow = CenterFrames.get_flow(player) - if flow[define.name] then - flow[define.name].destroy() + if flow[define.name..'-frame'] then + flow[define.name..'-frame'].destroy() end return false else @@ -99,7 +99,7 @@ function CenterFrames.new_frame(permision_name) mt.__index = CenterFrames._prototype mt.__call = self.event_handler - Gui.on_custom_close(self.name,function(event) + Gui.on_custom_close(self.name..'-frame',function(event) local element = event.element if element and element.valid then element.destroy() end end) @@ -124,8 +124,8 @@ function CenterFrames._prototype:draw_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - return flow[self.name] + if flow[self.name..'-frame'] then + return flow[self.name..'-frame'] end if self.auto_focus then @@ -134,7 +134,7 @@ function CenterFrames._prototype:draw_frame(player) local frame = flow.add{ type='frame', - name=self.name + name=self.name..'-frame' } if self.auto_focus then @@ -155,8 +155,8 @@ function CenterFrames._prototype:redraw_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - flow[self.name].destroy() + if flow[self.name..'-frame'] then + flow[self.name..'-frame'].destroy() end return self:draw_frame(player) @@ -169,8 +169,8 @@ function CenterFrames._prototype:toggle_frame(player) player = Game.get_player_from_any(player) local flow = CenterFrames.get_flow(player) - if flow[self.name] then - flow[self.name].destroy() + if flow[self.name..'-frame'] then + flow[self.name..'-frame'].destroy() return false else self:draw_frame(player) diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index 35a8b66b..a2dcf1d1 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -174,8 +174,8 @@ end -- @treturn LuaGuiElement the frame in the left frame flow for this define function LeftFrames._prototype:get_frame(player) local flow = LeftFrames.get_flow(player) - if flow[self.name] and flow[self.name].valid then - return flow[self.name] + if flow[self.name..'-frame'] and flow[self.name..'-frame'].valid then + return flow[self.name..'-frame'] end end @@ -276,7 +276,7 @@ Event.add(defines.events.on_player_created,function(event) for _,define in pairs(LeftFrames.frames) do local frame = flow.add{ type='frame', - name=define.name, + name=define.name..'-frame', direction=define.direction } From d068a07b8b62a85410f522acf285a04e2c1eba5c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 20:55:46 +0100 Subject: [PATCH 27/41] Added version to readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7509c63..a150c64a 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ All are welcome to make pull requests and issues for this scenario, if you are i | Scenario Version* | Version Name | Factorio Version** | |---|---|---| -| [v5.5](s5.5) | Gui System | [v0.17.35](f0.17.35) | +| [v5.6](s5.6) | Information Guis | [v0.17.43](f0.17.43) | +| [v5.5](s5.5) | Gui System | [v0.17.43](f0.17.43) | | [v5.4](s5.4) | Admin Controls | [v0.17.32](f0.17.32) | | [v5.3](s5.3) | Custom Roles | [v0.17.28](f0.17.28) | | [v5.2](s5.2) | Quality of life | [v0.17.22](f0.17.22) | @@ -71,6 +72,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i \** Factorio versions show the version they were made for, often the minimum requirement. +[s5.6]: https://github.com/explosivegaming/scenario/releases/tag/5.6.0 [s5.5]: https://github.com/explosivegaming/scenario/releases/tag/5.5.0 [s5.4]: https://github.com/explosivegaming/scenario/releases/tag/5.4.0 [s5.3]: https://github.com/explosivegaming/scenario/releases/tag/5.3.0 @@ -83,7 +85,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i [s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 [s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 -[f0.17.35]: https://wiki.factorio.com/Version_history/0.17.0#0.17.35 +[f0.17.43]: https://wiki.factorio.com/Version_history/0.17.0#0.17.43 [f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 [f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 [f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 From 922cd225e5014f1a946cf9c1a6afab0ee7435fa4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 21:07:21 +0100 Subject: [PATCH 28/41] Better issuse formats --- .github/ISSUE_TEMPLATE/Bug_report.md | 20 +++++----- .github/ISSUE_TEMPLATE/Desync_report.md | 24 ++++++++++++ .github/ISSUE_TEMPLATE/Error_report.md | 46 ++++++++++++----------- .github/ISSUE_TEMPLATE/Feature_request.md | 17 +++++---- 4 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/Desync_report.md diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 8d1d7915..885ebd8e 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -1,18 +1,24 @@ --- name: Bug report -about: Create a report to help us improve +about: Report a bug which does not crash the game, any bug from the latest major scenario version --- -**Describe the bug** +**Factorio version** +Version number: X.Y.Z + +**Scenario version** +Version number: X.Y.Z + +**Bug description** A clear and concise description of what the bug is. -**To Reproduce** +**Reproduction method** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' -4. See error +4. See error in log **Expected behavior** A clear and concise description of what you expected to happen. @@ -20,9 +26,5 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. -**Other information (please complete the following information):** - - OS: [e.g. iOS, Windows, Linux] - - Factorio Version: [e.g. 0.16.30] - **Additional context** -Add any other context about the problem here. +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Desync_report.md b/.github/ISSUE_TEMPLATE/Desync_report.md new file mode 100644 index 00000000..5c7e81f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Desync_report.md @@ -0,0 +1,24 @@ +--- +name: Desync report +about: Report a desync, latest version of scenario only including patches + +--- + +**Factorio version** +Version number: X.Y.Z + +**Scenario version** +Version number: X.Y.Z + +**Desync description** +A clear and concise description of what you believe causes the desync. + +**Reproduction method** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error in log + +**Additional context** +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Error_report.md b/.github/ISSUE_TEMPLATE/Error_report.md index 85f5a32f..d9ca9b28 100644 --- a/.github/ISSUE_TEMPLATE/Error_report.md +++ b/.github/ISSUE_TEMPLATE/Error_report.md @@ -1,33 +1,35 @@ --- -name: Error/Desync Report -about: Create a report on a bug which gives an error or desync +name: Error report +about: Report a bug which cases the game to crash, any bug from the latest major scenario version --- -**Error Message** -Error: insert error message +**Factorio version** +Version number: X.Y.Z -**Known Causes** -Know causes that will result in error: - - Cause 1 - - Cause 2 +**Scenario version** +Version number: X.Y.Z -**To Reproduce (please give for each cause outlined above)** +**Error message** +``` +error message and stacktrace back +``` + +**Error description** +A clear and concise description of what you believe causes the crash. + +**Reproduction method** Steps to reproduce the behavior: - - Cause 1 - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error - - Cause 2 - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error in log -**Other information (please complete the following information):** - - OS: [e.g. iOS, Windows, Linux] - - Factorio Version: [e.g. 0.16.30] +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 066b2d92..6bdc2252 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,17 +1,18 @@ --- name: Feature request -about: Suggest an idea for this project +about: Suggest a new idea to be worked on --- -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +**Feature overview** +Name: name-here +TL;DR: a few words about what the feature is -**Describe the solution you'd like** -A clear and concise description of what you want to happen. +**Details** +A detailed description of what the new feature is. -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +**Possible methods** +Any ideas you have had about how to implement the feature or any problems that may arise. **Additional context** -Add any other context or screenshots about the feature request here. +Add any other context or screenshots about the feature request here. \ No newline at end of file From 98f6266ad11821eb440f0266098a5bcf84605f71 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 21:33:09 +0100 Subject: [PATCH 29/41] Removed outdated docs --- doc/index.html | 144 ---- doc/ldoc.css | 303 ------- doc/modules/ExpGamingCore.Commands.html | 401 --------- doc/modules/ExpGamingCore.Gui.Center.html | 337 -------- doc/modules/ExpGamingCore.Gui.Inputs.html | 498 ----------- doc/modules/ExpGamingCore.Gui.Left.html | 240 ------ doc/modules/ExpGamingCore.Gui.Popup.html | 185 ----- doc/modules/ExpGamingCore.Gui.Test.html | 144 ---- doc/modules/ExpGamingCore.Gui.Toolbar.html | 190 ----- doc/modules/ExpGamingCore.Gui.html | 366 -------- doc/modules/ExpGamingCore.Ranking.html | 883 -------------------- doc/modules/ExpGamingCore.Server.html | 848 ------------------- doc/modules/ExpGamingCore.Sync.html | 820 ------------------ doc/modules/ExpGamingLib.html | 672 --------------- doc/modules/FSM.html | 455 ---------- doc/modules/StdLib.Color.html | 561 ------------- doc/modules/StdLib.Game.html | 222 ----- doc/modules/StdLib.String.html | 302 ------- doc/modules/StdLib.Table.html | 922 --------------------- doc/modules/StdLib.Time.html | 139 ---- 20 files changed, 8632 deletions(-) delete mode 100644 doc/index.html delete mode 100644 doc/ldoc.css delete mode 100644 doc/modules/ExpGamingCore.Commands.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Center.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Inputs.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Left.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Popup.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Test.html delete mode 100644 doc/modules/ExpGamingCore.Gui.Toolbar.html delete mode 100644 doc/modules/ExpGamingCore.Gui.html delete mode 100644 doc/modules/ExpGamingCore.Ranking.html delete mode 100644 doc/modules/ExpGamingCore.Server.html delete mode 100644 doc/modules/ExpGamingCore.Sync.html delete mode 100644 doc/modules/ExpGamingLib.html delete mode 100644 doc/modules/FSM.html delete mode 100644 doc/modules/StdLib.Color.html delete mode 100644 doc/modules/StdLib.Game.html delete mode 100644 doc/modules/StdLib.String.html delete mode 100644 doc/modules/StdLib.Table.html delete mode 100644 doc/modules/StdLib.Time.html diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index f5d24cda..00000000 --- a/doc/index.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- - - -

Modules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FSMFactorio Softmod Manager
ExpGamingCore.CommandA full ranking system for factorio.
ExpGamingCore.GuiAdds a objective version to custom guis.
ExpGamingCore.Gui.CenterAdds a uniform preset for guis in the center of the screen which allow for different tabs to be opened
ExpGamingCore.Gui.InputsAdds a clean way of making new inputs for a gui allowing for sliders and text inputs to be hanndleded with custom events
ExpGamingCore.Gui.LeftAdds a organiser for left gui ellements which will automaticaly update there information and have open requirements
ExpGamingCore.Gui.PopupAdds a location for popups which can be dismissed by a player and created from other scripts
ExpGamingCore.Gui.TestUsed to test all gui elements and parts can be used in game via Gui.test()
ExpGamingCore.Gui.ToolbarAdds a toolbar to the top left of the screen
ExpGamingCore.RoleA full ranking system for factorio.
ExpGamingCore.ServerAdds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)
ExpGamingCore.SyncAllows syncing with an outside server and info panle.
ExpGamingLibAdds some common functions used though out all ExpGaming modules
StdLib.ColorA defines module for retrieving colors by name.
StdLib.GameThe game module.
StdLib.StringExtends Lua 5.2 string.
StdLib.TableExtends Lua 5.2 table.
StdLib.TimeA defines module for retrieving the number of ticks in 1 unit of time.
- -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/ldoc.css b/doc/ldoc.css deleted file mode 100644 index 52c4ad2b..00000000 --- a/doc/ldoc.css +++ /dev/null @@ -1,303 +0,0 @@ -/* BEGIN RESET - -Copyright (c) 2010, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 2.8.2r1 -*/ -html { - color: #000; - background: #FFF; -} -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { - margin: 0; - padding: 0; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -fieldset,img { - border: 0; -} -address,caption,cite,code,dfn,em,strong,th,var,optgroup { - font-style: inherit; - font-weight: inherit; -} -del,ins { - text-decoration: none; -} -li { - margin-left: 20px; -} -caption,th { - text-align: left; -} -h1,h2,h3,h4,h5,h6 { - font-size: 100%; - font-weight: bold; -} -q:before,q:after { - content: ''; -} -abbr,acronym { - border: 0; - font-variant: normal; -} -sup { - vertical-align: baseline; -} -sub { - vertical-align: baseline; -} -legend { - color: #000; -} -input,button,textarea,select,optgroup,option { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; -} -input,button,textarea,select {*font-size:100%; -} -/* END RESET */ - -body { - margin-left: 1em; - margin-right: 1em; - font-family: arial, helvetica, geneva, sans-serif; - background-color: #ffffff; margin: 0px; -} - -code, tt { font-family: monospace; font-size: 1.1em; } -span.parameter { font-family:monospace; } -span.parameter:after { content:":"; } -span.types:before { content:"("; } -span.types:after { content:")"; } -.type { font-weight: bold; font-style:italic } - -body, p, td, th { font-size: .95em; line-height: 1.2em;} - -p, ul { margin: 10px 0 0 0px;} - -strong { font-weight: bold;} - -em { font-style: italic;} - -h1 { - font-size: 1.5em; - margin: 20px 0 20px 0; -} -h2, h3, h4 { margin: 15px 0 10px 0; } -h2 { font-size: 1.25em; } -h3 { font-size: 1.15em; } -h4 { font-size: 1.06em; } - -a:link { font-weight: bold; color: #004080; text-decoration: none; } -a:visited { font-weight: bold; color: #006699; text-decoration: none; } -a:link:hover { text-decoration: underline; } - -hr { - color:#cccccc; - background: #00007f; - height: 1px; -} - -blockquote { margin-left: 3em; } - -ul { list-style-type: disc; } - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -pre { - background-color: rgb(245, 245, 245); - border: 1px solid #C0C0C0; /* silver */ - padding: 10px; - margin: 10px 0 10px 0; - overflow: auto; - font-family: "Andale Mono", monospace; -} - -pre.example { - font-size: .85em; -} - -table.index { border: 1px #00007f; } -table.index td { text-align: left; vertical-align: top; } - -#container { - margin-left: 1em; - margin-right: 1em; - background-color: #f0f0f0; -} - -#product { - text-align: center; - border-bottom: 1px solid #cccccc; - background-color: #ffffff; -} - -#product big { - font-size: 2em; -} - -#main { - background-color: #f0f0f0; - border-left: 2px solid #cccccc; -} - -#navigation { - float: left; - width: 14em; - vertical-align: top; - background-color: #f0f0f0; - overflow: visible; -} - -#navigation h2 { - background-color:#e7e7e7; - font-size:1.1em; - color:#000000; - text-align: left; - padding:0.2em; - border-top:1px solid #dddddd; - border-bottom:1px solid #dddddd; -} - -#navigation ul -{ - font-size:1em; - list-style-type: none; - margin: 1px 1px 10px 1px; -} - -#navigation li { - text-indent: -1em; - display: block; - margin: 3px 0px 0px 22px; -} - -#navigation li li a { - margin: 0px 3px 0px -1em; -} - -#content { - margin-left: 14em; - padding: 1em; - width: 700px; - border-left: 2px solid #cccccc; - border-right: 2px solid #cccccc; - background-color: #ffffff; -} - -#about { - clear: both; - padding: 5px; - border-top: 2px solid #cccccc; - background-color: #ffffff; -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { font-weight: bold; color: #004080; text-decoration: underline; } - - #main { - background-color: #ffffff; - border-left: 0px; - } - - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - - #content { - padding: 1em; - background-color: #ffffff; - } - - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.module_list td.summary { width: 100%; } - - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } -table.function_list td.summary { width: 100%; } - -ul.nowrap { - overflow:auto; - white-space:nowrap; -} - -dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} -dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} -dl.table h3, dl.function h3 {font-size: .95em;} - -/* stop sublists from having initial vertical space */ -ul ul { margin-top: 0px; } -ol ul { margin-top: 0px; } -ol ol { margin-top: 0px; } -ul ol { margin-top: 0px; } - -/* make the target distinct; helps when we're navigating to a function */ -a:target + * { - background-color: #FF9; -} - - -/* styles for prettification of source */ -pre .comment { color: #558817; } -pre .constant { color: #a8660d; } -pre .escape { color: #844631; } -pre .keyword { color: #aa5050; font-weight: bold; } -pre .library { color: #0e7c6b; } -pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } -pre .string { color: #8080ff; } -pre .number { color: #f8660d; } -pre .operator { color: #2239a8; font-weight: bold; } -pre .preprocessor, pre .prepro { color: #a33243; } -pre .global { color: #800080; } -pre .user-keyword { color: #800080; } -pre .prompt { color: #558817; } -pre .url { color: #272fc2; text-decoration: underline; } - diff --git a/doc/modules/ExpGamingCore.Commands.html b/doc/modules/ExpGamingCore.Commands.html deleted file mode 100644 index 14672de7..00000000 --- a/doc/modules/ExpGamingCore.Commands.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Command

-

A full ranking system for factorio.

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - -
format_inputs (command)Returns the inputs of this command as a formated string
validate_args (event)Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params
get_commands (player)Used to return all the commands a player can use
add_command (name[, description='No Description'][, inputs=an infite string], callback)Used to define commands
-

Tables

- - - - - -
validateCollection of funcations that can be used to validate inputs
-

Fields

- - - - - - - - - -
errorUsed as an error constant for validation
dataIndex of all command data
- -
-
- - -

Functions

- -
-
- - format_inputs (command) -
-
- Returns the inputs of this command as a formated string - - -

Parameters:

-
    -
  • command - string, table or event - the command to get the inputs of -
  • -
- -

Returns:

-
    - - string - the formated string for the inputs -
- - - -

Usage:

-
    -
    commands.format_inputs('interface') -- returns <code> (if you have ExpGamingCore.Server)
    -
- -
-
- - validate_args (event) -
-
- Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params - - -

Parameters:

-
    -
  • event - table - this is the event created by add_command not on_console_command -
  • -
- -

Returns:

-
    - - string - the error that happend while parsing the args -
-

Or

-
    - - table - the args for this command -
-

Or

-
    - - command.error -
- - - -

Usage:

-
    -
    commands.validate_args(event) -- returns args table
    -
- -
-
- - get_commands (player) -
-
- Used to return all the commands a player can use - - -

Parameters:

-
    -
  • player - index, name or player - the player to test as -
  • -
- -

Returns:

-
    - - table - a table containg all the commands the player can use -
- - - -

Usage:

-
    -
    get_commands(1) -- return table of command data for each command that the player can use
    -
- -
-
- - add_command (name[, description='No Description'][, inputs=an infite string], callback) -
-
- Used to define commands - - -

Parameters:

-
    -
  • name - string - the name of the command -
  • -
  • description - string - the description of the command - (default 'No Description') -
  • -
  • inputs - table - a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word) - (default an infite string) -
  • -
  • callback - function - the function to call on the event -
  • -
- - - - -

Usage:

-
    -
    --see examples in file
    -
- -
-
-

Tables

- -
-
- - validate -
-
- Collection of funcations that can be used to validate inputs - - -

Fields:

-
    -
  • __comment - replace _ with - the ldoc did not like me using - in the names -
  • -
  • string - basicly does nothing but a type filed is required -
  • -
  • string_inf - same as string but is infite in length, must be last arg -
  • -
  • string_len - same as string but can define a max lengh -
  • -
  • number - converts the input into a number -
  • -
  • number_int - conerts the input to a number and floors it -
  • -
  • number_range - allows a number in a range after it has been floored min < math.floor(X) <= max -
  • -
  • number_range - allows a number in a range after it has been floored min < math.floor(X) <= max -
  • -
  • player - converts the input into a valid player -
  • -
  • player_online - converts the input to a player if the player is online -
  • -
  • player_alive - converts the input to a player if the player is online and alive -
  • -
  • player_rank - -online converts the input to a player if the player is a lower rank than the user and online -
  • -
  • player_rank - -online converts the input to a player if the player is a lower rank than the user and online -
  • -
  • player_rank_alive - converts the input to a player if the player is a lower rank than the user and online and alive -
  • -
  • type - string - the type that the value should be -
  • -
  • value - the value that will be tested -
  • -
  • ... - any other data that can be passed to the function -
  • -
- - - - -

Usage:

-
    -
    commands.validate[type](value,event,...)
    -
- -
-
-

Fields

- -
-
- - error -
-
- Used as an error constant for validation - - - - - - -

Usage:

-
    -
  • return commands.error, 'err message'
  • -
  • return commands.error('err message')
  • -
- -
-
- - data -
-
- Index of all command data - - -
    -
  • key - string, table or event - the command that will be returned: string is the name, table is the command data, event is event from add_command -
  • -
- - - - -

Usage:

-
    -
  • commands.command_name -- returns command data
  • -
  • commands.data -- returns all data
  • -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Center.html b/doc/modules/ExpGamingCore.Gui.Center.html deleted file mode 100644 index b6b0f202..00000000 --- a/doc/modules/ExpGamingCore.Gui.Center.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Center

-

Adds a uniform preset for guis in the center of the screen which allow for different tabs to be opened

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
add (obj)Adds a new obj to the center gui
get_flow (player)Used to get the center frame of the player, used mainly in script
open (player, center)Used to open a center frame for a player
open_tab (player, center, tab)Used to open a center frame for a player
clear (player)Used to clear the center frame of the player, used mainly in script
center._center:add_tab (name, caption[, tooltip], callback)If deafult draw is used then you can add tabs to the gui with this function
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - add (obj) -
-
- Adds a new obj to the center gui - - -

Parameters:

-
    -
  • obj - contains the new object, needs name, fraw is opt and is function(root_frame) -
  • -
- -

Returns:

-
    - - the object made, used to add tabs -
- - - -

Usage:

-
    -
    Gui.center.add{name='foo',caption='Foo',tooltip='Testing',draw=function}
    -
- -
-
- - get_flow (player) -
-
- Used to get the center frame of the player, used mainly in script - - -

Parameters:

-
    -
  • player - a player indifier to get the flow for -
  • -
- -

Returns:

-
    - - table - the gui element flow -
- - - -

Usage:

-
    -
    Gui.center.get_flow(player) -- returns gui emelemt
    -
- -
-
- - open (player, center) -
-
- Used to open a center frame for a player - - -

Parameters:

-
    -
  • player - a player indifier to get the flow for -
  • -
  • center - string - the name of the center frame to open -
  • -
- -

Returns:

-
    - - boolean - based on if it successed or not -
- - - -

Usage:

-
    -
    Gui.center.open(player,'server-info') -- return true
    -
- -
-
- - open_tab (player, center, tab) -
-
- Used to open a center frame for a player - - -

Parameters:

-
    -
  • player - a player indifier to get the flow for -
  • -
  • center - string - the name of the center frame to open -
  • -
  • tab - string - the name of the tab to open -
  • -
- -

Returns:

-
    - - boolean - based on if it successed or not -
- - - -

Usage:

-
    -
    Gui.center.open_tab(player,'readme','rules') -- return true
    -
- -
-
- - clear (player) -
-
- Used to clear the center frame of the player, used mainly in script - - -

Parameters:

-
    -
  • player - a player indifier to get the flow for -
  • -
- - - - -

Usage:

-
    -
    Gui.center.clear(player)
    -
- -
-
- - center._center:add_tab (name, caption[, tooltip], callback) -
-
- If deafult draw is used then you can add tabs to the gui with this function - - -

Parameters:

-
    -
  • name - string - this is the name of the tab -
  • -
  • caption - string - this is the words that appear on the tab button -
  • -
  • tooltip - string - the tooltip that is on the button - (optional) -
  • -
  • callback - function - this is called when button is pressed with function(root_frame) -
  • -
- -

Returns:

-
    - - self to allow chaining of _center:add_tab -
- - - -

Usage:

-
    -
    _center:add_tab('foo','Foo','Just a tab',function)
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Inputs.html b/doc/modules/ExpGamingCore.Gui.Inputs.html deleted file mode 100644 index b96c8532..00000000 --- a/doc/modules/ExpGamingCore.Gui.Inputs.html +++ /dev/null @@ -1,498 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Inputs

-

Adds a clean way of making new inputs for a gui allowing for sliders and text inputs to be hanndleded with custom events

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
inputs._input:on_event (event, callback)Sets the input to trigger on an certain event
inputs._input:draw (root)Draw the input into the root element
add (obj)Add a new input, this is the same as doing frame.add{} but returns a diffrent object
add_elem_button (name, elem_type, tooltip, callback)Used to define a choose-elem-button callback only on elem_changed
add_checkbox (name, radio, display, default, callback_true, callback_false)Used to define a checkbox callback only on state_changed
reset_radio (elements)Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with.
add_text (name, box, text, callback)Used to define a text callback only on text_changed
add_slider (name, orientation, min, max, start_callback, callback)Used to define a slider callback only on value_changed
add_drop_down (name, items, index, callback)Used to define a drop down callback only on value_changed
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - inputs._input:on_event (event, callback) -
-
- Sets the input to trigger on an certain event - - -

Parameters:

-
    -
  • event - the event to raise callback on | can be number of the event | can be a key of inputs.events -
  • -
  • callback - function - the function you want to run on the event -
  • -
- -

Returns:

-
    - - table - returns self so you can chain together -
- - - -

Usage:

-
    -
    button:on_event(defines.events.on_gui_click,player_return)
    -
- -
-
- - inputs._input:draw (root) -
-
- Draw the input into the root element - - -

Parameters:

-
    -
  • root - the element you want to add the input to -
  • -
- -

Returns:

-
    - - returns the element that was added -
- - - -

Usage:

-
    -
    button:draw(frame)
    -
- -
-
- - add (obj) -
-
- Add a new input, this is the same as doing frame.add{} but returns a diffrent object - - -

Parameters:

-
    -
  • obj - table - the new element to add if caption is a sprite path then sprite is used -
  • -
- -

Returns:

-
    - - table - the custom input object -
- - - -

Usage:

-
    -
    Gui.inputs.add{type='button',name='test',caption='Test'}
    -
- -
-
- - add_elem_button (name, elem_type, tooltip, callback) -
-
- Used to define a choose-elem-button callback only on elem_changed - - -

Parameters:

-
    -
  • name - string - the name of this button -
  • -
  • elem_type - string - the display for this button, either text or sprite path -
  • -
  • tooltip - string - the tooltip to show on the button -
  • -
  • callback - function - the callback to call on change function(player,element,elem) -
  • -
- -

Returns:

-
    - - table - the button object that was made, to allow a custom error event if wanted -
- - - -

Usage:

-
    -
    Gui.inputs.add_elem_button('test','Test','Just for testing',function)
    -
- -
-
- - add_checkbox (name, radio, display, default, callback_true, callback_false) -
-
- Used to define a checkbox callback only on state_changed - - -

Parameters:

-
    -
  • name - string - the name of this button -
  • -
  • radio - boolean - if this is a radio button -
  • -
  • display - string - the display for this button, either text or sprite path -
  • -
  • default - function - the callback which choses the default check state -
  • -
  • callback_true - function - the callback to call when changed to true -
  • -
  • callback_false - function - the callback to call when changed to false -
  • -
- -

Returns:

-
    - - table - the button object that was made, to allow a custom error event if wanted -
- - - -

Usage:

-
    -
    Gui.inputs.add_checkbox('test',false,'Just for testing',function,function,funvtion)
    -
- -
-
- - reset_radio (elements) -
-
- Used to reset the state of radio buttons, recomened to be called on_state_change to reset any radio buttons it is ment to work with. - - -

Parameters:

-
    -
  • elements - can be a list of elements or a single element -
  • -
- - - - -

Usage:

-
    -
    Gui.inputs.reset_radio{radio1,radio2,...}
    -
- -
-
- - add_text (name, box, text, callback) -
-
- Used to define a text callback only on text_changed - - -

Parameters:

-
    -
  • name - string - the name of this button -
  • -
  • box - boolean - is it a text box rather than a text field -
  • -
  • text - string - the starting text -
  • -
  • callback - function - the callback to call on change function(player,text,element) -
  • -
- -

Returns:

-
    - - table - the text object that was made, to allow a custom error event if wanted -
- - - -

Usage:

-
    -
    Gui.inputs.add_text('test',false,'Just for testing',function)
    -
- -
-
- - add_slider (name, orientation, min, max, start_callback, callback) -
-
- Used to define a slider callback only on value_changed - - -

Parameters:

-
    -
  • name - string - the name of this button -
  • -
  • orientation - string - direction of the slider -
  • -
  • min - number - the lowest number -
  • -
  • max - number - the highest number -
  • -
  • start_callback - function - either a number or a function to return a number -
  • -
  • callback - function - the function to be called on value_changed function(player,value,percent,element) -
  • -
- -

Returns:

-
    - - table - the slider object that was made, to allow a custom error event if wanted -
- - - -

Usage:

-
    -
    Gui.inputs.add_slider('test','horizontal',1,10,5,function)
    -
- -
-
- - add_drop_down (name, items, index, callback) -
-
- Used to define a drop down callback only on value_changed - - -

Parameters:

-
    -
  • name - string - name of the drop down -
  • -
  • items - either a list or a function which returns a list -
  • -
  • index - either a number or a function which returns a number -
  • -
  • callback - function - the callback which is called when a new index is selected function(player,selected,items,element) -
  • -
- -

Returns:

-
    - - table - the drop-down object that was made, to allow a custom error event if wanted -
- - - -

Usage:

-
    -
    Gui.inputs.add_drop_down('test',{1,2,3},1,function)
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Left.html b/doc/modules/ExpGamingCore.Gui.Left.html deleted file mode 100644 index b1fc3ddc..00000000 --- a/doc/modules/ExpGamingCore.Gui.Left.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Left

-

Adds a organiser for left gui ellements which will automaticaly update there information and have open requirements

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
add (obj)Used to add a left gui frame
update ([frame[, players]])This is used to update all the guis of connected players, good idea to use our thread system as it as nested for loops
open (left_name)Used to open the left gui of every player
close (left_name)Used to close the left gui of every player
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - add (obj) -
-
- Used to add a left gui frame - - -

Parameters:

-
    -
  • obj - this is what will be made, needs a name and a draw function(root_frame), open_on_join can be used to set the deaful state true/false, can_open is a test to block it from opening but is not needed -
  • -
- -

Returns:

-
    - - the object that is made to... well idk but for the future -
- - - -

Usage:

-
    -
    Gui.left.add{name='foo',caption='Foo',tooltip='just testing',open_on_join=true,can_open=function,draw=function}
    -
- -
-
- - update ([frame[, players]]) -
-
- This is used to update all the guis of connected players, good idea to use our thread system as it as nested for loops - - -

Parameters:

-
    -
  • frame - string - this is the name of a frame if you only want to update one - (optional) -
  • -
  • players - the player to update for, if not given all players are updated, can be one player - (optional) -
  • -
- - - - -

Usage:

-
    -
    Gui.left.update()
    -
- -
-
- - open (left_name) -
-
- Used to open the left gui of every player - - -

Parameters:

-
    -
  • left_name - string - this is the gui that you want to open -
  • -
- - - - -

Usage:

-
    -
    Gui.left.open('foo')
    -
- -
-
- - close (left_name) -
-
- Used to close the left gui of every player - - -

Parameters:

-
    -
  • left_name - string - this is the gui that you want to close -
  • -
- - - - -

Usage:

-
    -
    Gui.left.close('foo')
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Popup.html b/doc/modules/ExpGamingCore.Gui.Popup.html deleted file mode 100644 index f1567b56..00000000 --- a/doc/modules/ExpGamingCore.Gui.Popup.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Popup

-

Adds a location for popups which can be dismissed by a player and created from other scripts

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
add (obj)Used to add a popup gui style
open (style, data[, players=game.connected_players])Use to open a popup for these players
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - add (obj) -
-
- Used to add a popup gui style - - -

Parameters:

-
    -
  • obj - this is what will be made, needs a name and a draw function(root_frame,data) -
  • -
- -

Returns:

-
    - - the object that is made to... well idk but for the future -
- - - -

Usage:

-
    -
    Gui.left.add{name='foo',caption='Foo',draw=function}
    -
- -
-
- - open (style, data[, players=game.connected_players]) -
-
- Use to open a popup for these players - - -

Parameters:

-
    -
  • style - string - this is the name you gave to the popup when added -
  • -
  • data - this is the data that is sent to the draw function -
  • -
  • players - table - the players to open the popup for - (default game.connected_players) -
  • -
- - - - -

Usage:

-
    -
    Gui.popup.open('ban',nil,{player=1,reason='foo'})
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Test.html b/doc/modules/ExpGamingCore.Gui.Test.html deleted file mode 100644 index c5fc942d..00000000 --- a/doc/modules/ExpGamingCore.Gui.Test.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Test

-

Used to test all gui elements and parts can be used in game via Gui.test()

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
Gui.test ([player=game.player])The funcation that is called when calling Gui.test
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - Gui.test ([player=game.player]) -
-
- The funcation that is called when calling Gui.test - - -

Parameters:

-
    -
  • player - a pointer to a player to draw the test gui for - (default game.player) -
  • -
- - - - -

Usage:

-
    -
    Gui.test() -- draws test gui
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.Toolbar.html b/doc/modules/ExpGamingCore.Gui.Toolbar.html deleted file mode 100644 index 7abec4aa..00000000 --- a/doc/modules/ExpGamingCore.Gui.Toolbar.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui.Toolbar

-

Adds a toolbar to the top left of the screen

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - -
_comment ()This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
add (name, caption, tooltip, callback)Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset
draw (player)Draws the toolbar for a certain player
- -
-
- - -

Functions

- -
-
- - _comment () -
-
- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module - - - - - - - -
-
- - add (name, caption, tooltip, callback) -
-
- Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset - - -

Parameters:

-
    -
  • name - string - the name of the button -
  • -
  • caption - string - can be a sprite path or text to show -
  • -
  • tooltip - string - the help to show for the button -
  • -
  • callback - function - the function which is called on_click -
  • -
- -

Returns:

-
    - - table - the button object that was made -
- - - -

Usage:

-
    -
    toolbar.add('foo','Foo','Test',function() game.print('test') end)
    -
- -
-
- - draw (player) -
-
- Draws the toolbar for a certain player - - -

Parameters:

-
    -
  • player - the player to draw the tool bar of -
  • -
- - - - -

Usage:

-
    -
    toolbar.draw(1)
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Gui.html b/doc/modules/ExpGamingCore.Gui.html deleted file mode 100644 index b5fea915..00000000 --- a/doc/modules/ExpGamingCore.Gui.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Gui

-

Adds a objective version to custom guis.

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - -
bar (frame[, width=10])Add a white bar to any gui frame
set_dropdown_index (dropdown, _item)Used to set the index of a drop down to a certian item
cam_link (data)Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity
-

Tables

- - - - - - - - - -
eventsStores all the on_player_joined_game event handlers for the guis
ParametersForCamLinkPrams for Gui.cam_link
-

Fields

- - - - - -
dataUsed to set and get data about different guis
-

modules.expgamingcore.gui.src.server Functions

- - - - - - - - - -
_comment ()This file will be loaded when ExpGamingCore.Command is present
__comment ()Adds a server thread that allows the camera follows to be toggled off and on
- -
-
- - -

Functions

- -
-
- - bar (frame[, width=10]) -
-
- Add a white bar to any gui frame - - -

Parameters:

-
    -
  • frame - the frame to draw the line to -
  • -
  • width - the width of the bar - (default 10) -
  • -
- -

Returns:

-
    - - the line that was made type is progressbar -
- - - -

Usage:

-
    -
    Gui.bar(frame,100)
    -
- -
-
- - set_dropdown_index (dropdown, _item) -
-
- Used to set the index of a drop down to a certian item - - -

Parameters:

-
    -
  • dropdown - the dropdown that is to be effected -
  • -
  • _item - this is the item to look for -
  • -
- -

Returns:

-
    - - returns the dropdown if it was successful -
- - - -

Usage:

-
    -
    Gui.set_dropdown_index(dropdown,player.name) -- will select the index with the players name as the value
    -
- -
-
- - cam_link (data) -
-
- Adds a camera that updates every tick (or less depeading on how many are opening) it will move to follow an entity - - -

Parameters:

-
    -
  • data - table - contains all other params given below -
  • -
- -

Returns:

-
    - - the camera that the function used be it made or given as a param -
- - - -

Usage:

-
    -
  • Gui.cam_link{entity=game.player.character,frame=frame,width=50,hight=50,zoom=1}
  • -
  • Gui.cam_link{entity=game.player.character,cam=frame.camera,surface=game.surfaces['testing']}
  • -
- -
-
-

Tables

- -
-
- - events -
-
- Stores all the on_player_joined_game event handlers for the guis - - - - - - - -
-
- - ParametersForCamLink -
-
- Prams for Gui.cam_link - - -

Fields:

-
    -
  • entity - this is the entity that the camera will follow -
  • -
  • cam - a camera that you already have in the gui -
  • -
  • frame - the frame to add the camera to, no effect if cam param is given -
  • -
  • zoom - the zoom to give the new camera -
  • -
  • width - the width to give the new camera -
  • -
  • height - the height to give the new camera -
  • -
  • surface - this will over ride the surface that the camera follows on, allowing for a 'ghost surface' while keeping same position -
  • -
  • respawn_open - if set to true then the camera will auto re link to the player after a respawn -
  • -
- - - - - -
-
-

Fields

- -
-
- - data -
-
- Used to set and get data about different guis - - -
    -
  • location - string - the location to get/set the data, center left etc... -
  • -
  • key - string - the name of the gui to set the value of - (optional) -
  • -
  • value - the data that will be set can be any value but table advised - (optional) -
  • -
- - - - -

Usage:

-
    -
  • Gui.data[location] -- returns the gui data for that gui location ex center
  • -
  • Gui.data(location,gui_name,gui_data) -- adds gui data for a gui at a location
  • -
- -
-
-

modules.expgamingcore.gui.src.server Functions

- -
-
- - _comment () -
-
- This file will be loaded when ExpGamingCore.Command is present - - - - - - - -
-
- - __comment () -
-
- Adds a server thread that allows the camera follows to be toggled off and on - - - - - - - -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Ranking.html b/doc/modules/ExpGamingCore.Ranking.html deleted file mode 100644 index b63a6d37..00000000 --- a/doc/modules/ExpGamingCore.Ranking.html +++ /dev/null @@ -1,883 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Role

-

A full ranking system for factorio.

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
output_ranks ([player=server])Outputs as a string all the ranks and the loaded order
_base_preset (ranks)Used to set the prset ranks that will be given to players
get_rank (mixed)Returns a rank object given a player or rank name
get_group (mixed)Returns the group object used to sort ranks given group name or rank
print (rank_base, rtn[, colour=defines.color.white[, below=false]])Prints to all rank of greater/lower power of the rank given
give_rank (player[, rank=default[, by_player='server'[, tick=game.tick]]])Gives a user a rank
revert (player[, by_player=nil])Revert the last change to a players rank
find_preset (player[, tick=nil])Given that the player has a rank in the preset table it is given; also will attempt to promote players if a time requirement is met
-

Tables

- - - - - - - - - - - - - - - - - -
globalGlobal Table
ranksContains the location of all the ranks, readonly during runtime
ranksContains the location of all the rank groups, readonly during runtime
metaContains some meta data about the ranks
-

Events

- - - - - -
on_rank_changeCalled when there is a rank change for a user
-

Class Rank

- - - - - - - - - - - - - - - - - -
Ranking._rank:allowed (action)Is this rank allowed to open this gui or use this command etc.
Ranking._rank:get_players ([online=false])Get all the players in this rank
Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])Print a message to all players of this rank
Ranking._rank:edit (key, value)Allows for a clean way to edit rank objects
-

Class Group

- - - - - - - - - - - - - -
Ranking._group:create (obj)Creates a new group
Ranking._group:add_rank (obj)Creats a new rank with this group as its group
Ranking._group:edit (key, value)Allows for a clean way to edit rank group objects
-

modules.expgamingcore.ranking.src.server Functions

- - - - - - - - - -
_comment ()This file will be loaded when ExpGamingCore.Server is present
Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]])Print a message to all players of this rank
- -
-
- - -

Functions

- -
-
- - output_ranks ([player=server]) -
-
- Outputs as a string all the ranks and the loaded order - - -

Parameters:

-
    -
  • player - player_name, player_index or LuaPlayer - the player that the info will be printed to, nil will print to server - (default server) -
  • -
- - - - -

Usage:

-
    -
    Ranking.output_ranks(player) -- prints to player
    -
- -
-
- - _base_preset (ranks) -
-
- Used to set the prset ranks that will be given to players - - -

Parameters:

-
    -
  • ranks - table - table of player names with the player name as the key and rank name as the value -
  • -
- - - - -

Usage:

-
    -
    Ranking._base_preset{name=rank_name,nameTwo=rank_name_two} -- sets player name to have rank rank_name on join
    -
- -
-
- - get_rank (mixed) -
-
- Returns a rank object given a player or rank name - - -

Parameters:

-
    -
  • mixed - player, player_index, player_name, rank_name, Ranking._rank, 'server' or 'root' - what rank to get -
  • -
- -

Returns:

-
    - - table - the rank that is linked to mixed -
-

Or

-
    - - nil - there was no rank found -
- - - -

Usage:

-
    -
  • Ranking.get_rank(game.player) -- returns player's rank
  • -
  • Ranking.get_rank('admin') -- returns rank by the name of admin
  • -
- -
-
- - get_group (mixed) -
-
- Returns the group object used to sort ranks given group name or rank - - -

Parameters:

-
    -
  • mixed - player, player_index, player_name, rank_name, rank, 'server', 'root', group_name or group - what group to get -
  • -
- -

Returns:

-
    - - table - the group that is linked to mixed -
-

Or

-
    - - nil - there was no rank group found -
- - -

See also:

- - -

Usage:

-
    -
  • Ranking.get_group(game.player) -- returns player's rank group
  • -
  • Ranking.get_group('root') -- returns group by name of root
  • -
- -
-
- - print (rank_base, rtn[, colour=defines.color.white[, below=false]]) -
-
- Prints to all rank of greater/lower power of the rank given - - -

Parameters:

-
    -
  • rank_base - Ranking._rank or pointerToRank - the rank that acts as the cut off point (rank is always included) -
  • -
  • rtn - what do you want to return to the players -
  • -
  • colour - defines.color - the colour that will be used to print - (default defines.color.white) -
  • -
  • below - boolean - if true print to children rather than parents - (default false) -
  • -
- - - - -

Usage:

-
    -
    Ranking.print('admin','We got a grifer')
    -
- -
-
- - give_rank (player[, rank=default[, by_player='server'[, tick=game.tick]]]) -
-
- Gives a user a rank - - -

Parameters:

-
    -
  • player - LuaPlayer or pointerToPlayer - the player to give the rank to -
  • -
  • rank - Ranking._rank or pointerToRank - the rank to give to the player - (default default) -
  • -
  • by_player - LuaPlayer or pointerToPlayer - the player who is giving the rank - (default 'server') -
  • -
  • tick - number - the tick that the rank is being given on, used as pass though - (default game.tick) -
  • -
- - - - -

Usage:

-
    -
    Ranking.give_rank(1,'admin')
    -
- -
-
- - revert (player[, by_player=nil]) -
-
- Revert the last change to a players rank - - -

Parameters:

-
    -
  • player - LuaPlayer or pointerToPlayer - the player to revert the rank of -
  • -
  • by_player - the player who is doing the revert - (default nil) -
  • -
- - - - -

Usage:

-
    -
    Ranking.revert(1) -- reverts the rank of player with index 1
    -
- -
-
- - find_preset (player[, tick=nil]) -
-
- Given that the player has a rank in the preset table it is given; also will attempt to promote players if a time requirement is met - - -

Parameters:

-
    -
  • player - LuaPlayer or pointerToPlayer - the player to test for an auto rank -
  • -
  • tick - number - the tick it happens on - (default nil) -
  • -
- - - - -

Usage:

-
    -
    Ranking.find_preset(1) -- attemps to find the preset for player with index 1
    -
- -
-
-

Tables

- -
-
- - global -
-
- Global Table - - -

Fields:

-
    -
  • old - contains the previous rank a use had before a rank change -
  • -
  • preset - contains the preset ranks that users will recive apon joining -
  • -
  • last_change - contains the name of the player who last had there rank chagned -
  • -
- - - - - -
-
- - ranks -
-
- Contains the location of all the ranks, readonly during runtime - - - - - - - -
-
- - ranks -
-
- Contains the location of all the rank groups, readonly during runtime - - - - - - - -
-
- - meta -
-
- Contains some meta data about the ranks - - -

Fields:

-
    -
  • default - this is the name of the default rank -
  • -
  • root - this is the name of the root rank -
  • -
  • time_ranks - a list of all ranks which have a time requirement -
  • -
  • time_highest - the power of the highest rank that has a time requirement -
  • -
  • time_lowest - the lowest amount of time required for a time rank -
  • -
- - - - - -
-
-

Events

- -
-
- - on_rank_change -
-
- Called when there is a rank change for a user - - -

field:

-
    -
  • name - the rank id -
  • -
  • tick - the tick which the event was raised on -
  • -
  • player_index - the player whos rank was changed -
  • -
  • by_player_index - the player who changed the rank, 0 means server -
  • -
  • new_rank - the name of the rank that was given -
  • -
  • old_rank - the name of the rank the player had -
  • -
- - - - - -
-
-

Class Rank

- -
- The class for the ranks -
-
-
- - Ranking._rank:allowed (action) -
-
- Is this rank allowed to open this gui or use this command etc. - - -

Parameters:

-
    -
  • action - teh - to test for -
  • -
- -

Returns:

-
    - - boolean - is it allowed -
- - - -

Usage:

-
    -
    rank:allowed('interface') -- does the rank have permision for 'interface'
    -
- -
-
- - Ranking._rank:get_players ([online=false]) -
-
- Get all the players in this rank - - -

Parameters:

-
    -
  • online - boolean - get only online players - (default false) -
  • -
- -

Returns:

-
    - - table - a table of all players in this rank -
- - - -

Usage:

-
    -
    rank:get_players()
    -
- -
-
- - Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]]) -
-
- Print a message to all players of this rank - - -

Parameters:

-
    -
  • rtn - any value you want to return -
  • -
  • colour - define.color - the colour that will be used to print - (default defines.color.white) -
  • -
  • show_default - boolean - weather to use the default rank name for the print, used as a pass though - (default false) -
  • -
- - - - -

Usage:

-
    -
    rank:print('foo') -- prints to all members of this rank
    -
- -
-
- - Ranking._rank:edit (key, value) -
-
- Allows for a clean way to edit rank objects - - -

Parameters:

-
    -
  • key - string - the key to edit, often allow or disallow -
  • -
  • value - the new value to be set -
  • -
- - - - -

Usage:

-
    -
    rank:edit('allow',{'interface'}) -- allows this rank to use 'interface'
    -
- -
-
-

Class Group

- -
- The class for the rank groups, the way to allow modules to idex a group that is always present, ranks will always look to there group as a parent -
-
-
- - Ranking._group:create (obj) -
-
- Creates a new group - - -

Parameters:

-
    -
  • obj - table - the fields for this object -
  • -
- -

Returns:

-
    - - Ranking._group - returns the object to allow chaining -
- - - -

Usage:

-
    -
    Ranking._group:create{name='root'} -- returns group with name root
    -
- -
-
- - Ranking._group:add_rank (obj) -
-
- Creats a new rank with this group as its group - - -

Parameters:

-
    -
  • obj - table - the fields for this object -
  • -
- -

Returns:

-
    - - Ranking._group - returns the object to allow chaining -
- - - -

Usage:

-
    -
    group:add_rank{name='root'} -- returns self
    -
- -
-
- - Ranking._group:edit (key, value) -
-
- Allows for a clean way to edit rank group objects - - -

Parameters:

-
    -
  • key - string - the key to edit, often allow or disallow -
  • -
  • value - the new value to be set -
  • -
- - - - -

Usage:

-
    -
    group:edit('allow',{'interface'}) -- allows this rank to use 'interface'
    -
- -
-
-

modules.expgamingcore.ranking.src.server Functions

- -
-
- - _comment () -
-
- This file will be loaded when ExpGamingCore.Server is present - - - - - - - -
-
- - Ranking._rank:print (rtn[, colour=defines.color.white[, show_default=false]]) -
-
- Print a message to all players of this rank - - -

Parameters:

-
    -
  • rtn - any value you want to return -
  • -
  • colour - define.color - the colour that will be used to print - (default defines.color.white) -
  • -
  • show_default - boolean - weather to use the default rank name for the print, used as a pass though - (default false) -
  • -
- - - - -

Usage:

-
    -
    rank:print('foo') -- prints to all members of this rank
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Server.html b/doc/modules/ExpGamingCore.Server.html deleted file mode 100644 index 5bd0827d..00000000 --- a/doc/modules/ExpGamingCore.Server.html +++ /dev/null @@ -1,848 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Server

-

Adds a thread system and event listening and a admin bypass (recommend to disable /c and use optional /interface)

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new_thread (obj)Generates a new thread object
get_thread (mixed)Used to get a thread via uuid or name (if one is assied)
queue_thread (thread_to_queue)Adds a thread into the resolve queue, can be used to lower lag
close_all_threads (with_force)Closes all active threads, can use force if it causes errors
run_tick_threads ()Runs all the theads which have opened with an on_tick event
check_timeouts ()Checks the timeout on all active timeout threads
_thread_debuger (player, event[, state=toggle])Used to print event info to a player
interface (callback[, use_thread[, env[, ...]]])Acts as a bypass for running functions, can accept a string
-

Tables

- - - - - -
globalGlobal Table
-

Fields

- - - - - - - - - -
uuidUsed to generate a new uuid for the thread system
threadsRedirect to the thread index
-

Class Thread

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Server._thread:create ([obj={}])Returns a new thread object
Server._thread:queue ()Opens and queses a thread
Server._thread:valid ([skip_location_check=false])Test if the thread has all requied parts
Server._thread:open ()Opens the thread; indexs this thread in the global index
Server._thread:close ()Inverse of thread:open() - Removes all indexs to this thread, most cases this will cause it to become inassible
Server._thread:resolve ([...])Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async)
Server._thread:check_timeout ()Checks the timeout on a thread - if timed out then it calles on_timeout and closes
Server._thread:error (err)Used to check and raise the error handler of the thread, if not present it raises an error
Server._thread:on_event (event, callback)Set function to run then an event is triggered, none of them are 'needed' but you are advised to have atleast one
-

modules.expgamingcore.server.src.commands Functions

- - - - - - - - - -
_comment ()This file will be loaded when ExpGamingCore.Command is present
interfaceRuns the given input from the script
- -
-
- - -

Functions

- -
-
- - new_thread (obj) -
-
- Generates a new thread object - - -

Parameters:

-
    -
  • obj - table - the atributes to give to the thread -
  • -
- -

Returns:

-
    - - Server._thread - the new thread created -
- - - -

Usage:

-
    -
    Server.new_thread{name='foo',data={}}
    -
- -
-
- - get_thread (mixed) -
-
- Used to get a thread via uuid or name (if one is assied) - - -

Parameters:

-
    -
  • mixed - either a uuid or the name given to a thread -
  • -
- -

Returns:

-
    - - Server._thread - the thread by that name or uuid -
-

Or

-
    - - boolean - if false is returned then no thread existes -
- - - -

Usage:

-
    -
    Server.get_thread('decon') -- return thread
    -
- -
-
- - queue_thread (thread_to_queue) -
-
- Adds a thread into the resolve queue, can be used to lower lag - - -

Parameters:

-
    -
  • thread_to_queue - Server._thread - the thread to be added to the queue, must be open and have a on_resolve function -
  • -
- -

Returns:

-
    - - boolean - was it added successfuly -
- - - -

Usage:

-
    -
    Server.queue_thread(thread) -- return true/false
    -
- -
-
- - close_all_threads (with_force) -
-
- Closes all active threads, can use force if it causes errors - - -

Parameters:

-
    -
  • with_force - bolean - use force when closing -
  • -
- - - - -

Usage:

-
    -
  • Server.close_all_threads() -- asks all threads to close
  • -
  • Server.close_all_threads(true) -- forcefuly close all threads
  • -
- -
-
- - run_tick_threads () -
-
- Runs all the theads which have opened with an on_tick event - - - - - - -

Usage:

-
    -
    Server.run_tick_threads()
    -
- -
-
- - check_timeouts () -
-
- Checks the timeout on all active timeout threads - - - - - - -

Usage:

-
    -
    Server.check_timeouts()
    -
- -
-
- - _thread_debuger (player, event[, state=toggle]) -
-
- Used to print event info to a player - - -

Parameters:

-
    -
  • player - name, index or LuaPlayer - the player that the info will be returned to -
  • -
  • event - name or index - the event that info will be returned fo -
  • -
  • state - boolean - will info be returned, nil to toggle current state - (default toggle) -
  • -
- - - - -

Usage:

-
    -
    Server._thread_debuger('Cooldude2606','on_player_died',true) -- will output event info to 'Cooldude2606' for 'on_player_died'
    -
- -
-
- - interface (callback[, use_thread[, env[, ...]]]) -
-
- Acts as a bypass for running functions, can accept a string - - -

Parameters:

-
    -
  • callback - string or function - function to be ran -
  • -
  • use_thread - Server._thread or true - run the command on a premade thread or let it make its own - (optional) -
  • -
  • env - table - run the env to run the command in must have _env key as true to be - (optional) -
  • -
  • ... - any args you want to pass to the function - (optional) -
  • -
- -

Returns:

-
    -
  1. - boolean - if no thread then it will return a true for the success
  2. -
  3. - if no thread then it will return the value(s) returned by the callback
  4. -
-

Or

-
    -
  1. - boolean - if no thread then it will return a false for the success
  2. -
  3. - string - if no thread then it will return a an err value
  4. -
- - - -

Usage:

-
    -
  • Server.interface('local x = 1+1 print(x) return x') -- return 2
  • -
  • Server.interface('local x = 1+1 print(x)',true) -- will creat a thread to run as root (this is the bypass)
  • -
- -
-
-

Tables

- -
-
- - global -
-
- Global Table - - -

Fields:

-
    -
  • all - a list of every thread (indexed by uuid) -
  • -
  • queue - an index for threads which will be resolved (contains uuids) -
  • -
  • tick - an index for threads which will run every tick (contains uuids) -
  • -
  • timeout - an index for threads which will timeout (contains uuids) -
  • -
  • events - an index of threads based on event ids (contains uuids) -
  • -
  • paused - an index of pasued threads (contains uuids) -
  • -
  • named - a name index for thread uuids -
  • -
  • print_to - contains players that event details will be printed to -
  • -
  • uuid - contains the random number generator for the uuid system -
  • -
- - - - - -
-
-

Fields

- -
-
- - uuid -
-
- Used to generate a new uuid for the thread system - - - - - - -

Usage:

-
    -
    local uuid = tostring(Server.uuid) -- calling tostring locks the value
    -
- -
-
- - threads -
-
- Redirect to the thread index - - - - - - -

Usage:

-
    -
  • Server.threads -- return #global.all
  • -
  • Server.threads -- return global.all
  • -
- -
-
-

Class Thread

- -
- The class for the server threads, allows abbilty to run async function -
-
-
- - Server._thread:create ([obj={}]) -
-
- Returns a new thread object - - -

Parameters:

-
    -
  • obj - table - all values are opt {timeout=int,name=str,data=any} - (default {}) -
  • -
- -

Returns:

-
    - - Server._thread - the new thread object -
- - - -

Usage:

-
    -
    new_thread = thread:create()
    -
- -
-
- - Server._thread:queue () -
-
- Opens and queses a thread - - - -

Returns:

-
    - - boolean - was the thread queued successfuly -
- - -

See also:

- - -

Usage:

-
    -
    Server._thread:queue() -- returns true/false
    -
- -
-
- - Server._thread:valid ([skip_location_check=false]) -
-
- Test if the thread has all requied parts - - -

Parameters:

-
    -
  • skip_location_check - bolean - true to skip the location checking - (default false) -
  • -
- -

Returns:

-
    - - boolean - is the thread valid -
- - - -

Usage:

-
    -
    if thread:valid() then end -- basic test for valid
    -
- -
-
- - Server._thread:open () -
-
- Opens the thread; indexs this thread in the global index - - - -

Returns:

-
    - - bolean - if the thread was opened successfuly -
- - - -

Usage:

-
    -
    thread:open() -- return true
    -
- -
-
- - Server._thread:close () -
-
- Inverse of thread:open() - Removes all indexs to this thread, most cases this will cause it to become inassible - - - -

Returns:

-
    - - boolean - if the thread had a on_close function -
- - - -

Usage:

-
    -
    thread:close() -- return true
    -
- -
-
- - Server._thread:resolve ([...]) -
-
- Trigger the on_resolve function and closes the thread - error and success called based on result of pcall (useful for async) - - -

Parameters:

-
    -
  • ... - any arguments you want to pass to the resolve function - (optional) -
  • -
- -

Returns:

-
    - - bolean - true if the thread called on_success or on_error -
- - - -

Usage:

-
    -
    thread:resolve(x,y,z) -- return true
    -
- -
-
- - Server._thread:check_timeout () -
-
- Checks the timeout on a thread - if timed out then it calles on_timeout and closes - - - -

Returns:

-
    - - bolean - if the thread timed out -
- - - -

Usage:

-
    -
    thread:check_timeout() -- return true
    -
- -
-
- - Server._thread:error (err) -
-
- Used to check and raise the error handler of the thread, if not present it raises an error - - -

Parameters:

-
    -
  • err - string - the err to be rasied -
  • -
- -

Returns:

-
    - - boolean - did the thread have an error handler -
- - - -

Usage:

-
    -
    thread:error(err) -- return true
    -
- -
-
- - Server._thread:on_event (event, callback) -
-
- Set function to run then an event is triggered, none of them are 'needed' but you are advised to have atleast one - - -

Parameters:

-
    -
  • event - string or index - the name of the event that the function should be called on -
  • -
  • callback - function - the function which is called by the event trigger -
  • -
- -

Returns:

-
    - - table - returns self so that they can be chained together -
- - - -

Usage:

-
    -
  • thread:on_event('close',function) -- if event is not one below then a game event is used
  • -
  • thread_only_events = ['close','timeout','tick','resolve','success','error']
  • -
- -
-
-

modules.expgamingcore.server.src.commands Functions

- -
-
- - _comment () -
-
- This file will be loaded when ExpGamingCore.Command is present - - - - - - - -
-
- - interface -
-
- Runs the given input from the script - - -

param:

-
    -
  • code - The code that will be ran -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingCore.Sync.html b/doc/modules/ExpGamingCore.Sync.html deleted file mode 100644 index 291dd92b..00000000 --- a/doc/modules/ExpGamingCore.Sync.html +++ /dev/null @@ -1,820 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingCore.Sync

-

Allows syncing with an outside server and info panle.

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tick_format (tick)Used to standidise the tick format for any sync info
print (player_message, player_name[, player_tag[, player_colour[, prefix]]])Prints to chat as if it were a player
emit_embedded (args)Logs an embed to the json.data we use a js script to add things we cant here
count_admins ()Used to get the number of admins currently online
count_afk ([time=7200])Used to get the number of afk players defined by 2 min by default
count_ranks ()Used to get the number of players in each rank and currently online; if ExpGamingCore/Ranking is present then it will give more than admin and user
count_players (online)Used to get a list of every player name with the option to limit to only online players
count_player_times ()Used to get a list of every player name with the amount of time they have played for
update ()Called to update values inside of the info
add_update (key, callback)Adds a callback to be called when the info is updated
emit_data ()Outputs the curent server info into a file
-

Tables

- - - - - - - - - - - - - -
globalGlobal Table
global.playersPlayer sub-table
EmitEmbededParamatersOutline of the paramaters accepted by Sync.emit_embedded
-

Fields

- - - - - - - - - -
infoused to get the global list that has been defined, also used to set that list
timeUsed to return and set the current IRL time; not very good need a better way to do this
-

modules.expgamingcore.sync.src.gui Functions

- - - - - - - - - - - - - -
_comment ()This file will be loaded when ExpGamingCore.Gui is present
add_to_gui (element)Adds a emeltent to the sever info gui
server-infoCreates a center gui that will appear on join
-

modules.expgamingcore.sync.src.ranking Functions

- - - - - - - - - - - - - -
_comment ()This file will be loaded when ExpGamingCore.Role is present
set_ranks (...)Used as a redirect to Ranking._base_preset that will set the rank given to a player apon joining
count_ranks ()Used to get the number of players in each rank and currently online
- -
-
- - -

Functions

- -
-
- - tick_format (tick) -
-
- Used to standidise the tick format for any sync info - - -

Parameters:

-
    -
  • tick - -
  • -
- -

Returns:

-
    - - {number,string} - table containg both the raw number and clean version of a time -
- - - -

Usage:

-
    -
    Sync.tick_format(60) -- return {60,'1.00M'}
    -
- -
-
- - print (player_message, player_name[, player_tag[, player_colour[, prefix]]]) -
-
- Prints to chat as if it were a player - - -

Parameters:

-
    -
  • player_message - string - the message to be printed in chat -
  • -
  • player_name - string - the name of the player sending the message -
  • -
  • player_tag - string - the tag apllied to the player's name - (optional) -
  • -
  • player_colour - string - the colour of the message, either hex or named colour - (optional) -
  • -
  • prefix - string - add a prefix before the chat eg [IRC] - (optional) -
  • -
- - - - -

Usage:

-
    -
    Sync.print('Test','Cooldude2606')
    -
- -
-
- - emit_embedded (args) -
-
- Logs an embed to the json.data we use a js script to add things we cant here - - -

Parameters:

-
    -
  • args - table - a table which contains everything that the embedded will use -
  • -
- - - -

See also:

- - -

Usage:

-
    -
    Sync.emit_embedded{title='BAN',color='0x0',description='A player was banned' ... }
    -
- -
-
- - count_admins () -
-
- Used to get the number of admins currently online - - - -

Returns:

-
    - - number - the number of admins online -
- - - -

Usage:

-
    -
    Sync.count_admins() -- returns number
    -
- -
-
- - count_afk ([time=7200]) -
-
- Used to get the number of afk players defined by 2 min by default - - -

Parameters:

-
    -
  • time - int - in ticks that a player is called afk - (default 7200) -
  • -
- -

Returns:

-
    - - number - the number of afk players -
- - - -

Usage:

-
    -
    Sync.count_afk()
    -
- -
-
- - count_ranks () -
-
- Used to get the number of players in each rank and currently online; if ExpGamingCore/Ranking is present then it will give more than admin and user - - - -

Returns:

-
    - - table - contains the ranks and the players in that rank -
- - - -

Usage:

-
    -
    Sync.count_ranks()
    -
- -
-
- - count_players (online) -
-
- Used to get a list of every player name with the option to limit to only online players - - -

Parameters:

-
    -
  • online - boolean - true will get only the online players -
  • -
- -

Returns:

-
    - - table - table of player names -
- - - -

Usage:

-
    -
    Sync.count_players()
    -
- -
-
- - count_player_times () -
-
- Used to get a list of every player name with the amount of time they have played for - - - -

Returns:

-
    - - table - table indexed by player name, each value contains the raw tick and then the clean string -
- - - -

Usage:

-
    -
    Sync.count_player_times()
    -
- -
-
- - update () -
-
- Called to update values inside of the info - - - -

Returns:

-
    - - all of the new info -
- - - -

Usage:

-
    -
    Sync.update()
    -
- -
-
- - add_update (key, callback) -
-
- Adds a callback to be called when the info is updated - - -

Parameters:

-
    -
  • key - string - the key that the value will be stored in -
  • -
  • callback - function - the function which will return this value -
  • -
- - - - -

Usage:

-
    -
    Sync.add_update('players',function() return #game.players end)
    -
- -
-
- - emit_data () -
-
- Outputs the curent server info into a file - - - - - - -

Usage:

-
    -
    Sync.emit_data()
    -
- -
-
-

Tables

- -
-
- - global -
-
- Global Table - - -

Fields:

-
    -
  • server_name - the server name -
  • -
  • server_description - a short description of the server -
  • -
  • reset_time - the reset time of the server -
  • -
  • time - the last knowen irl time -
  • -
  • time_set - the last in game time that the time was set -
  • -
  • last_update - the last time that this info was updated -
  • -
  • time_period - how often this infomation is updated -
  • -
  • players - a list of different player related states -
  • -
  • ranks - a list of player ranks -
  • -
  • rockets - the number of rockets launched -
  • -
  • mods - the mods which are loaded -
  • -
- - - - - -
-
- - global.players -
-
- Player sub-table - - -

Fields:

-
    -
  • online - list of all players online -
  • -
  • n_online - the number of players online -
  • -
  • all - list of all player on or offline -
  • -
  • n_all - the number of players who have joined the server -
  • -
  • admins_online - the number of admins online -
  • -
  • afk_players - the number of afk players -
  • -
  • times - the play times of every player -
  • -
- - - - - -
-
- - EmitEmbededParamaters -
-
- Outline of the paramaters accepted by Sync.emit_embedded - - -

Fields:

-
    -
  • title - the tile of the embed -
  • -
  • color - the color given in hex you can use Color.to_hex{r=0,g=0,b=0} -
  • -
  • description - the description of the embed -
  • -
  • server_detail - sting to add onto the pre-set server detail -
  • -
  • fieldone - the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline) -
  • -
  • fieldtwo - the filed to add to the embed (key is name) (value is text) (start value with <<inline>> to make inline) -
  • -
- - - - - -
-
-

Fields

- -
-
- - info -
-
- used to get the global list that has been defined, also used to set that list - - -
    -
  • set - table - keys to be replaced in the server info - (default nil) -
  • -
- - - - -

Usage:

-
    -
  • Sync.info{server_name='Factorio Server 2'} -- returns true
  • -
  • Sync.info -- table of info
  • -
- -
-
- - time -
-
- Used to return and set the current IRL time; not very good need a better way to do this - - -
    -
  • set - string - the date time to be set - (default nil) -
  • -
- - - - -

Usage:

-
    -
  • Sync.time('Sun Apr  1 18:44:30 UTC 2018')
  • -
  • Sync.time -- string
  • -
- -
-
-

modules.expgamingcore.sync.src.gui Functions

- -
-
- - _comment () -
-
- This file will be loaded when ExpGamingCore.Gui is present - - - - - - - -
-
- - add_to_gui (element) -
-
- Adds a emeltent to the sever info gui - - -

Parameters:

-
    -
  • element - see examples before for what can be used, it can also be a return from Gui.inputs.add -
  • -
- -

Returns:

-
    - - bolean - based on weather it was successful or not -
- - - -

Usage:

-
    -
    Sync.add_to_gui('string') -- return true
    -
- -
-
- - server-info -
-
- Creates a center gui that will appear on join - - - - - - - -
-
-

modules.expgamingcore.sync.src.ranking Functions

- -
-
- - _comment () -
-
- This file will be loaded when ExpGamingCore.Role is present - - - - - - - -
-
- - set_ranks (...) -
-
- Used as a redirect to Ranking._base_preset that will set the rank given to a player apon joining - - -

Parameters:

-
    -
  • ... - -
  • -
- - - - -

Usage:

-
    -
    Sync.set_ranks{player_name=rank_name,...}
    -
- -
-
- - count_ranks () -
-
- Used to get the number of players in each rank and currently online - - - -

Returns:

-
    - - table - contains the ranks and the players in that rank -
- - - -

Usage:

-
    -
    Sync.count_ranks()
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/ExpGamingLib.html b/doc/modules/ExpGamingLib.html deleted file mode 100644 index 5cea1e8b..00000000 --- a/doc/modules/ExpGamingLib.html +++ /dev/null @@ -1,672 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module ExpGamingLib

-

Adds some common functions used though out all ExpGaming modules

-

-

Info:

-
    -
  • License: https://github.com/explosivegaming/scenario/blob/master/LICENSE
  • -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unpack_to_G (tbl)Loads a table into _G even when sandboxed; will not overwrite values or append to tables; will not work during runtime to avoid desyncs
get_env ()Used to get the current ENV with all _G keys removed; useful when saving function to global
add_metatable (tbl[, callback=tostring[, string=table.tostring]])Creats a table that will act like a string and a function
is_type (v[, test_type=nil])Compear types faster for faster valadation of prams
player_return (rtn[, colour=defines.colour.white[, player=game.player]])Will return a value of any type to the player/server console, allows colour for in-game players
tick_to_hour (tick)Convert ticks to hours
tick_to_min (tick)Convert ticks to minutes
tick_to_display_format (tick)Converts a tick into a clean format for end user
gui_tree (root)Used as a way to view the structure of a gui, used for debuging
-

Class table

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
table.val_to_str (v)Returns a value in a form able to be read as a value, any value to string
table.key_to_str (k)Returns a value in a form able to be read as a key, any key to string
table.tostring (tbl)Returns a table in a form able to be read as a table
table.json (lua_table)Simmilar to table.tostring but converts a lua table to a json one
table.autokey (tbl, str)Returns the closest match to a key
table.alphanumsort (tbl)Returns the list is a sorted way that would be expected by people (this is by key)
table.keysort (tbl)Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)
- -
-
- - -

Functions

- -
-
- - unpack_to_G (tbl) -
-
- Loads a table into _G even when sandboxed; will not overwrite values or append to tables; will not work during runtime to avoid desyncs - - -

Parameters:

-
    -
  • tbl - table - table to be unpacked -
  • -
- - - - -

Usage:

-
    -
    unpack_to_G{key1='foo',key2='bar'}
    -
- -
-
- - get_env () -
-
- Used to get the current ENV with all _G keys removed; useful when saving function to global - - - -

Returns:

-
    - - table - the env table with _G keys removed -
- - - -

Usage:

-
    -
    get_env() returns current ENV with _G keys removed
    -
- -
-
- - add_metatable (tbl[, callback=tostring[, string=table.tostring]]) -
-
- Creats a table that will act like a string and a function - - -

Parameters:

-
    -
  • tbl - table - the table that will have its metatable set -
  • -
  • callback - function - the function that will be used for the call - (default tostring) -
  • -
  • string - function or string - a function that resolves to a string or a string - (default table.tostring) -
  • -
- -

Returns:

-
    - - table - the new table with its metatable set -
- - - -

Usage:

-
    -
    add_metatable({},function) -- returns table
    -
- -
-
- - is_type (v[, test_type=nil]) -
-
- Compear types faster for faster valadation of prams - - -

Parameters:

-
    -
  • v - the value to be tested -
  • -
  • test_type - string - the type to test for if not given then it tests for nil - (default nil) -
  • -
- -

Returns:

-
    - - bolean - is v of type test_type -
- - - -

Usage:

-
    -
  • is_type('foo','string') -- return true
  • -
  • is_type('foo') -- return false
  • -
- -
-
- - player_return (rtn[, colour=defines.colour.white[, player=game.player]]) -
-
- Will return a value of any type to the player/server console, allows colour for in-game players - - -

Parameters:

-
    -
  • rtn - any value of any type that will be returned to the player or console -
  • -
  • colour - defines.color or string - the colour of the text for the player, ingroned when printing to console - (default defines.colour.white) -
  • -
  • player - LuaPlayer - the player that return will go to, if no game.player then returns to server - (default game.player) -
  • -
- - - - -

Usage:

-
    -
  • player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console
  • -
  • player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console
  • -
  • player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player
  • -
- -
-
- - tick_to_hour (tick) -
-
- Convert ticks to hours - - -

Parameters:

-
    -
  • tick - number - tick to convert to hours -
  • -
- -

Returns:

-
    - - number - the number of whole hours from this tick -
- - - -

Usage:

-
    -
    tick_to_hour(216001) -- return 1
    -
- -
-
- - tick_to_min (tick) -
-
- Convert ticks to minutes - - -

Parameters:

-
    -
  • tick - number - tick to convert to minutes -
  • -
- -

Returns:

-
    - - number - the number of whole minutes from this tick -
- - - -

Usage:

-
    -
    tick_to_hour(3601) -- return 1
    -
- -
-
- - tick_to_display_format (tick) -
-
- Converts a tick into a clean format for end user - - -

Parameters:

-
    -
  • tick - number - the tick to convert -
  • -
- -

Returns:

-
    - - string - the formated string -
- - - -

Usage:

-
    -
  • tick_to_display_format(3600) -- return '1.00 M'
  • -
  • tick_to_display_format(234000) -- return '1 H 5 M'
  • -
- -
-
- - gui_tree (root) -
-
- Used as a way to view the structure of a gui, used for debuging - - -

Parameters:

-
    -
  • root - LuaGuiElement - the root to start the tree from -
  • -
- -

Returns:

-
    - - table - the table that describes the gui -
- - - -

Usage:

-
    -
    Gui_tree(root) returns all children of gui recusivly
    -
- -
-
-

Class table

- -
- Extents the table class -
-
-
- - table.val_to_str (v) -
-
- Returns a value in a form able to be read as a value, any value to string - - -

Parameters:

-
    -
  • v - value to convert -
  • -
- -

Returns:

-
    - - string - the converted value -
- - - -

Usage:

-
    -
    table.val_to_str{a='foo'} -- return '"foo"'
    -
- -
-
- - table.key_to_str (k) -
-
- Returns a value in a form able to be read as a key, any key to string - - -

Parameters:

-
    -
  • k - key to convert -
  • -
- -

Returns:

-
    - - string - the converted key -
- - - -

Usage:

-
    -
    table.val_to_str{a='foo'} -- return '["a"]'
    -
- -
-
- - table.tostring (tbl) -
-
- Returns a table in a form able to be read as a table - - -

Parameters:

-
    -
  • tbl - table - table to convert -
  • -
- -

Returns:

-
    - - string - the converted table -
- - - -

Usage:

-
    -
    table.tostring{k1='foo',k2='bar'} -- return '{["k1"]="foo",["k2"]="bar"}'
    -
- -
-
- - table.json (lua_table) -
-
- Simmilar to table.tostring but converts a lua table to a json one - - -

Parameters:

-
    -
  • lua_table - table - the table to convert -
  • -
- -

Returns:

-
    - - string - the table in a json format -
- - - -

Usage:

-
    -
    talbe.json{k1='foo',k2='bar'} -- return '{"k1":"foo","k2":"bar"}'
    -
- -
-
- - table.autokey (tbl, str) -
-
- Returns the closest match to a key - - -

Parameters:

-
    -
  • tbl - table - the table that will be searched -
  • -
  • str - string - the string that will be looked for in the keys -
  • -
- - - - -

Usage:

-
    -
    table.autokey({foo=1,bar=2},'f') -- return 1
    -
- -
-
- - table.alphanumsort (tbl) -
-
- Returns the list is a sorted way that would be expected by people (this is by key) - - -

Parameters:

-
    -
  • tbl - table - the table to be sorted -
  • -
- -

Returns:

-
    - - table - the sorted table -
- - - -

Usage:

-
    -
    tbl = table.alphanumsort(tbl)
    -
- -
-
- - table.keysort (tbl) -
-
- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) - - -

Parameters:

-
    -
  • tbl - table - the table to be sorted -
  • -
- -

Returns:

-
    - - table - the sorted table -
- - - -

Usage:

-
    -
    tbl = table.alphanumsort(tbl)
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/FSM.html b/doc/modules/FSM.html deleted file mode 100644 index ff5d0e35..00000000 --- a/doc/modules/FSM.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module FSM

-

Factorio Softmod Manager

-

-

Usage:

-
    -
    Manager = require("FactorioSoftmodManager")
    -
    -
-

Info:

-
    -
  • Author: Cooldude2606
  • -
- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_verbose (rtn)Default output for the verbose
verbose (rtn, action)Used to call the output of the verbose when the current state allows it
setVerbose (settings)Main logic for allowing verbose at different stages though out the script
sandbox (callback[, env])Creates a sand box envorment and runs a callback in that sand box; provents global pollution
loadModules ()Loads the modules that are present in the index list
error (err, callback)A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error
event (event_name, callback)Event handler that modules can use, each module can register one function per event
-

Tables

- - - - - - - - - -
verboseSettingsDifferent verbose settings used for setVerbose
Manager.event.namesSub set to Manger.event and acts as a coverter between event_name and event_id
-

Fields

- - - - - -
globalUsed to avoid conflicts in the global table
- -
-
- - -

Functions

- -
-
- - _verbose (rtn) -
-
- Default output for the verbose - - -

Parameters:

-
    -
  • rtn - string - the value that will be returned though verbose output -
  • -
- - - - -

Usage:

-
    -
    Manager.verbose('Hello, World!')
    -
- -
-
- - verbose (rtn, action) -
-
- Used to call the output of the verbose when the current state allows it - - -

Parameters:

-
    -
  • rtn - string - the value that will be returned though verbose output -
  • -
  • action - string - is used to decide which verbose this is error || event etc -
  • -
- - - - -

Usage:

-
    -
    Manager.verbose('Hello, World!')
    -
- -
-
- - setVerbose (settings) -
-
- Main logic for allowing verbose at different stages though out the script - - -

Parameters:

-
    -
  • settings - newTbl - the table that will be searched for settings to be updated -
  • -
- - - - -

Usage:

-
    -
  • Manager.setVerbose{output=log}
  • -
  • Manager.setVerbose[setting] -- returns the value of that setting
  • -
  • tostring(Manager.setVerbose) -- returns a formated list of the current settings
  • -
- -
-
- - sandbox (callback[, env]) -
-
- Creates a sand box envorment and runs a callback in that sand box; provents global pollution - - -

Parameters:

-
    -
  • callback - function - the function that will be ran in the sandbox -
  • -
  • env - any other params that the function will use - (optional) -
  • -
- - - - -

Usage:

-
    -
  • Manager.sandbox(callback) -- return sandbox, success, other returns from callback
  • -
  • Manager.sandbox() -- returns and empty sandbox
  • -
  • Manager.sandbox[key] -- returns the sand box value in that key
  • -
- -
-
- - loadModules () -
-
- Loads the modules that are present in the index list - - - - - - -

Usage:

-
    -
  • Manager.loadModules() -- loads all moddules in the index list
  • -
  • #Manager.loadModules -- returns the number of modules loaded
  • -
  • tostring(Manager.loadModules) -- returns a formatted list of all modules loaded
  • -
  • pairs(Manager.loadModules) -- loops over the loaded modules moduleName, module
  • -
- -
-
- - error (err, callback) -
-
- A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error - - -

Parameters:

-
    -
  • err - string or fucntion - the string to be passed to handlers; if a function it will register a handler -
  • -
  • callback - function - if given the err param will be used to given the handler a name -
  • -
- - - - -

Usage:

-
    -
  • Manager.error(err) -- calls all error handlers that are set or if none then prints to game and if that fails crashs game
  • -
  • Manager.error() -- returns an error constant that can be used to crash game
  • -
  • Manager.error(Manager.error()) -- crashs the game
  • -
  • Manager.error.addHandler(name,callback) -- adds a new handler if handler returns Manager.error() then game will crash
  • -
  • Manager.error[name] -- returns the handler of that name if present
  • -
  • #Manager.error -- returns the number of error handlers that are present
  • -
  • pairs(Manager.error) -- loops over only the error handlers handler_name,hander
  • -
- -
-
- - event (event_name, callback) -
-
- Event handler that modules can use, each module can register one function per event - - -

Parameters:

-
    -
  • event_name - int or string - that referes to an event -
  • -
  • callback - function - the function that will be set for that event -
  • -
- - - - -

Usage:

-
    -
  • Manager.event[event_name] = callback -- sets the callback for that event
  • -
  • Manager.event[event_name] = nil -- clears the callback for that event
  • -
  • Manager.event(event_name,callback) -- sets the callback for that event
  • -
  • Manager.event[event_name] -- returns the callback for that event or the event id if not registered
  • -
  • Manager.event(event_name) -- runs all the call backs for that event
  • -
  • Manager.event() -- returns the stop value for the event proccessor, if returned during an event will stop all other callbacks
  • -
  • #Manager.event -- returns the number of callbacks that are registered
  • -
  • pairs(Manager.events) -- returns event_id,table of callbacks
  • -
- -
-
-

Tables

- -
-
- - verboseSettings -
-
- Different verbose settings used for setVerbose - - -

Fields:

-
    -
  • selfInit - boolean - called while the manager is being set up -
  • -
  • moduleLoad - boolean - when a module is required by the manager -
  • -
  • moduleInit - boolean - when and within the initation of a module -
  • -
  • moduleEnv - boolean - during module runtime, this is a global option set within each module(module_verbose=true ln:1) for fine control -
  • -
  • eventRegistered - boolean - when a module registers its event handlers -
  • -
  • errorCaught - boolean - when an error is caught during runtime -
  • -
  • output - function - can be: print || log || or other function -
  • -
  • _output - a constant value that can used to store output data -
  • -
- - - - - -
-
- - Manager.event.names -
-
- Sub set to Manger.event and acts as a coverter between event_name and event_id - - - - - - -

Usage:

-
    -
    Manager.event[event_name]
    -
- -
-
-

Fields

- -
-
- - global -
-
- Used to avoid conflicts in the global table - - -
    -
  • if - table, string or true - table then the default for the global, if a string then the module to get the global of, if true then reset the global to default - (default {}) -
  • -
- - - - -

Usage:

-
    -
  • global[key] -- used like the normal global table
  • -
  • global{'foo','bar'} -- sets the default value
  • -
  • global(true) -- restores global to default
  • -
  • global(mopdule_name) -- returns that module's global
  • -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/StdLib.Color.html b/doc/modules/StdLib.Color.html deleted file mode 100644 index bec3d07b..00000000 --- a/doc/modules/StdLib.Color.html +++ /dev/null @@ -1,561 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module StdLib.Color

-

A defines module for retrieving colors by name.

-

- Extends the Factorio defines table.

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - -
set ([color=white[, alpha=1]])Set a value for the alpha channel in the given color table.
to_table (c_arr)Converts a color in the array format to a color in the table format.
from_rgb ([r=0[, g=0[, b=0[, a=255]]]])Converts a color in the rgb format to a color table
from_hex (hex[, alpha=1])Get a color table with a hexadecimal string.
to_rgb (color)Converts a color in the color table format to rgb
to_hex (color)Converts a color in the color table format to hex
-

Tables

- - - - - - - - - - - - - - - - - -
defines.colorA table of colors allowing retrieval by color name.
defines.anticolorReturns white for dark colors or black for lighter colors.
defines.lightcolorReturns a lighter color of a named color
defines.textcolorReturns a lighter color of a named color.
- -
-
- - -

Functions

- -
-
- - set ([color=white[, alpha=1]]) -
-
- Set a value for the alpha channel in the given color table. - `color.a` represents the alpha channel in the given color table. -
    -
  • If ***alpha*** is given, set `color.a` to it. -
  • If ***alpha*** is not given, and if the given color table does not have a value for `color.a`, set `color.a` to 1. -
  • If ***alpha*** is not given, and if the given color table already has a value for `color.a`, then leave `color.a` alone. -
- - -

Parameters:

-
    -
  • color - defines.color or Concepts.Color - the color to configure - (default white) -
  • -
  • alpha - float - the alpha value (*[0 - 1]*) to set for the given color - (default 1) -
  • -
- -

Returns:

-
    - - a - color table that has the specified value for the alpha channel -
- - - - -
-
- - to_table (c_arr) -
-
- Converts a color in the array format to a color in the table format. - - -

Parameters:

-
    -
  • c_arr - table - the color to convert -
  • -
- -

Returns:

-
    - - a - converted color — { r = c\_arr[1], g = c\_arr[2], b = c\_arr[3], a = c\_arr[4] } -
- - - - -
-
- - from_rgb ([r=0[, g=0[, b=0[, a=255]]]]) -
-
- Converts a color in the rgb format to a color table - - -

Parameters:

-
    -
  • r - int - 0-255 red - (default 0) -
  • -
  • g - int - 0-255 green - (default 0) -
  • -
  • b - int - 0-255 blue - (default 0) -
  • -
  • a - int - 0-255 alpha - (default 255) -
  • -
- -

Returns:

-
    - - Concepts.Color - -
- - - - -
-
- - from_hex (hex[, alpha=1]) -
-
- Get a color table with a hexadecimal string. - Optionally provide the value for the alpha channel. - - -

Parameters:

-
    -
  • hex - string - hexadecimal color string (#ffffff, not #fff) -
  • -
  • alpha - float - the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]*** - (default 1) -
  • -
- -

Returns:

-
    - - a - color table with RGB converted from Hex and with alpha -
- - - - -
-
- - to_rgb (color) -
-
- Converts a color in the color table format to rgb - - -

Parameters:

-
    -
  • color - table - the color to convert -
  • -
- -

Returns:

-
    - - table - the color as rgb -
- - - - -
-
- - to_hex (color) -
-
- Converts a color in the color table format to hex - - -

Parameters:

-
    -
  • color - table - the color to convert -
  • -
- -

Returns:

-
    - - string - the color as hex -
- - - - -
-
-

Tables

- -
-
- - defines.color -
-
- A table of colors allowing retrieval by color name. - - -

Fields:

-
    -
  • white - {r=1.00,g=1.00,b=1.00} -
  • -
  • black - {r=0.00,g=0.00,b=0.00} -
  • -
  • darkgrey - {r=0.25,g=0.25,b=0.25} -
  • -
  • grey - {r=0.50,g=0.50,b=0.50} -
  • -
  • lightgrey - {r=0.75,g=0.75,b=0.75} -
  • -
  • red - {r=1.00,g=0.00,b=0.00} -
  • -
  • darkred - {r=0.50,g=0.00,b=0.00} -
  • -
  • lightred - {r=1.00,g=0.50,b=0.50} -
  • -
  • green - {r=0.00,g=1.00,b=0.00} -
  • -
  • darkgreen - {r=0.00,g=0.50,b=0.00} -
  • -
  • lightgreen - {r=0.50,g=1.00,b=0.50} -
  • -
  • blue - {r=0.00,g=0.00,b=1.00} -
  • -
  • darkblue - {r=0.00,g=0.00,b=0.50} -
  • -
  • lightblue - {r=0.50,g=0.50,b=1.00} -
  • -
  • orange - {r=1.00,g=0.55,b=0.10} -
  • -
  • yellow - {r=1.00,g=1.00,b=0.00} -
  • -
  • pink - {r=1.00,g=0.00,b=1.00} -
  • -
  • purple - {r=0.60,g=0.10,b=0.60} -
  • -
  • brown - {r=0.60,g=0.40,b=0.10} -
  • -
- - - - - -
-
- - defines.anticolor -
-
- Returns white for dark colors or black for lighter colors. - - -

Fields:

-
    -
  • green - defines.color.black -
  • -
  • grey - defines.color.black -
  • -
  • lightblue - defines.color.black -
  • -
  • lightgreen - defines.color.black -
  • -
  • lightgrey - defines.color.black -
  • -
  • lightred - defines.color.black -
  • -
  • orange - defines.color.black -
  • -
  • white - defines.color.black -
  • -
  • yellow - defines.color.black -
  • -
  • black - defines.color.white -
  • -
  • blue - defines.color.white -
  • -
  • brown - defines.color.white -
  • -
  • darkblue - defines.color.white -
  • -
  • darkgreen - defines.color.white -
  • -
  • darkgrey - defines.color.white -
  • -
  • darkred - defines.color.white -
  • -
  • pink - defines.color.white -
  • -
  • purple - defines.color.white -
  • -
  • red - defines.color.white -
  • -
- - - - - -
-
- - defines.lightcolor -
-
- Returns a lighter color of a named color - - -

Fields:

-
    -
  • white - defines.color.lightgrey -
  • -
  • grey - defines.color.darkgrey -
  • -
  • lightgrey - defines.color.grey -
  • -
  • red - defines.color.lightred -
  • -
  • green - defines.color.lightgreen -
  • -
  • blue - defines.color.lightblue -
  • -
  • yellow - defines.color.orange -
  • -
  • pink - defines.color.purple -
  • -
- - - - - -
-
- - defines.textcolor -
-
- Returns a lighter color of a named color. - - -

Fields:

-
    -
  • info - {r=0.21,g=0.95,b=1.00} -
  • -
  • bg - {r=0.00,g=0.00,b=0.00} -
  • -
  • low - {r=0.18,g=0.77,b=0.18} -
  • -
  • med - {r=1.00,g=0.89,b=0.26} -
  • -
  • high - {r=1.00,g=0.33,b=0.00} -
  • -
  • crit - {r=1.00,g=0.00,b=0.00} -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/StdLib.Game.html b/doc/modules/StdLib.Game.html deleted file mode 100644 index 627c73ad..00000000 --- a/doc/modules/StdLib.Game.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module StdLib.Game

-

The game module.

-

- - -

Functions

- - - - - - - - - - - - - - - - - -
fail_if_missing (var[, msg="missing value"])Print msg if specified var evaluates to false.
get_player (mixed)Return a valid player object from event, index, string, or userdata
get_force (mixed)Return a valid force object from event, string, or userdata
print_all (msg[, condition])Messages all players currently connected to the game.
- -
-
- - -

Functions

- -
-
- - fail_if_missing (var[, msg="missing value"]) -
-
- Print msg if specified var evaluates to false. - - -

Parameters:

-
    -
  • var - Mixed - variable to evaluate -
  • -
  • msg - string - message - (default "missing value") -
  • -
- - - - - -
-
- - get_player (mixed) -
-
- Return a valid player object from event, index, string, or userdata - - -

Parameters:

-
    -
  • mixed - string, number, LuaPlayer or event - -
  • -
- -

Returns:

-
    - - LuaPlayer - a valid player or nil -
- - - - -
-
- - get_force (mixed) -
-
- Return a valid force object from event, string, or userdata - - -

Parameters:

-
    -
  • mixed - string, LuaForce or event - -
  • -
- -

Returns:

-
    - - LuaForce - a valid force or nil -
- - - - -
-
- - print_all (msg[, condition]) -
-
- Messages all players currently connected to the game. -> Offline players are not counted as having received the message. - If no players exist msg is stored in the `global._print_queue` table. - - -

Parameters:

-
    -
  • msg - string - the message to send to players -
  • -
  • condition - nil or boolean - the condition to be true for a player to be messaged - (optional) -
  • -
- -

Returns:

-
    - - uint - the number of players who received the message. -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/StdLib.String.html b/doc/modules/StdLib.String.html deleted file mode 100644 index fe5de748..00000000 --- a/doc/modules/StdLib.String.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module StdLib.String

-

Extends Lua 5.2 string.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - -
trim (s)Returns a copy of the string with any leading or trailing whitespace from the string removed.
starts_with (s, start)Tests if a string starts with a given substring.
ends_with (s, ends)Tests if a string ends with a given substring.
contains (s, contains)Tests if a string contains a given substring.
is_empty (s)Tests whether a string is empty.
split (s[, sep="."[, pattern=false]])Splits a string into an array.
- -
-
- - -

Functions

- -
-
- - trim (s) -
-
- Returns a copy of the string with any leading or trailing whitespace from the string removed. - - -

Parameters:

-
    -
  • s - string - the string to remove leading or trailing whitespace from -
  • -
- -

Returns:

-
    - - string - a copy of the string without leading or trailing whitespace -
- - - - -
-
- - starts_with (s, start) -
-
- Tests if a string starts with a given substring. - - -

Parameters:

-
    -
  • s - string - the string to check for the start substring -
  • -
  • start - string - the substring to test for -
  • -
- -

Returns:

-
    - - boolean - true if the start substring was found in the string -
- - - - -
-
- - ends_with (s, ends) -
-
- Tests if a string ends with a given substring. - - -

Parameters:

-
    -
  • s - string - the string to check for the end substring -
  • -
  • ends - string - the substring to test for -
  • -
- -

Returns:

-
    - - boolean - true if the end substring was found in the string -
- - - - -
-
- - contains (s, contains) -
-
- Tests if a string contains a given substring. - - -

Parameters:

-
    -
  • s - string - the string to check for the substring -
  • -
  • contains - string - the substring to test for -
  • -
- -

Returns:

-
    - - boolean - true if the substring was found in the string -
- - - - -
-
- - is_empty (s) -
-
- Tests whether a string is empty. - - -

Parameters:

-
    -
  • s - string - the string to test -
  • -
- -

Returns:

-
    - - boolean - true if the string is empty -
- - - - -
-
- - split (s[, sep="."[, pattern=false]]) -
-
- Splits a string into an array. - *Note:* Empty split substrings are not included in the resulting table. -

For example, `string.split("foo.bar...", ".", false)` results in the table `{"foo", "bar"}`. - - -

Parameters:

-
    -
  • s - string - the string to split -
  • -
  • sep - string - the separator to use. - (default ".") -
  • -
  • pattern - boolean - whether to interpret the separator as a lua pattern or plaintext for the string split - (default false) -
  • -
- -

Returns:

-
    - - {string,...} - an array of strings -
- - - - -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/StdLib.Table.html b/doc/modules/StdLib.Table.html deleted file mode 100644 index 4c3d30c6..00000000 --- a/doc/modules/StdLib.Table.html +++ /dev/null @@ -1,922 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module StdLib.Table

-

Extends Lua 5.2 table.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
map (tbl, func[, ...])Given a mapping function, creates a transformed copy of the table - by calling the function for each element in the table, and using - the result as the new value for the key.
filter (tbl, func[, ...])Given a filter function, creates a filtered copy of the table - by calling the function for each element in the table, and - filtering out any key-value pairs for non-true results.
find (tbl, func[, ...])Given a candidate search function, iterates over the table, calling the function - for each element in the table, and returns the first element the search function returned true.
any (tbl, func[, ...])Given a candidate search function, iterates over the table, calling the function - for each element in the table, and returns true if search function returned true.
each (tbl, func[, ...])Given a function, apply it to each element in the table.
flatten (tbl[, level])Returns a new array that is a one-dimensional recursive flattening of the given array.
first (tbl)Given an array, returns the first element or nil if no element exists.
last (tbl)Given an array, returns the last element or nil if no elements exist.
min (tbl)Given an array of only numeric values, returns the minimum or nil if no element exists.
max (tbl)Given an array of only numeric values, returns the maximum or nil if no element exists.
sum (tbl)Given an array of only numeric values, return the sum of all values, or 0 for empty arrays.
avg (tbl)Given an array of only numeric values, returns the average or nil if no element exists.
merge (tblA, tblB[, array_merge=false])Merges two tables — values from first get overwritten by the second.
deepcopy (object)Creates a deep copy of table without copying Factorio objects.
values (tbl[, sorted[, as_string]])Returns a copy of all of the values in the table.
keys (tbl[, sorted[, as_string]])Returns a copy of all of the keys in the table.
remove_keys (tbl, keys)Removes keys from a table by setting the values associated with the keys to nil.
count_keys (tbl[, func[, ...]])Returns the number of keys in a table, if func is passed only count keys when the function is true.
invert (tbl)Returns an inverted (***{[value] = key,...}***) copy of the given table.
size (table)Return the size of a table using built in table_size function
arr_to_bool (tbl)For all string or number values in an array map them to a key = true table
- -
-
- - -

Functions

- -
-
- - map (tbl, func[, ...]) -
-
- Given a mapping function, creates a transformed copy of the table - by calling the function for each element in the table, and using - the result as the new value for the key. Passes the index as second argument to the function. - - -

Parameters:

-
    -
  • tbl - table - the table to be mapped to the transform -
  • -
  • func - function - the function to transform values -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    - - table - a new table containing the keys and mapped values -
- - - -

Usage:

-
    -
  • a= { 1, 2, 3, 4, 5}
    -table.map(a, function(v) return v * 10 end) --produces: { 10, 20, 30, 40, 50 }
  • -
  • a = {1, 2, 3, 4, 5}
    -table.map(a, function(v, k, x) return v * k + x end, 100) --produces { 101, 104, 109, 116, 125}
  • -
- -
-
- - filter (tbl, func[, ...]) -
-
- Given a filter function, creates a filtered copy of the table - by calling the function for each element in the table, and - filtering out any key-value pairs for non-true results. Passes the index as second argument to the function. - - -

Parameters:

-
    -
  • tbl - table - the table to be filtered -
  • -
  • func - function - the function to filter values -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    - - table - a new table containing the filtered key-value pairs -
- - - -

Usage:

-
    -
  • a= { 1, 2, 3, 4, 5}
    -table.filter(a, function(v) return v % 2 == 0 end) --produces: { 2, 4 }
  • -
  • a = {1, 2, 3, 4, 5}
    -table.filter(a, function(v, k, x) return k % 2 == 1 end) --produces: { 1, 3, 5 }
  • -
- -
-
- - find (tbl, func[, ...]) -
-
- Given a candidate search function, iterates over the table, calling the function - for each element in the table, and returns the first element the search function returned true. - Passes the index as second argument to the function. - - -

Parameters:

-
    -
  • tbl - table - the table to be searched -
  • -
  • func - function - the function to use to search for any matching element -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    - - nil or Mixed - the first found value, or nil if none was found -
- - - -

Usage:

-
    -
  • a= { 1, 2, 3, 4, 5}
    -table.find(a, function(v) return v % 2 == 0 end) --produces: 2
  • -
  • a = {1, 2, 3, 4, 5}
    -table.find(a, function(v, k, x) return k % 2 == 1 end) --produces: 1
  • -
- -
-
- - any (tbl, func[, ...]) -
-
- Given a candidate search function, iterates over the table, calling the function - for each element in the table, and returns true if search function returned true. - Passes the index as second argument to the function. - - -

Parameters:

-
    -
  • tbl - table - the table to be searched -
  • -
  • func - function - the function to use to search for any matching element -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    - - boolean - true if an element was found, false if none was found -
- - - -

Usage:

-
    -
  • a= { 1, 2, 3, 4, 5} table.any(a, function(v) return v % 2 == 0 end) --produces: true
  • -
  • a = {1, 2, 3, 4, 5} table.any(a, function(v, k, x) return k % 2 == 1 end) --produces: true
  • -
- -
-
- - each (tbl, func[, ...]) -
-
- Given a function, apply it to each element in the table. - Passes the index as the second argument to the function. -

Iteration is aborted if the applied function returns true for any element during iteration. - - -

Parameters:

-
    -
  • tbl - table - the table to be iterated -
  • -
  • func - function - the function to apply to elements -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    - - table - the table where the given function has been applied to its elements -
- - - -

Usage:

-
    -
    a = {10, 20, 30, 40}
    -table.each(a, function(v) game.print(v) end) --prints 10, 20, 30, 40, 50
    -
- -
-
- - flatten (tbl[, level]) -
-
- Returns a new array that is a one-dimensional recursive flattening of the given array. - For every element that is an array, extract its elements into the new array. -

The optional level argument determines the level of recursion to flatten. -> This function flattens an integer-indexed array, but not an associative array. - - -

Parameters:

-
    -
  • tbl - array - the array to be flattened -
  • -
  • level - uint - recursive levels, or no limit to recursion if not supplied - (optional) -
  • -
- -

Returns:

-
    - - array - a new array that represents the flattened contents of the given array -
- - - - -
-
- - first (tbl) -
-
- Given an array, returns the first element or nil if no element exists. - - -

Parameters:

-
    -
  • tbl - array - the array -
  • -
- -

Returns:

-
    - - nil or Mixed - the first element -
- - - - -
-
- - last (tbl) -
-
- Given an array, returns the last element or nil if no elements exist. - - -

Parameters:

-
    -
  • tbl - array - the array -
  • -
- -

Returns:

-
    - - nil or Mixed - the last element or nil -
- - - - -
-
- - min (tbl) -
-
- Given an array of only numeric values, returns the minimum or nil if no element exists. - - -

Parameters:

-
    -
  • tbl - {number,...} - the array with only numeric values -
  • -
- -

Returns:

-
    - - nil or number - the minimum value -
- - - - -
-
- - max (tbl) -
-
- Given an array of only numeric values, returns the maximum or nil if no element exists. - - -

Parameters:

-
    -
  • tbl - {number,...} - the array with only numeric values -
  • -
- -

Returns:

-
    - - nil or number - the maximum value -
- - - - -
-
- - sum (tbl) -
-
- Given an array of only numeric values, return the sum of all values, or 0 for empty arrays. - - -

Parameters:

-
    -
  • tbl - {number,...} - the array with only numeric values -
  • -
- -

Returns:

-
    - - number - the sum of the numbers or zero if the given array was empty -
- - - - -
-
- - avg (tbl) -
-
- Given an array of only numeric values, returns the average or nil if no element exists. - - -

Parameters:

-
    -
  • tbl - {number,...} - the array with only numeric values -
  • -
- -

Returns:

-
    - - nil or number - the average value -
- - - - -
-
- - merge (tblA, tblB[, array_merge=false]) -
-
- Merges two tables — values from first get overwritten by the second. - - -

Parameters:

-
    -
  • tblA - table - first table -
  • -
  • tblB - table - second table -
  • -
  • array_merge - boolean - set to true to merge the tables as an array or false for an associative array - (default false) -
  • -
- -

Returns:

-
    - - array or table - an array or an associated array where tblA and tblB have been merged -
- - - -

Usage:

-
    -
    function some_func(x, y, args)
    -    args = table.merge({option1=false}, args)
    -    if opts.option1 == true then return x else return y end
    -end
    -some_func(1,2) -- returns 2
    -some_func(1,2,{option1=true}) -- returns 1
    -
- -
-
- - deepcopy (object) -
-
- Creates a deep copy of table without copying Factorio objects. - - -

Parameters:

-
    -
  • object - table - the table to copy -
  • -
- -

Returns:

-
    - - table - a copy of the table -
- - - -

Usage:

-
    -
    local copy = table.deepcopy[data.raw.["stone-furnace"]["stone-furnace"]] -- returns a copy of the stone furnace entity
    -
- -
-
- - values (tbl[, sorted[, as_string]]) -
-
- Returns a copy of all of the values in the table. - - -

Parameters:

-
    -
  • tbl - table - the table to copy the keys from, or an empty table if tbl is nil -
  • -
  • sorted - boolean - whether to sort the keys (slower) or keep the random order from pairs() - (optional) -
  • -
  • as_string - boolean - whether to try and parse the values as strings, or leave them as their existing type - (optional) -
  • -
- -

Returns:

-
    - - array - an array with a copy of all the values in the table -
- - - - -
-
- - keys (tbl[, sorted[, as_string]]) -
-
- Returns a copy of all of the keys in the table. - - -

Parameters:

-
    -
  • tbl - table - the table to copy the keys from, or an empty table if tbl is nil -
  • -
  • sorted - boolean - whether to sort the keys (slower) or keep the random order from pairs() - (optional) -
  • -
  • as_string - boolean - whether to try and parse the keys as strings, or leave them as their existing type - (optional) -
  • -
- -

Returns:

-
    - - array - an array with a copy of all the keys in the table -
- - - - -
-
- - remove_keys (tbl, keys) -
-
- Removes keys from a table by setting the values associated with the keys to nil. - - -

Parameters:

-
    -
  • tbl - table - the table to remove the keys from -
  • -
  • keys - {Mixed,...} - an array of keys that exist in the given table -
  • -
- -

Returns:

-
    - - table - tbl without the specified keys -
- - - -

Usage:

-
    -
  • local a = {1, 2, 3, 4}
    -table.remove_keys(a, {1,3}) --returns {nil, 2, nil, 4}
  • -
  • local b = {k1 = 1, k2 = 'foo', old_key = 'bar'}
    -table.remove_keys(b, {'old_key'}) --returns {k1 = 1, k2 = 'foo'}
  • -
- -
-
- - count_keys (tbl[, func[, ...]]) -
-
- Returns the number of keys in a table, if func is passed only count keys when the function is true. - - -

Parameters:

-
    -
  • tbl - table - to count keys -
  • -
  • func - function - to incremement counter - (optional) -
  • -
  • ... - additional arguments passed to the function - (optional) -
  • -
- -

Returns:

-
    -
  1. - number - The number of keys matching the function or the number of all keys if func isn't passed
  2. -
  3. - number - The total number of keys
  4. -
- - - -

Usage:

-
    -
  • local a = { 1, 2, 3, 4, 5}
    - table.count_keys(a) -- produces: 5, 5
  • -
  • local a = {1, 2, 3, 4, 5}
    - table.count_keys(a, function(v, k) return k % 2 == 1 end) -- produces: 3, 5
  • -
- -
-
- - invert (tbl) -
-
- Returns an inverted (***{[value] = key,...}***) copy of the given table. If the values are not unique, the assigned key depends on the order of pairs(). - - -

Parameters:

-
    -
  • tbl - table - the table to invert -
  • -
- -

Returns:

-
    - - table - a new table with inverted mapping -
- - - -

Usage:

-
    -
  • local a = {k1 = 'foo', k2 = 'bar'}
    -table.invert(a) --returns {'foo' = k1, 'bar' = k2}
  • -
  • local b = {k1 = 'foo', k2 = 'bar', k3 = 'bar'}
    -table.invert(b) --returns {'foo' = k1, 'bar' = ?}
  • -
- -
-
- - size (table) -
-
- Return the size of a table using built in table_size function - - -

Parameters:

-
    -
  • table - table - to use -
  • -
- -

Returns:

-
    - - int - size of the table -
- - - - -
-
- - arr_to_bool (tbl) -
-
- For all string or number values in an array map them to a key = true table - - -

Parameters:

-
    -
  • tbl - table - the table to convert -
  • -
- -

Returns:

-
    - - table - the converted table -
- - - -

Usage:

-
    -
    local a = {"v1", "v2"}
    - table.array_to_dict_bool(a) -- return {["v1"] = true, ["v2"]= true}
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - diff --git a/doc/modules/StdLib.Time.html b/doc/modules/StdLib.Time.html deleted file mode 100644 index 1730086b..00000000 --- a/doc/modules/StdLib.Time.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module StdLib.Time

-

A defines module for retrieving the number of ticks in 1 unit of time.

-

- Extends the Factorio defines table.

- - -

Tables

- - - - - -
defines.timeReturns the number of ticks in a second, minute, hour, day, week, month, or year.
- -
-
- - -

Tables

- -
-
- - defines.time -
-
- Returns the number of ticks in a second, minute, hour, day, week, month, or year. - - -

Fields:

-
    -
  • second - the number of Factorio ticks in a second -
  • -
  • minute - the number of Factorio ticks in a second -
  • -
  • hour - the number of Factorio ticks in an hour -
  • -
  • day - the number of Factorio ticks in an day -
  • -
  • week - the number of Factorio ticks in a week -
  • -
  • month - the number of Factorio ticks in a month (30 days) -
  • -
  • year - the number of Factorio ticks in a year (365 days) -
  • -
- - - - -

Usage:

-
    -
    local ten_seconds = defines.time.second * 10
    -
- -
-
- - -
-
-
-generated by LDoc 1.4.6 -Last updated 2018-06-07 12:58:23 -
-
- - From 53f9c51c0e4f8b3386a98355391195dff803ce0a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 22:19:35 +0100 Subject: [PATCH 30/41] Moved more stuff to done --- old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/control.lua | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/de.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/en.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/fr.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/nl.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/sv-SE.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/softmod.json | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/src/sync.lua | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/control.lua | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/de.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/en.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/fr.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/nl.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/sv-Se.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/softmod.json | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Science/src/sync.lua | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/control.lua | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/de.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/en.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/fr.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/nl.cfg | 0 .../{ExpGamingInfo => DONE/Guis}/Tasklist/locale/sv-SE.cfg | 0 old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/softmod.json | 0 23 files changed, 0 insertions(+), 0 deletions(-) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/control.lua (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/de.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/en.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/fr.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/nl.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/locale/sv-SE.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/softmod.json (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Rockets/src/sync.lua (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/control.lua (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/de.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/en.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/fr.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/nl.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/locale/sv-Se.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/softmod.json (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Science/src/sync.lua (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/control.lua (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/de.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/en.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/fr.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/nl.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/locale/sv-SE.cfg (100%) rename old/modules/{ExpGamingInfo => DONE/Guis}/Tasklist/softmod.json (100%) diff --git a/old/modules/ExpGamingInfo/Rockets/control.lua b/old/modules/DONE/Guis/Rockets/control.lua similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/control.lua rename to old/modules/DONE/Guis/Rockets/control.lua diff --git a/old/modules/ExpGamingInfo/Rockets/locale/de.cfg b/old/modules/DONE/Guis/Rockets/locale/de.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/locale/de.cfg rename to old/modules/DONE/Guis/Rockets/locale/de.cfg diff --git a/old/modules/ExpGamingInfo/Rockets/locale/en.cfg b/old/modules/DONE/Guis/Rockets/locale/en.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/locale/en.cfg rename to old/modules/DONE/Guis/Rockets/locale/en.cfg diff --git a/old/modules/ExpGamingInfo/Rockets/locale/fr.cfg b/old/modules/DONE/Guis/Rockets/locale/fr.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/locale/fr.cfg rename to old/modules/DONE/Guis/Rockets/locale/fr.cfg diff --git a/old/modules/ExpGamingInfo/Rockets/locale/nl.cfg b/old/modules/DONE/Guis/Rockets/locale/nl.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/locale/nl.cfg rename to old/modules/DONE/Guis/Rockets/locale/nl.cfg diff --git a/old/modules/ExpGamingInfo/Rockets/locale/sv-SE.cfg b/old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/locale/sv-SE.cfg rename to old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg diff --git a/old/modules/ExpGamingInfo/Rockets/softmod.json b/old/modules/DONE/Guis/Rockets/softmod.json similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/softmod.json rename to old/modules/DONE/Guis/Rockets/softmod.json diff --git a/old/modules/ExpGamingInfo/Rockets/src/sync.lua b/old/modules/DONE/Guis/Rockets/src/sync.lua similarity index 100% rename from old/modules/ExpGamingInfo/Rockets/src/sync.lua rename to old/modules/DONE/Guis/Rockets/src/sync.lua diff --git a/old/modules/ExpGamingInfo/Science/control.lua b/old/modules/DONE/Guis/Science/control.lua similarity index 100% rename from old/modules/ExpGamingInfo/Science/control.lua rename to old/modules/DONE/Guis/Science/control.lua diff --git a/old/modules/ExpGamingInfo/Science/locale/de.cfg b/old/modules/DONE/Guis/Science/locale/de.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Science/locale/de.cfg rename to old/modules/DONE/Guis/Science/locale/de.cfg diff --git a/old/modules/ExpGamingInfo/Science/locale/en.cfg b/old/modules/DONE/Guis/Science/locale/en.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Science/locale/en.cfg rename to old/modules/DONE/Guis/Science/locale/en.cfg diff --git a/old/modules/ExpGamingInfo/Science/locale/fr.cfg b/old/modules/DONE/Guis/Science/locale/fr.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Science/locale/fr.cfg rename to old/modules/DONE/Guis/Science/locale/fr.cfg diff --git a/old/modules/ExpGamingInfo/Science/locale/nl.cfg b/old/modules/DONE/Guis/Science/locale/nl.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Science/locale/nl.cfg rename to old/modules/DONE/Guis/Science/locale/nl.cfg diff --git a/old/modules/ExpGamingInfo/Science/locale/sv-Se.cfg b/old/modules/DONE/Guis/Science/locale/sv-Se.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Science/locale/sv-Se.cfg rename to old/modules/DONE/Guis/Science/locale/sv-Se.cfg diff --git a/old/modules/ExpGamingInfo/Science/softmod.json b/old/modules/DONE/Guis/Science/softmod.json similarity index 100% rename from old/modules/ExpGamingInfo/Science/softmod.json rename to old/modules/DONE/Guis/Science/softmod.json diff --git a/old/modules/ExpGamingInfo/Science/src/sync.lua b/old/modules/DONE/Guis/Science/src/sync.lua similarity index 100% rename from old/modules/ExpGamingInfo/Science/src/sync.lua rename to old/modules/DONE/Guis/Science/src/sync.lua diff --git a/old/modules/ExpGamingInfo/Tasklist/control.lua b/old/modules/DONE/Guis/Tasklist/control.lua similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/control.lua rename to old/modules/DONE/Guis/Tasklist/control.lua diff --git a/old/modules/ExpGamingInfo/Tasklist/locale/de.cfg b/old/modules/DONE/Guis/Tasklist/locale/de.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/locale/de.cfg rename to old/modules/DONE/Guis/Tasklist/locale/de.cfg diff --git a/old/modules/ExpGamingInfo/Tasklist/locale/en.cfg b/old/modules/DONE/Guis/Tasklist/locale/en.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/locale/en.cfg rename to old/modules/DONE/Guis/Tasklist/locale/en.cfg diff --git a/old/modules/ExpGamingInfo/Tasklist/locale/fr.cfg b/old/modules/DONE/Guis/Tasklist/locale/fr.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/locale/fr.cfg rename to old/modules/DONE/Guis/Tasklist/locale/fr.cfg diff --git a/old/modules/ExpGamingInfo/Tasklist/locale/nl.cfg b/old/modules/DONE/Guis/Tasklist/locale/nl.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/locale/nl.cfg rename to old/modules/DONE/Guis/Tasklist/locale/nl.cfg diff --git a/old/modules/ExpGamingInfo/Tasklist/locale/sv-SE.cfg b/old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/locale/sv-SE.cfg rename to old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg diff --git a/old/modules/ExpGamingInfo/Tasklist/softmod.json b/old/modules/DONE/Guis/Tasklist/softmod.json similarity index 100% rename from old/modules/ExpGamingInfo/Tasklist/softmod.json rename to old/modules/DONE/Guis/Tasklist/softmod.json From e187059ae03ff3d8f70274fc96bd939cb842d37a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 22:24:04 +0100 Subject: [PATCH 31/41] Ldoc compliant --- doc/index.html | 376 +++++ doc/ldoc.css | 307 ++++ doc/modules/Commands.html | 1307 +++++++++++++++++ doc/modules/Permissions_Groups.html | 660 +++++++++ doc/modules/Public.html | 996 +++++++++++++ doc/modules/config._file_loader.html | 121 ++ doc/modules/config.action_buttons.html | 122 ++ doc/modules/config.advanced_start.html | 118 ++ doc/modules/config.death_logger.html | 120 ++ .../config.expcore-commands.auth_admin.html | 120 ++ .../config.expcore-commands.auth_roles.html | 118 ++ ...expcore-commands.auth_runtime_disable.html | 119 ++ ...config.expcore-commands.parse_general.html | 122 ++ .../config.expcore-commands.parse_roles.html | 118 ++ doc/modules/config.permission_groups.html | 121 ++ doc/modules/config.popup_messages.html | 118 ++ doc/modules/config.rockets.html | 165 +++ doc/modules/config.roles.html | 118 ++ doc/modules/config.scorched_earth.html | 118 ++ doc/modules/config.spawn_area.html | 118 ++ doc/modules/config.warnings.html | 118 ++ doc/modules/control.html | 121 ++ doc/modules/expcore.gui.buttons.html | 275 ++++ doc/modules/expcore.gui.center.html | 472 ++++++ doc/modules/expcore.gui.checkboxs.html | 414 ++++++ doc/modules/expcore.gui.core.html | 121 ++ doc/modules/expcore.gui.dropdown.html | 366 +++++ doc/modules/expcore.gui.elem-button.html | 224 +++ doc/modules/expcore.gui.html | 119 ++ doc/modules/expcore.gui.instances.html | 119 ++ doc/modules/expcore.gui.left.html | 573 ++++++++ doc/modules/expcore.gui.popups.html | 352 +++++ doc/modules/expcore.gui.progress-bar.html | 557 +++++++ doc/modules/expcore.gui.slider.html | 288 ++++ doc/modules/expcore.gui.test.html | 120 ++ doc/modules/expcore.gui.text.html | 290 ++++ doc/modules/expcore.gui.toolbar.html | 212 +++ doc/modules/expcore.store.html | 464 ++++++ .../modules.addons.advanced-start.html | 118 ++ doc/modules/modules.addons.chat-popups.html | 119 ++ doc/modules/modules.addons.damage-popups.html | 119 ++ doc/modules/modules.gui.player-list.html | 118 ++ doc/modules/modules.gui.rocket-info.html | 118 ++ doc/modules/modules.gui.science-info.html | 118 ++ doc/modules/modules.gui.task-list.html | 118 ++ .../utils.alien_evolution_progress.html | 158 ++ doc/modules/utils.core.html | 452 ++++++ doc/modules/utils.debug.html | 306 ++++ doc/modules/utils.event.html | 568 +++++++ doc/modules/utils.event_core.html | 204 +++ doc/modules/utils.math.html | 161 ++ doc/modules/utils.recipe_locker.html | 155 ++ doc/modules/utils.state_machine.html | 316 ++++ doc/modules/utils.table.html | 583 ++++++++ doc/modules/utils.task.html | 195 +++ doc/modules/utils.timestamp.html | 217 +++ expcore/commands.lua | 62 +- expcore/common.lua | 75 +- expcore/gui/buttons.lua | 16 +- expcore/gui/center.lua | 30 +- expcore/gui/checkboxs.lua | 46 +- expcore/gui/core.lua | 78 +- expcore/gui/dropdown.lua | 38 +- expcore/gui/elem-button.lua | 22 +- expcore/gui/instances.lua | 28 +- expcore/gui/left.lua | 36 +- expcore/gui/popups.lua | 28 +- expcore/gui/progress-bar.lua | 64 +- expcore/gui/slider.lua | 24 +- expcore/gui/text.lua | 26 +- expcore/gui/toolbar.lua | 6 +- expcore/permission_groups.lua | 30 +- expcore/roles.lua | 110 +- expcore/store.lua | 38 +- modules/addons/compilatron.lua | 6 +- modules/addons/jail-control.lua | 18 +- modules/addons/reports-control.lua | 24 +- modules/addons/warnings-control.lua | 32 +- modules/commands/interface.lua | 4 +- modules/gui/debug/_g_view.lua | 1 + old/modules/DONE/Core/Command/control.lua | 8 +- old/modules/DONE/Core/Group/control.lua | 2 +- old/modules/DONE/Core/Gui/control.lua | 2 +- old/modules/DONE/Core/Gui/inputs/control.lua | 6 +- old/modules/DONE/Core/Gui/toolbar/control.lua | 2 +- old/modules/DONE/Core/Role/control.lua | 12 +- old/modules/DONE/ExpGamingLib/control.lua | 22 +- .../DONE/FactorioStdLib/Color/control.lua | 2 +- .../DONE/FactorioStdLib/Game/control.lua | 2 +- .../DONE/FactorioStdLib/String/control.lua | 16 +- .../DONE/FactorioStdLib/Table/control.lua | 36 +- old/modules/ExpGamingCore/Server/control.lua | 6 +- old/modules/ExpGamingCore/Sync/control.lua | 4 +- utils/gui.lua | 2 +- 94 files changed, 15315 insertions(+), 479 deletions(-) create mode 100644 doc/index.html create mode 100644 doc/ldoc.css create mode 100644 doc/modules/Commands.html create mode 100644 doc/modules/Permissions_Groups.html create mode 100644 doc/modules/Public.html create mode 100644 doc/modules/config._file_loader.html create mode 100644 doc/modules/config.action_buttons.html create mode 100644 doc/modules/config.advanced_start.html create mode 100644 doc/modules/config.death_logger.html create mode 100644 doc/modules/config.expcore-commands.auth_admin.html create mode 100644 doc/modules/config.expcore-commands.auth_roles.html create mode 100644 doc/modules/config.expcore-commands.auth_runtime_disable.html create mode 100644 doc/modules/config.expcore-commands.parse_general.html create mode 100644 doc/modules/config.expcore-commands.parse_roles.html create mode 100644 doc/modules/config.permission_groups.html create mode 100644 doc/modules/config.popup_messages.html create mode 100644 doc/modules/config.rockets.html create mode 100644 doc/modules/config.roles.html create mode 100644 doc/modules/config.scorched_earth.html create mode 100644 doc/modules/config.spawn_area.html create mode 100644 doc/modules/config.warnings.html create mode 100644 doc/modules/control.html create mode 100644 doc/modules/expcore.gui.buttons.html create mode 100644 doc/modules/expcore.gui.center.html create mode 100644 doc/modules/expcore.gui.checkboxs.html create mode 100644 doc/modules/expcore.gui.core.html create mode 100644 doc/modules/expcore.gui.dropdown.html create mode 100644 doc/modules/expcore.gui.elem-button.html create mode 100644 doc/modules/expcore.gui.html create mode 100644 doc/modules/expcore.gui.instances.html create mode 100644 doc/modules/expcore.gui.left.html create mode 100644 doc/modules/expcore.gui.popups.html create mode 100644 doc/modules/expcore.gui.progress-bar.html create mode 100644 doc/modules/expcore.gui.slider.html create mode 100644 doc/modules/expcore.gui.test.html create mode 100644 doc/modules/expcore.gui.text.html create mode 100644 doc/modules/expcore.gui.toolbar.html create mode 100644 doc/modules/expcore.store.html create mode 100644 doc/modules/modules.addons.advanced-start.html create mode 100644 doc/modules/modules.addons.chat-popups.html create mode 100644 doc/modules/modules.addons.damage-popups.html create mode 100644 doc/modules/modules.gui.player-list.html create mode 100644 doc/modules/modules.gui.rocket-info.html create mode 100644 doc/modules/modules.gui.science-info.html create mode 100644 doc/modules/modules.gui.task-list.html create mode 100644 doc/modules/utils.alien_evolution_progress.html create mode 100644 doc/modules/utils.core.html create mode 100644 doc/modules/utils.debug.html create mode 100644 doc/modules/utils.event.html create mode 100644 doc/modules/utils.event_core.html create mode 100644 doc/modules/utils.math.html create mode 100644 doc/modules/utils.recipe_locker.html create mode 100644 doc/modules/utils.state_machine.html create mode 100644 doc/modules/utils.table.html create mode 100644 doc/modules/utils.task.html create mode 100644 doc/modules/utils.timestamp.html diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 00000000..d67b00a1 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,376 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + + +

Modules

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
config._file_loaderThis contains a list of all files that will be loaded and the order they are loaded in + to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded + config files should be loaded after all modules are loaded + core files should be required by modules and not be present in this list
config.action_buttonsConfig for the different action buttons that show on the player list + each button has the button define(s) given along side an auth function, and optional reason callback + if a reason callback is used then Store.set_child(action_name_store,player.name,'BUTTON_NAME') should be called during on_click + buttons can be removed from the gui by commenting them out of the config at the bottom of this file + the key used for the name of the button is the permision name used by the role system
config.advanced_startThis file is used to setup the map starting settings and the items players will start with
config.death_loggerThis config controls what happens when a player dies mostly about map markers and item collection + allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present + if not present then the commands will not be loaded into the game
config.expcore-commands.auth_adminThis is a very simple config file which adds a admin only auth function + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua + either way you can change the requirements to be "admin" if you wanted to
config.expcore-commands.auth_rolesThis will make commands only work if the role has been allowed it in the role config
config.expcore-commands.auth_runtime_disableThis config for command auth allows commands to be globally enabled and disabled during runtime + this config adds Commands.disable and Commands.enable to enable and disable commands for all users
config.expcore-commands.parse_generalThis file contains some common command param parse functions + this file is less of a config and more of a requirement but you may wish to change how some behave + as such you need to be confident with lua but you edit this config file + use Commands.add_parse('name',function(input,player,reject) end) to add a parse + see ./expcore/commands.lua for more details
config.expcore-commands.parse_rolesAdds some parse functions that can be used with the role system
config.permission_groupsUse this file to add new permission groups to the game + start with Permission_Groups.new_group('name') + then use either :allow_all() or :disallow_all() to set the default for non specified actions + then use :allow{} and :disallow{} to specify certain actions to allow/disallow
config.popup_messagesA combination of config settings for different popup values like chat and damage
config.rocketsThis file controls what will show in each section of the rocket info gui
config.rolesThis is the main config file for the role system; file includes defines for roles and role flags and default values
config.scorched_earthThis file controls the placement/degrading of tiles as players build and walk
config.spawn_areaUsed to config the spawn generation settings yes there is alot here i know just ignore the long tables at the end (they were generated with a command)
config.warningsConfig file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.
controlPlease go to ./config if you want to change settings, each file is commented with what it does + if it is not in ./config then you should not attempt to change it unless you know what you are doing + all files which are loaded (including the config files) are present in ./config/file_loader.lua + this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development
CommandsFactorio command making module that makes commands with better parse and more modularity
PublicAdds some commonly used functions used in many modules
expcore.guiThis 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 seperate files in ./gui
expcore.gui.buttonsGui class define for buttons and sprite buttons +[[
expcore.gui.centerGui structure define for center gui frames +[[
expcore.gui.checkboxsGui class define for checkboxs and radiobuttons +[[
expcore.gui.coreCore gui file for making element defines and element classes (use require 'expcore.gui') + see utils.gui for event handlering + see expcore.gui.test for examples for element defines +[[
expcore.gui.dropdownGui class define for dropdowns and list boxs +[[
expcore.gui.elem-buttonGui class defines for elem buttons +[[
expcore.gui.instancesThis file is a breakout from core which forcues on instance management of defines +[[
expcore.gui.leftGui structure define for left frames +[[
expcore.gui.popupsGui structure define for popup gui +[[
expcore.gui.progress-barGui element define for progess bars +[[
expcore.gui.sliderGui class define for silders +[[
expcore.gui.testThis file creates a teste gui that is used to test every input method + note that this does not cover every permutation only features in indepentance + for example store in most cases is just by player name, but other store methods are tested with checkbox
expcore.gui.textGui class define for text fields and text boxs +[[
expcore.gui.toolbarGui structure for the toolbar (top left) +[[
Permissions_GroupsPermission group making for factorio so you never have to make one by hand again
CommandsFactorio role system to manage custom permissions
expcore.storeAdds an easy way to store and watch for updates to a value +[[
modules.addons.advanced-startAdds a better method of player starting items based on production levels.
modules.addons.chat-popupsCreates flying text entities when a player sends a message in chat + also displays a ping above users who are named in the message
modules.addons.damage-popupsDisplays the amount of dmg that is done by players to entities + also shows player health when a player is attacked
modules.gui.player-listGui left frame define for a player list
modules.gui.rocket-infoAdds a rocket infomation gui which shows general stats, milestones and build progress of rockets
modules.gui.science-infoAdds a science info gui that shows production usage and net for the different science packs as well as an eta
modules.gui.task-listAdds a task list to the game which players can add remove and edit items on
utils.alien_evolution_progressinfo + Original (javascript) version: https://hastebin.com/udakacavap.js + Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor
utils.coreMeasures distance between pos1 and pos2
utils.debug
utils.eventThis Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.
utils.event_coreDo not use this function, use Event.add instead as it has safety checks.
utils.mathTakes two points and calculates the slope of a line
utils.recipe_lockerLocks recipes, preventing them from being enabled by research.
utils.state_machineThis module provides a classical mealy/moore state machine.
utils.tableSearches a table to remove a specific element without an index
utils.taskAllows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument + Cannot be called before init
utils.timestampsource https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua + edited down to just what is needed.
+ +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/ldoc.css b/doc/ldoc.css new file mode 100644 index 00000000..7d74ca23 --- /dev/null +++ b/doc/ldoc.css @@ -0,0 +1,307 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + list-style: disc; + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre.example { + background-color: rgb(245, 245, 245); + border: 1px solid silver; + padding: 10px; + margin: 10px 0 10px 0; + font-family: "Andale Mono", monospace; + font-size: .85em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid silver; + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 14em; + vertical-align: top; + background-color: #f0f0f0; + overflow: visible; +} + +#navigation h2 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + width: 700px; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.module_list td.summary { width: 100%; } + + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +ul.nowrap { + overflow:auto; + white-space:nowrap; +} + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } diff --git a/doc/modules/Commands.html b/doc/modules/Commands.html new file mode 100644 index 00000000..6a622949 --- /dev/null +++ b/doc/modules/Commands.html @@ -0,0 +1,1307 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Commands

+

Factorio role system to manage custom permissions

+

+[[

+

Info:

+
    +
  • Author: Cooldude2606
  • +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Roles.debug ()Returns a string which contains all roles in index order displaying all data for them
Roles.print_to_roles (roles, message)Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam
Roles.print_to_roles_higher (role, message)Prints a message to all players who have the given role or one which is higher (excluding default)
Roles.print_to_roles_lower (role, message)Prints a message to all players who have the given role or one which is lower (excluding default)
Roles.get_role_by_name (name)Get a role for the given name
Roles.get_role_by_order (index)Get a role with the given order index
Roles.get_role_from_any (any)Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions
Roles.get_player_roles (player)Gets all the roles of the given player, this will always contain the default role
Roles.get_player_highest_role (player)Gets the highest role which the player has, can be used to compeer one player to another
Roles.assign_player (player, roles[, by_player_name=[, silent=false]])Gives a player the given role(s) with an option to pass a by player name used in the log
Roles.unassign_player (player, roles[, by_player_name=[, silent=false]])Removes a player from the given role(s) with an option to pass a by player name used in the log
Roles.override_player_roles (roles)Overrides all player roles with the given table of roles, useful to mass set roles on game start
Roles.player_has_role (player, search_role)A test for weather a player has the given role
Roles.player_has_flag (player, flag_name)A test for weather a player has the given flag true for at least one of they roles
Roles.player_allowed (player, action)A test for weather a player has at least one role which is allowed the given action
Roles.define_role_order (order)Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file
Roles.define_flag_trigger (name, callback)Defines a new trigger for when a tag is added or removed from a player
Roles.set_default (name)Sets the default role which every player will have, this needs to be called at least once
Roles.set_root (name)Sets the root role which will always have all permissions, any server actions act from this role
Roles.new_role (name[, short_hand=name])Defines a new role and returns the prototype to allow configuration
Roles._prototype:set_allow_all ([state=true])Sets the default allow state of the role, true will allow all actions
Roles._prototype:allow (actions)Sets the allow actions for this role, actions in this list will be allowed for this role
Roles._prototype:disallow (actions)Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance
Roles._prototype:is_allowed (action)Test for if a role is allowed the given action, mostly internal see Roles.player_allowed
Roles._prototype:set_flag (name[, value=true])Sets the state of a flag for a role, flags can be used to apply effects to players
Roles._prototype:clear_flags ()Clears all flags from this role, individual flags can be removed with set_flag(name,false)
Roles._prototype:has_flag (name)A test for if the role has a flag set
Roles._prototype:set_custom_tag (tag)Sets a custom player tag for the role, can be accessed by other code
Roles._prototype:set_custom_color (color)Sets a custom colour for the role, can be accessed by other code
Roles._prototype:set_permission_group (name[, use_factorio_api=false])Sets the permission group for this role, players will be moved to the group of they highest role
Roles._prototype:set_parent (role)Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles
Roles._prototype:set_auto_promote_condition (callback)Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role + nb: this is one way, failing false after already gaining the role will not revoke the role
Roles._prototype:set_block_auto_promote ([state=true])Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment
Roles._prototype:add_player (player, skip_check, skip_event)Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign
Roles._prototype:remove_player (player, skip_check, skip_event)Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign
Roles._prototype:get_players ([online=nil])Returns an array of all the players who have this role, can be filtered by online status
Roles._prototype:print (message)Will print a message to all players with this role
+ +
+
+ + +

Functions

+ +
+
+ + Roles.debug () +
+
+ Returns a string which contains all roles in index order displaying all data for them + + + +

Returns:

+
    + + string + the debug output string +
+ + + + +
+
+ + Roles.print_to_roles (roles, message) +
+
+ Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam + + +

Parameters:

+
    +
  • roles + table + table a of roles which to send the message to +
  • +
  • message + string + the message to send to the players +
  • +
+ + + + + +
+
+ + Roles.print_to_roles_higher (role, message) +
+
+ Prints a message to all players who have the given role or one which is higher (excluding default) + + +

Parameters:

+
    +
  • role + string + the name of the role to send the message to +
  • +
  • message + string + the message to send to the players +
  • +
+ + + + + +
+
+ + Roles.print_to_roles_lower (role, message) +
+
+ Prints a message to all players who have the given role or one which is lower (excluding default) + + +

Parameters:

+
    +
  • role + string + the name of the role to send the message to +
  • +
  • message + string + the message to send to the players +
  • +
+ + + + + +
+
+ + Roles.get_role_by_name (name) +
+
+ Get a role for the given name + + +

Parameters:

+
    +
  • name + string + the name of the role to get +
  • +
+ +

Returns:

+
    + + Roles._prototype + the role with that name or nil +
+ + + + +
+
+ + Roles.get_role_by_order (index) +
+
+ Get a role with the given order index + + +

Parameters:

+
    +
  • index + number + the place in the oder list of the role to get +
  • +
+ +

Returns:

+
    + + Roles._prototype + the role with that index in the order list or nil +
+ + + + +
+
+ + Roles.get_role_from_any (any) +
+
+ Gets a role from a name,index or role object (where it is just returned) + nb: this function is used for the input for most outward facing functions + + +

Parameters:

+
    +
  • any + number, string or table + the value used to find the role +
  • +
+ +

Returns:

+
    + + Roles._prototype + the role that was found or nil see above +
+ + + + +
+
+ + Roles.get_player_roles (player) +
+
+ Gets all the roles of the given player, this will always contain the default role + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the roles of +
  • +
+ +

Returns:

+
    + + table + a table where the values are the roles which the player has +
+ + + + +
+
+ + Roles.get_player_highest_role (player) +
+
+ Gets the highest role which the player has, can be used to compeer one player to another + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the highest role of +
  • +
+ +

Returns:

+
    + + the + role with the highest order index which this player has +
+ + + + +
+
+ + Roles.assign_player (player, roles[, by_player_name=[, silent=false]]) +
+
+ Gives a player the given role(s) with an option to pass a by player name used in the log + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will be assigned the roles +
  • +
  • roles + table + table a of roles that the player will be given, can be one role and can be role names +
  • +
  • by_player_name + string + the name of the player that will be shown in the log + (default ) +
  • +
  • silent + boolean + when true there will be no game message printed + (default false) +
  • +
+ + + + + +
+
+ + Roles.unassign_player (player, roles[, by_player_name=[, silent=false]]) +
+
+ Removes a player from the given role(s) with an option to pass a by player name used in the log + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will have the roles removed +
  • +
  • roles + table + table a of roles to be removed from the player, can be one role and can be role names +
  • +
  • by_player_name + string + the name of the player that will be shown in the logs + (default ) +
  • +
  • silent + boolean + when true there will be no game message printed + (default false) +
  • +
+ + + + + +
+
+ + Roles.override_player_roles (roles) +
+
+ Overrides all player roles with the given table of roles, useful to mass set roles on game start + + +

Parameters:

+
    +
  • roles + table + table a which is indexed by case sensitive player names and has the value of a table of role names +
  • +
+ + + + + +
+
+ + Roles.player_has_role (player, search_role) +
+
+ A test for weather a player has the given role + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to test the roles of +
  • +
  • search_role + string, number or table + a pointer to the role that is being searched for +
  • +
+ +

Returns:

+
    + + boolean + true if the player has the role, false otherwise, nil for errors +
+ + + + +
+
+ + Roles.player_has_flag (player, flag_name) +
+
+ A test for weather a player has the given flag true for at least one of they roles + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to test the roles of +
  • +
  • flag_name + string + the name of the flag that is being looked for +
  • +
+ +

Returns:

+
    + + boolean + true if the player has at least one role which has the flag set to true, false otherwise, nil for errors +
+ + + + +
+
+ + Roles.player_allowed (player, action) +
+
+ A test for weather a player has at least one role which is allowed the given action + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to test the roles of +
  • +
  • action + string + the name of the action that is being tested for +
  • +
+ +

Returns:

+
    + + boolean + true if the player has at least one role which is allowed this action, false otherwise, nil for errors +
+ + + + +
+
+ + Roles.define_role_order (order) +
+
+ Used to set the role order, higher in the list is better, must be called at least once in config + nb: function also re links parents due to expected position in the config file + + +

Parameters:

+
    +
  • order + table + table a which is keyed only by numbers (start 1) and values are roles in order with highest first +
  • +
+ + + + + +
+
+ + Roles.define_flag_trigger (name, callback) +
+
+ Defines a new trigger for when a tag is added or removed from a player + + +

Parameters:

+
    +
  • name + string + the name of the flag which the roles will have +
  • +
  • callback + function + the function that is called when roles are assigned + flag param - player - the player that has had they roles changed + flag param - state - the state of the flag, aka if the flag is present +
  • +
+ + + + + +
+
+ + Roles.set_default (name) +
+
+ Sets the default role which every player will have, this needs to be called at least once + + +

Parameters:

+
    +
  • name + string + the name of the default role +
  • +
+ + + + + +
+
+ + Roles.set_root (name) +
+
+ Sets the root role which will always have all permissions, any server actions act from this role + + +

Parameters:

+
    +
  • name + string + the name of the root role +
  • +
+ + + + + +
+
+ + Roles.new_role (name[, short_hand=name]) +
+
+ Defines a new role and returns the prototype to allow configuration + + +

Parameters:

+
    +
  • name + string + the name of the new role, must be unique +
  • +
  • short_hand + string + the shortened version of the name + (default name) +
  • +
+ +

Returns:

+
    + + Roles._prototype + the start of the config chain for this role +
+ + + + +
+
+ + Roles._prototype:set_allow_all ([state=true]) +
+
+ Sets the default allow state of the role, true will allow all actions + + +

Parameters:

+
    +
  • state + boolean + true will allow all actions + (default true) +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:allow (actions) +
+
+ Sets the allow actions for this role, actions in this list will be allowed for this role + + +

Parameters:

+
    +
  • actions + table + indexed with numbers and is an array of action names, order has no effect +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:disallow (actions) +
+
+ Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance + + +

Parameters:

+
    +
  • actions + table + indexed with numbers and is an array of action names, order has no effect +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:is_allowed (action) +
+
+ Test for if a role is allowed the given action, mostly internal see Roles.player_allowed + + +

Parameters:

+
    +
  • action + string + the name of the action to test if it is allowed +
  • +
+ +

Returns:

+
    + + boolean + true if action is allowed, false otherwise +
+ + + + +
+
+ + Roles._prototype:set_flag (name[, value=true]) +
+
+ Sets the state of a flag for a role, flags can be used to apply effects to players + + +

Parameters:

+
    +
  • name + string + the name of the flag to set the value of +
  • +
  • value + boolean + the state to set the flag to + (default true) +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:clear_flags () +
+
+ Clears all flags from this role, individual flags can be removed with set_flag(name,false) + + + +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:has_flag (name) +
+
+ A test for if the role has a flag set + + +

Parameters:

+
    +
  • name + string + the name of the flag to test for +
  • +
+ +

Returns:

+
    + + boolean + true if the flag is set, false otherwise +
+ + + + +
+
+ + Roles._prototype:set_custom_tag (tag) +
+
+ Sets a custom player tag for the role, can be accessed by other code + + +

Parameters:

+
    +
  • tag + string + the value that the tag will be +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:set_custom_color (color) +
+
+ Sets a custom colour for the role, can be accessed by other code + + +

Parameters:

+
    +
  • color + table + ?string|table can either be and rgb colour or the name of a colour defined in the presets +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:set_permission_group (name[, use_factorio_api=false]) +
+
+ Sets the permission group for this role, players will be moved to the group of they highest role + + +

Parameters:

+
    +
  • name + string + the name of the permission group to have players moved to +
  • +
  • use_factorio_api + boolean + when true the custom permission group module is ignored + (default false) +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:set_parent (role) +
+
+ Sets the parent for a role, any action not in allow or disallow will be looked for in its parents + nb: this is a recursive action, and changing the allows and disallows will effect all children roles + + +

Parameters:

+
    +
  • role + string + the name of the role that will be the parent; has imminent effect if role is already defined +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:set_auto_promote_condition (callback) +
+
+ Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role + nb: this is one way, failing false after already gaining the role will not revoke the role + + +

Parameters:

+
    +
  • callback + function + receives only one param which is player to promote, return true to promote the player +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:set_block_auto_promote ([state=true]) +
+
+ Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment + + +

Parameters:

+
    +
  • state + boolean + when true the players with this role will not be auto promoted + (default true) +
  • +
+ +

Returns:

+
    + + Roles._prototype + allows chaining +
+ + + + +
+
+ + Roles._prototype:add_player (player, skip_check, skip_event) +
+
+ Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will be given this role +
  • +
  • skip_check + boolean + when true player will be taken as the player name (use when player has not yet joined) +
  • +
  • skip_event + boolean + when true the event emit will be skipped, this is used internally with Roles.assign +
  • +
+ +

Returns:

+
    + + boolean + true if the player was added successfully +
+ + + + +
+
+ + Roles._prototype:remove_player (player, skip_check, skip_event) +
+
+ Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will lose this role +
  • +
  • skip_check + boolean + when true player will be taken as the player name (use when player has not yet joined) +
  • +
  • skip_event + boolean + when true the event emit will be skipped, this is used internally with Roles.unassign +
  • +
+ +

Returns:

+
    + + boolean + true if the player was removed successfully +
+ + + + +
+
+ + Roles._prototype:get_players ([online=nil]) +
+
+ Returns an array of all the players who have this role, can be filtered by online status + + +

Parameters:

+
    +
  • online + boolean + when given will filter by this online state, nil will return all players + (default nil) +
  • +
+ +

Returns:

+
    + + table + all the players who have this role, indexed order is meaningless +
+ + + + +
+
+ + Roles._prototype:print (message) +
+
+ Will print a message to all players with this role + + +

Parameters:

+
    +
  • message + string + the message that will be printed to the players +
  • +
+ +

Returns:

+
    + + number + the number of players who received the message +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/Permissions_Groups.html b/doc/modules/Permissions_Groups.html new file mode 100644 index 00000000..d30beee9 --- /dev/null +++ b/doc/modules/Permissions_Groups.html @@ -0,0 +1,660 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Permissions_Groups

+

Permission group making for factorio so you never have to make one by hand again

+

+[[

+

Info:

+
    +
  • Author: Cooldude2606
  • +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
new_group (name)Defines a new permission group that can have it actions set in the config
get_group_by_name (name)Returns the group with the given name, case sensitive
get_group_from_player (player)Returns the group that a player is in
reload_permissions ()Reloads/creates all permission groups and sets them to they configured state
lockdown_permissions (exempt)Removes all permissions from every permission group except for "Default" and any passed as exempt
set_player_group (player, group)Sets a player's group to the one given, a player can only have one group at a time
Permissions_Groups._prototype:set_action (action, state)Sets the allow state of an action for this group, used internally but is safe to use else where
Permissions_Groups._prototype:allow (actions)Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime
Permissions_Groups._prototype:disallow (actions)Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime
Permissions_Groups._prototype:allow_all ()Sets the default state for any actions not given to be allowed, useful with :disallow
Permissions_Groups._prototype:disallow_all ()Sets the default state for any action not given to be disallowed, useful with :allow
Permissions_Groups._prototype:is_allowed (action)Returns if an input action is allowed for this group
Permissions_Groups._prototype:get_raw ()Returns the LuaPermissionGroup that was created with this group object, used internally
Permissions_Groups._prototype:create ()Creates or updates the permission group with the configured actions, used internally
Permissions_Groups._prototype:add_player (player)Adds a player to this group
Permissions_Groups._prototype:remove_player (player)Removes a player from this group
Permissions_Groups._prototype:get_players ([online])Returns all player that are in this group with the option to filter to online/offline only
Permissions_Groups._prototype:print (message)Prints a message to every player in this group
+ +
+
+ + +

Functions

+ +
+
+ + new_group (name) +
+
+ Defines a new permission group that can have it actions set in the config + + +

Parameters:

+
    +
  • name + string + the name of the new group +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype + the new group made with function to allow and disallow actions +
+ + + + +
+
+ + get_group_by_name (name) +
+
+ Returns the group with the given name, case sensitive + + +

Parameters:

+
    +
  • name + string + the name of the group to get +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype or nil + the group with that name or nil if non found +
+ + + + +
+
+ + get_group_from_player (player) +
+
+ Returns the group that a player is in + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the group of can be name index etc +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype or nil + the group with that player or nil if non found +
+ + + + +
+
+ + reload_permissions () +
+
+ Reloads/creates all permission groups and sets them to they configured state + + + + + + + +
+
+ + lockdown_permissions (exempt) +
+
+ Removes all permissions from every permission group except for "Default" and any passed as exempt + + +

Parameters:

+
    +
  • exempt + string or Array + groups that you want to be except, "Default" is always exempt +
  • +
+ +

Returns:

+
    + + number + the number of groups that had they permissions removed +
+ + + + +
+
+ + set_player_group (player, group) +
+
+ Sets a player's group to the one given, a player can only have one group at a time + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to effect can be name index etc +
  • +
  • group + string + the name of the group to give to the player +
  • +
+ +

Returns:

+
    + + boolean + true if the player was added successfully, false other wise +
+ + + + +
+
+ + Permissions_Groups._prototype:set_action (action, state) +
+
+ Sets the allow state of an action for this group, used internally but is safe to use else where + + +

Parameters:

+
    +
  • action + string or defines.input_action + the action that you want to set the state of +
  • +
  • state + boolean + the state that you want to set it to, true = allow, false = disallow +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype + returns self so function can be chained +
+ + + + +
+
+ + Permissions_Groups._prototype:allow (actions) +
+
+ Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime + + +

Parameters:

+
    +
  • actions + string or Array + the action or actions that you want to allow for this group +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype + returns self so function can be chained +
+ + + + +
+
+ + Permissions_Groups._prototype:disallow (actions) +
+
+ Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime + + +

Parameters:

+
    +
  • actions + string or Array + the action or actions that you want to disallow for this group +
  • +
+ +

Returns:

+
    + + Permissions_Groups._prototype + returns self so function can be chained +
+ + + + +
+
+ + Permissions_Groups._prototype:allow_all () +
+
+ Sets the default state for any actions not given to be allowed, useful with :disallow + + + +

Returns:

+
    + + Permissions_Groups._prototype + returns self so function can be chained +
+ + + + +
+
+ + Permissions_Groups._prototype:disallow_all () +
+
+ Sets the default state for any action not given to be disallowed, useful with :allow + + + +

Returns:

+
    + + Permissions_Groups._prototype + returns self so function can be chained +
+ + + + +
+
+ + Permissions_Groups._prototype:is_allowed (action) +
+
+ Returns if an input action is allowed for this group + + +

Parameters:

+
    +
  • action + string or defines.input_action + the action that you want to test for +
  • +
+ +

Returns:

+
    + + boolean + true if the group is allowed the action, false other wise +
+ + + + +
+
+ + Permissions_Groups._prototype:get_raw () +
+
+ Returns the LuaPermissionGroup that was created with this group object, used internally + + + +

Returns:

+
    + + LuaPermissionGroup + the raw lua permission group +
+ + + + +
+
+ + Permissions_Groups._prototype:create () +
+
+ Creates or updates the permission group with the configured actions, used internally + + + +

Returns:

+
    + + LuaPermissionGroup + the permission group that was created +
+ + + + +
+
+ + Permissions_Groups._prototype:add_player (player) +
+
+ Adds a player to this group + + +

Parameters:

+
    +
  • player + LuaPlayer + LuaPlayer the player you want to add to this group can be name or index etc +
  • +
+ +

Returns:

+
    + + boolean + true if the player was added successfully, false other wise +
+ + + + +
+
+ + Permissions_Groups._prototype:remove_player (player) +
+
+ Removes a player from this group + + +

Parameters:

+
    +
  • player + LuaPlayer + LuaPlayer the player you want to remove from this group can be name or index etc +
  • +
+ +

Returns:

+
    + + boolean + true if the player was removed successfully, false other wise +
+ + + + +
+
+ + Permissions_Groups._prototype:get_players ([online]) +
+
+ Returns all player that are in this group with the option to filter to online/offline only + + +

Parameters:

+
    +
  • online + boolean + if nil returns all players, if true online players only, if false returns online players only + (optional) +
  • +
+ +

Returns:

+
    + + table + a table of players that are in this group; filtered if online param is given +
+ + + + +
+
+ + Permissions_Groups._prototype:print (message) +
+
+ Prints a message to every player in this group + + +

Parameters:

+
    +
  • message + string + the message that you want to send to the players +
  • +
+ +

Returns:

+
    + + number + the number of players that received the message +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/Public.html b/doc/modules/Public.html new file mode 100644 index 00000000..def2be2b --- /dev/null +++ b/doc/modules/Public.html @@ -0,0 +1,996 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module Public

+

Adds some commonly used functions used in many modules

+

+[[

+

Info:

+
    +
  • Author: cooldude2606
  • +
+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
type_check (value[, test_type=nil])Compare types faster for faster validation of params
type_check_error (value, test_type, error_message, level)Raises an error if the value is of the wrong type
param_check (value, test_type, param_name, param_number)Raises an error when the value is the incorrect type, uses a consistent error message format
player_return (value[, colour=defines.colour.white[, player=game.player]])Will return a value of any type to the player/server console, allows colour for in-game players
write_json (path, tbl)Writes a table object to a file in json format
opt_require (path)Calls a require that will not error if the file is not found
ext_require (path, ...)Calls a require and returns only the keys given, file must return a table
format_time (ticks, options)Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one
move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]])Moves items to the position and stores them in the closest entity of the type given
print_grid_value (value, surface, position, scale, offset, immutable)https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.
print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)Prints a colored value on a location.
clear_flying_text (surface)Clears all flying text entites on a surface
string_contains (s, contains)Tests if a string contains a given substring.
extract_keys (tbl, ...)Extracts certain keys from a table
enum (tbl)Converts a table to an enum
auto_complete (options, input[, use_key=false[, rtn_key=false]])Returns the closest match to the input
table_keys (tbl)Returns all the keys of a table
table_values (tbl)Returns all the values of a table
table_alphanumsort (tbl)Returns the list is a sorted way that would be expected by people (this is by key)
table_keysort (tbl)Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)
format_chat_colour (message, color)Returns a message with valid chat tags to change its colour
format_chat_colour_localized (message, color)Returns a message with valid chat tags to change its colour, using localization
format_chat_player_name (player[, raw_string=false])Returns the players name in the players color
+ +
+
+ + +

Functions

+ +
+
+ + type_check (value[, test_type=nil]) +
+
+ Compare types faster for faster validation of params + + +

Parameters:

+
    +
  • value + any + the value to be tested +
  • +
  • test_type + string + the type to test for if not given then it tests for nil + (default nil) +
  • +
+ +

Returns:

+
    + + boolean + is v of type test_type +
+ + + +

Usage:

+
    +
  • type_check('foo','string') -- return true
  • +
  • type_check('foo') -- return false
  • +
+ +
+
+ + type_check_error (value, test_type, error_message, level) +
+
+ Raises an error if the value is of the wrong type + + +

Parameters:

+
    +
  • value + any + the value that you want to test the type of +
  • +
  • test_type + string + the type that the value should be +
  • +
  • error_message + string + the error message that is returned +
  • +
  • level + number + the level to call the error on (level = 1 means the caller) +
  • +
+ +

Returns:

+
    + + boolean + true if no error was called +
+ + + +

Usage:

+
    +
    type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number"
    +
+ +
+
+ + param_check (value, test_type, param_name, param_number) +
+
+ Raises an error when the value is the incorrect type, uses a consistent error message format + + +

Parameters:

+
    +
  • value + any + the value that you want to test the type of +
  • +
  • test_type + string + the type that the value should be +
  • +
  • param_name + string + the name of the param +
  • +
  • param_number + number + the number param it is +
  • +
+ +

Returns:

+
    + + boolean + true if no error was raised +
+ + + +

Usage:

+
    +
    param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to <anon>; repeat_count is not of type number"
    +
+ +
+
+ + player_return (value[, colour=defines.colour.white[, player=game.player]]) +
+
+ Will return a value of any type to the player/server console, allows colour for in-game players + + +

Parameters:

+
    +
  • value + any value of any type that will be returned to the player or console +
  • +
  • colour + defines.color or string + the colour of the text for the player, ignored when printing to console + (default defines.colour.white) +
  • +
  • player + LuaPlayer + the player that return will go to, if no game.player then returns to server + (default game.player) +
  • +
+ + + + +

Usage:

+
    +
  • player_return('Hello, World!') -- returns 'Hello, World!' to game.player or server console
  • +
  • player_return('Hello, World!','green') -- returns 'Hello, World!' to game.player with colour green or server console
  • +
  • player_return('Hello, World!',nil,player) -- returns 'Hello, World!' to the given player
  • +
+ +
+
+ + write_json (path, tbl) +
+
+ Writes a table object to a file in json format + + +

Parameters:

+
    +
  • path + string + the path of the file to write include / to use dir +
  • +
  • tbl + table + the table that will be converted to a json string and wrote to file +
  • +
+ + + + + +
+
+ + opt_require (path) +
+
+ Calls a require that will not error if the file is not found + + +

Parameters:

+
    +
  • path + string + the path that you want to require +
  • +
+ +

Returns:

+
    + + the returns from that file or nil, error if not loaded +
+ + + +

Usage:

+
    +
    local file = opt_require('file.not.present') -- will not cause any error
    +
+ +
+
+ + ext_require (path, ...) +
+
+ Calls a require and returns only the keys given, file must return a table + + +

Parameters:

+
    +
  • path + string + the path that you want to require +
  • +
  • ... + string + the name of the keys that you want returned +
  • +
+ +

Returns:

+
    + + the keys in the order given +
+ + + +

Usage:

+
    +
    local extract, param_check = ext_require('expcore.common','extract','param_check')
    +
+ +
+
+ + format_time (ticks, options) +
+
+ Formats tick into a clean format, denominations from highest to lowest + long will use words rather than letters + time will use : separates + string will return a string not a locale string + when a denomination is false it will overflow into the next one + + +

Parameters:

+
    +
  • ticks + number + the number of ticks that represents a time +
  • +
  • options + table + table a of options to use for the format +
  • +
+ +

Returns:

+
    + + string + a locale string that can be used +
+ + + + +
+
+ + move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]]) +
+
+ Moves items to the position and stores them in the closest entity of the type given + + +

Parameters:

+
    +
  • items + table + items which are to be added to the chests, ['name']=count +
  • +
  • surface + LuaSurface + the surface that the items will be moved to + (default navies) +
  • +
  • position + table + the position that the items will be moved to {x=100,y=100} + (default {0) +
  • +
  • radius + number + the radius in which the items are allowed to be placed + (default 32) +
  • +
  • chest_type + string + the chest type that the items should be moved into + (default iron-chest) +
  • +
+ + + + + +
+
+ + print_grid_value (value, surface, position, scale, offset, immutable) +
+
+ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location. + + +

Parameters:

+
    +
  • value + between -1 and 1 +
  • +
  • surface + LuaSurface +
  • +
  • position + Position {x, y} +
  • +
  • scale + float +
  • +
  • offset + float +
  • +
  • immutable + bool if immutable, only set, never do a surface lookup, values never change +
  • +
+ + + + + +
+
+ + print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) +
+
+ Prints a colored value on a location. When given a color_value and a delta_color, + will change the color of the text from the base to base + value * delta. This will + make the color of the text range from 'base_color' to 'base_color + delta_color' + as the color_value ranges from 0 to 1 + + +

Parameters:

+
    +
  • value + of number to be displayed +
  • +
  • surface + LuaSurface +
  • +
  • position + Position {x, y} +
  • +
  • offset + float position offset +
  • +
  • immutable + bool if immutable, only set, never do a surface lookup, values never change +
  • +
  • color_value + float How far along the range of values of colors the value is to be displayed +
  • +
  • base_color + {r,g,b} The color for the text to be if color_value is 0 +
  • +
  • delta_color + {r,g,b} The amount to correct the base_color if color_value is 1 +
  • +
  • under_bound + {r,g,b} The color to be used if color_value < 0 +
  • +
  • over_bound + {r,g,b} The color to be used if color_value > 1 +
  • +
+ + + + + +
+
+ + clear_flying_text (surface) +
+
+ Clears all flying text entites on a surface + + +

Parameters:

+
    +
  • surface + LuaSurface + the surface to clear +
  • +
+ + + + + +
+
+ + string_contains (s, contains) +
+
+ Tests if a string contains a given substring. + + +

Parameters:

+
    +
  • s + string + the string to check for the substring +
  • +
  • contains + string + the substring to test for +
  • +
+ +

Returns:

+
    + + boolean + true if the substring was found in the string +
+ + + + +
+
+ + extract_keys (tbl, ...) +
+
+ Extracts certain keys from a table + + +

Parameters:

+
    +
  • tbl + table + table the which contains the keys +
  • +
  • ... + string + the names of the keys you want extracted +
  • +
+ +

Returns:

+
    + + the keys in the order given +
+ + + +

Usage:

+
    +
    local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
    +
+ +
+
+ + enum (tbl) +
+
+ Converts a table to an enum + + +

Parameters:

+
    +
  • tbl + table + table the that will be converted +
  • +
+ +

Returns:

+
    + + table + the new table that acts like an enum +
+ + + + +
+
+ + auto_complete (options, input[, use_key=false[, rtn_key=false]]) +
+
+ Returns the closest match to the input + + +

Parameters:

+
    +
  • options + table + table a of options for the auto complete +
  • +
  • input + string + string the input that will be completed +
  • +
  • use_key + boolean + when true the keys of options will be used as the options + (default false) +
  • +
  • rtn_key + boolean + when true the the key will be returned rather than the value + (default false) +
  • +
+ +

Returns:

+
    + + the list item found that matches the input +
+ + + + +
+
+ + table_keys (tbl) +
+
+ Returns all the keys of a table + + +

Parameters:

+
    +
  • tbl + table + table the to get the keys of +
  • +
+ +

Returns:

+
    + + table + an array of the table keys +
+ + + + +
+
+ + table_values (tbl) +
+
+ Returns all the values of a table + + +

Parameters:

+
    +
  • tbl + table + table the to get the values of +
  • +
+ +

Returns:

+
    + + table + an array of the table values +
+ + + + +
+
+ + table_alphanumsort (tbl) +
+
+ Returns the list is a sorted way that would be expected by people (this is by key) + + +

Parameters:

+
    +
  • tbl + table + the table to be sorted +
  • +
+ +

Returns:

+
    + + table + the sorted table +
+ + + + +
+
+ + table_keysort (tbl) +
+
+ Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) + + +

Parameters:

+
    +
  • tbl + table + the table to be sorted +
  • +
+ +

Returns:

+
    + + table + the sorted table +
+ + + + +
+
+ + format_chat_colour (message, color) +
+
+ Returns a message with valid chat tags to change its colour + + +

Parameters:

+
    +
  • message + string + the message that will be in the output +
  • +
  • color + table + a color which contains r,g,b as its keys +
  • +
+ +

Returns:

+
    + + string + the message with the color tags included +
+ + + + +
+
+ + format_chat_colour_localized (message, color) +
+
+ Returns a message with valid chat tags to change its colour, using localization + + +

Parameters:

+
    +
  • message + string or table + the message that will be in the output +
  • +
  • color + table + a color which contains r,g,b as its keys +
  • +
+ +

Returns:

+
    + + table + the message with the color tags included +
+ + + + +
+
+ + format_chat_player_name (player[, raw_string=false]) +
+
+ Returns the players name in the players color + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to use the name and color of +
  • +
  • raw_string + boolean + when true a is returned rather than a localized string + (default false) +
  • +
+ +

Returns:

+
    + + table + the players name with tags for the players color +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config._file_loader.html b/doc/modules/config._file_loader.html new file mode 100644 index 00000000..46c6c81a --- /dev/null +++ b/doc/modules/config._file_loader.html @@ -0,0 +1,121 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config._file_loader

+

This contains a list of all files that will be loaded and the order they are loaded in + to stop a file from loading add "--" in front of it, remove the "--" to have the file be loaded + config files should be loaded after all modules are loaded + core files should be required by modules and not be present in this list

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.action_buttons.html b/doc/modules/config.action_buttons.html new file mode 100644 index 00000000..d4b608ae --- /dev/null +++ b/doc/modules/config.action_buttons.html @@ -0,0 +1,122 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.action_buttons

+

Config for the different action buttons that show on the player list + each button has the button define(s) given along side an auth function, and optional reason callback + if a reason callback is used then Store.set_child(action_name_store,player.name,'BUTTON_NAME') should be called during on_click + buttons can be removed from the gui by commenting them out of the config at the bottom of this file + the key used for the name of the button is the permision name used by the role system

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.advanced_start.html b/doc/modules/config.advanced_start.html new file mode 100644 index 00000000..afe165e4 --- /dev/null +++ b/doc/modules/config.advanced_start.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.death_logger.html b/doc/modules/config.death_logger.html new file mode 100644 index 00000000..c8037547 --- /dev/null +++ b/doc/modules/config.death_logger.html @@ -0,0 +1,120 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.death_logger

+

This config controls what happens when a player dies mostly about map markers and item collection + allow_teleport_to_body_command and allow_collect_bodies_command can be over ridden if command_auth_runtime_disable is present + if not present then the commands will not be loaded into the game

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.expcore-commands.auth_admin.html b/doc/modules/config.expcore-commands.auth_admin.html new file mode 100644 index 00000000..64230092 --- /dev/null +++ b/doc/modules/config.expcore-commands.auth_admin.html @@ -0,0 +1,120 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.expcore-commands.auth_admin

+

This is a very simple config file which adds a admin only auth function + not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua + either way you can change the requirements to be "admin" if you wanted to

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.expcore-commands.auth_roles.html b/doc/modules/config.expcore-commands.auth_roles.html new file mode 100644 index 00000000..bbf424a9 --- /dev/null +++ b/doc/modules/config.expcore-commands.auth_roles.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.expcore-commands.auth_runtime_disable.html b/doc/modules/config.expcore-commands.auth_runtime_disable.html new file mode 100644 index 00000000..1a9fd7e4 --- /dev/null +++ b/doc/modules/config.expcore-commands.auth_runtime_disable.html @@ -0,0 +1,119 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.expcore-commands.auth_runtime_disable

+

This config for command auth allows commands to be globally enabled and disabled during runtime + this config adds Commands.disable and Commands.enable to enable and disable commands for all users

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.expcore-commands.parse_general.html b/doc/modules/config.expcore-commands.parse_general.html new file mode 100644 index 00000000..8d39f9fc --- /dev/null +++ b/doc/modules/config.expcore-commands.parse_general.html @@ -0,0 +1,122 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.expcore-commands.parse_general

+

This file contains some common command param parse functions + this file is less of a config and more of a requirement but you may wish to change how some behave + as such you need to be confident with lua but you edit this config file + use Commands.add_parse('name',function(input,player,reject) end) to add a parse + see ./expcore/commands.lua for more details

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.expcore-commands.parse_roles.html b/doc/modules/config.expcore-commands.parse_roles.html new file mode 100644 index 00000000..7374331c --- /dev/null +++ b/doc/modules/config.expcore-commands.parse_roles.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.permission_groups.html b/doc/modules/config.permission_groups.html new file mode 100644 index 00000000..5b148167 --- /dev/null +++ b/doc/modules/config.permission_groups.html @@ -0,0 +1,121 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.permission_groups

+

Use this file to add new permission groups to the game + start with Permission_Groups.new_group('name') + then use either :allow_all() or :disallow_all() to set the default for non specified actions + then use :allow{} and :disallow{} to specify certain actions to allow/disallow

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.popup_messages.html b/doc/modules/config.popup_messages.html new file mode 100644 index 00000000..d719afa7 --- /dev/null +++ b/doc/modules/config.popup_messages.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.rockets.html b/doc/modules/config.rockets.html new file mode 100644 index 00000000..f00430ba --- /dev/null +++ b/doc/modules/config.rockets.html @@ -0,0 +1,165 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module config.rockets

+

This file controls what will show in each section of the rocket info gui

+

+ + +

Fields

+ + + + + + + + + +
show_statsThe data that will show in the stats section
show_progressThe data and buttons in the build progress section
+ +
+
+ + +

Fields

+ +
+
+ + show_stats +
+
+ The data that will show in the stats section + + + + + + + +
+
+ + show_progress +
+
+ The data and buttons in the build progress section + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.roles.html b/doc/modules/config.roles.html new file mode 100644 index 00000000..8ca811a6 --- /dev/null +++ b/doc/modules/config.roles.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.scorched_earth.html b/doc/modules/config.scorched_earth.html new file mode 100644 index 00000000..01474fac --- /dev/null +++ b/doc/modules/config.scorched_earth.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.spawn_area.html b/doc/modules/config.spawn_area.html new file mode 100644 index 00000000..314256b2 --- /dev/null +++ b/doc/modules/config.spawn_area.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/config.warnings.html b/doc/modules/config.warnings.html new file mode 100644 index 00000000..64511255 --- /dev/null +++ b/doc/modules/config.warnings.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/control.html b/doc/modules/control.html new file mode 100644 index 00000000..912524fd --- /dev/null +++ b/doc/modules/control.html @@ -0,0 +1,121 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module control

+

Please go to ./config if you want to change settings, each file is commented with what it does + if it is not in ./config then you should not attempt to change it unless you know what you are doing + all files which are loaded (including the config files) are present in ./config/file_loader.lua + this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.buttons.html b/doc/modules/expcore.gui.buttons.html new file mode 100644 index 00000000..30af2882 --- /dev/null +++ b/doc/modules/expcore.gui.buttons.html @@ -0,0 +1,275 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.buttons

+

Gui class define for buttons and sprite buttons +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
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 spirte 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
+ +
+
+ + +

Functions

+ +
+
+ + Button.new_button ([name]) +
+
+ Creates a new button element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new button element define +
+ + + + +
+
+ + Button._prototype:set_sprites (sprite[, hovered_sprite[, clicked_sprite]]) +
+
+ Adds sprites to a button making it a spirte button + + +

Parameters:

+
    +
  • sprite + SpritePath + the sprite path for the default sprite for the button +
  • +
  • hovered_sprite + SpritePath + the sprite path for the sprite when the player hovers over the button + (optional) +
  • +
  • clicked_sprite + SpritePath + the sprite path for the sprite when the player clicks the button + (optional) +
  • +
+ +

Returns:

+
    + + self + returns the button define to allow chaining +
+ + + + +
+
+ + Button._prototype:set_click_filter (filter[, ...]) +
+
+ Adds a click / mouse button filter to the button + + +

Parameters:

+
    +
  • filter + table + ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed +
  • +
  • ... + table + when filter is not a you can add the mouse buttons one after each other + (optional) +
  • +
+ +

Returns:

+
    + + self + returns the button define to allow chaining +
+ + + + +
+
+ + Button._prototype:set_key_filter (filter[, ...]) +
+
+ Adds a control key filter to the button + + +

Parameters:

+
    +
  • filter + table + ?string|table either a of control keys or the first control keys to filter, with a table true means allowed +
  • +
  • ... + table + when filter is not a you can add the control keyss one after each other + (optional) +
  • +
+ +

Returns:

+
    + + self + returns the button define to allow chaining +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.center.html b/doc/modules/expcore.gui.center.html new file mode 100644 index 00000000..bf096aeb --- /dev/null +++ b/doc/modules/expcore.gui.center.html @@ -0,0 +1,472 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.center

+

Gui structure define for center gui frames +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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 (permision_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
+ +
+
+ + +

Functions

+ +
+
+ + CenterFrames.get_flow (player) +
+
+ Gets the center flow for a player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the flow for +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the center flow +
+ + + + +
+
+ + CenterFrames.clear_flow (player) +
+
+ Clears the center flow for a player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to clear the flow for +
  • +
+ + + + + +
+
+ + CenterFrames.draw_frame (player, name) +
+
+ Draws the center frame for a player, if already open then will do nothing + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will have the frame drawn +
  • +
  • name + string + the name of the hui that will drawn +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the new frame that was made +
+ + + + +
+
+ + CenterFrames.redraw_frame (player, name) +
+
+ Draws the center frame for a player, if already open then will destroy it and redraw + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will have the frame drawn +
  • +
  • name + string + the name of the hui that will drawn +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the new frame that was made +
+ + + + +
+
+ + CenterFrames.toggle_frame (player, name[, state]) +
+
+ Toggles if the frame is currently open or not, will open if closed and close if open + + +

Parameters:

+
    +
  • player + LuaPlayer + the player that will have the frame toggled +
  • +
  • name + string + the name of the hui that will be toggled +
  • +
  • state + boolean + when set will force a state for the frame + (optional) +
  • +
+ +

Returns:

+
    + + boolean + if the frame if no open or closed +
+ + + + +
+
+ + CenterFrames.new_frame (permision_name) +
+
+ Creates a new center frame define + + +

Parameters:

+
    +
  • permision_name + string + the name that can be used with the permision system +
  • +
+ +

Returns:

+
    + + table + the 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 + + +

Parameters:

+
    +
  • state + boolean + when true will auto close other frames and set this frame as player.opened + (default true) +
  • +
+ + + + + +
+
+ + 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) + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to draw the frame for +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the new frame that was drawn +
+ + + + +
+
+ + 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) + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to draw the frame for +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the new frame that was drawn +
+ + + + +
+
+ + CenterFrames._prototype:toggle_frame (player) +
+
+ Toggles if the frame is open, if open it will close it and if closed it will open it + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to draw the frame for +
  • +
+ +

Returns:

+
    + + boolean + with the gui frame is now open +
+ + + + +
+
+ + CenterFrames._prototype:event_handler ([action=update]) +
+
+ Creates an event handler that will trigger one of its functions, use with Event.add + + +

Parameters:

+
    +
  • action + string + the action to take on this event + (default update) +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.checkboxs.html b/doc/modules/expcore.gui.checkboxs.html new file mode 100644 index 00000000..bc0924bd --- /dev/null +++ b/doc/modules/expcore.gui.checkboxs.html @@ -0,0 +1,414 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.checkboxs

+

Gui class define for checkboxs and radiobuttons +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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 (name, callback, categorize)Registers a new option set that can be linked to radiobutotns (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 radiobutotn in a element to false (unless excluded) and can act recursivly
+ +
+
+ + +

Functions

+ +
+
+ + Checkbox.new_checkbox ([name]) +
+
+ Creates a new checkbox element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new checkbox element define +
+ + + + +
+
+ + Checkbox.new_radiobutton ([name]) +
+
+ Creates a new radiobutton element define, has all functions checkbox has + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new button element define +
+ + + + +
+
+ + 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) + + +

Parameters:

+
    +
  • option_set + string + the name of the option set to add this element to +
  • +
  • option_name + string + the name of this option that will be used to idenitife it +
  • +
+ +

Returns:

+
    + + self + the define to allow chaining +
+ + + + +
+
+ + Checkbox._prototype_radiobutton:get_store (category, internal) +
+
+ Gets the stored value of the radiobutton or the option set if present + + +

Parameters:

+
    +
  • category + string + [opt] the category to get such as player name or force name +
  • +
  • internal + boolean + used to prevent stackover flow +
  • +
+ +

Returns:

+
    + + any + the value that is stored for this define +
+ + + + +
+
+ + Checkbox._prototype_radiobutton:set_store (category, value, internal) +
+
+ Sets the stored value of the radiobutton or the option set if present + + +

Parameters:

+
    +
  • category + string + [opt] the category to get such as player name or force name +
  • +
  • value + boolean + the value to set for this define, must be valid for its type ie for checkbox etc +
  • +
  • internal + boolean + used to prevent stackover flow +
  • +
+ +

Returns:

+
    + + boolean + true if the value was set +
+ + + + +
+
+ + Checkbox.new_option_set (name, callback, categorize) +
+
+ Registers a new option set that can be linked to radiobutotns (only one can be true at a time) + + +

Parameters:

+
    +
  • name + string + the name of the option set, must be unique +
  • +
  • callback + function + the update callback when the value of the option set chagnes + callback param - value string - the new selected option for this option set + callback param - category string - the category that updated if categorize was used +
  • +
  • categorize + function + the function used to convert an element into a string +
  • +
+ +

Returns:

+
    + + string + the name of this option set to be passed to add_as_option +
+ + + + +
+
+ + Checkbox.draw_option_set (name, element) +
+
+ Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) + + +

Parameters:

+
    +
  • name + string + the name of the option set to draw the radiobuttons of +
  • +
  • element + LuaGuiElement + the parent element that the radiobuttons will be drawn to +
  • +
+ + + + + +
+
+ + Checkbox.reset_radiobuttons (element[, exclude[, recursive=false]]) +
+
+ Sets all radiobutotn in a element to false (unless excluded) and can act recursivly + + +

Parameters:

+
    +
  • element + LuaGuiElement + the root gui element to start setting radio buttons from +
  • +
  • exclude + table + ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true + (optional) +
  • +
  • recursive + number or boolean + if true will recur as much as possible, if a will recur that number of times + (default false) +
  • +
+ +

Returns:

+
    + + boolean + true if successful +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.core.html b/doc/modules/expcore.gui.core.html new file mode 100644 index 00000000..f87e178c --- /dev/null +++ b/doc/modules/expcore.gui.core.html @@ -0,0 +1,121 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.core

+

Core gui file for making element defines and element classes (use require 'expcore.gui') + see utils.gui for event handlering + see expcore.gui.test for examples for element defines +[[

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.dropdown.html b/doc/modules/expcore.gui.dropdown.html new file mode 100644 index 00000000..50b18819 --- /dev/null +++ b/doc/modules/expcore.gui.dropdown.html @@ -0,0 +1,366 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.dropdown

+

Gui class define for dropdowns and list boxs +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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
+ +
+
+ + +

Functions

+ +
+
+ + Dropdown.new_dropdown ([name]) +
+
+ Creates a new dropdown element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new dropdown element define +
+ + + + +
+
+ + Dropdown.new_list_box ([name]) +
+
+ Creates a new list box element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the 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 + + +

Parameters:

+
    +
  • options + table + ?string|table either a of option strings or the first option string, with a table values are the options +
  • +
  • ... + table + when options is not a you can add the options one after each other + (optional) +
  • +
  • the + self + define to allow chaining +
  • +
+ + + + + +
+
+ + 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) + + +

Parameters:

+
    +
  • callback + function + the function that will run to get the options for the dropdown + callback param - player LuaPlayer - the player that the element is being drawn to + callback param - element LuaGuiElement - the element that is being drawn + callback return - table - the values of this table will be appended to the static options of the dropdown +
  • +
+ +

Returns:

+
    + + self + the define to allow chaining +
+ + + + +
+
+ + 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) + + +

Parameters:

+
    +
  • option + string + the name of the option to trigger the callback on; if not already added then will be added as an option +
  • +
  • callback + function + the function that will be called when that option is selected + callback param - player LuaPlayer - the player who owns the gui element + callback param - element LuaGuiElement - the element which is being effected + callback param - value string - the new option that has been selected +
  • +
+ +

Returns:

+
    + + self + the define to allow chaining +
+ + + + +
+
+ + Dropdown.select_value (element, value) +
+
+ Selects the option from a dropdown or list box given the value rather than key + + +

Parameters:

+
    +
  • element + LuaGuiElement + the element that contains the option +
  • +
  • value + string + the option to select from the dropdown +
  • +
+ +

Returns:

+
    + + number + the key where the value was +
+ + + + +
+
+ + Dropdown.get_selected_value (element) +
+
+ Returns the currently selected value rather than index + + +

Parameters:

+
    +
  • element + LuaGuiElement + the gui element that you want to get the value of +
  • +
+ +

Returns:

+
    + + string + the value that is currently selected +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.elem-button.html b/doc/modules/expcore.gui.elem-button.html new file mode 100644 index 00000000..b6709691 --- /dev/null +++ b/doc/modules/expcore.gui.elem-button.html @@ -0,0 +1,224 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.elem-button

+

Gui class defines for elem buttons +[[

+

+ + +

Functions

+ + + + + + + + + + + + + +
ElemButton.new_elem_button ([name])Creates a new elem button element define
ElemButton._prototype:set_type (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
+ +
+
+ + +

Functions

+ +
+
+ + ElemButton.new_elem_button ([name]) +
+
+ Creates a new elem button element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new elem button element define +
+ + + + +
+
+ + ElemButton._prototype:set_type (type) +
+
+ Sets the type of the elem button, the type is required so this must be called at least once + + +

Parameters:

+
    +
  • type + string + the type that this elem button is see factorio api +
  • +
+ +

Returns:

+
    + + the + element define to allow for chaining +
+ + + + +
+
+ + ElemButton._prototype:set_default (value) +
+
+ Sets the default value for the elem button, this may be a function or a string + + +

Parameters:

+
    +
  • value + string or function + string a will be a static default and a function will be called when drawn to get the default +
  • +
+ +

Returns:

+
    + + the + element define to allow for chaining +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.html b/doc/modules/expcore.gui.html new file mode 100644 index 00000000..ffe43e1d --- /dev/null +++ b/doc/modules/expcore.gui.html @@ -0,0 +1,119 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.instances.html b/doc/modules/expcore.gui.instances.html new file mode 100644 index 00000000..9f036c3c --- /dev/null +++ b/doc/modules/expcore.gui.instances.html @@ -0,0 +1,119 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.left.html b/doc/modules/expcore.gui.left.html new file mode 100644 index 00000000..2394a49a --- /dev/null +++ b/doc/modules/expcore.gui.left.html @@ -0,0 +1,573 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.left

+

Gui structure define for left frames +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LeftFrames.get_flow (player)Gets the left frame flow for a player
LeftFrames.get_frame (name, player)Gets one frame from the left flow by its name
LeftFrames.get_open (player)Gets all open frames for a player, if non are open it will remove the close all button
LeftFrames.toggle_frame (name, player[, state])Toggles the visiblty of a left frame, or sets its visiblty state
LeftFrames.new_frame (permision_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: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 visiblty of the left frame
LeftFrames._prototype:update (player)Updates the contents of the left frame, first tries update callback, oter 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
+ +
+
+ + +

Functions

+ +
+
+ + LeftFrames.get_flow (player) +
+
+ Gets the left frame flow for a player + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the flow of +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the left frame flow for the player +
+ + + + +
+
+ + LeftFrames.get_frame (name, player) +
+
+ Gets one frame from the left flow by its name + + +

Parameters:

+
    +
  • name + string + the name of the gui frame to get +
  • +
  • player + LuaPlayer + the player to get the frame of +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the frame in the left frame flow with that name +
+ + + + +
+
+ + LeftFrames.get_open (player) +
+
+ Gets all open frames for a player, if non are open it will remove the close all button + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the flow of +
  • +
+ +

Returns:

+
    + + table + contains all the open (and registered) frames for the player +
+ + + + +
+
+ + LeftFrames.toggle_frame (name, player[, state]) +
+
+ Toggles the visiblty of a left frame, or sets its visiblty state + + +

Parameters:

+
    +
  • name + string + the name of the gui frame to toggle +
  • +
  • player + LuaPlayer + the player to get the frame of +
  • +
  • state + boolean + when given will be the state that the visiblty is set to + (optional) +
  • +
+ +

Returns:

+
    + + boolean + the new state of the visiblity +
+ + + + +
+
+ + LeftFrames.new_frame (permision_name) +
+
+ Creates a new left frame define + + +

Parameters:

+
    +
  • permision_name + string + the name that can be used with the permision system +
  • +
+ +

Returns:

+
    + + table + the 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 + + +

Parameters:

+
    +
  • state + boolean or function + the default state of the visiblty, can be a function + state param - player LuaPlayer - the player that has joined the game + state param - define_name string - the define name for the frame + state return - boolean - false will hide the frame + (default true) +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:set_direction (direction) +
+
+ Sets the direction of the frame, either vertical or horizontal + + +

Parameters:

+
    +
  • direction + string + the direction to have the elements be added to thef frame +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:get_frame (player) +
+
+ Gets the frame for this define from the left frame flow + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the frame of +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the frame in the left frame flow for this define +
+ + + + +
+
+ + LeftFrames._prototype:is_open (player) +
+
+ Returns if the player currently has this define visible + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the frame of +
  • +
+ +

Returns:

+
    + + boolean + true if it is open/visible +
+ + + + +
+
+ + LeftFrames._prototype:toggle (player) +
+
+ Toggles the visiblty of the left frame + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to toggle the frame of +
  • +
+ +

Returns:

+
    + + boolean + the new state of the visiblity +
+ + + + +
+
+ + LeftFrames._prototype:update (player) +
+
+ Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to update the frame of +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:update_all ([update_offline=false]) +
+
+ Updates the frame for all players, see update + + +

Parameters:

+
    +
  • update_offline + boolean + when true will update the frame for offline players + (default false) +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:redraw (player) +
+
+ Redraws the frame by calling on_draw, will always clear the frame + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to update the frame of +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:redraw_all ([update_offline=false]) +
+
+ Redraws the frame for all players, see redraw + + +

Parameters:

+
    +
  • update_offline + boolean + when true will update the frame for offline players + (default false) +
  • +
+ + + + + +
+
+ + LeftFrames._prototype:event_handler ([action=update]) +
+
+ Creates an event handler that will trigger one of its functions, use with Event.add + + +

Parameters:

+
    +
  • action + string + the action to take on this event + (default update) +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.popups.html b/doc/modules/expcore.gui.popups.html new file mode 100644 index 00000000..1d014f0d --- /dev/null +++ b/doc/modules/expcore.gui.popups.html @@ -0,0 +1,352 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.popups

+

Gui structure define for popup gui +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + +
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.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
+

Fields

+ + + + + + + + + +
PopupFrames.close_progressProgress bar which when depleaded will close the popup frame
PopupFrames.close_buttonA button which can be used to close the gui before the timer runs out
+ +
+
+ + +

Functions

+ +
+
+ + PopupFrames.get_flow (player) +
+
+ Gets the left flow that contains the popup frames + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to get the flow for +
  • +
+ +

Returns:

+
    + + LuaGuiElement + 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 + + +

Parameters:

+
    +
  • define_name + string + the name of the define that you want to open for the player +
  • +
  • player + LuaPlayer + the player to open the popup for +
  • +
  • open_time + number + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + (optional) +
  • +
  • ... + any + the other params that you want to pass to your on_draw event +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the frame that was drawn, the inner gui flow which contains the content +
+ + + + +
+
+ + PopupFrames.new_popup ([name]) +
+
+ Creates a new popup frame define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the 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 + + +

Parameters:

+
    +
  • amount + number + the number of ticks, by default, the popup will be open for +
  • +
+ +

Returns:

+
    + + table + the define to allow for chaining +
+ + + + +
+
+ + 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 + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to open the popup for +
  • +
  • open_time + number + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + (optional) +
  • +
  • ... + any + the other params that you want to pass to your on_draw event +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the frame that was drawn, the inner gui flow which contains the content +
+ + + + +
+
+

Fields

+ +
+
+ + PopupFrames.close_progress +
+
+ Progress bar which when depleaded will close the popup frame + + + + + + + +
+
+ + PopupFrames.close_button +
+
+ A button which can be used to close the gui before the timer runs out + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.progress-bar.html b/doc/modules/expcore.gui.progress-bar.html new file mode 100644 index 00000000..db148260 --- /dev/null +++ b/doc/modules/expcore.gui.progress-bar.html @@ -0,0 +1,557 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.progress-bar

+

Gui element define for progess bars +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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 are incremented
ProgressBar.decrement (element[, amount=1])Decreases the value of the progressbar, if a define is given all of its instances are decresed
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 triggeres, can filter which elements are incremented
ProgressBar._prototype:event_countdown ([filter])Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented
+ +
+
+ + +

Functions

+ +
+
+ + ProgressBar.set_maximum (element, amount) +
+
+ Sets the maximum value that represents the end value of the progress bar + + +

Parameters:

+
    +
  • element + LuaGuiElement or string + either a gui element or a registered define +
  • +
  • amount + number + the amount to have set as the maximum +
  • +
+ + + + + +
+
+ + ProgressBar.increment (element[, amount=1]) +
+
+ Increases the value of the progressbar, if a define is given all of its instances are incremented + + +

Parameters:

+
    +
  • element + LuaGuiElement or string + either a gui element or a registered define +
  • +
  • amount + number + the amount to increase the progressbar by + (default 1) +
  • +
+ + + + + +
+
+ + ProgressBar.decrement (element[, amount=1]) +
+
+ Decreases the value of the progressbar, if a define is given all of its instances are decresed + + +

Parameters:

+
    +
  • element + LuaGuiElement or string + either a gui element or a registered define +
  • +
  • amount + number + the amount to decrease the progressbar by + (default 1) +
  • +
+ + + + + +
+
+ + ProgressBar.new_progressbar ([name]) +
+
+ Creates a new progressbar element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new progressbar elemente define +
+ + + + +
+
+ + ProgressBar._prototype:set_default_maximum (amount) +
+
+ Sets the maximum value that represents the end value of the progress bar + + +

Parameters:

+
    +
  • amount + number + the amount to have set as the maximum +
  • +
+ +

Returns:

+
    + + table + the define to allow chaining +
+ + + + +
+
+ + ProgressBar._prototype:use_count_down ([state=true]) +
+
+ Will set the progress bar to start at 1 and trigger when it hits 0 + + +

Parameters:

+
    +
  • state + boolean + when true the bar will start filled, to be used with decrease + (default true) +
  • +
+ +

Returns:

+
    + + table + the define to allow chaining +
+ + + + +
+
+ + ProgressBar._prototype:increment ([amount=1[, category]]) +
+
+ Increases the value of the progressbar + + +

Parameters:

+
    +
  • amount + number + the amount to increase the progressbar by + (default 1) +
  • +
  • category + string + the category that is used with a store + (optional) +
  • +
+ + + + + +
+
+ + ProgressBar._prototype:increment_filtered ([amount=1], filter) +
+
+ Increases the value of the progressbar, if the filter condition is met, does not work with store + + +

Parameters:

+
    +
  • amount + number + the amount to increase the progressbar by + (default 1) +
  • +
  • filter + function + the filter to be used +
  • +
+ + + + + +
+
+ + ProgressBar._prototype:decrement ([amount=1[, category]]) +
+
+ Decreases the value of the progressbar + + +

Parameters:

+
    +
  • amount + number + the amount to decrease the progressbar by + (default 1) +
  • +
  • category + string + the category that is used with a store + (optional) +
  • +
+ + + + + +
+
+ + ProgressBar._prototype:decrement_filtered ([amount=1], filter) +
+
+ Decreases the value of the progressbar, if the filter condition is met, does not work with store + + +

Parameters:

+
    +
  • amount + number + the amount to decrease the progressbar by + (default 1) +
  • +
  • filter + function + the filter to be used +
  • +
+ + + + + +
+
+ + 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 + + +

Parameters:

+
    +
  • element + LuaGuiElement + the element that you want to add into the waiting to complete list +
  • +
  • maximum + number + the maximum for this element if not given the default for this define is used + (optional) +
  • +
+ + + + + +
+
+ + ProgressBar._prototype:reset_element (element) +
+
+ Resets an element, or its store, to be back at the start, either 1 or 0 + + +

Parameters:

+
    +
  • element + LuaGuiElement + the element that you want to reset the progress of +
  • +
+ + + + + +
+
+ + ProgressBar._prototype:event_counter ([filter]) +
+
+ Event handler factory that counts up by 1 every time the event triggeres, can filter which elements are incremented + + +

Parameters:

+
    +
  • filter + function + when given will use filtered incerement + (optional) +
  • +
+ +

Returns:

+
    + + function + the event handler +
+ + + + +
+
+ + ProgressBar._prototype:event_countdown ([filter]) +
+
+ Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented + + +

Parameters:

+
    +
  • filter + function + when given will use filtered decerement + (optional) +
  • +
+ +

Returns:

+
    + + function + the event handler +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.slider.html b/doc/modules/expcore.gui.slider.html new file mode 100644 index 00000000..4d58666a --- /dev/null +++ b/doc/modules/expcore.gui.slider.html @@ -0,0 +1,288 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.slider

+

Gui class define for silders +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + +
Slider.new_slider ([name])Creates a new slider element define
Slider._prototype:use_notches ([state])Adds notches to the slider
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
+ +
+
+ + +

Functions

+ +
+
+ + Slider.new_slider ([name]) +
+
+ Creates a new slider element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new slider element define +
+ + + + +
+
+ + Slider._prototype:use_notches ([state]) +
+
+ Adds notches to the slider + + +

Parameters:

+
    +
  • state + boolean + when true will draw notches onto the slider + (optional) +
  • +
+ + + + + +
+
+ + Slider._prototype:set_range ([min[, max]]) +
+
+ Sets the range of a slider, if not used will use default values for a slider + + +

Parameters:

+
    +
  • min + number + the minimum value that the slider can take + (optional) +
  • +
  • max + number + the maximum value that the slider can take + (optional) +
  • +
+ +

Returns:

+
    + + self + the define to allow chaining +
+ + + + +
+
+ + 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 + + +

Parameters:

+
    +
  • element + LuaGuiElement + the parent element that the lable will be drawn to +
  • +
+ +

Returns:

+
    + + LuaGuiElement + the new label element so that styles can be applied +
+ + + + +
+
+ + 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 + + +

Parameters:

+
    +
  • state + boolean + when false will disable the auto draw of the label + (default true) +
  • +
+ +

Returns:

+
    + + self + the define to allow chaining +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.test.html b/doc/modules/expcore.gui.test.html new file mode 100644 index 00000000..d951fd6b --- /dev/null +++ b/doc/modules/expcore.gui.test.html @@ -0,0 +1,120 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.test

+

This file creates a teste gui that is used to test every input method + note that this does not cover every permutation only features in indepentance + for example store in most cases is just by player name, but other store methods are tested with checkbox

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.text.html b/doc/modules/expcore.gui.text.html new file mode 100644 index 00000000..d564cf5b --- /dev/null +++ b/doc/modules/expcore.gui.text.html @@ -0,0 +1,290 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.text

+

Gui class define for text fields and text boxs +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + +
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
+ +
+
+ + +

Functions

+ +
+
+ + Text.new_text_field ([name]) +
+
+ Creates a new text field element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new text field element define +
+ + + + +
+
+ + Text.new_text_box ([name]) +
+
+ Creates a new text box element define + + +

Parameters:

+
    +
  • name + string + the optional debug name that can be added + (optional) +
  • +
+ +

Returns:

+
    + + table + the new text box element define +
+ + + + +
+
+ + Text._prototype_box:set_selectable ([state=true]) +
+
+ Sets the text box to be selectable + + +

Parameters:

+
    +
  • state + boolean + when false will set the state to false + (default true) +
  • +
+ +

Returns:

+
    + + self + table the define to allow for chaining +
+ + + + +
+
+ + Text._prototype_box:set_word_wrap ([state=true]) +
+
+ Sets the text box to have word wrap + + +

Parameters:

+
    +
  • state + boolean + when false will set the state to false + (default true) +
  • +
+ +

Returns:

+
    + + self + table the define to allow for chaining +
+ + + + +
+
+ + Text._prototype_box:set_read_only ([state=true]) +
+
+ Sets the text box to be read only + + +

Parameters:

+
    +
  • state + boolean + when false will set the state to false + (default true) +
  • +
+ +

Returns:

+
    + + self + table the define to allow for chaining +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.gui.toolbar.html b/doc/modules/expcore.gui.toolbar.html new file mode 100644 index 00000000..b06956ec --- /dev/null +++ b/doc/modules/expcore.gui.toolbar.html @@ -0,0 +1,212 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.gui.toolbar

+

Gui structure for the toolbar (top left) +[[

+

+ + +

Functions

+ + + + + + + + + + + + + +
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
+ +
+
+ + +

Functions

+ +
+
+ + Toolbar.new_button ([name]) +
+
+ Adds a new button to the toolbar + + +

Parameters:

+
    +
  • name + string + when given allows an alias to the button for the permission system + (optional) +
  • +
+ +

Returns:

+
    + + table + the button define +
+ + + + +
+
+ + Toolbar.add_button (button) +
+
+ Adds an existing buttton to the toolbar + + +

Parameters:

+
    +
  • button + table + the button define for the button to be added +
  • +
+ + + + + +
+
+ + Toolbar.update (player) +
+
+ Updates the player's toolbar with an new buttons or expected change in auth return + + +

Parameters:

+
    +
  • player + LuaPlayer + the player to update the toolbar for +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/expcore.store.html b/doc/modules/expcore.store.html new file mode 100644 index 00000000..e51e8806 --- /dev/null +++ b/doc/modules/expcore.store.html @@ -0,0 +1,464 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expcore.store

+

Adds an easy way to store and watch for updates to a value +[[

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Store.is_registered (location)Check for if a lcoation is registered
Store.uid_location ()Returns a unqiue name that can be used for a store
Store.register (location, callback[, start_value])Registers a new location with an update callback which is triggered when the value updates
Store.register_synced (location, callback[, start_value])Registers a new cross server synced location with an update callback, and external script is required for cross server
Store.add_watch (location, callback)Adds a function that will be checked every tick for a change in the returned value, when the value changes it will be saved in the store
Store.get (location[, no_error=false])Gets the value stored at a location, this location must be registered
Store.set (location, value)Sets the value at a location, this location must be registered, if server synced it will emit the change to file
Store.get_children (location)Gets all non nil children at a location, children can be added and removed during runtime + this is similar to Store.get but will always return a table even if it is empty
Store.get_child (location, child)Gets the value of the child to a location, children can be added and removed during runtime
Store.set_child (location, child, value)Sets the value of the chlid to a location, children can be added and removed during runtime + when a child is set it will call the update handler of the parent allowing children be to added at runtime + this may be used when a player joins the game and the child is the players name
+ +
+
+ + +

Functions

+ +
+
+ + Store.is_registered (location) +
+
+ Check for if a lcoation is registered + + +

Parameters:

+
    +
  • location + string + the location to test for +
  • +
+ +

Returns:

+
    + + boolean + true if registered +
+ + + + +
+
+ + Store.uid_location () +
+
+ Returns a unqiue name that can be used for a store + + + +

Returns:

+
    + + string + a unqiue name +
+ + + + +
+
+ + Store.register (location, callback[, start_value]) +
+
+ Registers a new location with an update callback which is triggered when the value updates + + +

Parameters:

+
    +
  • location + string + string a unique that points to the data, string used rather than token to allow migration +
  • +
  • callback + function + this callback will be called when the stored value is set to a new value +
  • +
  • start_value + any + this value will be the inital value that is stored at this location + (optional) +
  • +
+ + + + + +
+
+ + Store.register_synced (location, callback[, start_value]) +
+
+ Registers a new cross server synced location with an update callback, and external script is required for cross server + + +

Parameters:

+
    +
  • location + string + string a unique that points to the data, string used rather than token to allow migration +
  • +
  • callback + function + this callback will be called when the stored value is set to a new value +
  • +
  • start_value + any + this value will be the inital value that is stored at this location + (optional) +
  • +
+ + + + + +
+
+ + Store.add_watch (location, callback) +
+
+ Adds a function that will be checked every tick for a change in the returned value, when the value changes it will be saved in the store + + +

Parameters:

+
    +
  • location + string + the location where the data will be saved and compeared to, must already be a registered location +
  • +
  • callback + function + this function will be called every tick to check for a change in value +
  • +
+ + + + + +
+
+ + Store.get (location[, no_error=false]) +
+
+ Gets the value stored at a location, this location must be registered + + +

Parameters:

+
    +
  • location + string + the location to get the data from +
  • +
  • no_error + boolean + when true no error is returned if the location is not registered + (default false) +
  • +
+ +

Returns:

+
    + + any + the data which was stored at the location +
+ + + + +
+
+ + Store.set (location, value) +
+
+ Sets the value at a location, this location must be registered, if server synced it will emit the change to file + + +

Parameters:

+
    +
  • location + string + the location to set the data to +
  • +
  • value + any + the new value to set at the location, value may be reverted if there is a watch callback +
  • +
+ +

Returns:

+
    + + boolean + true if it was successful +
+ + + + +
+
+ + Store.get_children (location) +
+
+ Gets all non nil children at a location, children can be added and removed during runtime + this is similar to Store.get but will always return a table even if it is empty + + +

Parameters:

+
    +
  • location + string + the location to get the children of +
  • +
+ +

Returns:

+
    + + table + a table containg all the children and they values +
+ + + + +
+
+ + Store.get_child (location, child) +
+
+ Gets the value of the child to a location, children can be added and removed during runtime + + +

Parameters:

+
    +
  • location + string + the location of which the child is located +
  • +
  • child + string + the child element to get the value of +
  • +
+ +

Returns:

+
    + + any + the value which was stored at that location +
+ + + + +
+
+ + Store.set_child (location, child, value) +
+
+ Sets the value of the chlid to a location, children can be added and removed during runtime + when a child is set it will call the update handler of the parent allowing children be to added at runtime + this may be used when a player joins the game and the child is the players name + + +

Parameters:

+
    +
  • location + string + the location of which the child is located +
  • +
  • child + string + the child element to set the value of +
  • +
  • value + any + the value to set at this location +
  • +
+ +

Returns:

+
    + + boolean + true if it was successful +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.addons.advanced-start.html b/doc/modules/modules.addons.advanced-start.html new file mode 100644 index 00000000..3f63d65c --- /dev/null +++ b/doc/modules/modules.addons.advanced-start.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.addons.chat-popups.html b/doc/modules/modules.addons.chat-popups.html new file mode 100644 index 00000000..608bb5b6 --- /dev/null +++ b/doc/modules/modules.addons.chat-popups.html @@ -0,0 +1,119 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.addons.damage-popups.html b/doc/modules/modules.addons.damage-popups.html new file mode 100644 index 00000000..2bb0aca6 --- /dev/null +++ b/doc/modules/modules.addons.damage-popups.html @@ -0,0 +1,119 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.gui.player-list.html b/doc/modules/modules.gui.player-list.html new file mode 100644 index 00000000..098838e2 --- /dev/null +++ b/doc/modules/modules.gui.player-list.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + + + + diff --git a/doc/modules/modules.gui.rocket-info.html b/doc/modules/modules.gui.rocket-info.html new file mode 100644 index 00000000..295f4644 --- /dev/null +++ b/doc/modules/modules.gui.rocket-info.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.gui.science-info.html b/doc/modules/modules.gui.science-info.html new file mode 100644 index 00000000..1c9a9526 --- /dev/null +++ b/doc/modules/modules.gui.science-info.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + + +
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/modules.gui.task-list.html b/doc/modules/modules.gui.task-list.html new file mode 100644 index 00000000..55e1aab4 --- /dev/null +++ b/doc/modules/modules.gui.task-list.html @@ -0,0 +1,118 @@ + + + + + Reference + + + + + + + diff --git a/doc/modules/utils.alien_evolution_progress.html b/doc/modules/utils.alien_evolution_progress.html new file mode 100644 index 00000000..1db74f11 --- /dev/null +++ b/doc/modules/utils.alien_evolution_progress.html @@ -0,0 +1,158 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.alien_evolution_progress

+

info + Original (javascript) version: https://hastebin.com/udakacavap.js + Can be tested against: https://wiki.factorio.com/Enemies#Spawn_chances_by_evolution_factor

+

+ + +

Functions

+ + + + + +
AlienEvolutionProgress.create_spawner_request (total_aliens)Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all +available spawners.
+ +
+
+ + +

Functions

+ +
+
+ + AlienEvolutionProgress.create_spawner_request (total_aliens) +
+
+ Creates the spawner_request structure required for AlienEvolutionProgress.get_aliens for all +available spawners. If dividing the total spawners by the total aliens causes a fraction, the +fraction will decide a chance to spawn. 1 alien for 2 spawners will have 50% on both. + + +

Parameters:

+
    +
  • total_aliens + table +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.core.html b/doc/modules/utils.core.html new file mode 100644 index 00000000..14d79ff6 --- /dev/null +++ b/doc/modules/utils.core.html @@ -0,0 +1,452 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.core

+

Measures distance between pos1 and pos2

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Module.print_except (msg, player, color)Takes msg and prints it to all players except provided player
Module.print_admins (msg, source)Prints a message to all online admins
Module.get_actor ()Returns a valid string with the name of the actor of a command.
Module.format_time (ticks)Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)"
Module.cant_run (name)Prints a message letting the player know they cannot run a command
Module.log_command (actor, command, parameters)Logs the use of a command and its user
Module.verify_mult_types (arg, arg_types)Asserts the argument is one of type arg_types
Module.random_RGB ()Returns a random RGB color as a table
Module.set_and_return (tbl, key, value)Sets a table element to value while also returning value.
+

Fields

+ + + + + + + + + + + + + +
Module.move_positionMoves a position according to the parameters given + Notice: only accepts cardinal directions as direction
Module.opposite_directionTakes a direction and gives you the opposite
Module.is_module_availableTakes the string of a module and returns whether is it available or not
+ +
+
+ + +

Functions

+ +
+
+ + Module.print_except (msg, player, color) +
+
+ Takes msg and prints it to all players except provided player + + +

Parameters:

+
    +
  • msg + table if locale is used +
  • +
  • player + the player not to send the message to +
  • +
  • color + the color to use for the message, defaults to white + + + + + + + + +
    + + Module.print_admins (msg, source) +
    +
    + Prints a message to all online admins + + +

    Parameters:

    +
      +
    • msg + table if locale is used +
    • +
    • source + string must be the name of a player, nil for server. +
    • +
    + + + + + +
    +
    + + Module.get_actor () +
    +
    + Returns a valid string with the name of the actor of a command. + + + + + + + +
    +
    + + Module.format_time (ticks) +
    +
    + Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)" + + +

    Parameters:

    +
      +
    • ticks + +
    • +
    + + + + + +
    +
    + + Module.cant_run (name) +
    +
    + Prints a message letting the player know they cannot run a command + + +

    Parameters:

    +
      +
    • name + string name of the command +
    • +
    + + + + + +
    +
    + + Module.log_command (actor, command, parameters) +
    +
    + Logs the use of a command and its user + + +

    Parameters:

    +
      +
    • actor + string with the actor's name (usually acquired by calling get_actor) +
    • +
    • command + the command's name as table element +
    • +
    • parameters + the command's parameters as a table (optional) +
    • +
    + + + + + +
    +
    + + Module.verify_mult_types (arg, arg_types) +
    +
    + Asserts the argument is one of type arg_types + + +

    Parameters:

    +
      +
    • arg + the variable to check +
    • +
    • arg_types + the type as a table of sings +
    • +
    + +

    Returns:

    +
      + + boolean +
    + + + + +
    +
    + + Module.random_RGB () +
    +
    + Returns a random RGB color as a table + + + + + + + +
    +
    + + Module.set_and_return (tbl, key, value) +
    +
    + Sets a table element to value while also returning value. + + +

    Parameters:

    +
      +
    • tbl + table to change the element of +
    • +
    • key + string +
    • +
    • value + nil|boolean|number|string|table to set the element to +
    • +
    + +

    Returns:

    +
      + + value +
    + + + + +
    + +

    Fields

    + +
    +
    + + Module.move_position +
    +
    + Moves a position according to the parameters given + Notice: only accepts cardinal directions as direction + + +
      +
    • position +
    table containing a map position + +
  • direction + north, east, south, west +
  • +
  • distance + +
  • + + + + + + + +
    + + Module.opposite_direction +
    +
    + Takes a direction and gives you the opposite + + +
      +
    • direction + north, east, south, west, northeast, northwest, southeast, southwest +
    • +
    + + + + + +
    +
    + + Module.is_module_available +
    +
    + Takes the string of a module and returns whether is it available or not + + +
      +
    • name + the name of the module (ex. 'utils.core') +
    • +
    + + + + + +
    + + + + + +
    +generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
    + + + diff --git a/doc/modules/utils.debug.html b/doc/modules/utils.debug.html new file mode 100644 index 00000000..d1307dcd --- /dev/null +++ b/doc/modules/utils.debug.html @@ -0,0 +1,306 @@ + + + + + Reference + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Debug.print (message, stack_traceback)Shows the given message if debug is enabled.
    Debug.get_meta_value (object, key)Returns the value of the key inside the object + or 'InvalidLuaObject' if the LuaObject is invalid.
    Debug.object_type (object)Returns the Lua data type or the factorio LuaObject type + or 'NoHelpLuaObject' if the LuaObject does not have a help function + or 'InvalidLuaObject' if the LuaObject is invalid.
    Debug.print_position (position, message)Shows the given message if debug is on.
    Debug.cheat (callback)Executes the given callback if cheating is enabled.
    Debug.is_closure (func)Returns true if the function is a closure, false otherwise.
    + +
    +
    + + +

    Functions

    + +
    +
    + + Debug.print (message, stack_traceback) +
    +
    + Shows the given message if debug is enabled. Uses serpent to print non scalars. + + +

    Parameters:

    +
      +
    • message + +
    • +
    • stack_traceback + levels of stack trace to give, defaults to 1 level if nil +
    • +
    + + + + + +
    +
    + + Debug.get_meta_value (object, key) +
    +
    + Returns the value of the key inside the object + or 'InvalidLuaObject' if the LuaObject is invalid. + or 'InvalidLuaObjectKey' if the LuaObject does not have an entry at that key + + +

    Parameters:

    +
      +
    • object + LuaObject or metatable + +
    • key + +
    • + + +

      Returns:

      +
        + + +
      + + + + + +
      + + Debug.object_type (object) +
      +
      + Returns the Lua data type or the factorio LuaObject type + or 'NoHelpLuaObject' if the LuaObject does not have a help function + or 'InvalidLuaObject' if the LuaObject is invalid. + + +

      Parameters:

      +
        +
      • object + +
      • +
      + +

      Returns:

      +
        + + string +
      + + + + +
      +
      + + Debug.print_position (position, message) +
      +
      + Shows the given message if debug is on. + + +

      Parameters:

      +
        +
      • position + Position +
      • +
      • message + string +
      • +
      + + + + + +
      +
      + + Debug.cheat (callback) +
      +
      + Executes the given callback if cheating is enabled. + + +

      Parameters:

      +
        +
      • callback + function +
      • +
      + + + + + +
      +
      + + Debug.is_closure (func) +
      +
      + Returns true if the function is a closure, false otherwise. + A closure is a function that contains 'upvalues' or in other words + has a reference to a local variable defined outside the function's scope. + + +

      Parameters:

      +
        +
      • func + +
      • +
      + +

      Returns:

      +
        + + boolean +
      + + + + +
      + + + + + +
      +generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
      + + + diff --git a/doc/modules/utils.event.html b/doc/modules/utils.event.html new file mode 100644 index 00000000..caa51ff3 --- /dev/null +++ b/doc/modules/utils.event.html @@ -0,0 +1,568 @@ + + + + + Reference + + + + +
      + +
      + +
      +
      +
      + + +
      + + + + + + +
      + +

      Module utils.event

      +

      This Module allows for registering multiple handlers to the same event, overcoming the limitation of script.register.

      +

      +

      ** Event.add(event_name, handler) ** +

      Handlers added with Event.add must be added at the control stage or in Event.on_init or Event.on_load. + Remember that for each player, on_init or on_load is run, never both. So if you can't add the handler in the + control stage add the handler in both on_init and on_load. + Handlers added with Event.add cannot be removed. + For handlers that need to be removed or added at runtime use Event.add_removable.

      +

      Usage:

      +
        +
      • + local Event = require 'utils.event'
        + Event.add(
        +     defines.events.on_built_entity,
        +     function(event)
        +         game.print(serpent.block(event)) -- prints the content of the event table to console.
        +     end
        + )
        +
        + ** Event.add_removable(event_name, token) **
        +
        + For conditional event handlers. Event.add_removable can be safely called at runtime without desync risk.
        + Only use this if you need to add the handler at runtime or need to remove the handler, otherwise use Event.add
        +
        + Event.add_removable can be safely used at the control stage or in Event.on_init. If used in on_init you don't
        + need to also add in on_load (unlike Event.add).
        + Event.add_removable cannot be called in on_load, doing so will crash the game on loading.
        + Token is used because it's a desync risk to store closures inside the global table.
        +
      • +
      • + local Token = require 'utils.token'
        + local Event = require 'utils.event'
        +
        + Token.register must not be called inside an event handler.
        + local handler =
        +     Token.register(
        +     function(event)
        +         game.print(serpent.block(event)) -- prints the content of the event table to console.
        +     end
        + )
        +
        + The below code would typically be inside another event or a custom command.
        + Event.add_removable(defines.events.on_built_entity, handler)
        +
        + When you no longer need the handler.
        + Event.remove_removable(defines.events.on_built_entity, handler)
        +
        + It's not an error to register the same token multiple times to the same event, however when
        + removing only the first occurrence is removed.
        +
        + ** Event.add_removable_function(event_name, func) **
        +
        + Only use this function if you can't use Event.add_removable. i.e you are registering the handler at the console.
        + The same restrictions that apply to Event.add_removable also apply to Event.add_removable_function.
        + func cannot be a closure in this case, as there is no safe way to store closures in the global table.
        + A closure is a function that uses a local variable not defined in the function.
        +
      • +
      • + local Event = require 'utils.event'
        +
        + If you want to remove the handler you will need to keep a reference to it.
        + global.handler = function(event)
        +     game.print(serpent.block(event)) -- prints the content of the event table to console.
        + end
        +
        + The below code would typically be used at the command console.
        + Event.add_removable_function(defines.events.on_built_entity, global.handler)
        +
        + When you no longer need the handler.
        + Event.remove_removable_function(defines.events.on_built_entity, global.handler)
        +
        + ** Other Events **
        +
        + Use Event.on_init(handler) for script.on_init(handler)
        + Use Event.on_load(handler) for script.on_load(handler)
        +
        + Use Event.on_nth_tick(tick, handler) for script.on_nth_tick(tick, handler)
        + Favour this event over Event.add(defines.events.on_tick, handler)
        + There are also Event.add_removable_nth_tick(tick, token) and Event.add_removable_nth_tick_function(tick, func)
        + That work the same as above.
        +
        + ** Custom Scenario Events **
        +
        + local Event = require 'utils.event'
        +
        + local event_id = script.generate_event_name()
        +
        + Event.add(
        +     event_id,
        +     function(event)
        +         game.print(serpent.block(event)) -- prints the content of the event table to console.
        +     end
        + )
        +
        + The table contains extra information that you want to pass to the handler.
        + script.raise_event(event_id, {extra = 'data'})
      • +
      + + +

      Functions

      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Event.add (event_name, handler)Register a handler for the event_name event.
      Event.on_init (handler)Register a handler for the script.on_init event.
      Event.on_load (handler)Register a handler for the script.on_load event.
      Event.on_nth_tick (tick, handler)Register a handler for the nth_tick event.
      Event.add_removable (event_name, token)Register a token handler that can be safely added and removed at runtime.
      Event.remove_removable (event_name, token)Removes a token handler for the given event_name.
      Event.add_removable_function (event_name, func)Register a handler that can be safely added and removed at runtime.
      Event.remove_removable_function (event_name, func)Removes a handler for the given event_name.
      Event.add_removable_nth_tick (tick, token)Register a token handler for the nth tick that can be safely added and removed at runtime.
      Event.remove_removable_nth_tick (tick, token)Removes a token handler for the nth tick.
      Event.add_removable_nth_tick_function (tick, func)Register a handler for the nth tick that can be safely added and removed at runtime.
      Event.remove_removable_nth_tick_function (tick, func)Removes a handler for the nth tick.
      + +
      +
      + + +

      Functions

      + +
      +
      + + Event.add (event_name, handler) +
      +
      + Register a handler for the event_name event. + This function must be called in the control stage or in Event.on_init or Event.on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • event_name + +
      • +
      • handler + +
      • +
      + + + + + +
      +
      + + Event.on_init (handler) +
      +
      + Register a handler for the script.on_init event. + This function must be called in the control stage or in Event.on_init or Event.on_load + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • handler + +
      • +
      + + + + + +
      +
      + + Event.on_load (handler) +
      +
      + Register a handler for the script.on_load event. + This function must be called in the control stage or in Event.on_init or Event.on_load + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • handler + +
      • +
      + + + + + +
      +
      + + Event.on_nth_tick (tick, handler) +
      +
      + Register a handler for the nth_tick event. + This function must be called in the control stage or in Event.on_init or Event.on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • tick + The handler will be called every nth tick +
      • +
      • handler + +
      • +
      + + + + + +
      +
      + + Event.add_removable (event_name, token) +
      +
      + Register a token handler that can be safely added and removed at runtime. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • event_name + +
      • +
      • token + +
      • +
      + + + + + +
      +
      + + Event.remove_removable (event_name, token) +
      +
      + Removes a token handler for the given event_name. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • event_name + +
      • +
      • token + +
      • +
      + + + + + +
      +
      + + Event.add_removable_function (event_name, func) +
      +
      + Register a handler that can be safely added and removed at runtime. + The handler must not be a closure, as that is a desync risk. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • event_name + +
      • +
      • func + +
      • +
      + + + + + +
      +
      + + Event.remove_removable_function (event_name, func) +
      +
      + Removes a handler for the given event_name. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • event_name + +
      • +
      • func + +
      • +
      + + + + + +
      +
      + + Event.add_removable_nth_tick (tick, token) +
      +
      + Register a token handler for the nth tick that can be safely added and removed at runtime. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • tick + +
      • +
      • token + +
      • +
      + + + + + +
      +
      + + Event.remove_removable_nth_tick (tick, token) +
      +
      + Removes a token handler for the nth tick. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • tick + +
      • +
      • token + +
      • +
      + + + + + +
      +
      + + Event.add_removable_nth_tick_function (tick, func) +
      +
      + Register a handler for the nth tick that can be safely added and removed at runtime. + The handler must not be a closure, as that is a desync risk. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • tick + +
      • +
      • func + +
      • +
      + + + + + +
      +
      + + Event.remove_removable_nth_tick_function (tick, func) +
      +
      + Removes a handler for the nth tick. + Do NOT call this method during on_load. + See documentation at top of file for details on using events. + + +

      Parameters:

      +
        +
      • tick + +
      • +
      • func + +
      • +
      + + + + + +
      +
      + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.event_core.html b/doc/modules/utils.event_core.html new file mode 100644 index 00000000..4c241168 --- /dev/null +++ b/doc/modules/utils.event_core.html @@ -0,0 +1,204 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.event_core

+

Do not use this function, use Event.add instead as it has safety checks.

+

+ + +

Functions

+ + + + + + + + + + + + + +
Public.on_init (handler)Do not use this function, use Event.on_init instead as it has safety checks.
Public.on_load (handler)Do not use this function, use Event.on_load instead as it has safety checks.
Public.on_nth_tick (tick, handler)Do not use this function, use Event.on_nth_tick instead as it has safety checks.
+ +
+
+ + +

Functions

+ +
+
+ + Public.on_init (handler) +
+
+ Do not use this function, use Event.on_init instead as it has safety checks. + + +

Parameters:

+
    +
  • handler + +
  • +
+ + + + + +
+
+ + Public.on_load (handler) +
+
+ Do not use this function, use Event.on_load instead as it has safety checks. + + +

Parameters:

+
    +
  • handler + +
  • +
+ + + + + +
+
+ + Public.on_nth_tick (tick, handler) +
+
+ Do not use this function, use Event.on_nth_tick instead as it has safety checks. + + +

Parameters:

+
    +
  • tick + +
  • +
  • handler + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.math.html b/doc/modules/utils.math.html new file mode 100644 index 00000000..947d4cd6 --- /dev/null +++ b/doc/modules/utils.math.html @@ -0,0 +1,161 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.math

+

Takes two points and calculates the slope of a line

+

+ + +

Functions

+ + + + + +
calculate_y_intercept (x, slope)Calculates the y-intercept of a line
+ +
+
+ + +

Functions

+ +
+
+ + calculate_y_intercept (x, slope) +
+
+ Calculates the y-intercept of a line + + +

Parameters:

+
    +
  • x + , y numbers - coordinates of point on line +
  • +
  • slope + number - the slope of a line +
  • +
+ +

Returns:

+
    + + number - the y-intercept of a line +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.recipe_locker.html b/doc/modules/utils.recipe_locker.html new file mode 100644 index 00000000..5527fd92 --- /dev/null +++ b/doc/modules/utils.recipe_locker.html @@ -0,0 +1,155 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.recipe_locker

+

Locks recipes, preventing them from being enabled by research.

+

+ Does not check if they should be enabled/disabled by existing research.

+ + +

Functions

+ + + + + +
Public.unlock_recipes (tbl)Unlocks recipes, allowing them to be enabled by research.
+ +
+
+ + +

Functions

+ +
+
+ + Public.unlock_recipes (tbl) +
+
+ Unlocks recipes, allowing them to be enabled by research. + Does not check if they should be enabled/disabled by existing research. + + +

Parameters:

+
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.table.html b/doc/modules/utils.table.html new file mode 100644 index 00000000..bdfa0bdb --- /dev/null +++ b/doc/modules/utils.table.html @@ -0,0 +1,583 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.table

+

Searches a table to remove a specific element without an index

+

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fast_remove (tbl, index)Removes an item from an array in O(1) time.
add_all (t1, t2)Adds the contents of table t2 to table t1
index_of (t, e)Checks if a table contains an element
index_of_in_array (t, e)Checks if the arrayed portion of a table contains an element
contains (t, e)Checks if a table contains an element
array_contains (t, e)Checks if the arrayed portion of a table contains an element
set (t, index, element)Adds an element into a specific index position while shuffling the rest down
get_random_dictionary_entry (t, key)Chooses a random entry from a table + because this uses math.random, it cannot be used outside of events
get_random_weighted (weight_table, item_index, weight_index)Chooses a random entry from a weighted table + because this uses math.random, it cannot be used outside of events
shuffle_table (t)Creates a fisher-yates shuffle of a sequential number-indexed table + because this uses math.random, it cannot be used outside of events if no rng is supplied + from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items
clear_table (t, array)Clears all existing entries in a table
+

Fields

+ + + + + + + + + + + + + + + + + + + + + +
inspectSimilar to serpent.block, returns a string with a pretty representation of a table.
sizeTakes a table and returns the number of entries in the table.
deep_copyCreates a deepcopy of a table.
mergeMerges multiple tables.
equalsDetermines if two tables are structurally equal.
+ +
+
+ + +

Functions

+ +
+
+ + fast_remove (tbl, index) +
+
+ Removes an item from an array in O(1) time. + The catch is that fast_remove doesn't guarantee to maintain the order of items in the array. + + +

Parameters:

+
    +
  • tbl + arrayed table + +
  • index + Must be >= 0. The case where index > #tbl is handled. +
  • + + + + + + + +
    + + add_all (t1, t2) +
    +
    + Adds the contents of table t2 to table t1 + + +

    Parameters:

    +
      +
    • t1 +
    to insert into + +
  • t2 +
  • to insert from + + + + + + + + +
    + + index_of (t, e) +
    +
    + Checks if a table contains an element + + +

    Parameters:

    +
      +
    • t +
    + +
  • e + table element +
  • + + + + + + + +
    + + index_of_in_array (t, e) +
    +
    + Checks if the arrayed portion of a table contains an element + + +

    Parameters:

    +
      +
    • t +
    + +
  • e + table element +
  • + + + + + + + +
    + + contains (t, e) +
    +
    + Checks if a table contains an element + + +

    Parameters:

    +
      +
    • t +
    + +
  • e + table element +
  • + + + + + + + +
    + + array_contains (t, e) +
    +
    + Checks if the arrayed portion of a table contains an element + + +

    Parameters:

    +
      +
    • t +
    + +
  • e + table element +
  • + + + + + + + +
    + + set (t, index, element) +
    +
    + Adds an element into a specific index position while shuffling the rest down + + +

    Parameters:

    +
      +
    • t +
    to add into + +
  • index + the position in the table to add to +
  • +
  • element + to add to the table +
  • + + + + + + + +
    + + get_random_dictionary_entry (t, key) +
    +
    + Chooses a random entry from a table + because this uses math.random, it cannot be used outside of events + + +

    Parameters:

    +
      +
    • t +
    + +
  • key + to indicate whether to return the key or value +
  • + + +

    Returns:

    +
      + + a random element of table t +
    + + + + + +
    + + get_random_weighted (weight_table, item_index, weight_index) +
    +
    + Chooses a random entry from a weighted table + because this uses math.random, it cannot be used outside of events + + +

    Parameters:

    +
      +
    • weight_table +
    of tables with items and their weights + +
  • item_index + of the index of items, defaults to 1 +
  • +
  • weight_index + of the index of the weights, defaults to 2 +
  • + + +

    Returns:

    +
      + + table element +
    + + +

    See also:

    +
      +
    + + + +
    + + shuffle_table (t) +
    +
    + Creates a fisher-yates shuffle of a sequential number-indexed table + because this uses math.random, it cannot be used outside of events if no rng is supplied + from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items + + +

    Parameters:

    +
      +
    • t +
    to shuffle + + + + + + + + +
    + + clear_table (t, array) +
    +
    + Clears all existing entries in a table + + +

    Parameters:

    +
      +
    • t +
    to clear + +
  • array + to indicate whether the table is an array or not +
  • + + + + + + + + +

    Fields

    + +
    +
    + + inspect +
    +
    + Similar to serpent.block, returns a string with a pretty representation of a table. + Notice: This method is not appropriate for saving/restoring tables. It is meant to be used by the programmer mainly while debugging a program. + depth sets the maximum depth that will be printed out. When the max depth is reached, inspect will stop parsing tables and just return {...} + process is a function which allow altering the passed object before transforming it into a string. + A typical way to use it would be to remove certain values so that they don't appear at all. + return the prettied table + + +
      +
    • table +
    the table to serialize + +
  • options +
  • options are depth, newline, indent, process + + + + + + + + +
    + + size +
    +
    + Takes a table and returns the number of entries in the table. (Slower than #table, faster than iterating via pairs) + + + + + + + +
    +
    + + deep_copy +
    +
    + Creates a deepcopy of a table. Metatables and LuaObjects inside the table are shallow copies. + Shallow copies meaning it copies the reference to the object instead of the object itself. + + +
      +
    • object +
    the object to copy + + + + + + + + +
    + + merge +
    +
    + Merges multiple tables. Tables later in the list will overwrite entries from tables earlier in the list. + Ex. merge({{1, 2, 3}, {[2] = 0}, {[3] = 0}}) will return {1, 0, 0} + + +
      +
    • tables +
    takes a table of tables to merge + + + + + + + + +
    + + equals +
    +
    + Determines if two tables are structurally equal. + Notice: tables that are LuaObjects or contain LuaObjects won't be compared correctly, use == operator for LuaObjects + + +
      +
    • tbl1 +
    + +
  • tbl2 +
  • + + + + + + + + + + + + + +
    +generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
    + + + diff --git a/doc/modules/utils.task.html b/doc/modules/utils.task.html new file mode 100644 index 00000000..290c641b --- /dev/null +++ b/doc/modules/utils.task.html @@ -0,0 +1,195 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + + + +
    Task.set_timeout (sec, func_token, params)Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument + Cannot be called before init
    Task.queue_task (func_token, params, weight)Queueing allows you to split up heavy tasks which don't need to be completed in the same tick.
    + +
    +
    + + +

    Functions

    + +
    +
    + + Task.set_timeout (sec, func_token, params) +
    +
    + Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument + Cannot be called before init + + +

    Parameters:

    +
      +
    • sec + +
    • +
    • func_token + a token for a function store via the token system +
    • +
    • params + the argument to send to the tokened function +
    • +
    + + + + + +
    +
    + + Task.queue_task (func_token, params, weight) +
    +
    + Queueing allows you to split up heavy tasks which don't need to be completed in the same tick. + Queued tasks are generally run 1 per tick. If the queue backs up, more tasks will be processed per tick. + Ex. if the task is expected to repeat multiple times (ie. the function returns true and loops several ticks) + + +

    Parameters:

    +
      +
    • func_token + a token for a function stored via the token system + If this function returns `true` it will run again the next tick, delaying other queued tasks (see weight) +
    • +
    • params + the argument to send to the tokened function +
    • +
    • weight + (defaults to 1) weight is the number of ticks a task is expected to take. +
    • +
    + + + + + +
    +
    + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + diff --git a/doc/modules/utils.timestamp.html b/doc/modules/utils.timestamp.html new file mode 100644 index 00000000..7a3c12d3 --- /dev/null +++ b/doc/modules/utils.timestamp.html @@ -0,0 +1,217 @@ + + + + + Reference + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module utils.timestamp

+

source https://github.com/daurnimator/luatz/blob/master/luatz/timetable.lua + edited down to just what is needed.

+

+ + +

Functions

+ + + + + + + + + + + + + +
Public.to_timetable (sec)Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number}
Public.from_timetable (timetable)Converts timetable into unix epoch timestamp
Public.to_string (secs)Converts unix epoch timestamp into human readable string.
+ +
+
+ + +

Functions

+ +
+
+ + Public.to_timetable (sec) +
+
+ Converts unix epoch timestamp into table {year: number, month: number, day: number, hour: number, min: number, sec: number} + + +

Parameters:

+
    +
  • sec + unix epoch timestamp +
  • +
+ +

Returns:

+
    + + {year: number, month: number, day: number, hour: number, min: number, sec: number} +
+ + + + +
+
+ + Public.from_timetable (timetable) +
+
+ Converts timetable into unix epoch timestamp + + +

Parameters:

+
    +
  • timetable + {year: number, month: number, day: number, hour: number, min: number, sec: number} + + + +

    Returns:

    +
      + + number +
    + + + + + +
    + + Public.to_string (secs) +
    +
    + Converts unix epoch timestamp into human readable string. + + +

    Parameters:

    +
      +
    • secs + unix epoch timestamp +
    • +
    + +

    Returns:

    +
      + + string +
    + + + + +
    + + + + + +
    +generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
    + + + diff --git a/expcore/commands.lua b/expcore/commands.lua index c7698802..c27bea4a 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -235,8 +235,7 @@ local Commands = { } --- Adds an authorization callback, function used to check if a player if allowed to use a command --- @see Commands.authorize --- @tparam callback function the callback you want to register as an authenticator +-- @tparam function callback the callback you want to register as an authenticator -- callback param - player: LuaPlayer - the player who is trying to use the command -- callback param - command: string - the name of the command which is being used -- callback param - flags: table - any flags which have been set for the command @@ -248,8 +247,7 @@ function Commands.add_authenticator(callback) end --- Removes an authorization callback --- @see Commands.add_authenticator --- @tparam callback function|number the callback to remove, an index returned by add_authenticator can be passed +-- @tparam function|number callback the callback to remove, an index returned by add_authenticator can be passed -- @treturn boolean was the callback found and removed function Commands.remove_authenticator(callback) if type(callback) == 'number' then @@ -277,8 +275,8 @@ function Commands.remove_authenticator(callback) end --- Mostly used internally, calls all authorization callbacks, returns if the player is authorized --- @tparam player LuaPlayer the player that is using the command, passed to callbacks --- @tparam command_name string the command that is being used, passed to callbacks +-- @tparam LuaPlayer player the player that is using the command, passed to callbacks +-- @tparam string command_name the command that is being used, passed to callbacks -- @treturn[1] boolean true player is authorized -- @treturn[1] string commands const for success -- @treturn[2] boolean false player is unauthorized @@ -322,7 +320,7 @@ function Commands.authorize(player,command_name) end --- Gets all commands that a player is allowed to use, game commands not included --- @tparam[opt] player LuaPlayer the player that you want to get commands of, nil will return all commands +-- @tparam[opt] LuaPlayer player the player that you want to get commands of, nil will return all commands -- @treturn table all commands that that player is allowed to use, or all commands function Commands.get(player) player = Game.get_player_from_any(player) @@ -337,8 +335,8 @@ function Commands.get(player) end --- Searches command names and help messages to find possible commands, game commands included --- @tparam keyword string the word which you are trying to find --- @tparam[opt] allowed_player LuaPlayer the player to get allowed commands of, if nil all commands are searched +-- @tparam string keyword the word which you are trying to find +-- @tparam[opt] LuaPlayer allowed_player the player to get allowed commands of, if nil all commands are searched -- @treturn table all commands that contain the key word, and allowed by player if player given function Commands.search(keyword,allowed_player) local custom_commands = Commands.get(allowed_player) @@ -369,8 +367,8 @@ end --- Adds a parse function which can be called by name rather than callback (used in add_param) -- nb: this is not needed as you can use the callback directly this just allows it to be called by name --- @tparam name string the name of the parse, should be the type like player or player_alive, must be unique --- @tparam callback function the callback that is ran to parse the input +-- @tparam string name the name of the parse, should be the type like player or player_alive, must be unique +-- @tparam function callback the callback that is ran to parse the input -- parse param - input: string - the input given by the user for this param -- parse param - player: LuaPlayer - the player who is using the command -- parse param - reject: function(error_message) - use this function to send a error to the user and fail running @@ -386,14 +384,16 @@ function Commands.add_parse(name,callback) end --- Removes a parse function, see add_parse for adding them --- @tparam name string the name of the parse to remove +-- @tparam string name the name of the parse to remove function Commands.remove_parse(name) Commands.parse_functions[name] = nil end --- Intended to be used within other parse functions, runs a parse and returns success and new value --- @tparam name string the name of the parse to call, must be registered and cant be a function --- @tparam input string the input to pass to the parse, will always be a string but might not be the orginal input +-- @tparam string name the name of the parse to call, must be registered and cant be a function +-- @tparam string input string the input to pass to the parse, will always be a but might not be the orginal input +-- @tparam LuaPlayer player the player that is calling using the command +-- @tparam function reject the reject function that was passed by the command hander -- @treturn any the new value for the input, may be nil, if nil then either there was an error or input was nil function Commands.parse(name,input,player,reject,...) if not Commands.parse_functions[name] then return end @@ -405,8 +405,8 @@ function Commands.parse(name,input,player,reject,...) end --- Creates a new command object to added details to, note this does not register the command to the game --- @tparam name string the name of the command to be created --- @tparam help string the help message for the command +-- @tparam string name the name of the command to be created +-- @tparam string help the help message for the command -- @treturn Commands._prototype this will be used with other functions to generate the command functions function Commands.new_command(name,help) local command = setmetatable({ @@ -427,9 +427,9 @@ function Commands.new_command(name,help) end --- Adds a new param to the command this will be displayed in the help and used to parse the input --- @tparam name string the name of the new param that is being added to the command --- @tparam[opt=true] optional is this param required for this command, these must be after all required params --- @tparam[opt=pass through] parse function this function will take the input and return a new (or same) value +-- @tparam string name the name of the new param that is being added to the command +-- @tparam[opt=true] boolean optional is this param required for this command, these must be after all required params +-- @tparam[opt=pass function through] ?string|function parse this function will take the input and return a new (or same) value -- @param[opt] ... extra args you want to pass to the parse function; for example if the parse is general use -- parse param - input: string - the input given by the user for this param -- parse param - player: LuaPlayer - the player who is using the command @@ -452,7 +452,7 @@ function Commands._prototype:add_param(name,optional,parse,...) end --- Adds default values to params only matters if the param is optional, if default value is a function it is called with param player --- @tparam defaults table a table keyed by the name of the param with the value as the default value {paramName=defaultValue} +-- @tparam table defaults table a keyed by the name of the param with the value as the default value {paramName=defaultValue} -- callback param - player: LuaPlayer - the player using the command, default value does not need to be a function callback -- @treturn Commands._prototype pass through to allow more functions to be called function Commands._prototype:set_defaults(defaults) @@ -465,8 +465,8 @@ function Commands._prototype:set_defaults(defaults) end --- Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type --- @tparam name string the name of the tag to be added; used to keep flags separate --- @tparam value any the tag that you want can be anything that the authenticators are expecting +-- @tparam string name the name of the tag to be added; used to keep flags separate +-- @tparam any value the tag that you want can be anything that the authenticators are expecting -- nb: if value is nil then name will be assumed as the value and added at a numbered index -- @treturn Commands._prototype pass through to allow more functions to be called function Commands._prototype:set_flag(name,value) @@ -482,7 +482,7 @@ end --- Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working -- @usage command:add_alias('aliasOne','aliasTwo','etc') --- @tparam ... string any amount of aliases that you want this command to be callable with +-- @tparam string any ... amount of aliases that you want this command to be callable with -- @treturn Commands._prototype pass through to allow more functions to be called function Commands._prototype:add_alias(...) for _,alias in pairs({...}) do @@ -503,7 +503,7 @@ end --- Adds the callback to the command and registers all aliases, params and help message with the game -- nb: this must be the last function ran on the command and must be done for the command to work --- @tparam callback function the callback for the command, will receive the player running command, and params added with add_param +-- @tparam function callback the callback for the command, will receive the player running command, and params added with add_param -- callback param - player: LuaPlayer - the player who used the command -- callback param - ... - any params which were registered with add_param in the order they where registered -- callback param - raw: string - the raw input from the user, comes after every param added with add_param @@ -540,8 +540,8 @@ end -- nb: this is for non fatal errors meaning there is no log of this event -- nb: if reject is giving as a param to the callback use that instead -- @usage return Commands.error() --- @tparam[opt] error_message string an optional error message that can be sent to the user --- @tparam[opt] play_sound string the sound to play for the error +-- @tparam[opt] string error_message an optional error message that can be sent to the user +-- @tparam[opt] string play_sound the sound to play for the error -- @treturn Commands.defines.error return this to command handler to exit execution function Commands.error(error_message,play_sound) error_message = error_message or '' @@ -555,9 +555,9 @@ end --- Sends an error to the player and logs the error, used with pcall within command handler please avoid direct use -- nb: use error(error_message) within your callback to trigger do not trigger directly as the handler may still continue --- @tparam success boolean the success value returned from pcall, or just false to trigger error --- @tparam command_name string the name of the command this is used within the log --- @tparam error_message string the error returned by pcall or some other error, this is logged and not returned to player +-- @tparam boolean success the success value returned from pcall, or just false to trigger error +-- @tparam string command_name the name of the command this is used within the log +-- @tparam string error_message the error returned by pcall or some other error, this is logged and not returned to player -- @treturn boolean the opposite of success so true means to cancel execution, used internally function Commands.internal_error(success,command_name,error_message) if not success then @@ -569,7 +569,7 @@ end --- Sends a value to the player, followed by a command complete message -- nb: either return a value from your callback to trigger or return the return of this to prevent two messages --- @tparam[opt] value any the value to return to the player, if nil then only success message returned +-- @tparam[opt] any value the value to return to the player, if nil then only success message returned -- @treturn Commands.defines.success return this to the command handler to prevent two success messages function Commands.success(value) if value ~= nil then player_return(value) end @@ -591,7 +591,7 @@ local function command_log(player,command,comment,params,raw,details) end --- Main event function that is ran for all commands, used internally please avoid direct use --- @tparam command_event table passed directly from command event from the add_command function +-- @tparam table command_event passed directly from command event from the add_command function function Commands.run_command(command_event) local command_data = Commands.commands[command_event.name] -- player can be nil when it is the server diff --git a/expcore/common.lua b/expcore/common.lua index 41adffd5..674793e3 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -48,7 +48,7 @@ local Public = {} --- Compare types faster for faster validation of params -- @usage type_check('foo','string') -- return true -- @usage type_check('foo') -- return false --- @param v the value to be tested +-- @tparam any value the value to be tested -- @tparam[opt=nil] string test_type the type to test for if not given then it tests for nil -- @treturn boolean is v of type test_type function Public.type_check(value,test_type) @@ -57,10 +57,10 @@ end --- Raises an error if the value is of the wrong type -- @usage type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number" --- @tparam value any the value that you want to test the type of --- @tparam test_type string the type that the value should be --- @tparam error_message string the error message that is returned --- @tparam level number the level to call the error on (level = 1 means the caller) +-- @tparam any value the value that you want to test the type of +-- @tparam string test_type the type that the value should be +-- @tparam string error_message the error message that is returned +-- @tparam number level the level to call the error on (level = 1 means the caller) -- @treturn boolean true if no error was called function Public.type_check_error(value,test_type,error_message,level) level = level and level+1 or 2 @@ -69,10 +69,10 @@ end --- Raises an error when the value is the incorrect type, uses a consistent error message format -- @usage param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to ; repeat_count is not of type number" --- @tparam value any the value that you want to test the type of --- @tparam test_type string the type that the value should be --- @tparam param_name string the name of the param --- @tparam param_number number the number param it is +-- @tparam any value the value that you want to test the type of +-- @tparam string test_type the type that the value should be +-- @tparam string param_name the name of the param +-- @tparam number param_number the number param it is -- @treturn boolean true if no error was raised function Public.param_check(value,test_type,param_name,param_number) if not Public.test_type(value,test_type) then @@ -125,15 +125,15 @@ function Public.player_return(value,colour,player) end --- Writes a table object to a file in json format --- @tparam path string the path of the file to write include / to use dir --- @tpatam tbl table the table that will be converted to a json string and wrote to file +-- @tparam string path the path of the file to write include / to use dir +-- @tparam table tbl the table that will be converted to a json string and wrote to file function Public.write_json(path,tbl) game.write_file(path,game.table_to_json(tbl)..'\n',true,0) end --- Calls a require that will not error if the file is not found -- @usage local file = opt_require('file.not.present') -- will not cause any error --- @tparam path string the path that you want to require +-- @tparam string path the path that you want to require -- @return the returns from that file or nil, error if not loaded function Public.opt_require(path) local success, rtn = pcall(require,path) @@ -142,9 +142,9 @@ function Public.opt_require(path) end --- Calls a require and returns only the keys given, file must return a table --- @useage local extract, param_check = ext_require('expcore.common','extract','param_check') --- @tparam path string the path that you want to require --- @tparam ... string the name of the keys that you want returned +-- @usage local extract, param_check = ext_require('expcore.common','extract','param_check') +-- @tparam string path the path that you want to require +-- @tparam string ... the name of the keys that you want returned -- @return the keys in the order given function Public.ext_require(path,...) local rtn = require(path) @@ -159,8 +159,8 @@ end -- time will use : separates -- string will return a string not a locale string -- when a denomination is false it will overflow into the next one --- @tparam ticks number the number of ticks that represents a time --- @tparam options table a table of options to use for the format +-- @tparam number ticks the number of ticks that represents a time +-- @tparam table options table a of options to use for the format -- @treturn string a locale string that can be used function Public.format_time(ticks,options) -- Sets up the options @@ -247,10 +247,11 @@ function Public.format_time(ticks,options) end --- Moves items to the position and stores them in the closest entity of the type given --- @tparam items table items which are to be added to the chests, ['name']=count --- @tparam[opt=navies] surface LuaSurface the surface that the items will be moved to --- @tparam[opt={0,0}] position table the position that the items will be moved to {x=100,y=100} --- @tparam[opt=32] radius number the radius in which the items are allowed to be placed +-- @tparam table items items which are to be added to the chests, ['name']=count +-- @tparam[opt=navies] LuaSurface surface the surface that the items will be moved to +-- @tparam[opt={0,0}] table position the position that the items will be moved to {x=100,y=100} +-- @tparam[opt=32] number radius the radius in which the items are allowed to be placed +-- @tparam[opt=iron-chest] string chest_type the chest type that the items should be moved into function Public.move_items(items,surface,position,radius,chest_type) chest_type = chest_type or 'iron-chest' surface = surface or game.surfaces[1] @@ -438,7 +439,7 @@ function Public.print_colored_grid_value(value, surface, position, offset, immut end --- Clears all flying text entites on a surface --- @tparam surface LuaSurface the surface to clear +-- @tparam LuaSurface surface the surface to clear function Public.clear_flying_text(surface) local entities = surface.find_entities_filtered{name ='flying-text'} for _,entity in pairs(entities) do @@ -458,8 +459,8 @@ end --- Extracts certain keys from a table -- @usage local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one') --- @tparam tbl table the table which contains the keys --- @tparam ... string the names of the keys you want extracted +-- @tparam table tbl table the which contains the keys +-- @tparam string ... the names of the keys you want extracted -- @return the keys in the order given function Public.extract_keys(tbl,...) local values = {} @@ -470,7 +471,7 @@ function Public.extract_keys(tbl,...) end --- Converts a table to an enum --- @tparam tbl table the table that will be converted +-- @tparam table tbl table the that will be converted -- @treturn table the new table that acts like an enum function Public.enum(tbl) local rtn = {} @@ -491,10 +492,10 @@ function Public.enum(tbl) end --- Returns the closest match to the input --- @tparam options table a table of options for the auto complete --- @tparam input string the input string that will be completed --- @tparam[opt=false] use_key boolean when true the keys of options will be used as the options --- @tparam[opt=false] rtn_key boolean when true the the key will be returned rather than the value +-- @tparam table options table a of options for the auto complete +-- @tparam string input string the input that will be completed +-- @tparam[opt=false] boolean use_key when true the keys of options will be used as the options +-- @tparam[opt=false] boolean rtn_key when true the the key will be returned rather than the value -- @return the list item found that matches the input function Public.auto_complete(options,input,use_key,rtn_key) local rtn = {} @@ -511,7 +512,7 @@ function Public.auto_complete(options,input,use_key,rtn_key) end --- Returns all the keys of a table --- @tparam tbl table the table to get the keys of +-- @tparam table tbl table the to get the keys of -- @treturn table an array of the table keys function Public.table_keys(tbl) local rtn = {} @@ -522,7 +523,7 @@ function Public.table_keys(tbl) end --- Returns all the values of a table --- @tparam tbl table the table to get the values of +-- @tparam table tbl table the to get the values of -- @treturn table an array of the table values function Public.table_values(tbl) local rtn = {} @@ -558,8 +559,8 @@ function Public.table_keysort(tbl) end --- Returns a message with valid chat tags to change its colour --- @tparam message string the message that will be in the output --- @tparam color table a color which contains r,g,b as its keys +-- @tparam string message the message that will be in the output +-- @tparam table color a color which contains r,g,b as its keys -- @treturn string the message with the color tags included function Public.format_chat_colour(message,color) color = color or Colours.white @@ -568,8 +569,8 @@ function Public.format_chat_colour(message,color) end --- Returns a message with valid chat tags to change its colour, using localization --- @tparam message ?string|table the message that will be in the output --- @tparam color table a color which contains r,g,b as its keys +-- @tparam ?string|table message the message that will be in the output +-- @tparam table color a color which contains r,g,b as its keys -- @treturn table the message with the color tags included function Public.format_chat_colour_localized(message,color) color = color or Colours.white @@ -578,8 +579,8 @@ function Public.format_chat_colour_localized(message,color) end --- Returns the players name in the players color --- @tparam player LuaPlayer the player to use the name and color of --- @tparam[opt=false] raw_string boolean when true a string is returned rather than a localized string +-- @tparam LuaPlayer player the player to use the name and color of +-- @tparam[opt=false] boolean raw_string when true a is returned rather than a localized string -- @treturn table the players name with tags for the players color function Public.format_chat_player_name(player,raw_string) player = Game.get_player_from_any(player) diff --git a/expcore/gui/buttons.lua b/expcore/gui/buttons.lua index 9e3ae887..9a5d794b 100644 --- a/expcore/gui/buttons.lua +++ b/expcore/gui/buttons.lua @@ -25,7 +25,7 @@ local Button = { } --- Creates a new button element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new button element define function Button.new_button(name) @@ -68,9 +68,9 @@ function Button.new_button(name) end --- Adds sprites to a button making it a spirte button --- @tparam sprite SpritePath the sprite path for the default sprite for the button --- @tparam[opt] hovered_sprite SpritePath the sprite path for the sprite when the player hovers over the button --- @tparam[opt] clicked_sprite SpritePath the sprite path for the sprite when the player clicks the button +-- @tparam SpritePath sprite the sprite path for the default sprite for the button +-- @tparam[opt] SpritePath hovered_sprite the sprite path for the sprite when the player hovers over the button +-- @tparam[opt] SpritePath clicked_sprite the sprite path for the sprite when the player clicks the button -- @treturn self returns the button define to allow chaining function Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) self.draw_data.type = 'sprite-button' @@ -81,8 +81,8 @@ function Button._prototype:set_sprites(sprite,hovered_sprite,clicked_sprite) end --- Adds a click / mouse button filter to the button --- @tparam filter ?string|table either a table of mouse buttons or the first mouse button to filter, with a table true means allowed --- @tparam[opt] ... when filter is not a table you can add the mouse buttons one after each other +-- @tparam table filter ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed +-- @tparam[opt] table ... when filter is not a you can add the mouse buttons one after each other -- @treturn self returns the button define to allow chaining function Button._prototype:set_click_filter(filter,...) if type(filter) == 'string' then @@ -103,8 +103,8 @@ function Button._prototype:set_click_filter(filter,...) end --- Adds a control key filter to the button --- @tparam filter ?string|table either a table of control keys or the first control keys to filter, with a table true means allowed --- @tparam[opt] ... when filter is not a table you can add the control keyss one after each other +-- @tparam table filter ?string|table either a of control keys or the first control keys to filter, with a table true means allowed +-- @tparam[opt] table ... when filter is not a you can add the control keyss one after each other -- @treturn self returns the button define to allow chaining function Button._prototype:set_key_filter(filter,...) if type(filter) == 'string' then diff --git a/expcore/gui/center.lua b/expcore/gui/center.lua index 59c978c2..2788e804 100644 --- a/expcore/gui/center.lua +++ b/expcore/gui/center.lua @@ -26,7 +26,7 @@ local CenterFrames = { } --- Gets the center flow for a player --- @tparam player LuapPlayer the player to get the flow for +-- @tparam LuaPlayer player the player to get the flow for -- @treturn LuaGuiElement the center flow function CenterFrames.get_flow(player) player = Game.get_player_from_any(player) @@ -34,15 +34,15 @@ function CenterFrames.get_flow(player) end --- Clears the center flow for a player --- @tparam player LuapPlayer the player to clear the flow for +-- @tparam LuaPlayer player the player to clear the flow for function CenterFrames.clear_flow(player) local flow = CenterFrames.get_flow(player) flow.clear() end --- Draws the center frame for a player, if already open then will do nothing --- @tparam player LuapPlayer the player that will have the frame drawn --- @tparam name string the name of the hui that will drawn +-- @tparam LuaPlayer player the player that will have the frame drawn +-- @tparam string name the name of the hui that will drawn -- @treturn LuaGuiElement the new frame that was made function CenterFrames.draw_frame(player,name) local define = Gui.get_define(name,true) @@ -52,8 +52,8 @@ function CenterFrames.draw_frame(player,name) end --- Draws the center frame for a player, if already open then will destroy it and redraw --- @tparam player LuapPlayer the player that will have the frame drawn --- @tparam name string the name of the hui that will drawn +-- @tparam LuaPlayer player the player that will have the frame drawn +-- @tparam string name the name of the hui that will drawn -- @treturn LuaGuiElement the new frame that was made function CenterFrames.redraw_frame(player,name) local define = Gui.get_define(name,true) @@ -63,9 +63,9 @@ function CenterFrames.redraw_frame(player,name) end --- Toggles if the frame is currently open or not, will open if closed and close if open --- @tparam player LuapPlayer the player that will have the frame toggled --- @tparam name string the name of the hui that will be toggled --- @tparam[opt] state boolean when set will force a state for the frame +-- @tparam LuaPlayer player the player that will have the frame toggled +-- @tparam string name the name of the hui that will be toggled +-- @tparam[opt] boolean state when set will force a state for the frame -- @treturn boolean if the frame if no open or closed function CenterFrames.toggle_frame(player,name,state) local define = Gui.get_define(name,true) @@ -86,7 +86,7 @@ function CenterFrames.toggle_frame(player,name,state) end --- Creates a new center frame define --- @tparam permision_name string the name that can be used with the permision system +-- @tparam string permision_name the name that can be used with the permision system -- @treturn table the new center frame define function CenterFrames.new_frame(permision_name) local self = Toolbar.new_button(permision_name) @@ -108,7 +108,7 @@ function CenterFrames.new_frame(permision_name) end --- Sets the frame to be the current active gui when opened and closes all other frames --- @tparam[opt=true] state boolean when true will auto close other frames and set this frame as player.opened +-- @tparam[opt=true] boolean state when true will auto close other frames and set this frame as player.opened function CenterFrames._prototype:set_auto_focus(state) if state == false then self.auto_focus = false @@ -118,7 +118,7 @@ function CenterFrames._prototype:set_auto_focus(state) end --- Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) --- @tparam player LuaPlayer the player to draw the frame for +-- @tparam LuaPlayer player the player to draw the frame for -- @treturn LuaGuiElement the new frame that was drawn function CenterFrames._prototype:draw_frame(player) player = Game.get_player_from_any(player) @@ -149,7 +149,7 @@ function CenterFrames._prototype:draw_frame(player) end --- 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) --- @tparam player LuaPlayer the player to draw the frame for +-- @tparam LuaPlayer player the player to draw the frame for -- @treturn LuaGuiElement the new frame that was drawn function CenterFrames._prototype:redraw_frame(player) player = Game.get_player_from_any(player) @@ -163,7 +163,7 @@ function CenterFrames._prototype:redraw_frame(player) end --- Toggles if the frame is open, if open it will close it and if closed it will open it --- @tparam player LuaPlayer the player to draw the frame for +-- @tparam LuaPlayer player the player to draw the frame for -- @treturn boolean with the gui frame is now open function CenterFrames._prototype:toggle_frame(player) player = Game.get_player_from_any(player) @@ -179,7 +179,7 @@ function CenterFrames._prototype:toggle_frame(player) end --- Creates an event handler that will trigger one of its functions, use with Event.add --- @tparam[opt=update] action string the action to take on this event +-- @tparam[opt=update] string action the action to take on this event function CenterFrames._prototype:event_handler(action) action = action or 'update' return function(event) diff --git a/expcore/gui/checkboxs.lua b/expcore/gui/checkboxs.lua index b31d9f6e..a87d9c02 100644 --- a/expcore/gui/checkboxs.lua +++ b/expcore/gui/checkboxs.lua @@ -50,9 +50,9 @@ local Store = require 'expcore.store' local Game = require 'utils.game' --- Event call for on_checked_state_changed and store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value boolean the new state of the checkbox +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam boolean value the new state of the checkbox local function event_call(define,element,value) if define.events.on_element_update then local player = Game.get_player_by_index(element.player_index) @@ -61,9 +61,9 @@ local function event_call(define,element,value) end --- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value boolean the new state of the checkbox +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam boolean value the new state of the checkbox local function store_call(define,element,value) element.state = value event_call(define,element,value) @@ -87,7 +87,7 @@ local Checkbox = { } --- Creates a new checkbox element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new checkbox element define function Checkbox.new_checkbox(name) @@ -131,7 +131,7 @@ function Checkbox.new_checkbox(name) end --- Creates a new radiobutton element define, has all functions checkbox has --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new button element define function Checkbox.new_radiobutton(name) local self = Checkbox.new_checkbox(name) @@ -144,9 +144,9 @@ function Checkbox.new_radiobutton(name) end --- Adds this radiobutton to be an option in the given option set (only one can be true at a time) --- @tparam option_set string the name of the option set to add this element to --- @tparam option_name string the name of this option that will be used to idenitife it --- @tparam self the define to allow chaining +-- @tparam string option_set the name of the option set to add this element to +-- @tparam string option_name the name of this option that will be used to idenitife it +-- @treturn self the define to allow chaining function Checkbox._prototype_radiobutton:add_as_option(option_set,option_name) self.option_set = option_set self.option_name = option_name or self.name @@ -160,7 +160,8 @@ function Checkbox._prototype_radiobutton:add_as_option(option_set,option_name) end --- Gets the stored value of the radiobutton or the option set if present --- @tparam category[opt] string the category to get such as player name or force name +-- @tparam string category[opt] the category to get such as player name or force name +-- @tparam boolean internal used to prevent stackover flow -- @treturn any the value that is stored for this define function Checkbox._prototype_radiobutton:get_store(category,internal) if not self.store then return end @@ -174,8 +175,9 @@ function Checkbox._prototype_radiobutton:get_store(category,internal) end --- Sets the stored value of the radiobutton or the option set if present --- @tparam category[opt] string the category to get such as player name or force name --- @tparam value any the value to set for this define, must be valid for its type ie boolean for checkbox etc +-- @tparam string category[opt] the category to get such as player name or force name +-- @tparam boolean value the value to set for this define, must be valid for its type ie for checkbox etc +-- @tparam boolean internal used to prevent stackover flow -- @treturn boolean true if the value was set function Checkbox._prototype_radiobutton:set_store(category,value,internal) if not self.store then return end @@ -189,11 +191,11 @@ function Checkbox._prototype_radiobutton:set_store(category,value,internal) end --- Registers a new option set that can be linked to radiobutotns (only one can be true at a time) --- @tparam name string the name of the option set, must be unique --- @tparam callback function the update callback when the value of the option set chagnes +-- @tparam string name the name of the option set, must be unique +-- @tparam function callback the update callback when the value of the option set chagnes -- callback param - value string - the new selected option for this option set -- callback param - category string - the category that updated if categorize was used --- @tpram categorize function the function used to convert an element into a string +-- @tparam function categorize the function used to convert an element into a string -- @treturn string the name of this option set to be passed to add_as_option function Checkbox.new_option_set(name,callback,categorize) @@ -216,8 +218,8 @@ function Checkbox.new_option_set(name,callback,categorize) end --- Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) --- @tparam name string the name of the option set to draw the radiobuttons of --- @tparam element LuaGuiElement the parent element that the radiobuttons will be drawn to +-- @tparam string name the name of the option set to draw the radiobuttons of +-- @tparam LuaGuiElement element the parent element that the radiobuttons will be drawn to function Checkbox.draw_option_set(name,element) if not Checkbox.option_sets[name] then return end local options = Checkbox.option_sets[name] @@ -231,9 +233,9 @@ function Checkbox.draw_option_set(name,element) end --- Sets all radiobutotn in a element to false (unless excluded) and can act recursivly --- @tparam element LuaGuiElement the root gui element to start setting radio buttons from --- @tparam[opt] exclude ?string|table the name of the radiobutton to exclude or a table of radiobuttons where true will set the state true --- @tparam[opt=false] recursive boolean if true will recur as much as possible, if a number will recur that number of times +-- @tparam LuaGuiElement element the root gui element to start setting radio buttons from +-- @tparam[opt] table exclude ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true +-- @tparam[opt=false] ?number|boolean recursive if true will recur as much as possible, if a will recur that number of times -- @treturn boolean true if successful function Checkbox.reset_radiobuttons(element,exclude,recursive) if not element or not element.valid then return end diff --git a/expcore/gui/core.lua b/expcore/gui/core.lua index c58de2e3..3288d195 100644 --- a/expcore/gui/core.lua +++ b/expcore/gui/core.lua @@ -167,7 +167,7 @@ Gui.defines = {} -- Stores the indivdual element definations Gui.names = {} -- Stores debug names to link to gui uids --- Used internally to create new prototypes for element defines --- @tparam tbl table a table that will have functions added to it +-- @tparam table tbl table a that will have functions added to it -- @treturn table the new table with the keys added to it function Gui._prototype_factory(tbl) for k,v in pairs(Gui._prototype) do @@ -177,12 +177,12 @@ function Gui._prototype_factory(tbl) end --- Used internally to create event handler adders for element defines --- @tparam name string the key that the event will be stored under, should be the same as the event name +-- @tparam string name the key that the event will be stored under, should be the same as the event name -- @treturn function the function that can be used to add an event handler function Gui._event_factory(name) --- Gui._prototype:on_event(callback) --- Add a hander to run on this event, replace event with the event, different classes have different events - -- @tparam callback function the function that will be called on the event + -- @tparam function callback the function that will be called on the event -- callback param - player LuaPlayer - the player who owns the gui element -- callback param - element LuaGuiElement - the element that caused the event -- callback param - value any - (not always present) the updated value for the element @@ -204,7 +204,7 @@ end function Gui._store_factory(callback) --- Gui._prototype:add_store(categorize) --- Adds a store location for the define that will save the state of the element, categorize is a function that returns a string - -- @tparam[opt] categorize function if present will be called to convert an element into a category string + -- @tparam[opt] function categorize if present will be called to convert an element into a category string -- categorize param - element LuaGuiElement - the element that needs to be converted -- categorize return - string - a determistic string that referses to a category such as player name or force name -- @treturn self the element define to allow chaining @@ -238,8 +238,8 @@ end function Gui._sync_store_factory(callback) --- Gui._prototype:add_sync_store(location,categorize) --- Adds a store location for the define that will sync between games, categorize is a function that returns a string - -- @tparam location string a unique string location, unlike add_store a uid location should not be used to avoid migration problems - -- @tparam[opt] categorize function if present will be called to convert an element into a category string + -- @tparam string location string a unique location, unlike add_store a uid location should not be used to avoid migration problems + -- @tparam[opt] function categorize if present will be called to convert an element into a category string -- categorize param - element LuaGuiElement - the element that needs to be converted -- categorize return - string - a determistic string that referses to a category such as player name or force name -- @treturn self the element define to allow chaining @@ -272,7 +272,7 @@ function Gui._sync_store_factory(callback) end --- Used internally to create new element defines from a class prototype --- @tparam prototype table the class prototype that will be used for the element define +-- @tparam table prototype the class prototype that will be used for the element define -- @treturn table the new element define with all functions accessed via __index metamethod function Gui._define_factory(prototype) local uid = Gui.uid_name() @@ -299,7 +299,7 @@ function Gui._prototype:uid() end --- Sets a debug alias for the define --- @tparam name string the debug name for the element define that can be used to get this element define +-- @tparam string name the debug name for the element define that can be used to get this element define -- @treturn self the element define to allow chaining function Gui._prototype:debug_name(name) self.debug_name = name @@ -307,7 +307,7 @@ function Gui._prototype:debug_name(name) end --- Sets the caption for the element define --- @tparam caption string the caption that will be drawn with the element +-- @tparam string caption the caption that will be drawn with the element -- @treturn self the element define to allow chaining function Gui._prototype:set_caption(caption) self.draw_data.caption = caption @@ -315,7 +315,7 @@ function Gui._prototype:set_caption(caption) end --- Sets the tooltip for the element define --- @tparam tooltip string the tooltip that will be displayed for this element when drawn +-- @tparam string tooltip the tooltip that will be displayed for this element when drawn -- @treturn self the element define to allow chaining function Gui._prototype:set_tooltip(tooltip) self.draw_data.tooltip = tooltip @@ -323,8 +323,8 @@ function Gui._prototype:set_tooltip(tooltip) end --- Sets the style for the element define --- @tparam style string the style that will be used for this element when drawn --- @tapram[opt] callback function function is called when element is drawn to alter its style +-- @tparam string style the style that will be used for this element when drawn +-- @tparam[opt] callback function function is called when element is drawn to alter its style -- @treturn self the element define to allow chaining function Gui._prototype:set_style(style,callback) self.draw_data.style = style @@ -345,7 +345,7 @@ function Gui._prototype:set_embeded_flow(state) end --- Sets an authenticator that blocks the draw function if check fails --- @tparam callback function the function that will be ran to test if the element should be drawn or not +-- @tparam function callback the function that will be ran to test if the element should be drawn or not -- callback param - player LuaPlayer - the player that the element is being drawn to -- callback param - define_name string - the name of the define that is being drawn -- callback return - boolean - false will stop the element from being drawn @@ -360,7 +360,7 @@ function Gui._prototype:set_pre_authenticator(callback) end --- Sets an authenticator that disables the element if check fails --- @tparam callback function the function that will be ran to test if the element should be enabled or not +-- @tparam function callback the function that will be ran to test if the element should be enabled or not -- callback param - player LuaPlayer - the player that the element is being drawn to -- callback param - define_name string - the name of the define that is being drawn -- callback return - boolean - false will disable the element @@ -376,7 +376,7 @@ end --- Draws the element using what is in the draw_data table, allows use of authenticator if present, registers new instances if store present -- the data with in the draw_data is set up through the use of all the other functions --- @tparam element LuaGuiElement the element that the define will draw a copy of its self onto +-- @tparam LuaGuiElement element the element that the define will draw a copy of its self onto -- @treturn LuaGuiElement the new element that was drawn so styles can be applied function Gui._prototype:draw_to(element,...) if element[self.name] then return end @@ -415,7 +415,7 @@ function Gui._prototype:draw_to(element,...) end --- Gets the value in this elements store, category needed if categorize function used --- @tparam category[opt] string the category to get such as player name or force name +-- @tparam string category[opt] the category to get such as player name or force name -- @treturn any the value that is stored for this define function Gui._prototype:get_store(category) if not self.store then return end @@ -427,8 +427,8 @@ function Gui._prototype:get_store(category) end --- Sets the value in this elements store, category needed if categorize function used --- @tparam category[opt] string the category to get such as player name or force name --- @tparam value any the value to set for this define, must be valid for its type ie boolean for checkbox etc +-- @tparam string category[opt] the category to get such as player name or force name +-- @tparam boolean any value the value to set for this define, must be valid for its type ie for checkbox etc -- @treturn boolean true if the value was set function Gui._prototype:set_store(category,value) if not self.store then return end @@ -441,7 +441,7 @@ end --- Gets an element define give the uid, debug name or a copy of the element define -- @tparam name ?string|table the uid, debug name or define for the element define to get --- @tparam[opt] internal boolean when true the error trace is one level higher (used internally) +-- @tparam[opt] boolean internal when true the error trace is one level higher (used internally) -- @treturn table the element define that was found or an error function Gui.get_define(name,internal) if type(name) == 'table' then @@ -465,7 +465,7 @@ end --- Gets the value that is stored for a given element define, category needed if categorize function used -- @tparam name ?string|table the uid, debug name or define for the element define to get --- @tparam[opt] category string the category to get the value for +-- @tparam[opt] string category the category to get the value for -- @treturn any the value that is stored for this define function Gui.get_store(name,category) local define = Gui.get_define(name,true) @@ -474,8 +474,8 @@ end --- Sets the value stored for a given element define, category needed if categorize function used -- @tparam name ?string|table the uid, debug name or define for the element define to set --- @tparam[opt] category string the category to set the value for --- @tparam value any the value to set for the define, must be valid for its type ie boolean for a checkbox +-- @tparam[opt] string category the category to set the value for +-- @tparam boolean any value the value to set for the define, must be valid for its type ie for a checkbox -- @treturn boolean true if the value was set function Gui.set_store(name,category,value) local define = Gui.get_define(name,true) @@ -483,7 +483,7 @@ function Gui.set_store(name,category,value) end --- A categorize function to be used with add_store, each player has their own value --- @tparam element LuaGuiElement the element that will be converted to a string +-- @tparam LuaGuiElement element the element that will be converted to a string -- @treturn string the player's name who owns this element function Gui.player_store(element) local player = Game.get_player_by_index(element.player_index) @@ -491,7 +491,7 @@ function Gui.player_store(element) end --- A categorize function to be used with add_store, each force has its own value --- @tparam element LuaGuiElement the element that will be converted to a string +-- @tparam LuaGuiElement element the element that will be converted to a string -- @treturn string the player's force name who owns this element function Gui.force_store(element) local player = Game.get_player_by_index(element.player_index) @@ -499,7 +499,7 @@ function Gui.force_store(element) end --- A categorize function to be used with add_store, each surface has its own value --- @tparam element LuaGuiElement the element that will be converted to a string +-- @tparam LuaGuiElement element the element that will be converted to a string -- @treturn string the player's surface name who owns this element function Gui.surface_store(element) local player = Game.get_player_by_index(element.player_index) @@ -516,7 +516,7 @@ function Gui.draw(name,element,...) end --- Will toggle the enabled state of an element --- @tparam element LuaGuiElement the gui element to toggle +-- @tparam LuaGuiElement element the gui element to toggle -- @treturn boolean the new state that the element has function Gui.toggle_enable(element) if not element or not element.valid then return end @@ -529,7 +529,7 @@ function Gui.toggle_enable(element) end --- Will toggle the visiblity of an element --- @tparam element LuaGuiElement the gui element to toggle +-- @tparam LuaGuiElement element the gui element to toggle -- @treturn boolean the new state that the element has function Gui.toggle_visible(element) if not element or not element.valid then return end @@ -542,11 +542,11 @@ function Gui.toggle_visible(element) end --- Sets the padding for a gui element --- @tparam element LuaGuiElement the element to set the padding for --- @tparam[opt=0] up number the amount of padding on the top --- @tparam[opt=0] down number the amount of padding on the bottom --- @tparam[opt=0] left number the amount of padding on the left --- @tparam[opt=0] right number the amount of padding on the right +-- @tparam LuaGuiElement element the element to set the padding for +-- @tparam[opt=0] number up the amount of padding on the top +-- @tparam[opt=0] number down the amount of padding on the bottom +-- @tparam[opt=0] number left the amount of padding on the left +-- @tparam[opt=0] number right the amount of padding on the right function Gui.set_padding(element,up,down,left,right) local style = element.style style.top_padding = up or 0 @@ -557,10 +557,10 @@ end --- Sets the padding for a gui style -- @tparam element LuaStyle the element to set the padding for --- @tparam[opt=0] up number the amount of padding on the top --- @tparam[opt=0] down number the amount of padding on the bottom --- @tparam[opt=0] left number the amount of padding on the left --- @tparam[opt=0] right number the amount of padding on the right +-- @tparam[opt=0] number up the amount of padding on the top +-- @tparam[opt=0] number down the amount of padding on the bottom +-- @tparam[opt=0] number left the amount of padding on the left +-- @tparam[opt=0] number right the amount of padding on the right function Gui.set_padding_style(style,up,down,left,right) style.top_padding = up or 0 style.bottom_padding = down or 0 @@ -569,8 +569,8 @@ function Gui.set_padding_style(style,up,down,left,right) end --- Allows the creation of a right align flow to place elements into --- @tparam element LuaGuiElement the element to add this flow to, --- @tparam[opt] flow_name string the name of the flow can be nil +-- @tparam LuaGuiElement element the element to add this flow to, +-- @tparam[opt] string flow_name the name of the flow can be nil -- @treturn LuaGuiElement the flow that was created function Gui.create_right_align(element,flow_name) local right_flow = @@ -585,7 +585,7 @@ function Gui.create_right_align(element,flow_name) end --- Destroies an element but tests for it being present and valid first --- @tparam element LuaGuiElement the element to be destroied +-- @tparam LuaGuiElement element the element to be destroied -- @treturn boolean true if it was destoried function Gui.destory_if_valid(element) if element and element.valid then diff --git a/expcore/gui/dropdown.lua b/expcore/gui/dropdown.lua index 1737577e..8d976162 100644 --- a/expcore/gui/dropdown.lua +++ b/expcore/gui/dropdown.lua @@ -20,9 +20,9 @@ local Gui = require 'expcore.gui.core' local Game = require 'utils.game' --- Event call for on_selection_state_changed and store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new option for the dropdown +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new option for the dropdown local function event_call(define,element,value) local player = Game.get_player_by_index(element.player_index) @@ -35,11 +35,11 @@ local function event_call(define,element,value) end end ---- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new option for the dropdown local _select_value +--- Store call for store update +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new option for the dropdown local function store_call(define,element,value) _select_value(element,value) event_call(define,element,value) @@ -55,7 +55,7 @@ local Dropdown = { } --- Creates a new dropdown element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new dropdown element define function Dropdown.new_dropdown(name) @@ -103,7 +103,7 @@ function Dropdown.new_dropdown(name) end --- Creates a new list box element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new list box element define function Dropdown.new_list_box(name) local self = Dropdown.new_dropdown(name) @@ -113,8 +113,8 @@ function Dropdown.new_list_box(name) end --- Adds new static options to the dropdown which will trigger the general callback --- @tparam options ?string|table either a table of option strings or the first option string, with a table values are the options --- @tparam[opt] ... when options is not a table you can add the options one after each other +-- @tparam table options ?string|table either a of option strings or the first option string, with a table values are the options +-- @tparam[opt] table ... when options is not a you can add the options one after each other -- @tparam self the define to allow chaining function Dropdown._prototype:new_static_options(options,...) if type(options) == 'string' then @@ -131,11 +131,11 @@ end Dropdown._prototype.add_options = Dropdown._prototype.new_static_options --- Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options) --- @tparam callback function the function that will run to get the options for the dropdown +-- @tparam function callback the function that will run to get the options for the dropdown -- callback param - player LuaPlayer - the player that the element is being drawn to -- callback param - element LuaGuiElement - the element that is being drawn -- callback return - table - the values of this table will be appended to the static options of the dropdown --- @tparam self the define to allow chaining +-- @treturn self the define to allow chaining function Dropdown._prototype:new_dynamic_options(callback) if type(callback) ~= 'function' then return error('Dynamic options callback must be a function',2) @@ -146,12 +146,12 @@ end Dropdown._prototype.add_dynamic = Dropdown._prototype.new_dynamic_options --- Adds a case specific callback which will only run when that option is selected (general case still triggered) --- @tparam option string the name of the option to trigger the callback on; if not already added then will be added as an option --- @tparam callback function the function that will be called when that option is selected +-- @tparam string option the name of the option to trigger the callback on; if not already added then will be added as an option +-- @tparam function callback the function that will be called when that option is selected -- callback param - player LuaPlayer - the player who owns the gui element -- callback param - element LuaGuiElement - the element which is being effected -- callback param - value string - the new option that has been selected --- @tparam self the define to allow chaining +-- @treturn self the define to allow chaining function Dropdown._prototype:add_option_callback(option,callback) if not self.option_callbacks then self.option_callbacks = {} end if not self.options then self.options = {} end @@ -165,8 +165,8 @@ function Dropdown._prototype:add_option_callback(option,callback) end --- Selects the option from a dropdown or list box given the value rather than key --- @tparam element LuaGuiElement the element that contains the option --- @tparam value string the option to select from the dropdown +-- @tparam LuaGuiElement element the element that contains the option +-- @tparam string value the option to select from the dropdown -- @treturn number the key where the value was function Dropdown.select_value(element,value) for k,item in pairs(element.items) do @@ -179,7 +179,7 @@ end _select_value = Dropdown.select_value --- Returns the currently selected value rather than index --- @tparam element LuaGuiElement the gui element that you want to get the value of +-- @tparam LuaGuiElement element the gui element that you want to get the value of -- @treturn string the value that is currently selected function Dropdown.get_selected_value(element) local index = element.selected_index diff --git a/expcore/gui/elem-button.lua b/expcore/gui/elem-button.lua index e976d3d5..b20cae59 100644 --- a/expcore/gui/elem-button.lua +++ b/expcore/gui/elem-button.lua @@ -15,9 +15,9 @@ local Gui = require 'expcore.gui.core' local Game = require 'utils.game' --- Event call for on_elem_changed and store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new value for the elem button +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new value for the elem button local function event_call(define,element,value) local player = Game.get_player_by_index(element.player_index) @@ -28,12 +28,12 @@ local function event_call(define,element,value) end --- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new value for the elem button -local function store_call(self,element,value) +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new value for the elem button +local function store_call(define,element,value) element.elem_value = value - event_call(self,element,value) + event_call(define,element,value) end local ElemButton = { @@ -46,7 +46,7 @@ local ElemButton = { } --- Creates a new elem button element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new elem button element define function ElemButton.new_elem_button(name) @@ -90,7 +90,7 @@ function ElemButton.new_elem_button(name) end --- Sets the type of the elem button, the type is required so this must be called at least once --- @tparam type string the type that this elem button is see factorio api +-- @tparam string type the type that this elem button is see factorio api -- @treturn the element define to allow for chaining function ElemButton._prototype:set_type(type) self.draw_data.elem_type = type @@ -98,7 +98,7 @@ function ElemButton._prototype:set_type(type) end --- Sets the default value for the elem button, this may be a function or a string --- @tparam value ?string|function a string will be a static default and a function will be called when drawn to get the default +-- @tparam ?string|function value string a will be a static default and a function will be called when drawn to get the default -- @treturn the element define to allow for chaining function ElemButton._prototype:set_default(value) self.default = value diff --git a/expcore/gui/instances.lua b/expcore/gui/instances.lua index 7e0fde9f..1bb502b9 100644 --- a/expcore/gui/instances.lua +++ b/expcore/gui/instances.lua @@ -86,22 +86,22 @@ Global.register(Instances.data,function(tbl) end) --- Returns if a instnace group has a categorise function; must be registerd --- @tparam name string the name of the instance group +-- @tparam string name the name of the instance group -- @treturn boolean true if there is a categorise function function Instances.has_categories(name) return type(Instances.categorise[name]) == 'function' end --- Returns if the given name is a registered instance group --- @tparam name string the name of the instance group you are testing +-- @tparam string name the name of the instance group you are testing -- @treturn boolean true if the name is registered function Instances.is_registered(name) return Instances.categorise[name] ~= nil end --- Registers the name of an instance group to allow for storing element instances --- @tparam name string the name of the instance group; must to unique --- @tparam[opt] categorise function function used to turn the element into a string +-- @tparam string name the name of the instance group; must to unique +-- @tparam[opt] function categorise function used to turn the element into a string -- categorise param - element LuaGuiElement - the gui element to be turned into a string -- categorise return - string - the category that the element will be added to like the player's name or force's name -- @treturn string the name that was added so it can be used as a varible @@ -123,8 +123,8 @@ function Instances.register(name,categorise) end --- Adds an element to the instance group under the correct category; must be registered --- @tparam name string the name of the instance group to add the element to --- @tparam element LuaGuiElement the element to add the the instance group +-- @tparam string name the name of the instance group to add the element to +-- @tparam LuaGuiElement element the element to add the the instance group function Instances.add_element(name,element) if not Instances.categorise[name] then return error('Inavlid name for instance group: '..name,2) @@ -140,8 +140,8 @@ function Instances.add_element(name,element) end --- Gets all element instances without first removing any invalid ones; used internally and must be registered --- @tparam name string the name of the instance group to get the instances of --- @tparam[opt] category string the category to get the instance from, not needed when no categorise function +-- @tparam string name the name of the instance group to get the instances of +-- @tparam[opt] string category the category to get the instance from, not needed when no categorise function -- @treturn table the table of element instances of which some may be invalid function Instances.get_elements_raw(name,category) if not Instances.categorise[name] then @@ -156,8 +156,8 @@ function Instances.get_elements_raw(name,category) end --- Gets all valid element instances and has the option of running a callback on those that are valid --- @tparam name string the name of the instance group to get the instances of --- @tparam[opt] category string the category to get the instances of, not needed when no categorise function +-- @tparam string name the name of the instance group to get the instances of +-- @tparam[opt] string category the category to get the instances of, not needed when no categorise function -- @tparan[opt] callback function when given the callback will be ran on all valid elements -- callback param - element LuaGuiElement - the current valid element -- @treturn table the table of element instances with all invalid ones removed @@ -185,9 +185,9 @@ Instances.get_elements = Instances.get_valid_elements Instances.apply_to_elements = Instances.get_valid_elements --- A version of add_element that does not require the group to be registered --- @tparam name string the name of the instance group to add the element to +-- @tparam string name the name of the instance group to add the element to -- @tparam category ?string|nil the category to add the element to, can be nil but must still be given --- @tparam element LuaGuiElement the element to add to the instance group +-- @tparam LuaGuiElement element the element to add to the instance group function Instances.unregistered_add_element(name,category,element) if not Instances.data[name] then Instances.data[name] = {} end if category then @@ -199,9 +199,9 @@ function Instances.unregistered_add_element(name,category,element) end --- A version of get_elements that does not require the group to be registered --- @tparam name string the name of the instance group to get the instances of +-- @tparam string name the name of the instance group to get the instances of -- @tparam category ?string|nil the category to get the instances of, can be nil but must still be given --- @tparam[opt] callback function when given will be called on all valid instances +-- @tparam[opt] function callback when given will be called on all valid instances -- callback param - element LuaGuiElement - the current valid element -- @treturn table the table of element instances with all invalid ones removed function Instances.unregistered_get_elements(name,category,callback) diff --git a/expcore/gui/left.lua b/expcore/gui/left.lua index a2dcf1d1..77a03db0 100644 --- a/expcore/gui/left.lua +++ b/expcore/gui/left.lua @@ -66,7 +66,7 @@ setmetatable(LeftFrames._prototype, { }) --- Gets the left frame flow for a player --- @tparam player LuaPlayer the player to get the flow of +-- @tparam LuaPlayer player the player to get the flow of -- @treturn LuaGuiElement the left frame flow for the player function LeftFrames.get_flow(player) player = Game.get_player_from_any(player) @@ -74,8 +74,8 @@ function LeftFrames.get_flow(player) end --- Gets one frame from the left flow by its name --- @tparam name string the name of the gui frame to get --- @tparam player LuaPlayer the player to get the frame of +-- @tparam string name the name of the gui frame to get +-- @tparam LuaPlayer player the player to get the frame of -- @treturn LuaGuiElement the frame in the left frame flow with that name function LeftFrames.get_frame(name,player) local define = LeftFrames.frames[name] @@ -86,7 +86,7 @@ function LeftFrames.get_frame(name,player) end --- Gets all open frames for a player, if non are open it will remove the close all button --- @tparam player LuaPlayer the player to get the flow of +-- @tparam LuaPlayer player the player to get the flow of -- @treturn table contains all the open (and registered) frames for the player function LeftFrames.get_open(player) local open = {} @@ -104,9 +104,9 @@ function LeftFrames.get_open(player) end --- Toggles the visiblty of a left frame, or sets its visiblty state --- @tparam name string the name of the gui frame to toggle --- @tparam player LuaPlayer the player to get the frame of --- @tparam[opt] state boolean when given will be the state that the visiblty is set to +-- @tparam string name the name of the gui frame to toggle +-- @tparam LuaPlayer player the player to get the frame of +-- @tparam[opt] boolean state when given will be the state that the visiblty is set to -- @treturn boolean the new state of the visiblity function LeftFrames.toggle_frame(name,player,state) local define = LeftFrames.frames[name] @@ -127,7 +127,7 @@ function LeftFrames.toggle_frame(name,player,state) end --- Creates a new left frame define --- @tparam permision_name string the name that can be used with the permision system +-- @tparam string permision_name the name that can be used with the permision system -- @treturn table the new left frame define function LeftFrames.new_frame(permision_name) @@ -147,7 +147,7 @@ function LeftFrames.new_frame(permision_name) end --- Sets if the frame is visible when a player joins, can also be a function to return a boolean --- @tparam[opt=true] state ?boolean|function the default state of the visiblty, can be a function +-- @tparam[opt=true] ?boolean|function state the default state of the visiblty, can be a function -- state param - player LuaPlayer - the player that has joined the game -- state param - define_name string - the define name for the frame -- state return - boolean - false will hide the frame @@ -163,14 +163,14 @@ function LeftFrames._prototype:set_open_by_default(state) end --- Sets the direction of the frame, either vertical or horizontal --- @tparam direction string the direction to have the elements be added to thef frame +-- @tparam string direction the direction to have the elements be added to thef frame function LeftFrames._prototype:set_direction(direction) self.direction = direction return self end --- Gets the frame for this define from the left frame flow --- @tparam player LuaPlayer the player to get the frame of +-- @tparam LuaPlayer player the player to get the frame of -- @treturn LuaGuiElement the frame in the left frame flow for this define function LeftFrames._prototype:get_frame(player) local flow = LeftFrames.get_flow(player) @@ -180,7 +180,7 @@ function LeftFrames._prototype:get_frame(player) end --- Returns if the player currently has this define visible --- @tparam player LuaPlayer the player to get the frame of +-- @tparam LuaPlayer player the player to get the frame of -- @treturn boolean true if it is open/visible function LeftFrames._prototype:is_open(player) local frame = self:get_frame(player) @@ -188,7 +188,7 @@ function LeftFrames._prototype:is_open(player) end --- Toggles the visiblty of the left frame --- @tparam player LuaPlayer the player to toggle the frame of +-- @tparam LuaPlayer player the player to toggle the frame of -- @treturn boolean the new state of the visiblity function LeftFrames._prototype:toggle(player) local frame = self:get_frame(player) @@ -198,7 +198,7 @@ function LeftFrames._prototype:toggle(player) end --- Updates the contents of the left frame, first tries update callback, oter wise will clear and redraw --- @tparam player LuaPlayer the player to update the frame of +-- @tparam LuaPlayer player the player to update the frame of function LeftFrames._prototype:update(player) local frame = self:get_frame(player) if self.events.on_update then @@ -210,7 +210,7 @@ function LeftFrames._prototype:update(player) end --- Updates the frame for all players, see update --- @tparam[opt=false] update_offline boolean when true will update the frame for offline players +-- @tparam[opt=false] boolean update_offline when true will update the frame for offline players function LeftFrames._prototype:update_all(update_offline) local players = update_offline == true and game.players or game.connected_players for _,player in pairs(players) do @@ -219,7 +219,7 @@ function LeftFrames._prototype:update_all(update_offline) end --- Redraws the frame by calling on_draw, will always clear the frame --- @tparam player LuaPlayer the player to update the frame of +-- @tparam LuaPlayer player the player to update the frame of function LeftFrames._prototype:redraw(player) local frame = self:get_frame(player) frame.clear() @@ -229,7 +229,7 @@ function LeftFrames._prototype:redraw(player) end --- Redraws the frame for all players, see redraw --- @tparam[opt=false] update_offline boolean when true will update the frame for offline players +-- @tparam[opt=false] boolean update_offline when true will update the frame for offline players function LeftFrames._prototype:redraw_all(update_offline) local players = update_offline == true and game.players or game.connected_players for _,player in pairs(players) do @@ -238,7 +238,7 @@ function LeftFrames._prototype:redraw_all(update_offline) end --- Creates an event handler that will trigger one of its functions, use with Event.add --- @tparam[opt=update] action string the action to take on this event +-- @tparam[opt=update] string action the action to take on this event function LeftFrames._prototype:event_handler(action) action = action or 'update' return function(event) diff --git a/expcore/gui/popups.lua b/expcore/gui/popups.lua index fa0c0668..b324f0c0 100644 --- a/expcore/gui/popups.lua +++ b/expcore/gui/popups.lua @@ -34,22 +34,22 @@ Global.register(PopupFrames.paused_popups,function(tbl) end) --- Sets the state of the element in the pasued list, nil or true --- @tparam element LuaGuiElement the element to set the state of --- @tparam[opt] state boolean the state to set it to, true will pause the the progress bar +-- @tparam LuaGuiElement element the element to set the state of +-- @tparam[opt] boolean state the state to set it to, true will pause the the progress bar local function set_pasued_state(element,state) local name = element.player_index..':'..element.index PopupFrames.paused_popups[name] = state end --- Gets the state of the element in the pasued list, nil or true --- @tparam element LuaGuiElement the element to get the state of +-- @tparam LuaGuiElement element the element to get the state of local function get_pasued_state(element) local name = element.player_index..':'..element.index return PopupFrames.paused_popups[name] end --- Gets the left flow that contains the popup frames --- @tparam player LuaPlayer the player to get the flow for +-- @tparam LuaPlayer player the player to get the flow for -- @treturn LuaGuiElement the left flow that contains the popup frames function PopupFrames.get_flow(player) player = Game.get_player_from_any(player) @@ -58,10 +58,10 @@ function PopupFrames.get_flow(player) end --- Opens a popup for the player, can give the amount of time it is open as well as params for the draw function --- @tparam define_name string the name of the define that you want to open for the player --- @tparam player LuaPlayer the player to open the popup for --- @tparam[opt] open_time number the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default --- @tparam ... any the other params that you want to pass to your on_draw event +-- @tparam string define_name the name of the define that you want to open for the player +-- @tparam LuaPlayer player the player to open the popup for +-- @tparam[opt] number open_time the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default +-- @tparam any ... the other params that you want to pass to your on_draw event -- @treturn LuaGuiElement the frame that was drawn, the inner gui flow which contains the content function PopupFrames.open(define_name,player,open_time,...) local define = Gui.get_define(define_name,true) @@ -70,7 +70,7 @@ function PopupFrames.open(define_name,player,open_time,...) end --- Closes the popup, is called by progress bar and close button --- @tparam element LuaGuiElement either the progress bar or the close button +-- @tparam LuaGuiElement element either the progress bar or the close button local function close_popup(element) local frame = element.parent.parent.parent if not frame or not frame.valid then return end @@ -117,7 +117,7 @@ Gui.on_click(PopupFrames.close_frame_name,function(event) end) --- Creates a new popup frame define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new popup frame define function PopupFrames.new_popup(name) local self = Gui._define_factory(PopupFrames._prototype) @@ -182,7 +182,7 @@ function PopupFrames.new_popup(name) end --- Sets the default open time for the popup, will be used if non is provided with open --- @tparam amount number the number of ticks, by default, the popup will be open for +-- @tparam number amount the number of ticks, by default, the popup will be open for -- @treturn table the define to allow for chaining function PopupFrames._prototype:set_default_open_time(amount) self.default_open_time = amount @@ -190,9 +190,9 @@ function PopupFrames._prototype:set_default_open_time(amount) end --- Opens this define for a player, can be given open time and any other params for the draw function --- @tparam player LuaPlayer the player to open the popup for --- @tparam[opt] open_time number the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default --- @tparam ... any the other params that you want to pass to your on_draw event +-- @tparam LuaPlayer player the player to open the popup for +-- @tparam[opt] number open_time the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default +-- @tparam any ... the other params that you want to pass to your on_draw event -- @treturn LuaGuiElement the frame that was drawn, the inner gui flow which contains the content function PopupFrames._prototype:open(player,open_time,...) open_time = open_time or self.default_open_time or 0 diff --git a/expcore/gui/progress-bar.lua b/expcore/gui/progress-bar.lua index 2b4ffcbc..78bb7f78 100644 --- a/expcore/gui/progress-bar.lua +++ b/expcore/gui/progress-bar.lua @@ -25,8 +25,8 @@ local Global = require 'utils.global' local Game = require 'utils.game' --- Event call for when the value is outside the range 0-1 --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event local function event_call(define,element) local player = Game.get_player_by_index(element.player_index) @@ -39,8 +39,9 @@ local function event_call(define,element) end --- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam number value the new value for the progress bar local function store_call(define,element,value) if value then element.value = value @@ -71,7 +72,7 @@ Global.register({ end) --- Gets the define data, cant use Gui.get_define as it would error --- @tparam define ?table|string the define to get +-- @tparam ?table|string define the define to get -- @treturn table the define or nil local function get_define(define) if type(define) == 'table' then @@ -84,7 +85,7 @@ local function get_define(define) end --- Gets the element data, used when there is no define --- @tparam element LuaGuiElement +-- @tparam LuaGuiElement element the element to get the data of -- @treturn table the element data simialr to define local function get_element(element) if not element.valid then return end @@ -96,8 +97,8 @@ local function get_element(element) end --- Sets the maximum value that represents the end value of the progress bar --- @tparam element ?LuaGuiElement|string either a gui element or a registered define --- @tparam amount number the amount to have set as the maximum +-- @tparam ?LuaGuiElement|string element either a gui element or a registered define +-- @tparam number amount the amount to have set as the maximum function ProgressBar.set_maximum(element,amount) amount = amount > 0 and amount or error('amount must be greater than 0') @@ -124,8 +125,8 @@ function ProgressBar.set_maximum(element,amount) end --- Increases the value of the progressbar, if a define is given all of its instances are incremented --- @tapram element ?LuaGuiElement|string either a gui element or a registered define --- @tparam[opt=1] amount number the amount to increase the progressbar by +-- @tparam ?LuaGuiElement|string element either a gui element or a registered define +-- @tparam[opt=1] number amount the amount to increase the progressbar by function ProgressBar.increment(element,amount) amount = type(amount) == 'number' and amount or 1 @@ -151,8 +152,8 @@ function ProgressBar.increment(element,amount) end --- Decreases the value of the progressbar, if a define is given all of its instances are decresed --- @tapram element ?LuaGuiElement|string either a gui element or a registered define --- @tparam[opt=1] amount number the amount to decrease the progressbar by +-- @tparam ?LuaGuiElement|string element either a gui element or a registered define +-- @tparam[opt=1] number amount the amount to decrease the progressbar by function ProgressBar.decrement(element,amount) amount = type(amount) == 'number' and amount or 1 @@ -178,7 +179,7 @@ function ProgressBar.decrement(element,amount) end --- Creates a new progressbar element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new progressbar elemente define function ProgressBar.new_progressbar(name) local self = Gui._define_factory(ProgressBar._prototype) @@ -220,7 +221,7 @@ function ProgressBar.new_progressbar(name) end --- Sets the maximum value that represents the end value of the progress bar --- @tparam amount number the amount to have set as the maximum +-- @tparam number amount the amount to have set as the maximum -- @treturn table the define to allow chaining function ProgressBar._prototype:set_default_maximum(amount) amount = amount > 0 and amount or error('amount must be greater than 0') @@ -229,7 +230,7 @@ function ProgressBar._prototype:set_default_maximum(amount) end --- Will set the progress bar to start at 1 and trigger when it hits 0 --- @tparam[opt=true] state boolean when true the bar will start filled, to be used with decrease +-- @tparam[opt=true] boolean state when true the bar will start filled, to be used with decrease -- @treturn table the define to allow chaining function ProgressBar._prototype:use_count_down(state) if state == false then @@ -241,9 +242,10 @@ function ProgressBar._prototype:use_count_down(state) end --- Main logic for changing the value of a progress bar, this only applies when its a registered define --- @tparam self table the define that is being changed --- @tparam amount number the amount which it is being changed by, may be negative --- @tparam[opt] category string the category to use with store +-- @tparam table self the define that is being changed +-- @tparam number amount the amount which it is being changed by, may be negative +-- @tparam[opt] string category the category to use with store +-- @tparam[opt] function filter when given the filter must return true for the value of the element to be changed local function change_value_prototype(self,amount,category,filter) local function reset_store() @@ -298,32 +300,32 @@ local function change_value_prototype(self,amount,category,filter) end --- Increases the value of the progressbar --- @tparam[opt=1] amount number the amount to increase the progressbar by --- @tparam[opt] category string the category that is used with a store +-- @tparam[opt=1] number amount the amount to increase the progressbar by +-- @tparam[opt] string category the category that is used with a store function ProgressBar._prototype:increment(amount,category) amount = type(amount) == 'number' and amount or 1 change_value_prototype(self,amount,category) end --- Increases the value of the progressbar, if the filter condition is met, does not work with store --- @tparam[opt=1] amount number the amount to increase the progressbar by --- @tparam[opt] category string the category that is used with a store +-- @tparam[opt=1] number amount the amount to increase the progressbar by +-- @tparam function filter the filter to be used function ProgressBar._prototype:increment_filtered(amount,filter) amount = type(amount) == 'number' and amount or 1 change_value_prototype(self,amount,nil,filter) end --- Decreases the value of the progressbar --- @tparam[opt=1] amount number the amount to decrease the progressbar by --- @tparam[opt] category string the category that is used with a store +-- @tparam[opt=1] number amount the amount to decrease the progressbar by +-- @tparam[opt] string category the category that is used with a store function ProgressBar._prototype:decrement(amount,category) amount = type(amount) == 'number' and amount or 1 change_value_prototype(self,-amount,category) end --- Decreases the value of the progressbar, if the filter condition is met, does not work with store --- @tparam[opt=1] amount number the amount to decrease the progressbar by --- @tparam[opt] category string the category that is used with a store +-- @tparam[opt=1] number amount the amount to decrease the progressbar by +-- @tparam function filter the filter to be used function ProgressBar._prototype:decrement_filtered(amount,filter) amount = type(amount) == 'number' and amount or 1 change_value_prototype(self,-amount,nil,filter) @@ -331,8 +333,8 @@ end --- 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 --- @tparam element LuaGuiElement the element that you want to add into the waiting to complete list --- @tparam[opt] maximum number the maximum for this element if not given the default for this define is used +-- @tparam LuaGuiElement element the element that you want to add into the waiting to complete list +-- @tparam[opt] number maximum the maximum for this element if not given the default for this define is used function ProgressBar._prototype:add_element(element,maximum) if self.store then return end if not ProgressBar.independent[self.name] then @@ -345,7 +347,7 @@ function ProgressBar._prototype:add_element(element,maximum) end --- Resets an element, or its store, to be back at the start, either 1 or 0 --- @tparam element LuaGuiElement the element that you want to reset the progress of +-- @tparam LuaGuiElement element the element that you want to reset the progress of function ProgressBar._prototype:reset_element(element) if not element or not element.valid then return end local value = self.count_down and 1 or 0 @@ -358,7 +360,7 @@ function ProgressBar._prototype:reset_element(element) end --- Event handler factory that counts up by 1 every time the event triggeres, can filter which elements are incremented --- @tparam[opt] filter function when given will use filtered incerement +-- @tparam[opt] function filter when given will use filtered incerement -- @treturn function the event handler function ProgressBar._prototype:event_counter(filter) if type(filter) == 'function' then @@ -373,7 +375,7 @@ function ProgressBar._prototype:event_counter(filter) end --- Event handler factory that counts down by 1 every time the event triggeres, can filter which elements are decremented --- @tparam[opt] filter function when given will use filtered decerement +-- @tparam[opt] function filter when given will use filtered decerement -- @treturn function the event handler function ProgressBar._prototype:event_countdown(filter) if type(filter) == 'function' then diff --git a/expcore/gui/slider.lua b/expcore/gui/slider.lua index 7c0df3ee..f8bdef5e 100644 --- a/expcore/gui/slider.lua +++ b/expcore/gui/slider.lua @@ -18,9 +18,9 @@ local Instances = require 'expcore.gui.instances' local Game = require 'utils.game' --- Event call for on_value_changed and store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value number the new value for the slider +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam number value the new value for the slider local function event_call(define,element,value) local player = Game.get_player_by_index(element.player_index) @@ -43,9 +43,9 @@ local function event_call(define,element,value) end --- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value number the new value for the slider +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam number value the new value for the slider local function store_call(define,element,value) element.slider_value = value event_call(define,element,value) @@ -61,7 +61,7 @@ local Slider = { } --- Creates a new slider element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new slider element define function Slider.new_slider(name) @@ -116,7 +116,7 @@ function Slider.new_slider(name) end --- Adds notches to the slider --- @tparam[opt] state boolean when true will draw notches onto the slider +-- @tparam[opt] boolean state when true will draw notches onto the slider function Slider._prototype:use_notches(state) if state == false then self.draw_data.style = nil @@ -127,8 +127,8 @@ function Slider._prototype:use_notches(state) end --- Sets the range of a slider, if not used will use default values for a slider --- @tparam[opt] min number the minimum value that the slider can take --- @tparam[opt] max number the maximum value that the slider can take +-- @tparam[opt] number min the minimum value that the slider can take +-- @tparam[opt] number max the maximum value that the slider can take -- @treturn self the define to allow chaining function Slider._prototype:set_range(min,max) self.min = min @@ -146,7 +146,7 @@ function Slider._prototype:set_range(min,max) end --- 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 --- @tparam element LuaGuiElement the parent element that the lable will be drawn to +-- @tparam LuaGuiElement element the parent element that the lable will be drawn to -- @treturn LuaGuiElement the new label element so that styles can be applied function Slider._prototype:draw_label(element) local name = self.name..'-label' @@ -173,7 +173,7 @@ function Slider._prototype:draw_label(element) end --- Enables auto draw of the label, the label will share the same parent element as the slider --- @tparam[opt=true] state boolean when false will disable the auto draw of the label +-- @tparam[opt=true] boolean state when false will disable the auto draw of the label -- @treturn self the define to allow chaining function Slider._prototype:enable_auto_draw_label(state) if state == false then diff --git a/expcore/gui/text.lua b/expcore/gui/text.lua index 3a06e439..4fb5b43f 100644 --- a/expcore/gui/text.lua +++ b/expcore/gui/text.lua @@ -18,9 +18,9 @@ local Gui = require 'expcore.gui.core' local Game = require 'utils.game' --- Event call for on_text_changed and store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new text for the text field +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new text for the text field local function event_call(define,element,value) local player = Game.get_player_by_index(element.player_index) @@ -31,12 +31,12 @@ local function event_call(define,element,value) end --- Store call for store update --- @tparam define table the define that this is acting on --- @tparam element LuaGuiElement the element that triggered the event --- @tparam value string the new text for the text field -local function store_call(self,element,value) +-- @tparam table define the define that this is acting on +-- @tparam LuaGuiElement element the element that triggered the event +-- @tparam string value the new text for the text field +local function store_call(define,element,value) element.text = value - event_call(self,element,value) + event_call(define,element,value) end local Text = { @@ -55,7 +55,7 @@ local Text = { } --- Creates a new text field element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new text field element define function Text.new_text_field(name) @@ -105,7 +105,7 @@ function Text.new_text_field(name) end --- Creates a new text box element define --- @tparam[opt] name string the optional debug name that can be added +-- @tparam[opt] string name the optional debug name that can be added -- @treturn table the new text box element define function Text.new_text_box(name) local self = Text.new_text_field(name) @@ -118,7 +118,7 @@ function Text.new_text_box(name) end --- Sets the text box to be selectable --- @tparam[opt=true] state boolean when false will set the state to false +-- @tparam[opt=true] boolean state when false will set the state to false -- @treturn self table the define to allow for chaining function Text._prototype_box:set_selectable(state) if state == false then @@ -130,7 +130,7 @@ function Text._prototype_box:set_selectable(state) end --- Sets the text box to have word wrap --- @tparam[opt=true] state boolean when false will set the state to false +-- @tparam[opt=true] boolean state when false will set the state to false -- @treturn self table the define to allow for chaining function Text._prototype_box:set_word_wrap(state) if state == false then @@ -142,7 +142,7 @@ function Text._prototype_box:set_word_wrap(state) end --- Sets the text box to be read only --- @tparam[opt=true] state boolean when false will set the state to false +-- @tparam[opt=true] boolean state when false will set the state to false -- @treturn self table the define to allow for chaining function Text._prototype_box:set_read_only(state) if state == false then diff --git a/expcore/gui/toolbar.lua b/expcore/gui/toolbar.lua index 4c384dcc..9c83541d 100644 --- a/expcore/gui/toolbar.lua +++ b/expcore/gui/toolbar.lua @@ -36,7 +36,7 @@ function Toolbar.permission_alias(define_name,permisison_name) end --- Adds a new button to the toolbar --- @tparam[opt] name string when given allows an alias to the button for the permission system +-- @tparam[opt] string name when given allows an alias to the button for the permission system -- @treturn table the button define function Toolbar.new_button(name) local button = @@ -51,7 +51,7 @@ function Toolbar.new_button(name) end --- Adds an existing buttton to the toolbar --- @tparam button table the button define for the button to be added +-- @tparam table button the button define for the button to be added function Toolbar.add_button(button) table.insert(Toolbar.buttons,button) Gui.allow_player_to_toggle_top_element_visibility(button.name) @@ -66,7 +66,7 @@ function Toolbar.add_button(button) end --- Updates the player's toolbar with an new buttons or expected change in auth return --- @tparam player LuaPlayer the player to update the toolbar for +-- @tparam LuaPlayer player the player to update the toolbar for function Toolbar.update(player) local top = Gui.get_top_element_flow(player) if not top then return end diff --git a/expcore/permission_groups.lua b/expcore/permission_groups.lua index a237bf80..a87f3b18 100644 --- a/expcore/permission_groups.lua +++ b/expcore/permission_groups.lua @@ -59,7 +59,7 @@ local Permissions_Groups = { } --- Defines a new permission group that can have it actions set in the config --- @tparam name string the name of the new group +-- @tparam string name the name of the new group -- @treturn Permissions_Groups._prototype the new group made with function to allow and disallow actions function Permissions_Groups.new_group(name) local group = setmetatable({ @@ -74,14 +74,14 @@ function Permissions_Groups.new_group(name) end --- Returns the group with the given name, case sensitive --- @tparam name string the name of the group to get +-- @tparam string name the name of the group to get -- @treturn ?Permissions_Groups._prototype|nil the group with that name or nil if non found function Permissions_Groups.get_group_by_name(name) return Permissions_Groups.groups[name] end --- Returns the group that a player is in --- @tparam LuaPlayer the player to get the group of can be LuaPlayer name index etc +-- @tparam LuaPlayer player the player to get the group of can be name index etc -- @treturn ?Permissions_Groups._prototype|nil the group with that player or nil if non found function Permissions_Groups.get_group_from_player(player) player = Game.get_player_from_any(player) @@ -100,7 +100,7 @@ function Permissions_Groups.reload_permissions() end --- Removes all permissions from every permission group except for "Default" and any passed as exempt --- @tparam string|Array any groups that you want to be except, "Default" is always exempt +-- @tparam ?string|Array exempt groups that you want to be except, "Default" is always exempt -- @treturn number the number of groups that had they permissions removed function Permissions_Groups.lockdown_permissions(exempt) local count = 0 @@ -126,8 +126,8 @@ function Permissions_Groups.lockdown_permissions(exempt) end --- Sets a player's group to the one given, a player can only have one group at a time --- @tparam LuaPlayer the player to effect can be LuaPlayer name index etc --- @tparam string the name of the group to give to the player +-- @tparam LuaPlayer player the player to effect can be name index etc +-- @tparam string group the name of the group to give to the player -- @treturn boolean true if the player was added successfully, false other wise function Permissions_Groups.set_player_group(player,group) player = Game.get_player_from_any(player) @@ -138,8 +138,8 @@ function Permissions_Groups.set_player_group(player,group) end --- Sets the allow state of an action for this group, used internally but is safe to use else where --- @tparam action ?string|defines.input_action the action that you want to set the state of --- @tparam state boolean the state that you want to set it to, true = allow, false = disallow +-- @tparam ?string|defines.input_action action the action that you want to set the state of +-- @tparam boolean state the state that you want to set it to, true = allow, false = disallow -- @treturn Permissions_Groups._prototype returns self so function can be chained function Permissions_Groups._prototype:set_action(action,state) if type(action) == 'string' then @@ -150,7 +150,7 @@ function Permissions_Groups._prototype:set_action(action,state) end --- Sets an action or actions to be allowed for this group even with disallow_all triggered, Do not use in runtime --- @tparam string|Array the action or actions that you want to allow for this group +-- @tparam string|Array actions the action or actions that you want to allow for this group -- @treturn Permissions_Groups._prototype returns self so function can be chained function Permissions_Groups._prototype:allow(actions) if type(actions) ~= 'table' then @@ -163,7 +163,7 @@ function Permissions_Groups._prototype:allow(actions) end --- Sets an action or actions to be disallowed for this group even with allow_all triggered, Do not use in runtime --- @tparam string|Array the action or actions that you want to disallow for this group +-- @tparam string|Array actions the action or actions that you want to disallow for this group -- @treturn Permissions_Groups._prototype returns self so function can be chained function Permissions_Groups._prototype:disallow(actions) if type(actions) ~= 'table' then @@ -190,7 +190,7 @@ function Permissions_Groups._prototype:disallow_all() end --- Returns if an input action is allowed for this group --- @tparam action ?string|defines.input_action the action that you want to test for +-- @tparam ?string|defines.input_action action the action that you want to test for -- @treturn boolean true if the group is allowed the action, false other wise function Permissions_Groups._prototype:is_allowed(action) if type(action) == 'string' then @@ -223,7 +223,7 @@ function Permissions_Groups._prototype:create() end --- Adds a player to this group --- @tparam player LuaPlayer the player you want to add to this group can be LuaPlayer name or index etc +-- @tparam LuaPlayer player LuaPlayer the player you want to add to this group can be name or index etc -- @treturn boolean true if the player was added successfully, false other wise function Permissions_Groups._prototype:add_player(player) player = Game.get_player_from_any(player) @@ -234,7 +234,7 @@ function Permissions_Groups._prototype:add_player(player) end --- Removes a player from this group --- @tparam player LuaPlayer the player you want to remove from this group can be LuaPlayer name or index etc +-- @tparam LuaPlayer player LuaPlayer the player you want to remove from this group can be name or index etc -- @treturn boolean true if the player was removed successfully, false other wise function Permissions_Groups._prototype:remove_player(player) player = Game.get_player_from_any(player) @@ -245,7 +245,7 @@ function Permissions_Groups._prototype:remove_player(player) end --- Returns all player that are in this group with the option to filter to online/offline only --- @tparam[opt] online boolean if nil returns all players, if true online players only, if false returns online players only +-- @tparam[opt] boolean online if nil returns all players, if true online players only, if false returns online players only -- @treturn table a table of players that are in this group; filtered if online param is given function Permissions_Groups._prototype:get_players(online) local players = {} @@ -265,7 +265,7 @@ function Permissions_Groups._prototype:get_players(online) end --- Prints a message to every player in this group --- @tparam message string the message that you want to send to the players +-- @tparam string message the message that you want to send to the players -- @treturn number the number of players that received the message function Permissions_Groups._prototype:print(message) local players = self:get_players(true) diff --git a/expcore/roles.lua b/expcore/roles.lua index ec088fef..9dddcbb4 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -246,8 +246,8 @@ function Roles.debug() end --- Prints a message to all players in the given roles, may send duplicate message however factorio blocks spam --- @tparam roles table a table of roles which to send the message to --- @tparam message string the message to send to the players +-- @tparam table roles table a of roles which to send the message to +-- @tparam string message the message to send to the players function Roles.print_to_roles(roles,message) for _,role in pairs(roles) do role = Roles.get_role_from_any(role) @@ -256,8 +256,8 @@ function Roles.print_to_roles(roles,message) end --- Prints a message to all players who have the given role or one which is higher (excluding default) --- @tparam role string the name of the role to send the message to --- @tparam message string the message to send to the players +-- @tparam string role the name of the role to send the message to +-- @tparam string message the message to send to the players function Roles.print_to_roles_higher(role,message) role = Roles.get_role_from_any(role) if not role then return end @@ -271,8 +271,8 @@ function Roles.print_to_roles_higher(role,message) end --- Prints a message to all players who have the given role or one which is lower (excluding default) --- @tparam role string the name of the role to send the message to --- @tparam message string the message to send to the players +-- @tparam string role the name of the role to send the message to +-- @tparam string message the message to send to the players function Roles.print_to_roles_lower(role,message) role = Roles.get_role_from_any(role) if not role then return end @@ -286,14 +286,14 @@ function Roles.print_to_roles_lower(role,message) end --- Get a role for the given name --- @tparam name string the name of the role to get +-- @tparam string name the name of the role to get -- @treturn Roles._prototype the role with that name or nil function Roles.get_role_by_name(name) return Roles.config.roles[name] end --- Get a role with the given order index --- @tparam index number the place in the oder list of the role to get +-- @tparam number index the place in the oder list of the role to get -- @treturn Roles._prototype the role with that index in the order list or nil function Roles.get_role_by_order(index) local name = Roles.config.order[index] @@ -302,7 +302,7 @@ end --- Gets a role from a name,index or role object (where it is just returned) -- nb: this function is used for the input for most outward facing functions --- @tparam any ?number|string|table the value used to find the role +-- @tparam ?number|string|table any the value used to find the role -- @treturn Roles._prototype the role that was found or nil see above function Roles.get_role_from_any(any) local tany = type(any) @@ -317,7 +317,7 @@ function Roles.get_role_from_any(any) end --- Gets all the roles of the given player, this will always contain the default role --- @tparam player LuaPlayer the player to get the roles of +-- @tparam LuaPlayer player the player to get the roles of -- @treturn table a table where the values are the roles which the player has function Roles.get_player_roles(player) player = Game.get_player_from_any(player) @@ -332,7 +332,7 @@ function Roles.get_player_roles(player) end --- Gets the highest role which the player has, can be used to compeer one player to another --- @tparam player LuaPlayer the player to get the highest role of +-- @tparam LuaPlayer player the player to get the highest role of -- @treturn the role with the highest order index which this player has function Roles.get_player_highest_role(player) local roles = Roles.get_player_roles(player) @@ -347,10 +347,10 @@ function Roles.get_player_highest_role(player) end --- Gives a player the given role(s) with an option to pass a by player name used in the log --- @tparam player LuaPlayer the player that will be assigned the roles --- @tparam role table a table of roles that the player will be given, can be one role and can be role names --- @tparam[opt=] by_player_name string the name of the player that will be shown in the log --- @tparam[opt=false] silent boolean when true there will be no game message printed +-- @tparam LuaPlayer player the player that will be assigned the roles +-- @tparam table roles table a of roles that the player will be given, can be one role and can be role names +-- @tparam[opt=] string by_player_name the name of the player that will be shown in the log +-- @tparam[opt=false] boolean silent when true there will be no game message printed function Roles.assign_player(player,roles,by_player_name,silent) player = Game.get_player_from_any(player) if not player then return end @@ -367,10 +367,10 @@ function Roles.assign_player(player,roles,by_player_name,silent) end --- Removes a player from the given role(s) with an option to pass a by player name used in the log --- @tparam player LuaPlayer the player that will have the roles removed --- @tparam roles table a table of roles to be removed from the player, can be one role and can be role names --- @tparam[opt=] by_player_name string the name of the player that will be shown in the logs --- @tparam[opt=false] silent boolean when true there will be no game message printed +-- @tparam LuaPlayer player the player that will have the roles removed +-- @tparam table roles table a of roles to be removed from the player, can be one role and can be role names +-- @tparam[opt=] string by_player_name the name of the player that will be shown in the logs +-- @tparam[opt=false] boolean silent when true there will be no game message printed function Roles.unassign_player(player,roles,by_player_name,silent) player = Game.get_player_from_any(player) if not player then return end @@ -387,14 +387,14 @@ function Roles.unassign_player(player,roles,by_player_name,silent) end --- Overrides all player roles with the given table of roles, useful to mass set roles on game start --- @tparam roles table a table which is indexed by case sensitive player names and has the value of a table of role names +-- @tparam table roles table a which is indexed by case sensitive player names and has the value of a table of role names function Roles.override_player_roles(roles) Roles.config.players = roles end --- A test for weather a player has the given role --- @tparam player LuaPlayer the player to test the roles of --- @tparam search_role ?string|number|table a pointer to the role that is being searched for +-- @tparam LuaPlayer player the player to test the roles of +-- @tparam ?string|number|table search_role a pointer to the role that is being searched for -- @treturn boolean true if the player has the role, false otherwise, nil for errors function Roles.player_has_role(player,search_role) local roles = Roles.get_player_roles(player) @@ -408,8 +408,8 @@ function Roles.player_has_role(player,search_role) end --- A test for weather a player has the given flag true for at least one of they roles --- @tparam player LuaPlayer the player to test the roles of --- @tparam flag_name string the name of the flag that is being looked for +-- @tparam LuaPlayer player the player to test the roles of +-- @tparam string flag_name the name of the flag that is being looked for -- @treturn boolean true if the player has at least one role which has the flag set to true, false otherwise, nil for errors function Roles.player_has_flag(player,flag_name) local roles = Roles.get_player_roles(player) @@ -423,8 +423,8 @@ function Roles.player_has_flag(player,flag_name) end --- A test for weather a player has at least one role which is allowed the given action --- @tparam player LuaPlayer the player to test the roles of --- @tparam action string the name of the action that is being tested for +-- @tparam LuaPlayer player the player to test the roles of +-- @tparam string action the name of the action that is being tested for -- @treturn boolean true if the player has at least one role which is allowed this action, false otherwise, nil for errors function Roles.player_allowed(player,action) local roles = Roles.get_player_roles(player) @@ -439,7 +439,7 @@ end --- Used to set the role order, higher in the list is better, must be called at least once in config -- nb: function also re links parents due to expected position in the config file --- @tparam order table a table which is keyed only by numbers (start 1) and values are roles in order with highest first +-- @tparam table order table a which is keyed only by numbers (start 1) and values are roles in order with highest first function Roles.define_role_order(order) -- Clears and then rebuilds the order table Roles.config.order = {} @@ -462,8 +462,8 @@ function Roles.define_role_order(order) end --- Defines a new trigger for when a tag is added or removed from a player --- @tparam name string the name of the flag which the roles will have --- @tparam callback function the function that is called when roles are assigned +-- @tparam string name the name of the flag which the roles will have +-- @tparam function callback the function that is called when roles are assigned -- flag param - player - the player that has had they roles changed -- flag param - state - the state of the flag, aka if the flag is present function Roles.define_flag_trigger(name,callback) @@ -471,7 +471,7 @@ function Roles.define_flag_trigger(name,callback) end --- Sets the default role which every player will have, this needs to be called at least once --- @tparam name string the name of the default role +-- @tparam string name the name of the default role function Roles.set_default(name) local role = Roles.config.roles[name] if not role then return end @@ -479,7 +479,7 @@ function Roles.set_default(name) end --- Sets the root role which will always have all permissions, any server actions act from this role --- @tparam name string the name of the root role +-- @tparam string name the name of the root role function Roles.set_root(name) local role = Roles.config.roles[name] if not role then return end @@ -488,8 +488,8 @@ function Roles.set_root(name) end --- Defines a new role and returns the prototype to allow configuration --- @tparam name string the name of the new role, must be unique --- @tparam[opt=name] shirt_hand string the shortened version of the name +-- @tparam string name the name of the new role, must be unique +-- @tparam[opt=name] string short_hand the shortened version of the name -- @treturn Roles._prototype the start of the config chain for this role function Roles.new_role(name,short_hand) if Roles.config.roles[name] then return error('Role name is non unique') end @@ -505,7 +505,7 @@ function Roles.new_role(name,short_hand) end --- Sets the default allow state of the role, true will allow all actions --- @tparam[opt=true] strate boolean true will allow all actions +-- @tparam[opt=true] boolean state true will allow all actions -- @treturn Roles._prototype allows chaining function Roles._prototype:set_allow_all(state) if state == nil then state = true end @@ -514,7 +514,7 @@ function Roles._prototype:set_allow_all(state) end --- Sets the allow actions for this role, actions in this list will be allowed for this role --- @tparam actions table indexed with numbers and is an array of action names, order has no effect +-- @tparam table actions indexed with numbers and is an array of action names, order has no effect -- @treturn Roles._prototype allows chaining function Roles._prototype:allow(actions) if type(actions) ~= 'table' then @@ -527,7 +527,7 @@ function Roles._prototype:allow(actions) end --- Sets the disallow actions for this role, will prevent actions from being allowed regardless of inheritance --- @tparam actions table indexed with numbers and is an array of action names, order has no effect +-- @tparam table actions indexed with numbers and is an array of action names, order has no effect -- @treturn Roles._prototype allows chaining function Roles._prototype:disallow(actions) if type(actions) ~= 'table' then @@ -540,7 +540,7 @@ function Roles._prototype:disallow(actions) end --- Test for if a role is allowed the given action, mostly internal see Roles.player_allowed --- @tparam action string the name of the action to test if it is allowed +-- @tparam string action the name of the action to test if it is allowed -- @treturn boolean true if action is allowed, false otherwise function Roles._prototype:is_allowed(action) local is_root = Roles.config.internal.root.name == self.name @@ -548,8 +548,8 @@ function Roles._prototype:is_allowed(action) end --- Sets the state of a flag for a role, flags can be used to apply effects to players --- @tparam name string the name of the flag to set the value of --- @tparam[opt=true] value boolean the state to set the flag to +-- @tparam string name the name of the flag to set the value of +-- @tparam[opt=true] boolean value the state to set the flag to -- @treturn Roles._prototype allows chaining function Roles._prototype:set_flag(name,value) if value == nil then value = true end @@ -565,14 +565,14 @@ function Roles._prototype:clear_flags() end --- A test for if the role has a flag set --- @tparam name string the name of the flag to test for +-- @tparam string name the name of the flag to test for -- @treturn boolean true if the flag is set, false otherwise function Roles._prototype:has_flag(name) return self.flags[name] or false end --- Sets a custom player tag for the role, can be accessed by other code --- @tparam tag string the value that the tag will be +-- @tparam string tag the value that the tag will be -- @treturn Roles._prototype allows chaining function Roles._prototype:set_custom_tag(tag) self.custom_tag = tag @@ -580,7 +580,7 @@ function Roles._prototype:set_custom_tag(tag) end --- Sets a custom colour for the role, can be accessed by other code --- @tparam color ?string|table can either be and rgb colour table or the name of a colour defined in the presets +-- @tparam table color ?string|table can either be and rgb colour or the name of a colour defined in the presets -- @treturn Roles._prototype allows chaining function Roles._prototype:set_custom_color(color) if type(color) ~= 'table' then @@ -591,8 +591,8 @@ function Roles._prototype:set_custom_color(color) end --- Sets the permission group for this role, players will be moved to the group of they highest role --- @tparam name string the name of the permission group to have players moved to --- @tparam[opt=false] use_factorio_api boolean when true the custom permission group module is ignored +-- @tparam string name the name of the permission group to have players moved to +-- @tparam[opt=false] boolean use_factorio_api when true the custom permission group module is ignored -- @treturn Roles._prototype allows chaining function Roles._prototype:set_permission_group(name,use_factorio_api) if use_factorio_api then @@ -607,7 +607,7 @@ end --- Sets the parent for a role, any action not in allow or disallow will be looked for in its parents -- nb: this is a recursive action, and changing the allows and disallows will effect all children roles --- @tparam role string the name of the role that will be the parent; has imminent effect if role is already defined +-- @tparam string role the name of the role that will be the parent; has imminent effect if role is already defined -- @treturn Roles._prototype allows chaining function Roles._prototype:set_parent(role) self.parent = role @@ -619,7 +619,7 @@ end --- Sets an auto promote condition that is checked every 5 seconds, if true is returned then the player will recive the role -- nb: this is one way, failing false after already gaining the role will not revoke the role --- @tparam callback function receives only one param which is player to promote, return true to promote the player +-- @tparam function callback receives only one param which is player to promote, return true to promote the player -- @treturn Roles._prototype allows chaining function Roles._prototype:set_auto_promote_condition(callback) self.auto_promote_condition = callback @@ -627,7 +627,7 @@ function Roles._prototype:set_auto_promote_condition(callback) end --- Sets the role to not allow players to have auto promote effect them, useful to keep people locked to a punishment --- @tparam[opt=true] state boolean when true the players with this role will not be auto promoted +-- @tparam[opt=true] boolean state when true the players with this role will not be auto promoted -- @treturn Roles._prototype allows chaining function Roles._prototype:set_block_auto_promote(state) if state == nil then state = true end @@ -636,9 +636,9 @@ function Roles._prototype:set_block_auto_promote(state) end --- Adds a player to this role, players can have more than one role at a time, used internally see Roles.assign --- @tparam player LuaPlayer the player that will be given this role --- @tparam skip_check boolean when true player will be taken as the player name (use when player has not yet joined) --- @tparam skip_event boolean when true the event emit will be skipped, this is used internally with Roles.assign +-- @tparam LuaPlayer player the player that will be given this role +-- @tparam boolean skip_check when true player will be taken as the player name (use when player has not yet joined) +-- @tparam boolean skip_event when true the event emit will be skipped, this is used internally with Roles.assign -- @treturn boolean true if the player was added successfully function Roles._prototype:add_player(player,skip_check,skip_event) player = Game.get_player_from_any(player) @@ -670,9 +670,9 @@ function Roles._prototype:add_player(player,skip_check,skip_event) end --- Removes a player from this role, players can have more than one role at a time, used internally see Roles.unassign --- @tparam player LuaPlayer the player that will lose this role --- @tparam skip_check boolean when true player will be taken as the player name (use when player has not yet joined) --- @tparam skip_event boolean when true the event emit will be skipped, this is used internally with Roles.unassign +-- @tparam LuaPlayer player the player that will lose this role +-- @tparam boolean skip_check when true player will be taken as the player name (use when player has not yet joined) +-- @tparam boolean skip_event when true the event emit will be skipped, this is used internally with Roles.unassign -- @treturn boolean true if the player was removed successfully function Roles._prototype:remove_player(player,skip_check,skip_event) player = Game.get_player_from_any(player) @@ -709,7 +709,7 @@ function Roles._prototype:remove_player(player,skip_check,skip_event) end --- Returns an array of all the players who have this role, can be filtered by online status --- @tparam[opt=nil] online boolean when given will filter by this online state, nil will return all players +-- @tparam[opt=nil] boolean online when given will filter by this online state, nil will return all players -- @treturn table all the players who have this role, indexed order is meaningless function Roles._prototype:get_players(online) local players = {} @@ -740,7 +740,7 @@ function Roles._prototype:get_players(online) end --- Will print a message to all players with this role --- @tparam message string the message that will be printed to the players +-- @tparam string message the message that will be printed to the players -- @treturn number the number of players who received the message function Roles._prototype:print(message) local players = self:get_players(true) diff --git a/expcore/store.lua b/expcore/store.lua index f391dbd2..7a05be78 100644 --- a/expcore/store.lua +++ b/expcore/store.lua @@ -108,7 +108,7 @@ Global.register(Store.data,function(tbl) end) --- Check for if a lcoation is registered --- @tparam location string the location to test for +-- @tparam string location the location to test for -- @treturn boolean true if registered function Store.is_registered(location) return not not Store.callbacks[location] @@ -121,9 +121,9 @@ function Store.uid_location() end --- Registers a new location with an update callback which is triggered when the value updates --- @tparam location string a unique string that points to the data, string used rather than token to allow migration --- @tparam callback function this callback will be called when the stored value is set to a new value --- @tparam[opt] start_value any this value will be the inital value that is stored at this location +-- @tparam string location string a unique that points to the data, string used rather than token to allow migration +-- @tparam function callback this callback will be called when the stored value is set to a new value +-- @tparam[opt] any start_value this value will be the inital value that is stored at this location function Store.register(location,callback,start_value) if _LIFECYCLE ~= _STAGE.control then return error('Can only be called during the control stage', 2) @@ -144,9 +144,9 @@ function Store.register(location,callback,start_value) end --- Registers a new cross server synced location with an update callback, and external script is required for cross server --- @tparam location string a unique string that points to the data, string used rather than token to allow migration --- @tparam callback function this callback will be called when the stored value is set to a new value --- @tparam[opt] start_value any this value will be the inital value that is stored at this location +-- @tparam string location string a unique that points to the data, string used rather than token to allow migration +-- @tparam function callback this callback will be called when the stored value is set to a new value +-- @tparam[opt] any start_value this value will be the inital value that is stored at this location function Store.register_synced(location,callback,start_value) if _LIFECYCLE ~= _STAGE.control then return error('Can only be called during the control stage', 2) @@ -166,8 +166,8 @@ function Store.register_synced(location,callback,start_value) end --- Adds a function that will be checked every tick for a change in the returned value, when the value changes it will be saved in the store --- @tparam location string the location where the data will be saved and compeared to, must already be a registered location --- @tparam callback function this function will be called every tick to check for a change in value +-- @tparam string location the location where the data will be saved and compeared to, must already be a registered location +-- @tparam function callback this function will be called every tick to check for a change in value function Store.add_watch(location,callback) if _LIFECYCLE ~= _STAGE.control then return error('Can only be called during the control stage', 2) @@ -185,8 +185,8 @@ function Store.add_watch(location,callback) end --- Gets the value stored at a location, this location must be registered --- @tparam location string the location to get the data from --- @tparam[opt=false] no_error boolean when true no error is returned if the location is not registered +-- @tparam string location the location to get the data from +-- @tparam[opt=false] boolean no_error when true no error is returned if the location is not registered -- @treturn any the data which was stored at the location function Store.get(location,no_error) if not Store.callbacks[location] and not no_error then @@ -197,8 +197,8 @@ function Store.get(location,no_error) end --- Sets the value at a location, this location must be registered, if server synced it will emit the change to file --- @tparam location string the location to set the data to --- @tparam value any the new value to set at the location, value may be reverted if there is a watch callback +-- @tparam string location the location to set the data to +-- @tparam any value the new value to set at the location, value may be reverted if there is a watch callback -- @treturn boolean true if it was successful function Store.set(location,value) if not Store.callbacks[location] then @@ -220,7 +220,7 @@ end --- Gets all non nil children at a location, children can be added and removed during runtime -- this is similar to Store.get but will always return a table even if it is empty --- @tparam location string the location to get the children of +-- @tparam string location the location to get the children of -- @treturn table a table containg all the children and they values function Store.get_children(location) local store = Store.get(location) @@ -233,8 +233,8 @@ function Store.get_children(location) end --- Gets the value of the child to a location, children can be added and removed during runtime --- @tparam location string the location of which the child is located --- @tparam child string the child element to get the value of +-- @tparam string location the location of which the child is located +-- @tparam string child the child element to get the value of -- @treturn any the value which was stored at that location function Store.get_child(location,child) local store = Store.get(location) @@ -249,9 +249,9 @@ end --- Sets the value of the chlid to a location, children can be added and removed during runtime -- when a child is set it will call the update handler of the parent allowing children be to added at runtime -- this may be used when a player joins the game and the child is the players name --- @tparam location string the location of which the child is located --- @tparam child string the child element to set the value of --- @tparam value any the value to set at this location +-- @tparam string location the location of which the child is located +-- @tparam string child the child element to set the value of +-- @tparam any value the value to set at this location -- @treturn boolean true if it was successful function Store.set_child(location,child,value) local store = Store.get(location) diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index cbe75b0c..e8511ff0 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -63,7 +63,7 @@ Event.on_nth_tick(config.message_cycle, circle_messages) --- This will add a compilatron to the global and start his message cycle -- @tparam entity LuaEntity the compilatron entity that moves around --- @tparam name string the name of the location that the complitron is at +-- @tparam string name the name of the location that the complitron is at function Public.add_compilatron(entity, name) if not entity and not entity.valid then return @@ -80,8 +80,8 @@ function Public.add_compilatron(entity, name) end --- This spawns a new compilatron on a surface with the given location tag (not a position) --- @tparam surface LuaSurface the surface to spawn the compilatron on --- @tparam location string the location tag that is in the config file +-- @tparam LuaSurface surface the surface to spawn the compilatron on +-- @tparam string location the location tag that is in the config file function Public.spawn_compilatron(surface,location) local position = locations[location] local pos = surface.find_non_colliding_position('compilatron', position, 1.5, 0.5) diff --git a/modules/addons/jail-control.lua b/modules/addons/jail-control.lua index 2706f0a1..054e7dd9 100644 --- a/modules/addons/jail-control.lua +++ b/modules/addons/jail-control.lua @@ -31,8 +31,8 @@ local function event_emit(event,player,by_player_name,reason) end --- Jails a player, this is only the logic there is no output to players --- @tparam player LuaPlayer the player that will be jailed, must not be in jail --- @tparam[opt=''] by_player_name string the name of the player doing the action used in logs +-- @tparam LuaPlayer player the player that will be jailed, must not be in jail +-- @tparam[opt=''] string by_player_name the name of the player doing the action used in logs -- @treturn the number of roles that were removed, nil if there was an error function Public.jail_player(player,by_player_name) player = Game.get_player_from_any(player) @@ -47,8 +47,8 @@ function Public.jail_player(player,by_player_name) end --- Unjails a player, this is only the logic there is no output to players --- @tparam player LuaPlayer the player that will be unjailed, must be in jail --- @tparam[opt=''] by_player_name string string the name of the player who is doing the action +-- @tparam LuaPlayer player the player that will be unjailed, must be in jail +-- @tparam[opt=''] string string by_player_name the name of the player who is doing the action -- @treturn the number of roles that were added, nil if there was an error function Public.unjail_player(player,by_player_name) player = Game.get_player_from_any(player) @@ -62,9 +62,9 @@ function Public.unjail_player(player,by_player_name) end --- Temp bans a player which is similar to jail but will store the reason for the action and clears items --- @tparam player LuaPlayer the player that will be temp baned, must not be temp banned --- @tparam[opt=''] by_player_name string the name of the player that is doing the action --- @tparam[opt='None Given.'] reason string the reason that will be stored for this temp ban +-- @tparam LuaPlayer player the player that will be temp baned, must not be temp banned +-- @tparam[opt=''] string by_player_name the name of the player that is doing the action +-- @tparam[opt='None string Given.'] reason the reason that will be stored for this temp ban -- @treturn boolean true if successful else will return nil function Public.temp_ban_player(player,by_player_name,reason) player = Game.get_player_from_any(player) @@ -81,8 +81,8 @@ function Public.temp_ban_player(player,by_player_name,reason) end --- Removes temp ban from a player, note this does not restore the items --- @tparam player LuaPlayer the player that will be cleared from temp baned, must be temp banned --- @tparam[opt=''] by_player_name string the name of the player that is doing the action +-- @tparam LuaPlayer player the player that will be cleared from temp baned, must be temp banned +-- @tparam[opt=''] string by_player_name the name of the player that is doing the action -- @treturn boolean true if successful else will return nil function Public.clear_temp_ban_player(player,by_player_name) player = Game.get_player_from_any(player) diff --git a/modules/addons/reports-control.lua b/modules/addons/reports-control.lua index e71b97f5..673f3f3c 100644 --- a/modules/addons/reports-control.lua +++ b/modules/addons/reports-control.lua @@ -24,9 +24,9 @@ local function event_emit(event,player,by_player_name) end --- Adds a report to a player, reports are stored in global table and can be accessed later --- @tparam player LuaPlayer the player that will be reported --- @tparam[opt='Non Given.'] reason string the reason that the player is being reported --- @tparam[opt=''] by_player_name string the name of the player doing the action +-- @tparam LuaPlayer player the player that will be reported +-- @tparam[opt='Non string Given.'] reason the reason that the player is being reported +-- @tparam[opt=''] string by_player_name the name of the player doing the action -- @treturn boolean true if the report was added, nil if there is an error function Public.report_player(player,reason,by_player_name) player = Game.get_player_from_any(player) @@ -46,8 +46,8 @@ function Public.report_player(player,reason,by_player_name) end --- Removes a report from a player by the given player, see clear_player_reports to remove all --- @tparam player LuaPlayer the player that will have the report removed --- @tparam[opt=''] by_player_name string the name of the player doing the action +-- @tparam LuaPlayer player the player that will have the report removed +-- @tparam[opt=''] string by_player_name the name of the player doing the action -- @treturn boolean true if the report was removed, nil if there was an error function Public.remove_player_report(player,by_player_name) player = Game.get_player_from_any(player) @@ -66,7 +66,7 @@ function Public.remove_player_report(player,by_player_name) end --- Clears all reports from a player, will emit an event for each individual report as if remove_player_report was used --- @tparam player LuaPlayer the player to clear the reports of +-- @tparam LuaPlayer player the player to clear the reports of -- @treturn boolean true if the reports were cleared, nil if error function Public.clear_player_reports(player) player = Game.get_player_from_any(player) @@ -83,9 +83,9 @@ function Public.clear_player_reports(player) end --- Test for if a player has been reported by another player, can also return the reason from that player --- @tparam player LuaPlayer the player to check the reports of --- @tparam by_player_name string the player that made if the report if present (note server is not default here) --- @tparam[opt=false] rtn_reason boolean true will return the reason for the report rather than a boolean +-- @tparam LuaPlayer player the player to check the reports of +-- @tparam string by_player_name the player that made if the report if present (note server is not default here) +-- @tparam[opt=false] boolean rtn_reason true will return the reason for the report rather than a boolean -- @treturn boolean true if a report from the player is present unless rtn_reason is true when a string is returned (or false) function Public.player_is_reported_by(player,by_player_name,rtn_reason) player = Game.get_player_from_any(player) @@ -98,7 +98,7 @@ function Public.player_is_reported_by(player,by_player_name,rtn_reason) end --- Gets all the reports that are on a player --- @tparam player LuaPlayer the player to get the reports of +-- @tparam LuaPlayer player the player to get the reports of -- @treturn table a table of all the reports for this player, empty table if no reports function Public.get_player_reports(player) player = Game.get_player_from_any(player) @@ -107,8 +107,8 @@ function Public.get_player_reports(player) end --- Counts all reports on a player returning a number, a custom count function can be given which should return a number --- @tparam player LuaPlayer the player to count the reports of --- @tparam[opt] count_callback function should return a number or true (for 1) this will be passed every report on the player +-- @tparam LuaPlayer player the player to count the reports of +-- @tparam[opt] number function count_callback should return a or true (for 1) this will be passed every report on the player -- count_callback param - player_name string - the name of the player who made the report -- count_callback param - reason string - the reason the reason was made -- count_callback return - number or boolean - if number then this will be added to the count, if boolean then false = 0 and true = 1 diff --git a/modules/addons/warnings-control.lua b/modules/addons/warnings-control.lua index bb19e7aa..616ef3d1 100644 --- a/modules/addons/warnings-control.lua +++ b/modules/addons/warnings-control.lua @@ -36,9 +36,9 @@ local function event_emit(event,player,by_player_name) end --- Adds X number (default 1) of warnings to a player from the given player --- @tparam player LuaPlayer the player to add the warning to --- @tparam[opt=''] by_player_name string the name of the player doing the action --- @tparam[opt=1] count number the number of warnings to add +-- @tparam LuaPlayer player the player to add the warning to +-- @tparam[opt=''] string by_player_name the name of the player doing the action +-- @tparam[opt=1] number count the number of warnings to add -- @treturn number the new number of warnings function Public.add_warnings(player,by_player_name,count) player = Game.get_player_from_any(player) @@ -58,9 +58,9 @@ function Public.add_warnings(player,by_player_name,count) end --- Removes X number (default 1) of warnings from a player, removes in order fifo --- @tparam player LuaPlayer the player to remove the warnings from --- @tparam[opt=''] by_playey_name string the name of the player doing the action --- @tparam[opt=1] count number the number of warnings to remove (if greater than current warning count then all are removed) +-- @tparam LuaPlayer player the player to remove the warnings from +-- @tparam[opt=''] string by_playey_name the name of the player doing the action +-- @tparam[opt=1] number count the number of warnings to remove (if greater than current warning count then all are removed) -- @treturn number the new number of warnings function Public.remove_warnings(player,by_player_name,count) player = Game.get_player_from_any(player) @@ -82,8 +82,8 @@ function Public.remove_warnings(player,by_player_name,count) end --- Clears all warnings from a player, emits event multiple times as if remove_warnings was used --- @tparam player LuaPlayer the player to clear the warnings of --- @tparam[oot=''] by_player_name string the name of the player who is doing the action +-- @tparam LuaPlayer player the player to clear the warnings of +-- @tparam[oot=''] string by_player_name the name of the player who is doing the action -- @treturn boolean true if the warnings were cleared, nil if error function Public.clear_warnings(player,by_player_name) player = Game.get_player_from_any(player) @@ -99,8 +99,8 @@ function Public.clear_warnings(player,by_player_name) end --- Gets the number of warnings that a player has, raw table will contain the names of who gave warnings --- @tparam player LuaPlayer the player to get the warnings of --- @tparam[opt=false] raw_table when true will return a table which contains who gave warnings (the table stored in global) +-- @tparam LuaPlayer player the player to get the warnings of +-- @tparam[opt=false] table table raw_table when true will return a which contains who gave warnings (the stored in global) -- @treturn number the number of warnings a player has, a table if raw_table is true function Public.get_warnings(player,raw_table) player = Game.get_player_from_any(player) @@ -114,8 +114,8 @@ function Public.get_warnings(player,raw_table) end --- Adds a temp warning to a player that will timeout after some time, used for script given warnings (ie silent to outside players as a buffer) --- @tparam player LuaPlayer the player to give the warnings to --- @tparam[opt=1] count number the number of warnings to give to the player +-- @tparam LuaPlayer player the player to give the warnings to +-- @tparam[opt=1] number count the number of warnings to give to the player -- @treturn number the new number of warnings function Public.add_temp_warnings(player,count) player = Game.get_player_from_any(player) @@ -153,8 +153,8 @@ Event.on_nth_tick(temp_warning_cool_down/4,function() end) --- Clears all temp warnings from a player, emits events as if the warnings had been removed due to time --- @tparam player LuaPlayer the player to clear the warnings of --- @tparam[opt=''] by_player_name string the name of the player doing the action +-- @tparam LuaPlayer player the player to clear the warnings of +-- @tparam[opt=''] string by_player_name the name of the player doing the action -- @treturn boolean true if the warnings were cleared, nil for error function Public.clear_temp_warnings(player,by_player_name) player = Game.get_player_from_any(player) @@ -170,8 +170,8 @@ function Public.clear_temp_warnings(player,by_player_name) end --- Gets the number of temp warnings, raw table is a table of when temp warnings were given --- @tparam player LuaPlayer the player to get the warnings of --- @tparam[opt=false] raw_table if true will return a table of ticks when warnings were added (the global table) +-- @tparam LuaPlayer player the player to get the warnings of +-- @tparam[opt=false] table raw_table if true will return a of ticks when warnings were added (the global table) -- @treturn number the number of warnings which the player has, a table if raw_table is true function Public.get_temp_warnings(player,raw_table) player = Game.get_player_from_any(player) diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index 51752618..217ff43f 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -33,8 +33,8 @@ end) --- Adds a callback function when the interface command is used -- nb: returned value is saved in the env that the interface uses --- @tparam name string the name that the value is loaded under, cant use upvalues --- @tparam callback function the function that will run whent he command is used +-- @tparam string name the name that the value is loaded under, cant use upvalues +-- @tparam function callback the function that will run whent he command is used -- callback param - player: LuaPlayer - the player who used the command local function add_interface_callback(name,callback) if type(callback) == 'function' then diff --git a/modules/gui/debug/_g_view.lua b/modules/gui/debug/_g_view.lua index 3cf4bbd2..2e484eb8 100644 --- a/modules/gui/debug/_g_view.lua +++ b/modules/gui/debug/_g_view.lua @@ -1,3 +1,4 @@ +--non-luadoc=true local Gui = require 'utils.gui' local Model = require 'modules.gui.debug.model' local Color = require 'resources.color_presets' diff --git a/old/modules/DONE/Core/Command/control.lua b/old/modules/DONE/Core/Command/control.lua index 72cdde36..ffe85e73 100644 --- a/old/modules/DONE/Core/Command/control.lua +++ b/old/modules/DONE/Core/Command/control.lua @@ -24,7 +24,7 @@ function commands.add_middleware(callback) if not is_type(callback,'function') t -- @field commands.data -- @usage commands.command_name -- returns command data -- @usage commands.data -- returns all data --- @tparam ?string|table|event key the command that will be returned: string is the name, table is the command data, event is event from add_command +-- @tparam string table ?string|table|event key the command that will be returned: is the name, is the command data, event is event from add_command -- @treturn table the command data setmetatable(commands,{ __index=function(tbl,key) return is_type(key,'table') and (key.command and rawget(commandDataStore,key.name) or key) or key == 'data' and commandDataStore or rawget(commandDataStore,key) end @@ -242,9 +242,9 @@ end --- Used to define commands -- @usage --see examples in file -- @tparam string name the name of the command --- @tparam[opt='No Description'] string description the description of the command --- @tparam[opt=an infinite string] table inputs a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word) --- @tparam function callback the function to call on the event +-- @tparam[opt='No string Description'] description the description of the command +-- @tparam[opt=an table table infinite string] inputs a of the inputs to be used, last index being true makes the last parameter open ended (longer than one word) +-- @tparam function function callback the to call on the event commands.add_command = function(name, description, inputs, callback) if commands[name] then error('That command is already registered',2) end if not is_type(name,'string') then error('Command name has not been given') end diff --git a/old/modules/DONE/Core/Group/control.lua b/old/modules/DONE/Core/Group/control.lua index 97843d35..5c1e42fb 100644 --- a/old/modules/DONE/Core/Group/control.lua +++ b/old/modules/DONE/Core/Group/control.lua @@ -40,7 +40,7 @@ _GroupSelfRef=Group --- Defines a new instance of a group -- @usage Group.define{name='foo',disallow={'edit_permission_group','delete_permission_group','add_permission_group'}} -- returns new group -- @usage Group{name='foo',disallow={'edit_permission_group','delete_permission_group','add_permission_group'}} -- returns new group --- @tparam table obj contains string name and table disallow of defines.input_action +-- @tparam string table table obj contains name and disallow of defines.input_action -- @treturn Group the group which has been made function Group.define(obj) if not type_error(game,nil,'Cant define Group during runtime.') then return end diff --git a/old/modules/DONE/Core/Gui/control.lua b/old/modules/DONE/Core/Gui/control.lua index 1ffe615f..0c9968f9 100644 --- a/old/modules/DONE/Core/Gui/control.lua +++ b/old/modules/DONE/Core/Gui/control.lua @@ -48,7 +48,7 @@ end --- Adds a label that is centered -- @usage Gui.centered_label(frame, 'Hello, world!') -- @tparam LuaGuiElement frame the parent frame to add the label to --- @tparam string string the string that the label will have +-- @tparam string string string the that the label will have function Gui.centered_label(frame, string) local flow = frame.add {frame = 'flow'} local flow_style = flow.style diff --git a/old/modules/DONE/Core/Gui/inputs/control.lua b/old/modules/DONE/Core/Gui/inputs/control.lua index 9d6aab03..1da9afee 100644 --- a/old/modules/DONE/Core/Gui/inputs/control.lua +++ b/old/modules/DONE/Core/Gui/inputs/control.lua @@ -28,7 +28,7 @@ inputs.events = { --- Sets the input to trigger on an certain event -- @usage button:on_event(defines.events.on_gui_click,player_return) -- @param event the event to raise callback on | can be number of the event | can be a key of inputs.events --- @tparam function callback the function you want to run on the event +-- @tparam function function callback the you want to run on the event -- @treturn table returns self so you can chain together function inputs._prototype:on_event(event,callback) if not is_type(callback,'function') then return self end @@ -311,8 +311,8 @@ end -- @tparam string orientation direction of the slider -- @tparam number min the lowest number -- @tparam number max the highest number --- @tparam function start_callback either a number or a function to return a number --- @tparam function callback the function to be called on value_changed function(player,value,percent,element) +-- @tparam number function function start_callback either a or a to return a number +-- @tparam function function callback the to be called on value_changed function(player,value,percent,element) -- @treturn table the slider object that was made, to allow a custom error event if wanted function inputs.add_slider(name,orientation,min,max,start_callback,callback) local slider = inputs.add{ diff --git a/old/modules/DONE/Core/Gui/toolbar/control.lua b/old/modules/DONE/Core/Gui/toolbar/control.lua index a31f2d98..4bc95bb4 100644 --- a/old/modules/DONE/Core/Gui/toolbar/control.lua +++ b/old/modules/DONE/Core/Gui/toolbar/control.lua @@ -38,7 +38,7 @@ end) -- @tparam string name the name of the button -- @tparam string caption can be a sprite path or text to show -- @tparam string tooltip the help to show for the button --- @tparam function callback the function which is called on_click +-- @tparam function function callback the which is called on_click -- @treturn table the button object that was made, calling the returned value will draw the toolbar button added function toolbar.add(name,caption,tooltip,callback) verbose('Created Toolbar Button: '..name) diff --git a/old/modules/DONE/Core/Role/control.lua b/old/modules/DONE/Core/Role/control.lua index fa049446..61a32206 100644 --- a/old/modules/DONE/Core/Role/control.lua +++ b/old/modules/DONE/Core/Role/control.lua @@ -80,7 +80,7 @@ function Role.set_preassign(tbl) if game then global.preassign = tbl else Role.p --- Defines a new instance of a role -- @usage Role.define{name='Root',short_hand='Root',tag='[Root]',group='Root',colour={r=255,b=255,g=255},is_root=true,allow={}} -- returns new role -- @usage Role{name='Root',short_hand='Root',tag='[Root]',group='Root',colour={r=255,b=255,g=255},is_root=true,allow={}} -- returns new role --- @tparam table obj contains the strings: name,short_hand,tag a table called allow a table called colour and a pointer to a permission group +-- @tparam table table obj contains the strings: name,short_hand,tag a called allow a table called colour and a pointer to a permission group -- @treturn Role the role which has been made function Role.define(obj) if not type_error(game,nil,'Cant define Role during runtime.') then return end @@ -127,7 +127,7 @@ end -- @usage Role.assign(player,'Root') -- @usage Role.assign(player,{'Root','Foo'}) -- @tparam ?LuaPlayer|pointerToPlayer player the player to assign the role to --- @tparam ?string|role|table the role to add the player to, if its a table then it will act recursively though the table +-- @tparam table ?string|role|table the role to add the player to, if its a then it will act recursively though the table -- @tparam[opt=''] ?LuaPlayer|pointerToPlayer by_player the player who assigned the roles to the player -- @tparam[opt] table batch this is used internally to prevent multiple event calls, contains {role_index_in_batch,batch} -- @treturn boolean was the player assigned the roles @@ -153,7 +153,7 @@ end --- Used to remove a player from a role(s) -- @usage Role.unassign(player,'Root') -- @tparam ?LuaPlayer|pointerToPlayer player the player to unassign the role to --- @tparam ?string|role|table role the role to remove the player from, if its a table then it will act recursively though the table +-- @tparam table ?string|role|table role the role to remove the player from, if its a then it will act recursively though the table -- @tparam[opt=''] ?LuaPlayer|pointerToPlayer by_player the player who unassigned the roles from the player -- @tparam[opt] table batch this is used internally to prevent multiple event calls -- @treturn boolean was the player unassigned the roles @@ -179,7 +179,7 @@ end --- Returns the highest role given in a list, if a player is passed then it returns the highest role of the player -- @usage Role.get_highest{'Root','Admin','Mod'} -- returns Root (given that root is highest) -- @usage Role.get_highest(player) -- returns the players highest role --- @tparam ?table|LuaPlayer|pointerToPlayer options table of options or a player +-- @tparam table ?table|LuaPlayer|pointerToPlayer options of options or a player -- @treturn role the highest role given in the options function Role.get_highest(options) local player = Game.get_player(options) @@ -199,7 +199,7 @@ end -- @usage Role.revert(player) -- reverts the last change to the players roles -- @tparam ?LuaPlayer|pointerToPlayer player the player to revert the changes of -- @tparam[opt] ?LuaPlayer|pointerToPlayer the player who preformed the role revert --- @tparam[opt=1] count the number of reverts to do, if 0 all changes cached are reverted +-- @tparam[opt=1] number count the of reverts to do, if 0 all changes cached are reverted -- @treturn number the number of changes that occurred function Role.revert(player,by_player,count) player = Game.get_player(player) @@ -224,7 +224,7 @@ end --- Adds a flag which can be set on roles; these flags act as a quick way to access general role changes -- @usage Role.add_flag('is_admin',function(player,state) player.admin = state end) -- the function is passed player and if the flag is true or false -- @tparam string flag the name of the flag that is being added --- @tparam[opt] function callback the function(player,state) which is called when a player loses or gains a flag, if nil no function is called +-- @tparam[opt] function function callback the function(player,state) which is called when a player loses or gains a flag, if nil no is called function Role.add_flag(flag,callback) if not type_error(flag,'string','Invalid argument #1 to Role.add_flag, flag is not a string.') then return end if callback and not type_error(callback,'function','Invalid argument #2 to Role.add_flag, callback is not a function.') then return end diff --git a/old/modules/DONE/ExpGamingLib/control.lua b/old/modules/DONE/ExpGamingLib/control.lua index 77b4685c..5bc65516 100644 --- a/old/modules/DONE/ExpGamingLib/control.lua +++ b/old/modules/DONE/ExpGamingLib/control.lua @@ -12,7 +12,7 @@ local ExpLib = {} --- Loads a table into _G even when sandboxes; will not overwrite values or append to tables; will not work during runtime to avoid desyncs -- @usage unpack_to_G{key1='foo',key2='bar'} --- @tparam table tbl table to be unpacked +-- @tparam table table tbl to be unpacked function ExpLib.unpack_to_G(tbl) if not type(tbl) == 'table' or game then return end for key,value in pairs(tbl) do @@ -60,9 +60,9 @@ end --- Creates a table that will act like a string and a function -- @usage add_metatable({},function) -- returns table --- @tparam table tbl the table that will have its metatable set --- @tparam[opt=tostring] function callback the function that will be used for the call --- @tparam[opt=table.tostring] ?function|string string a function that resolves to a string or a string +-- @tparam table table tbl the that will have its metatable set +-- @tparam[opt=tostring] function function callback the that will be used for the call +-- @tparam[opt=table.tostring] function string string ?function|string a that resolves to a or a string -- @treturn table the new table with its metatable set function ExpLib.add_metatable(tbl,callback,string) if not ExpLib.is_type(tbl,'table') then error('No table given to add_metatable',2) end @@ -98,7 +98,7 @@ end --- A specialised version of type_error to test for self -- @usage self_test(self,'Object','get_name') --- @tparam table self the table that is the object +-- @tparam table table self the that is the object -- @tparam string prototype_name the name of the class -- @tparam string function_name the name of the function function ExpLib.self_test(self,prototype_name,function_name) @@ -240,7 +240,7 @@ end --- Returns a table in a form able to be read as a table -- @usage table.tostring{k1='foo',k2='bar'} -- return '{["k1"]="foo",["k2"]="bar"}' --- @tparam table tbl table to convert +-- @tparam table table tbl to convert -- @treturn string the converted table function table.tostring(tbl) if type(tbl) ~= 'table' then return tostring(tbl) end @@ -260,7 +260,7 @@ end --- Similar to table.tostring but converts a lua table to a json one -- @usage table.json{k1='foo',k2='bar'} -- return '{"k1":"foo","k2":"bar"}' --- @tparam table lua_table the table to convert +-- @tparam table table lua_table the to convert -- @treturn string the table in a json format function table.json(lua_table) --if game and game.table_to_json then return game.table_to_json(lua_table) end @@ -288,8 +288,8 @@ end --- Returns the closest match to a key -- @usage table.autokey({foo=1,bar=2},'f') -- return 1 --- @tparam table tbl the table that will be searched --- @tparam string str the string that will be looked for in the keys +-- @tparam table table tbl the that will be searched +-- @tparam string string str the that will be looked for in the keys function table.autokey(tbl,str) if not ExpLib.is_type(str,'string') then return end local _return = {} @@ -301,7 +301,7 @@ end --- Returns the list is a sorted way that would be expected by people (this is by key) -- @usage tbl = table.alphanumsort(tbl) --- @tparam table tbl the table to be sorted +-- @tparam table table tbl the to be sorted -- @treturn table the sorted table function table.alphanumsort(tbl) local o = table.keys(tbl) @@ -317,7 +317,7 @@ end --- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) -- @usage tbl = table.alphanumsort(tbl) --- @tparam table tbl the table to be sorted +-- @tparam table table tbl the to be sorted -- @treturn table the sorted table function table.keysort(tbl) local o = table.keys(tbl,true) diff --git a/old/modules/DONE/FactorioStdLib/Color/control.lua b/old/modules/DONE/FactorioStdLib/Color/control.lua index 9ccedbc5..e7eeae1f 100644 --- a/old/modules/DONE/FactorioStdLib/Color/control.lua +++ b/old/modules/DONE/FactorioStdLib/Color/control.lua @@ -177,7 +177,7 @@ end --- Get a color table with a hexadecimal string. -- Optionally provide the value for the alpha channel. --- @tparam string hex hexadecimal color string (#ffffff, not #fff) +-- @tparam string string hex hexadecimal color (#ffffff, not #fff) -- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]*** -- @treturn a color table with RGB converted from Hex and with alpha function Color.from_hex(hex, alpha) diff --git a/old/modules/DONE/FactorioStdLib/Game/control.lua b/old/modules/DONE/FactorioStdLib/Game/control.lua index b7608965..1c783c38 100644 --- a/old/modules/DONE/FactorioStdLib/Game/control.lua +++ b/old/modules/DONE/FactorioStdLib/Game/control.lua @@ -36,7 +36,7 @@ end --- Print msg if specified var evaluates to false. -- @tparam Mixed var variable to evaluate --- @tparam[opt="missing value"] string msg message +-- @tparam[opt="missing string value"] msg message function Game.fail_if_missing(var, msg) if not var then error(msg or "Missing value", 3) diff --git a/old/modules/DONE/FactorioStdLib/String/control.lua b/old/modules/DONE/FactorioStdLib/String/control.lua index 24ff26ad..48ccea0b 100644 --- a/old/modules/DONE/FactorioStdLib/String/control.lua +++ b/old/modules/DONE/FactorioStdLib/String/control.lua @@ -5,14 +5,14 @@ -- luacheck: globals string (Allow mutating string) --- Returns a copy of the string with any leading or trailing whitespace from the string removed. --- @tparam string s the string to remove leading or trailing whitespace from +-- @tparam string string s the to remove leading or trailing whitespace from -- @treturn string a copy of the string without leading or trailing whitespace function string.trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end --- Tests if a string starts with a given substring. --- @tparam string s the string to check for the start substring +-- @tparam string string s the to check for the start substring -- @tparam string start the substring to test for -- @treturn boolean true if the start substring was found in the string function string.starts_with(s, start) @@ -20,7 +20,7 @@ function string.starts_with(s, start) end --- Tests if a string ends with a given substring. --- @tparam string s the string to check for the end substring +-- @tparam string string s the to check for the end substring -- @tparam string ends the substring to test for -- @treturn boolean true if the end substring was found in the string function string.ends_with(s, ends) @@ -28,7 +28,7 @@ function string.ends_with(s, ends) end --- Tests if a string contains a given substring. --- @tparam string s the string to check for the substring +-- @tparam string string s the to check for the substring -- @tparam string contains the substring to test for -- @treturn boolean true if the substring was found in the string function string.contains(s, contains) @@ -36,7 +36,7 @@ function string.contains(s, contains) end --- Tests whether a string is empty. --- @tparam string s the string to test +-- @tparam string string s the to test -- @treturn boolean true if the string is empty function string.is_empty(s) return s == nil or s == '' @@ -45,9 +45,9 @@ end --- Splits a string into an array. -- *Note:* Empty split substrings are not included in the resulting table. --

    For example, `string.split("foo.bar...", ".", false)` results in the table `{"foo", "bar"}`. --- @tparam string s the string to split +-- @tparam string string s the to split -- @tparam[opt="."] string sep the separator to use. --- @tparam[opt=false] boolean pattern whether to interpret the separator as a lua pattern or plaintext for the string split +-- @tparam[opt=false] string boolean pattern whether to interpret the separator as a lua pattern or plaintext for the split -- @treturn {string,...} an array of strings function string.split(s, sep, pattern) sep = sep or "." @@ -76,7 +76,7 @@ end --- Returns a string as a hex format (also a string) -- @usage a = 'foo' -- string.to_hex(a) -- return '666f6f' --- @tparam string str the string to encode +-- @tparam string string str the to encode -- @treturn string the hex format of the string function string.to_hex(str) if not is_type(str,'string') then return '' end diff --git a/old/modules/DONE/FactorioStdLib/Table/control.lua b/old/modules/DONE/FactorioStdLib/Table/control.lua index 04f048fc..e9196e1c 100644 --- a/old/modules/DONE/FactorioStdLib/Table/control.lua +++ b/old/modules/DONE/FactorioStdLib/Table/control.lua @@ -11,8 +11,8 @@ ---table.map(a, function(v) return v * 10 end) --produces: { 10, 20, 30, 40, 50 } --- @usage a = {1, 2, 3, 4, 5} ---table.map(a, function(v, k, x) return v * k + x end, 100) --produces { 101, 104, 109, 116, 125} --- @tparam table tbl the table to be mapped to the transform --- @tparam function func the function to transform values +-- @tparam table table tbl the to be mapped to the transform +-- @tparam function function func the to transform values -- @param[opt] ... additional arguments passed to the function -- @treturn table a new table containing the keys and mapped values function table.map(tbl, func, ...) @@ -30,8 +30,8 @@ end ---table.filter(a, function(v) return v % 2 == 0 end) --produces: { 2, 4 } --- @usage a = {1, 2, 3, 4, 5} ---table.filter(a, function(v, k, x) return k % 2 == 1 end) --produces: { 1, 3, 5 } --- @tparam table tbl the table to be filtered --- @tparam function func the function to filter values +-- @tparam table table tbl the to be filtered +-- @tparam function function func the to filter values -- @param[opt] ... additional arguments passed to the function -- @treturn table a new table containing the filtered key-value pairs function table.filter(tbl, func, ...) @@ -53,8 +53,8 @@ end ---table.find(a, function(v) return v % 2 == 0 end) --produces: 2 --- @usage a = {1, 2, 3, 4, 5} ---table.find(a, function(v, k, x) return k % 2 == 1 end) --produces: 1 --- @tparam table tbl the table to be searched --- @tparam function func the function to use to search for any matching element +-- @tparam table table tbl the to be searched +-- @tparam function any func the function to use to search for matching element -- @param[opt] ... additional arguments passed to the function -- @treturn ?|nil|Mixed the first found value, or nil if none was found function table.find(tbl, func, ...) @@ -68,7 +68,7 @@ end --- Finds the first index at which the value appears in the table -- @usage table.index({'foo','bar','baz'},'bar') -- retuns 2,'bar' --- @tparam table tbl the table to search though +-- @tparam table table tbl the to search though -- @param value the value you want the index of -- @treturn number the index that the value apeears at -- @return the value in that possition @@ -83,7 +83,7 @@ end --- Returns a boolean on weather the table includes the value or not -- @usage table.includes({'foo','bar','baz'},'bar') -- retuns true --- @tparam table tbl the table to search though +-- @tparam table table tbl the to search though -- @param value the value you want the index of -- @treturn boolean if the table includes the value function table.includes(tbl, value) @@ -100,8 +100,8 @@ end -- Passes the index as second argument to the function. -- @usage a= { 1, 2, 3, 4, 5} table.any(a, function(v) return v % 2 == 0 end) --produces: true -- @usage a = {1, 2, 3, 4, 5} table.any(a, function(v, k, x) return k % 2 == 1 end) --produces: true --- @tparam table tbl the table to be searched --- @tparam function func the function to use to search for any matching element +-- @tparam table table tbl the to be searched +-- @tparam function any func the function to use to search for matching element -- @param[opt] ... additional arguments passed to the function -- @treturn boolean true if an element was found, false if none was found function table.any(tbl, func, ...) @@ -114,8 +114,8 @@ end -- @usage -- a = {10, 20, 30, 40} -- table.each(a, function(v) game.print(v) end) --prints 10, 20, 30, 40, 50 --- @tparam table tbl the table to be iterated --- @tparam function func the function to apply to elements +-- @tparam table table tbl the to be iterated +-- @tparam function function func the to apply to elements -- @param[opt] ... additional arguments passed to the function -- @treturn table the table where the given function has been applied to its elements function table.each(tbl, func, ...) @@ -250,7 +250,7 @@ end --- Creates a deep copy of table without copying Factorio objects. -- @usage local copy = table.deepcopy[data.raw.["stone-furnace"]["stone-furnace"]] -- returns a copy of the stone furnace entity --- @tparam table object the table to copy +-- @tparam table table object the to copy -- @treturn table a copy of the table function table.deepcopy(object) local lookup_table = {} @@ -294,7 +294,7 @@ local function sortFunc(x, y) --sorts tables with mixed index types. end --- Returns a copy of all of the values in the table. --- @tparam table tbl the table to copy the keys from, or an empty table if tbl is nil +-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil -- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() -- @tparam[opt] boolean as_string whether to try and parse the values as strings, or leave them as their existing type -- @treturn array an array with a copy of all the values in the table @@ -320,7 +320,7 @@ function table.values(tbl, sorted, as_string) end --- Returns a copy of all of the keys in the table. --- @tparam table tbl the table to copy the keys from, or an empty table if tbl is nil +-- @tparam table table tbl the to copy the keys from, or an empty table if tbl is nil -- @tparam[opt] boolean sorted whether to sort the keys (slower) or keep the random order from pairs() -- @tparam[opt] boolean as_string whether to try and parse the keys as strings, or leave them as their existing type -- @treturn array an array with a copy of all the keys in the table @@ -350,7 +350,7 @@ end --table.remove_keys(a, {1,3}) --returns {nil, 2, nil, 4} -- @usage local b = {k1 = 1, k2 = 'foo', old_key = 'bar'} --table.remove_keys(b, {'old_key'}) --returns {k1 = 1, k2 = 'foo'} --- @tparam table tbl the table to remove the keys from +-- @tparam table table tbl the to remove the keys from -- @tparam {Mixed,...} keys an array of keys that exist in the given table -- @treturn table tbl without the specified keys function table.remove_keys(tbl, keys) @@ -391,7 +391,7 @@ end --table.invert(a) --returns {'foo' = k1, 'bar' = k2} -- @usage local b = {k1 = 'foo', k2 = 'bar', k3 = 'bar'} --table.invert(b) --returns {'foo' = k1, 'bar' = ?} --- @tparam table tbl the table to invert +-- @tparam table table tbl the to invert -- @treturn table a new table with inverted mapping function table.invert(tbl) local inverted = {} @@ -410,7 +410,7 @@ table.size = table_size --- For all string or number values in an array map them to a key = true table -- @usage local a = {"v1", "v2"} -- table.array_to_dict_bool(a) -- return {["v1"] = true, ["v2"]= true} --- @tparam table tbl the table to convert +-- @tparam table table tbl the to convert -- @treturn table the converted table function table.arr_to_bool(tbl) local newtbl = {} diff --git a/old/modules/ExpGamingCore/Server/control.lua b/old/modules/ExpGamingCore/Server/control.lua index 33523468..4de7da63 100644 --- a/old/modules/ExpGamingCore/Server/control.lua +++ b/old/modules/ExpGamingCore/Server/control.lua @@ -206,7 +206,7 @@ end --- Acts as a bypass for running functions, can accept a string -- @usage Server.interface('local x = 1+1 print(x) return x') -- return 2 -- @usage Server.interface('local x = 1+1 print(x)',true) -- will create a thread to run as root (this is the bypass) --- @tparam ?string|function callback function to be ran +-- @tparam function ?string|function callback to be ran -- @tparam[opt] ?Server._thread|true use_thread run the command on a pre-made thread or let it make its own -- @tparam[opt] table env run the env to run the command in must have _env key as true to be -- @param[opt] ... any args you want to pass to the function @@ -467,8 +467,8 @@ end --- Set function to run then an event is triggered, none of them are 'needed' but you are advised to have at least one -- @usage thread:on_event('close',function) -- if event is not one below then a game event is used -- @usage thread_only_events = ['close','timeout','tick','resolve','success','error'] --- @tparam ?string|index event the name of the event that the function should be called on --- @tparam function callback the function which is called by the event trigger +-- @tparam function ?string|index event the name of the event that the should be called on +-- @tparam function function callback the which is called by the event trigger -- @treturn table returns self so that they can be chained together function Server._thread:on_event(event,callback) local events = {'close','timeout','tick','resolve','success','error'} diff --git a/old/modules/ExpGamingCore/Sync/control.lua b/old/modules/ExpGamingCore/Sync/control.lua index 4a780a95..d7511518 100644 --- a/old/modules/ExpGamingCore/Sync/control.lua +++ b/old/modules/ExpGamingCore/Sync/control.lua @@ -104,7 +104,7 @@ end --- Logs an embed to the json.data we use a js script to add things we cant here -- @usage Sync.emit_embedded{title='BAN',color='0x0',description='A player was banned' ... } --- @tparam table args a table which contains everything that the embedded will use +-- @tparam table table args a which contains everything that the embedded will use -- @see EmitEmbededParamaters function Sync.emit_embedded(args) if not is_type(args,'table') then error('Args table not given to Sync.emit_embedded',2) end @@ -282,7 +282,7 @@ end --- Adds a callback to be called when the info is updated -- @usage Sync.add_update('players',function() return #game.players end) -- @tparam string key the key that the value will be stored in --- @tparam function callback the function which will return this value +-- @tparam function function callback the which will return this value function Sync.add_update(key,callback) if game then return end if not is_type(callback,'function') then return end diff --git a/utils/gui.lua b/utils/gui.lua index 8a765dff..8f1427aa 100644 --- a/utils/gui.lua +++ b/utils/gui.lua @@ -192,7 +192,7 @@ end --- Returns the flow where top elements can be added and will be effected by google visibility -- For the toggle to work it must be registed with Gui.allow_player_to_toggle_top_element_visibility(element_name) --- @tparam player LuaPlayer pointer to the player who has the gui +-- @tparam LuaPlayer player pointer to the player who has the gui -- @treturn LuaGuiEelement the top element flow function Gui.get_top_element_flow(player) player = Game.get_player_from_any(player) From 801f942d2914d33a68c7e2adb34f8a2843882b91 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 22:28:53 +0100 Subject: [PATCH 32/41] Renamed Public to Common --- doc/index.html | 6 +- doc/modules/Commands.html | 4 +- doc/modules/{Public.html => Common.html} | 6 +- doc/modules/Permissions_Groups.html | 4 +- doc/modules/config._file_loader.html | 4 +- doc/modules/config.action_buttons.html | 4 +- doc/modules/config.advanced_start.html | 4 +- doc/modules/config.death_logger.html | 4 +- .../config.expcore-commands.auth_admin.html | 4 +- .../config.expcore-commands.auth_roles.html | 4 +- ...expcore-commands.auth_runtime_disable.html | 4 +- ...config.expcore-commands.parse_general.html | 4 +- .../config.expcore-commands.parse_roles.html | 4 +- doc/modules/config.permission_groups.html | 4 +- doc/modules/config.popup_messages.html | 4 +- doc/modules/config.rockets.html | 4 +- doc/modules/config.roles.html | 4 +- doc/modules/config.scorched_earth.html | 4 +- doc/modules/config.spawn_area.html | 4 +- doc/modules/config.warnings.html | 4 +- doc/modules/control.html | 4 +- doc/modules/expcore.gui.buttons.html | 4 +- doc/modules/expcore.gui.center.html | 4 +- doc/modules/expcore.gui.checkboxs.html | 4 +- doc/modules/expcore.gui.core.html | 4 +- doc/modules/expcore.gui.dropdown.html | 4 +- doc/modules/expcore.gui.elem-button.html | 4 +- doc/modules/expcore.gui.html | 4 +- doc/modules/expcore.gui.instances.html | 4 +- doc/modules/expcore.gui.left.html | 4 +- doc/modules/expcore.gui.popups.html | 4 +- doc/modules/expcore.gui.progress-bar.html | 4 +- doc/modules/expcore.gui.slider.html | 4 +- doc/modules/expcore.gui.test.html | 4 +- doc/modules/expcore.gui.text.html | 4 +- doc/modules/expcore.gui.toolbar.html | 4 +- doc/modules/expcore.store.html | 4 +- .../modules.addons.advanced-start.html | 4 +- doc/modules/modules.addons.chat-popups.html | 4 +- doc/modules/modules.addons.damage-popups.html | 4 +- doc/modules/modules.gui.player-list.html | 4 +- doc/modules/modules.gui.rocket-info.html | 4 +- doc/modules/modules.gui.science-info.html | 4 +- doc/modules/modules.gui.task-list.html | 4 +- .../utils.alien_evolution_progress.html | 4 +- doc/modules/utils.core.html | 4 +- doc/modules/utils.debug.html | 4 +- doc/modules/utils.event.html | 4 +- doc/modules/utils.event_core.html | 4 +- doc/modules/utils.math.html | 4 +- doc/modules/utils.recipe_locker.html | 4 +- doc/modules/utils.state_machine.html | 4 +- doc/modules/utils.table.html | 4 +- doc/modules/utils.task.html | 4 +- doc/modules/utils.timestamp.html | 4 +- expcore/common.lua | 124 +++++++++--------- 56 files changed, 174 insertions(+), 174 deletions(-) rename doc/modules/{Public.html => Common.html} (99%) diff --git a/doc/index.html b/doc/index.html index d67b00a1..953f2c7e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -49,7 +49,7 @@

  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -191,7 +191,7 @@
    - + @@ -369,7 +369,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/Commands.html b/doc/modules/Commands.html index 6a622949..5f570a52 100644 --- a/doc/modules/Commands.html +++ b/doc/modules/Commands.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -1300,7 +1300,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/Public.html b/doc/modules/Common.html similarity index 99% rename from doc/modules/Public.html rename to doc/modules/Common.html index def2be2b..346c867c 100644 --- a/doc/modules/Public.html +++ b/doc/modules/Common.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -99,7 +99,7 @@
    -

    Module Public

    +

    Module Common

    Adds some commonly used functions used in many modules

    [[

    @@ -989,7 +989,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/Permissions_Groups.html b/doc/modules/Permissions_Groups.html index d30beee9..33aafbb1 100644 --- a/doc/modules/Permissions_Groups.html +++ b/doc/modules/Permissions_Groups.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -653,7 +653,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config._file_loader.html b/doc/modules/config._file_loader.html index 46c6c81a..3985ea37 100644 --- a/doc/modules/config._file_loader.html +++ b/doc/modules/config._file_loader.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.action_buttons.html b/doc/modules/config.action_buttons.html index d4b608ae..788fe95c 100644 --- a/doc/modules/config.action_buttons.html +++ b/doc/modules/config.action_buttons.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -115,7 +115,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.advanced_start.html b/doc/modules/config.advanced_start.html index afe165e4..bcff9a39 100644 --- a/doc/modules/config.advanced_start.html +++ b/doc/modules/config.advanced_start.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.death_logger.html b/doc/modules/config.death_logger.html index c8037547..ce8702b5 100644 --- a/doc/modules/config.death_logger.html +++ b/doc/modules/config.death_logger.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.expcore-commands.auth_admin.html b/doc/modules/config.expcore-commands.auth_admin.html index 64230092..4eec3011 100644 --- a/doc/modules/config.expcore-commands.auth_admin.html +++ b/doc/modules/config.expcore-commands.auth_admin.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.expcore-commands.auth_roles.html b/doc/modules/config.expcore-commands.auth_roles.html index bbf424a9..177ae679 100644 --- a/doc/modules/config.expcore-commands.auth_roles.html +++ b/doc/modules/config.expcore-commands.auth_roles.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.expcore-commands.auth_runtime_disable.html b/doc/modules/config.expcore-commands.auth_runtime_disable.html index 1a9fd7e4..eaf632bf 100644 --- a/doc/modules/config.expcore-commands.auth_runtime_disable.html +++ b/doc/modules/config.expcore-commands.auth_runtime_disable.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.expcore-commands.parse_general.html b/doc/modules/config.expcore-commands.parse_general.html index 8d39f9fc..fa9562e3 100644 --- a/doc/modules/config.expcore-commands.parse_general.html +++ b/doc/modules/config.expcore-commands.parse_general.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -115,7 +115,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.expcore-commands.parse_roles.html b/doc/modules/config.expcore-commands.parse_roles.html index 7374331c..54625aba 100644 --- a/doc/modules/config.expcore-commands.parse_roles.html +++ b/doc/modules/config.expcore-commands.parse_roles.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.permission_groups.html b/doc/modules/config.permission_groups.html index 5b148167..cf3a80b0 100644 --- a/doc/modules/config.permission_groups.html +++ b/doc/modules/config.permission_groups.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.popup_messages.html b/doc/modules/config.popup_messages.html index d719afa7..1a4a411e 100644 --- a/doc/modules/config.popup_messages.html +++ b/doc/modules/config.popup_messages.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.rockets.html b/doc/modules/config.rockets.html index f00430ba..27876b0a 100644 --- a/doc/modules/config.rockets.html +++ b/doc/modules/config.rockets.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -158,7 +158,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.roles.html b/doc/modules/config.roles.html index 8ca811a6..b94be117 100644 --- a/doc/modules/config.roles.html +++ b/doc/modules/config.roles.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.scorched_earth.html b/doc/modules/config.scorched_earth.html index 01474fac..82f1e1fd 100644 --- a/doc/modules/config.scorched_earth.html +++ b/doc/modules/config.scorched_earth.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.spawn_area.html b/doc/modules/config.spawn_area.html index 314256b2..a3d8fa33 100644 --- a/doc/modules/config.spawn_area.html +++ b/doc/modules/config.spawn_area.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/config.warnings.html b/doc/modules/config.warnings.html index 64511255..afa96974 100644 --- a/doc/modules/config.warnings.html +++ b/doc/modules/config.warnings.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/control.html b/doc/modules/control.html index 912524fd..0151cfeb 100644 --- a/doc/modules/control.html +++ b/doc/modules/control.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.buttons.html b/doc/modules/expcore.gui.buttons.html index 30af2882..94f7a01b 100644 --- a/doc/modules/expcore.gui.buttons.html +++ b/doc/modules/expcore.gui.buttons.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -268,7 +268,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.center.html b/doc/modules/expcore.gui.center.html index bf096aeb..b0c22903 100644 --- a/doc/modules/expcore.gui.center.html +++ b/doc/modules/expcore.gui.center.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -465,7 +465,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.checkboxs.html b/doc/modules/expcore.gui.checkboxs.html index bc0924bd..d5c08478 100644 --- a/doc/modules/expcore.gui.checkboxs.html +++ b/doc/modules/expcore.gui.checkboxs.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -407,7 +407,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.core.html b/doc/modules/expcore.gui.core.html index f87e178c..9b26c60f 100644 --- a/doc/modules/expcore.gui.core.html +++ b/doc/modules/expcore.gui.core.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.dropdown.html b/doc/modules/expcore.gui.dropdown.html index 50b18819..f796fef3 100644 --- a/doc/modules/expcore.gui.dropdown.html +++ b/doc/modules/expcore.gui.dropdown.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -359,7 +359,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.elem-button.html b/doc/modules/expcore.gui.elem-button.html index b6709691..78fcaedf 100644 --- a/doc/modules/expcore.gui.elem-button.html +++ b/doc/modules/expcore.gui.elem-button.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -217,7 +217,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.html b/doc/modules/expcore.gui.html index ffe43e1d..529f0c66 100644 --- a/doc/modules/expcore.gui.html +++ b/doc/modules/expcore.gui.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.instances.html b/doc/modules/expcore.gui.instances.html index 9f036c3c..68442e01 100644 --- a/doc/modules/expcore.gui.instances.html +++ b/doc/modules/expcore.gui.instances.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.left.html b/doc/modules/expcore.gui.left.html index 2394a49a..12eada3e 100644 --- a/doc/modules/expcore.gui.left.html +++ b/doc/modules/expcore.gui.left.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -566,7 +566,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.popups.html b/doc/modules/expcore.gui.popups.html index 1d014f0d..15afc4c7 100644 --- a/doc/modules/expcore.gui.popups.html +++ b/doc/modules/expcore.gui.popups.html @@ -57,7 +57,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -345,7 +345,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.progress-bar.html b/doc/modules/expcore.gui.progress-bar.html index db148260..58889949 100644 --- a/doc/modules/expcore.gui.progress-bar.html +++ b/doc/modules/expcore.gui.progress-bar.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -550,7 +550,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.slider.html b/doc/modules/expcore.gui.slider.html index 4d58666a..bcf7524f 100644 --- a/doc/modules/expcore.gui.slider.html +++ b/doc/modules/expcore.gui.slider.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -281,7 +281,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.test.html b/doc/modules/expcore.gui.test.html index d951fd6b..014cefb2 100644 --- a/doc/modules/expcore.gui.test.html +++ b/doc/modules/expcore.gui.test.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.text.html b/doc/modules/expcore.gui.text.html index d564cf5b..f34a17e8 100644 --- a/doc/modules/expcore.gui.text.html +++ b/doc/modules/expcore.gui.text.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -283,7 +283,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.gui.toolbar.html b/doc/modules/expcore.gui.toolbar.html index b06956ec..1c578bb1 100644 --- a/doc/modules/expcore.gui.toolbar.html +++ b/doc/modules/expcore.gui.toolbar.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -205,7 +205,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/expcore.store.html b/doc/modules/expcore.store.html index e51e8806..d5aa81cc 100644 --- a/doc/modules/expcore.store.html +++ b/doc/modules/expcore.store.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -457,7 +457,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.addons.advanced-start.html b/doc/modules/modules.addons.advanced-start.html index 3f63d65c..b619211a 100644 --- a/doc/modules/modules.addons.advanced-start.html +++ b/doc/modules/modules.addons.advanced-start.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.addons.chat-popups.html b/doc/modules/modules.addons.chat-popups.html index 608bb5b6..3d6e6856 100644 --- a/doc/modules/modules.addons.chat-popups.html +++ b/doc/modules/modules.addons.chat-popups.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.addons.damage-popups.html b/doc/modules/modules.addons.damage-popups.html index 2bb0aca6..307f5a0a 100644 --- a/doc/modules/modules.addons.damage-popups.html +++ b/doc/modules/modules.addons.damage-popups.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.gui.player-list.html b/doc/modules/modules.gui.player-list.html index 098838e2..39274a18 100644 --- a/doc/modules/modules.gui.player-list.html +++ b/doc/modules/modules.gui.player-list.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.gui.rocket-info.html b/doc/modules/modules.gui.rocket-info.html index 295f4644..182cdfd7 100644 --- a/doc/modules/modules.gui.rocket-info.html +++ b/doc/modules/modules.gui.rocket-info.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.gui.science-info.html b/doc/modules/modules.gui.science-info.html index 1c9a9526..5dea5ee0 100644 --- a/doc/modules/modules.gui.science-info.html +++ b/doc/modules/modules.gui.science-info.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/modules.gui.task-list.html b/doc/modules/modules.gui.task-list.html index 55e1aab4..bb085dff 100644 --- a/doc/modules/modules.gui.task-list.html +++ b/doc/modules/modules.gui.task-list.html @@ -52,7 +52,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.alien_evolution_progress.html b/doc/modules/utils.alien_evolution_progress.html index 1db74f11..8395e327 100644 --- a/doc/modules/utils.alien_evolution_progress.html +++ b/doc/modules/utils.alien_evolution_progress.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -151,7 +151,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawners will have 50% on
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.core.html b/doc/modules/utils.core.html index 14d79ff6..0f39df00 100644 --- a/doc/modules/utils.core.html +++ b/doc/modules/utils.core.html @@ -57,7 +57,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -445,7 +445,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.debug.html b/doc/modules/utils.debug.html index d1307dcd..d52a38b5 100644 --- a/doc/modules/utils.debug.html +++ b/doc/modules/utils.debug.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -299,7 +299,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.event.html b/doc/modules/utils.event.html index caa51ff3..708f0421 100644 --- a/doc/modules/utils.event.html +++ b/doc/modules/utils.event.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -561,7 +561,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.event_core.html b/doc/modules/utils.event_core.html index 4c241168..2358f09f 100644 --- a/doc/modules/utils.event_core.html +++ b/doc/modules/utils.event_core.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -197,7 +197,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.math.html b/doc/modules/utils.math.html index 947d4cd6..8d5bff64 100644 --- a/doc/modules/utils.math.html +++ b/doc/modules/utils.math.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -154,7 +154,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.recipe_locker.html b/doc/modules/utils.recipe_locker.html index 5527fd92..e1457859 100644 --- a/doc/modules/utils.recipe_locker.html +++ b/doc/modules/utils.recipe_locker.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -148,7 +148,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.state_machine.html b/doc/modules/utils.state_machine.html index 78414f3b..55295f83 100644 --- a/doc/modules/utils.state_machine.html +++ b/doc/modules/utils.state_machine.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -309,7 +309,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.table.html b/doc/modules/utils.table.html index bdfa0bdb..c7621cea 100644 --- a/doc/modules/utils.table.html +++ b/doc/modules/utils.table.html @@ -57,7 +57,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -576,7 +576,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.task.html b/doc/modules/utils.task.html index 290c641b..cc0fe691 100644 --- a/doc/modules/utils.task.html +++ b/doc/modules/utils.task.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -188,7 +188,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/doc/modules/utils.timestamp.html b/doc/modules/utils.timestamp.html index 7a3c12d3..84b2893a 100644 --- a/doc/modules/utils.timestamp.html +++ b/doc/modules/utils.timestamp.html @@ -56,7 +56,7 @@
  • config.warnings
  • control
  • Commands
  • -
  • Public
  • +
  • Common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -210,7 +210,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:22:59 +Last updated 2019-05-29 22:26:12
    diff --git a/expcore/common.lua b/expcore/common.lua index 674793e3..b640a9ca 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -1,40 +1,40 @@ --- Adds some commonly used functions used in many modules -- @author cooldude2606 --- @module Public +-- @module Common --[[ >>>>Functions List (see function for more detail): - Public.type_check(value,test_type) --- Compare types faster for faster validation of prams - Public.type_check_error(value,test_type,error_message,level) --- Raises an error if the value is of the incorrect type - Public.param_check(value,test_type,param_name,param_number) --- Raises an error when the value is the incorrect type, uses a consistent error message format + Common.type_check(value,test_type) --- Compare types faster for faster validation of prams + Common.type_check_error(value,test_type,error_message,level) --- Raises an error if the value is of the incorrect type + Common.param_check(value,test_type,param_name,param_number) --- Raises an error when the value is the incorrect type, uses a consistent error message format - Public.player_return(value,colour,player) --- Will return a value of any type to the player/server console, allows colour for in-game players - Public.write_json(path,tbl) --- Writes a table object to a file in json format + Common.player_return(value,colour,player) --- Will return a value of any type to the player/server console, allows colour for in-game players + Common.write_json(path,tbl) --- Writes a table object to a file in json format - Public.opt_require(path) --- Calls a require that will not error if the file is not found - Public.ext_require(path,...) --- Calls a require and returns only the keys given, file must return a table + Common.opt_require(path) --- Calls a require that will not error if the file is not found + Common.ext_require(path,...) --- Calls a require and returns only the keys given, file must return a table - Public.format_time(ticks,options) --- Formats tick into a clean format, denominations from highest to lowest + Common.format_time(ticks,options) --- Formats tick into a clean format, denominations from highest to lowest - Public.move_items(items,surface,position,radius,chest_type) --- Moves items to the position and stores them in the closest entity of the type given + Common.move_items(items,surface,position,radius,chest_type) --- Moves items to the position and stores them in the closest entity of the type given - Public.print_grid_value(value, surface, position, scale, offset, immutable) --- Prints a colored value on a location. - Public.print_colored_grid_value(value, surface, position, offset, immutable, + Common.print_grid_value(value, surface, position, scale, offset, immutable) --- Prints a colored value on a location. + Common.print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) --- Prints a colored value on a location. with extra settings. - Public.clear_flying_text(surface) --- Clears all flying text entites on a surface + Common.clear_flying_text(surface) --- Clears all flying text entites on a surface - Public.string_contains(s, contains) --- Tests if a string contains a given substring. + Common.string_contains(s, contains) --- Tests if a string contains a given substring. - Public.extract_keys(tbl,...) --- Extracts certain keys from a table - Public.enum(tbl) --- Converts a table to an enum - Public.auto_complete(options,input,use_key,rtn_key) --- Returns the closest match to the input - Public.table_keys(tbl) --- Returns all the keys of a table - Public.table_values(tbl) --- Returns all the values of a table - Public.table_alphanumsort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) - Public.table_keysort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) + Common.extract_keys(tbl,...) --- Extracts certain keys from a table + Common.enum(tbl) --- Converts a table to an enum + Common.auto_complete(options,input,use_key,rtn_key) --- Returns the closest match to the input + Common.table_keys(tbl) --- Returns all the keys of a table + Common.table_values(tbl) --- Returns all the values of a table + Common.table_alphanumsort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) + Common.table_keysort(tbl) --- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) - Public.format_chat_colour(message,color) --- Returns a message with valid chat tags to change its colour - Public.format_chat_colour_localized(message,color) --- Returns a message with valid chat tags to change its colour, using localization - Public.format_chat_player_name(player,raw_string) --- Returns the players name in the players color + Common.format_chat_colour(message,color) --- Returns a message with valid chat tags to change its colour + Common.format_chat_colour_localized(message,color) --- Returns a message with valid chat tags to change its colour, using localization + Common.format_chat_player_name(player,raw_string) --- Returns the players name in the players color ]] local Colours = require 'resources.color_presets' @@ -43,7 +43,7 @@ local Util = require 'util' require 'utils.table' require 'utils.math' -local Public = {} +local Common = {} --- Compare types faster for faster validation of params -- @usage type_check('foo','string') -- return true @@ -51,7 +51,7 @@ local Public = {} -- @tparam any value the value to be tested -- @tparam[opt=nil] string test_type the type to test for if not given then it tests for nil -- @treturn boolean is v of type test_type -function Public.type_check(value,test_type) +function Common.type_check(value,test_type) return test_type and value and type(value) == test_type or not test_type and not value or false end @@ -62,9 +62,9 @@ end -- @tparam string error_message the error message that is returned -- @tparam number level the level to call the error on (level = 1 means the caller) -- @treturn boolean true if no error was called -function Public.type_check_error(value,test_type,error_message,level) +function Common.type_check_error(value,test_type,error_message,level) level = level and level+1 or 2 - return Public.test_type(value,test_type) or error(error_message,level) + return Common.test_type(value,test_type) or error(error_message,level) end --- Raises an error when the value is the incorrect type, uses a consistent error message format @@ -74,8 +74,8 @@ end -- @tparam string param_name the name of the param -- @tparam number param_number the number param it is -- @treturn boolean true if no error was raised -function Public.param_check(value,test_type,param_name,param_number) - if not Public.test_type(value,test_type) then +function Common.param_check(value,test_type,param_name,param_number) + if not Common.test_type(value,test_type) then local function_name = debug.getinfo(2,'n').name or '' local error_message = string.format('Invalid param #%2d given to %s; %s is not of type %s',param_number,function_name,param_name,test_type) return error(error_message,3) @@ -90,16 +90,16 @@ end -- @param value any value of any type that will be returned to the player or console -- @tparam[opt=defines.colour.white] ?defines.color|string colour the colour of the text for the player, ignored when printing to console -- @tparam[opt=game.player] LuaPlayer player the player that return will go to, if no game.player then returns to server -function Public.player_return(value,colour,player) - colour = Public.type_check(colour,'table') and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white +function Common.player_return(value,colour,player) + colour = Common.type_check(colour,'table') and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white player = player or game.player -- converts the value to a string local returnAsString - if Public.type_check(value,'table') or type(value) == 'userdata' then - if Public.type_check(value.__self,'userdata') or type(value) == 'userdata' then + if Common.type_check(value,'table') or type(value) == 'userdata' then + if Common.type_check(value.__self,'userdata') or type(value) == 'userdata' then -- value is userdata returnAsString = 'Cant Display Userdata' - elseif Public.type_check(value[1],'string') and string.find(value[1],'.+[.].+') and not string.find(value[1],'%s') then + elseif Common.type_check(value[1],'string') and string.find(value[1],'.+[.].+') and not string.find(value[1],'%s') then -- value is a locale string returnAsString = value elseif getmetatable(value) ~= nil and not tostring(value):find('table: 0x') then @@ -109,7 +109,7 @@ function Public.player_return(value,colour,player) -- value is a table returnAsString = table.inspect(value,{depth=5,indent=' ',newline='\n'}) end - elseif Public.type_check(value,'function') then + elseif Common.type_check(value,'function') then -- value is a function returnAsString = 'Cant Display Functions' else returnAsString = tostring(value) end @@ -127,7 +127,7 @@ end --- Writes a table object to a file in json format -- @tparam string path the path of the file to write include / to use dir -- @tparam table tbl the table that will be converted to a json string and wrote to file -function Public.write_json(path,tbl) +function Common.write_json(path,tbl) game.write_file(path,game.table_to_json(tbl)..'\n',true,0) end @@ -135,7 +135,7 @@ end -- @usage local file = opt_require('file.not.present') -- will not cause any error -- @tparam string path the path that you want to require -- @return the returns from that file or nil, error if not loaded -function Public.opt_require(path) +function Common.opt_require(path) local success, rtn = pcall(require,path) if success then return rtn else return nil,rtn end @@ -146,12 +146,12 @@ end -- @tparam string path the path that you want to require -- @tparam string ... the name of the keys that you want returned -- @return the keys in the order given -function Public.ext_require(path,...) +function Common.ext_require(path,...) local rtn = require(path) if type(rtn) ~= 'table' then error('File did not return a table, can not extract keys.',2) end - return Public.extract_keys(rtn,...) + return Common.extract_keys(rtn,...) end --- Formats tick into a clean format, denominations from highest to lowest @@ -162,7 +162,7 @@ end -- @tparam number ticks the number of ticks that represents a time -- @tparam table options table a of options to use for the format -- @treturn string a locale string that can be used -function Public.format_time(ticks,options) +function Common.format_time(ticks,options) -- Sets up the options options = options or { days=false, @@ -252,7 +252,7 @@ end -- @tparam[opt={0,0}] table position the position that the items will be moved to {x=100,y=100} -- @tparam[opt=32] number radius the radius in which the items are allowed to be placed -- @tparam[opt=iron-chest] string chest_type the chest type that the items should be moved into -function Public.move_items(items,surface,position,radius,chest_type) +function Common.move_items(items,surface,position,radius,chest_type) chest_type = chest_type or 'iron-chest' surface = surface or game.surfaces[1] if position and type(position) ~= 'table' then return end @@ -306,7 +306,7 @@ end @param offset float @param immutable bool if immutable, only set, never do a surface lookup, values never change ]] -function Public.print_grid_value(value, surface, position, scale, offset, immutable) +function Common.print_grid_value(value, surface, position, scale, offset, immutable) local is_string = type(value) == 'string' local color = Colours.white local text = value @@ -381,7 +381,7 @@ end @param under_bound {r,g,b} The color to be used if color_value < 0 @param over_bound {r,g,b} The color to be used if color_value > 1 ]] -function Public.print_colored_grid_value(value, surface, position, offset, immutable, +function Common.print_colored_grid_value(value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) local is_string = type(value) == 'string' -- default values: @@ -440,7 +440,7 @@ end --- Clears all flying text entites on a surface -- @tparam LuaSurface surface the surface to clear -function Public.clear_flying_text(surface) +function Common.clear_flying_text(surface) local entities = surface.find_entities_filtered{name ='flying-text'} for _,entity in pairs(entities) do if entity and entity.valid then @@ -453,7 +453,7 @@ end -- @tparam string s the string to check for the substring -- @tparam string contains the substring to test for -- @treturn boolean true if the substring was found in the string -function Public.string_contains(s, contains) +function Common.string_contains(s, contains) return s and string.find(s, contains) ~= nil end @@ -462,7 +462,7 @@ end -- @tparam table tbl table the which contains the keys -- @tparam string ... the names of the keys you want extracted -- @return the keys in the order given -function Public.extract_keys(tbl,...) +function Common.extract_keys(tbl,...) local values = {} for _,key in pairs({...}) do table.insert(values,tbl[key]) @@ -473,7 +473,7 @@ end --- Converts a table to an enum -- @tparam table tbl table the that will be converted -- @treturn table the new table that acts like an enum -function Public.enum(tbl) +function Common.enum(tbl) local rtn = {} for k,v in pairs(tbl) do if type(k) ~= 'number' then @@ -497,13 +497,13 @@ end -- @tparam[opt=false] boolean use_key when true the keys of options will be used as the options -- @tparam[opt=false] boolean rtn_key when true the the key will be returned rather than the value -- @return the list item found that matches the input -function Public.auto_complete(options,input,use_key,rtn_key) +function Common.auto_complete(options,input,use_key,rtn_key) local rtn = {} if type(input) ~= 'string' then return end input = input:lower() for key,value in pairs(options) do local check = use_key and key or value - if Public.string_contains(string.lower(check),input) then + if Common.string_contains(string.lower(check),input) then local result = rtn_key and key or value table.insert(rtn,result) end @@ -514,7 +514,7 @@ end --- Returns all the keys of a table -- @tparam table tbl table the to get the keys of -- @treturn table an array of the table keys -function Public.table_keys(tbl) +function Common.table_keys(tbl) local rtn = {} for key,_ in pairs(tbl) do table.insert(rtn,key) @@ -525,7 +525,7 @@ end --- Returns all the values of a table -- @tparam table tbl table the to get the values of -- @treturn table an array of the table values -function Public.table_values(tbl) +function Common.table_values(tbl) local rtn = {} for _,value in pairs(tbl) do table.insert(rtn,value) @@ -536,8 +536,8 @@ end --- Returns the list is a sorted way that would be expected by people (this is by key) -- @tparam table tbl the table to be sorted -- @treturn table the sorted table -function Public.table_alphanumsort(tbl) - local o = Public.table_keys(tbl) +function Common.table_alphanumsort(tbl) + local o = Common.table_keys(tbl) local function padnum(d) local dec, n = string.match(d, "(%.?)0*(.+)") return #dec > 0 and ("%.12f"):format(d) or ("%s%03d%s"):format(dec, #n, n) end table.sort(o, function(a,b) @@ -551,8 +551,8 @@ end --- Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) -- @tparam table tbl the table to be sorted -- @treturn table the sorted table -function Public.table_keysort(tbl) - local o = Public.table_keys(tbl,true) +function Common.table_keysort(tbl) + local o = Common.table_keys(tbl,true) local _tbl = {} for _,k in pairs(o) do _tbl[k] = tbl[k] end return _tbl @@ -562,7 +562,7 @@ end -- @tparam string message the message that will be in the output -- @tparam table color a color which contains r,g,b as its keys -- @treturn string the message with the color tags included -function Public.format_chat_colour(message,color) +function Common.format_chat_colour(message,color) color = color or Colours.white local color_tag = '[color='..math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3)..']' return string.format('%s%s[/color]',color_tag,message) @@ -572,7 +572,7 @@ end -- @tparam ?string|table message the message that will be in the output -- @tparam table color a color which contains r,g,b as its keys -- @treturn table the message with the color tags included -function Public.format_chat_colour_localized(message,color) +function Common.format_chat_colour_localized(message,color) color = color or Colours.white color = math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3) return {'color-tag',color,message} @@ -582,15 +582,15 @@ end -- @tparam LuaPlayer player the player to use the name and color of -- @tparam[opt=false] boolean raw_string when true a is returned rather than a localized string -- @treturn table the players name with tags for the players color -function Public.format_chat_player_name(player,raw_string) +function Common.format_chat_player_name(player,raw_string) player = Game.get_player_from_any(player) local player_name = player and player.name or '' local player_chat_colour = player and player.chat_color or Colours.white if raw_string then - return Public.format_chat_colour(player_name,player_chat_colour) + return Common.format_chat_colour(player_name,player_chat_colour) else - return Public.format_chat_colour_localized(player_name,player_chat_colour) + return Common.format_chat_colour_localized(player_name,player_chat_colour) end end -return Public \ No newline at end of file +return Common \ No newline at end of file From a4543b44fe9e5d30b468767d5703991121bd072f Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 29 May 2019 22:31:23 +0100 Subject: [PATCH 33/41] Altered expcore to have different module names --- doc/index.html | 18 +-- doc/modules/config._file_loader.html | 10 +- doc/modules/config.action_buttons.html | 10 +- doc/modules/config.advanced_start.html | 10 +- doc/modules/config.death_logger.html | 10 +- .../config.expcore-commands.auth_admin.html | 10 +- .../config.expcore-commands.auth_roles.html | 10 +- ...expcore-commands.auth_runtime_disable.html | 10 +- ...config.expcore-commands.parse_general.html | 10 +- .../config.expcore-commands.parse_roles.html | 10 +- doc/modules/config.permission_groups.html | 10 +- doc/modules/config.popup_messages.html | 10 +- doc/modules/config.rockets.html | 10 +- doc/modules/config.roles.html | 10 +- doc/modules/config.scorched_earth.html | 10 +- doc/modules/config.spawn_area.html | 10 +- doc/modules/config.warnings.html | 10 +- doc/modules/control.html | 10 +- doc/modules/expcore.commands.html | 123 ++++++++++++++ .../{Common.html => expcore.common.html} | 150 +++++++++--------- doc/modules/expcore.gui.buttons.html | 10 +- doc/modules/expcore.gui.center.html | 10 +- doc/modules/expcore.gui.checkboxs.html | 10 +- doc/modules/expcore.gui.core.html | 10 +- doc/modules/expcore.gui.dropdown.html | 10 +- doc/modules/expcore.gui.elem-button.html | 10 +- doc/modules/expcore.gui.html | 10 +- doc/modules/expcore.gui.instances.html | 10 +- doc/modules/expcore.gui.left.html | 10 +- doc/modules/expcore.gui.popups.html | 10 +- doc/modules/expcore.gui.progress-bar.html | 10 +- doc/modules/expcore.gui.slider.html | 10 +- doc/modules/expcore.gui.test.html | 10 +- doc/modules/expcore.gui.text.html | 10 +- doc/modules/expcore.gui.toolbar.html | 10 +- ...ps.html => expcore.permission_groups.html} | 48 +++--- .../{Commands.html => expcore.roles.html} | 12 +- doc/modules/expcore.store.html | 10 +- .../modules.addons.advanced-start.html | 10 +- doc/modules/modules.addons.chat-popups.html | 10 +- doc/modules/modules.addons.damage-popups.html | 10 +- doc/modules/modules.gui.player-list.html | 10 +- doc/modules/modules.gui.rocket-info.html | 10 +- doc/modules/modules.gui.science-info.html | 10 +- doc/modules/modules.gui.task-list.html | 10 +- .../utils.alien_evolution_progress.html | 10 +- doc/modules/utils.core.html | 10 +- doc/modules/utils.debug.html | 10 +- doc/modules/utils.event.html | 10 +- doc/modules/utils.event_core.html | 10 +- doc/modules/utils.math.html | 10 +- doc/modules/utils.recipe_locker.html | 10 +- doc/modules/utils.state_machine.html | 10 +- doc/modules/utils.table.html | 10 +- doc/modules/utils.task.html | 10 +- doc/modules/utils.timestamp.html | 10 +- expcore/commands.lua | 1 - expcore/common.lua | 1 - expcore/permission_groups.lua | 1 - expcore/roles.lua | 1 - 60 files changed, 492 insertions(+), 373 deletions(-) create mode 100644 doc/modules/expcore.commands.html rename doc/modules/{Common.html => expcore.common.html} (83%) rename doc/modules/{Permissions_Groups.html => expcore.permission_groups.html} (91%) rename doc/modules/{Commands.html => expcore.roles.html} (99%) diff --git a/doc/index.html b/doc/index.html index 953f2c7e..45c80e3f 100644 --- a/doc/index.html +++ b/doc/index.html @@ -48,8 +48,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -65,8 +65,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -187,11 +187,11 @@ this file is the landing point for all scenarios please DO NOT edit directly, further comments are to aid development
    - + - + @@ -273,11 +273,11 @@ [[ - + - + @@ -369,7 +369,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config._file_loader.html b/doc/modules/config._file_loader.html index 3985ea37..2b4403f7 100644 --- a/doc/modules/config._file_loader.html +++ b/doc/modules/config._file_loader.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.action_buttons.html b/doc/modules/config.action_buttons.html index 788fe95c..ae1730dc 100644 --- a/doc/modules/config.action_buttons.html +++ b/doc/modules/config.action_buttons.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -115,7 +115,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.advanced_start.html b/doc/modules/config.advanced_start.html index bcff9a39..e1826c7e 100644 --- a/doc/modules/config.advanced_start.html +++ b/doc/modules/config.advanced_start.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.death_logger.html b/doc/modules/config.death_logger.html index ce8702b5..98437177 100644 --- a/doc/modules/config.death_logger.html +++ b/doc/modules/config.death_logger.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.expcore-commands.auth_admin.html b/doc/modules/config.expcore-commands.auth_admin.html index 4eec3011..3a780c6b 100644 --- a/doc/modules/config.expcore-commands.auth_admin.html +++ b/doc/modules/config.expcore-commands.auth_admin.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.expcore-commands.auth_roles.html b/doc/modules/config.expcore-commands.auth_roles.html index 177ae679..328cf7df 100644 --- a/doc/modules/config.expcore-commands.auth_roles.html +++ b/doc/modules/config.expcore-commands.auth_roles.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.expcore-commands.auth_runtime_disable.html b/doc/modules/config.expcore-commands.auth_runtime_disable.html index eaf632bf..f8f18960 100644 --- a/doc/modules/config.expcore-commands.auth_runtime_disable.html +++ b/doc/modules/config.expcore-commands.auth_runtime_disable.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.expcore-commands.parse_general.html b/doc/modules/config.expcore-commands.parse_general.html index fa9562e3..3b6006bd 100644 --- a/doc/modules/config.expcore-commands.parse_general.html +++ b/doc/modules/config.expcore-commands.parse_general.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -115,7 +115,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.expcore-commands.parse_roles.html b/doc/modules/config.expcore-commands.parse_roles.html index 54625aba..45f17c50 100644 --- a/doc/modules/config.expcore-commands.parse_roles.html +++ b/doc/modules/config.expcore-commands.parse_roles.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.permission_groups.html b/doc/modules/config.permission_groups.html index cf3a80b0..c9572f7f 100644 --- a/doc/modules/config.permission_groups.html +++ b/doc/modules/config.permission_groups.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.popup_messages.html b/doc/modules/config.popup_messages.html index 1a4a411e..93daa302 100644 --- a/doc/modules/config.popup_messages.html +++ b/doc/modules/config.popup_messages.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.rockets.html b/doc/modules/config.rockets.html index 27876b0a..93c35073 100644 --- a/doc/modules/config.rockets.html +++ b/doc/modules/config.rockets.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -158,7 +158,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.roles.html b/doc/modules/config.roles.html index b94be117..62b973ec 100644 --- a/doc/modules/config.roles.html +++ b/doc/modules/config.roles.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.scorched_earth.html b/doc/modules/config.scorched_earth.html index 82f1e1fd..22741e11 100644 --- a/doc/modules/config.scorched_earth.html +++ b/doc/modules/config.scorched_earth.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.spawn_area.html b/doc/modules/config.spawn_area.html index a3d8fa33..e25138fb 100644 --- a/doc/modules/config.spawn_area.html +++ b/doc/modules/config.spawn_area.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/config.warnings.html b/doc/modules/config.warnings.html index afa96974..d087da36 100644 --- a/doc/modules/config.warnings.html +++ b/doc/modules/config.warnings.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/control.html b/doc/modules/control.html index 0151cfeb..73a8a5b4 100644 --- a/doc/modules/control.html +++ b/doc/modules/control.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.commands.html b/doc/modules/expcore.commands.html new file mode 100644 index 00000000..a41d8db7 --- /dev/null +++ b/doc/modules/expcore.commands.html @@ -0,0 +1,123 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + + +
    +generated by LDoc 1.4.3 +Last updated 2019-05-29 22:30:49 +
    +
    + + diff --git a/doc/modules/Common.html b/doc/modules/expcore.common.html similarity index 83% rename from doc/modules/Common.html rename to doc/modules/expcore.common.html index 346c867c..83fc1ed4 100644 --- a/doc/modules/Common.html +++ b/doc/modules/expcore.common.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -99,7 +99,7 @@
    -

    Module Common

    +

    Module expcore.common

    Adds some commonly used functions used in many modules

    [[

    @@ -112,35 +112,35 @@

    Functions

    Factorio command making module that makes commands with better parse and more modularity
    PublicCommon Adds some commonly used functions used in many modules
    Commandsexpcore.commands Factorio command making module that makes commands with better parse and more modularity
    Commonexpcore.common Adds some commonly used functions used in many modules
    Permissions_Groupsexpcore.permission_groups Permission group making for factorio so you never have to make one by hand again
    Commandsexpcore.roles Factorio role system to manage custom permissions
    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
    type_check (value[, test_type=nil])Common.type_check (value[, test_type=nil]) Compare types faster for faster validation of params
    type_check_error (value, test_type, error_message, level)Common.type_check_error (value, test_type, error_message, level) Raises an error if the value is of the wrong type
    param_check (value, test_type, param_name, param_number)Common.param_check (value, test_type, param_name, param_number) Raises an error when the value is the incorrect type, uses a consistent error message format
    player_return (value[, colour=defines.colour.white[, player=game.player]])Common.player_return (value[, colour=defines.colour.white[, player=game.player]]) Will return a value of any type to the player/server console, allows colour for in-game players
    write_json (path, tbl)Common.write_json (path, tbl) Writes a table object to a file in json format
    opt_require (path)Common.opt_require (path) Calls a require that will not error if the file is not found
    ext_require (path, ...)Common.ext_require (path, ...) Calls a require and returns only the keys given, file must return a table
    format_time (ticks, options)Common.format_time (ticks, options) Formats tick into a clean format, denominations from highest to lowest long will use words rather than letters time will use : separates @@ -148,64 +148,64 @@ when a denomination is false it will overflow into the next one
    move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]])Common.move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]]) Moves items to the position and stores them in the closest entity of the type given
    print_grid_value (value, surface, position, scale, offset, immutable)Common.print_grid_value (value, surface, position, scale, offset, immutable) https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 Prints a colored value on a location.
    print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)Common.print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) Prints a colored value on a location.
    clear_flying_text (surface)Common.clear_flying_text (surface) Clears all flying text entites on a surface
    string_contains (s, contains)Common.string_contains (s, contains) Tests if a string contains a given substring.
    extract_keys (tbl, ...)Common.extract_keys (tbl, ...) Extracts certain keys from a table
    enum (tbl)Common.enum (tbl) Converts a table to an enum
    auto_complete (options, input[, use_key=false[, rtn_key=false]])Common.auto_complete (options, input[, use_key=false[, rtn_key=false]]) Returns the closest match to the input
    table_keys (tbl)Common.table_keys (tbl) Returns all the keys of a table
    table_values (tbl)Common.table_values (tbl) Returns all the values of a table
    table_alphanumsort (tbl)Common.table_alphanumsort (tbl) Returns the list is a sorted way that would be expected by people (this is by key)
    table_keysort (tbl)Common.table_keysort (tbl) Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above)
    format_chat_colour (message, color)Common.format_chat_colour (message, color) Returns a message with valid chat tags to change its colour
    format_chat_colour_localized (message, color)Common.format_chat_colour_localized (message, color) Returns a message with valid chat tags to change its colour, using localization
    format_chat_player_name (player[, raw_string=false])Common.format_chat_player_name (player[, raw_string=false]) Returns the players name in the players color
    @@ -218,8 +218,8 @@
    - - type_check (value[, test_type=nil]) + + Common.type_check (value[, test_type=nil])
    Compare types faster for faster validation of params @@ -255,8 +255,8 @@
    - - type_check_error (value, test_type, error_message, level) + + Common.type_check_error (value, test_type, error_message, level)
    Raises an error if the value is of the wrong type @@ -298,8 +298,8 @@
    - - param_check (value, test_type, param_name, param_number) + + Common.param_check (value, test_type, param_name, param_number)
    Raises an error when the value is the incorrect type, uses a consistent error message format @@ -341,8 +341,8 @@
    - - player_return (value[, colour=defines.colour.white[, player=game.player]]) + + Common.player_return (value[, colour=defines.colour.white[, player=game.player]])
    Will return a value of any type to the player/server console, allows colour for in-game players @@ -377,8 +377,8 @@
    - - write_json (path, tbl) + + Common.write_json (path, tbl)
    Writes a table object to a file in json format @@ -402,8 +402,8 @@
    - - opt_require (path) + + Common.opt_require (path)
    Calls a require that will not error if the file is not found @@ -432,8 +432,8 @@
    - - ext_require (path, ...) + + Common.ext_require (path, ...)
    Calls a require and returns only the keys given, file must return a table @@ -466,8 +466,8 @@
    - - format_time (ticks, options) + + Common.format_time (ticks, options)
    Formats tick into a clean format, denominations from highest to lowest @@ -501,8 +501,8 @@
    - - move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]]) + + Common.move_items (items[, surface=navies[, position={0[, radius=32[, chest_type=iron-chest]]]])
    Moves items to the position and stores them in the closest entity of the type given @@ -542,8 +542,8 @@
    - - print_grid_value (value, surface, position, scale, offset, immutable) + + Common.print_grid_value (value, surface, position, scale, offset, immutable)
    https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 @@ -578,8 +578,8 @@
    - - print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound) + + Common.print_colored_grid_value (value, surface, position, offset, immutable, color_value, base_color, delta_color, under_bound, over_bound)
    Prints a colored value on a location. When given a color_value and a delta_color, @@ -628,8 +628,8 @@
    - - clear_flying_text (surface) + + Common.clear_flying_text (surface)
    Clears all flying text entites on a surface @@ -649,8 +649,8 @@
    - - string_contains (s, contains) + + Common.string_contains (s, contains)
    Tests if a string contains a given substring. @@ -680,8 +680,8 @@
    - - extract_keys (tbl, ...) + + Common.extract_keys (tbl, ...)
    Extracts certain keys from a table @@ -714,8 +714,8 @@
    - - enum (tbl) + + Common.enum (tbl)
    Converts a table to an enum @@ -741,8 +741,8 @@
    - - auto_complete (options, input[, use_key=false[, rtn_key=false]]) + + Common.auto_complete (options, input[, use_key=false[, rtn_key=false]])
    Returns the closest match to the input @@ -781,8 +781,8 @@
    - - table_keys (tbl) + + Common.table_keys (tbl)
    Returns all the keys of a table @@ -808,8 +808,8 @@
    - - table_values (tbl) + + Common.table_values (tbl)
    Returns all the values of a table @@ -835,8 +835,8 @@
    - - table_alphanumsort (tbl) + + Common.table_alphanumsort (tbl)
    Returns the list is a sorted way that would be expected by people (this is by key) @@ -862,8 +862,8 @@
    - - table_keysort (tbl) + + Common.table_keysort (tbl)
    Returns the list is a sorted way that would be expected by people (this is by key) (faster alterative than above) @@ -889,8 +889,8 @@
    - - format_chat_colour (message, color) + + Common.format_chat_colour (message, color)
    Returns a message with valid chat tags to change its colour @@ -920,8 +920,8 @@
    - - format_chat_colour_localized (message, color) + + Common.format_chat_colour_localized (message, color)
    Returns a message with valid chat tags to change its colour, using localization @@ -951,8 +951,8 @@
    - - format_chat_player_name (player[, raw_string=false]) + + Common.format_chat_player_name (player[, raw_string=false])
    Returns the players name in the players color @@ -989,7 +989,7 @@
generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
diff --git a/doc/modules/expcore.gui.buttons.html b/doc/modules/expcore.gui.buttons.html index 94f7a01b..db445924 100644 --- a/doc/modules/expcore.gui.buttons.html +++ b/doc/modules/expcore.gui.buttons.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -268,7 +268,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.center.html b/doc/modules/expcore.gui.center.html index b0c22903..4aa127e1 100644 --- a/doc/modules/expcore.gui.center.html +++ b/doc/modules/expcore.gui.center.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -465,7 +465,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.checkboxs.html b/doc/modules/expcore.gui.checkboxs.html index d5c08478..12c17dd4 100644 --- a/doc/modules/expcore.gui.checkboxs.html +++ b/doc/modules/expcore.gui.checkboxs.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -407,7 +407,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.core.html b/doc/modules/expcore.gui.core.html index 9b26c60f..523bda7b 100644 --- a/doc/modules/expcore.gui.core.html +++ b/doc/modules/expcore.gui.core.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -114,7 +114,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.dropdown.html b/doc/modules/expcore.gui.dropdown.html index f796fef3..8f7b876d 100644 --- a/doc/modules/expcore.gui.dropdown.html +++ b/doc/modules/expcore.gui.dropdown.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -359,7 +359,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.elem-button.html b/doc/modules/expcore.gui.elem-button.html index 78fcaedf..8bc3eb4c 100644 --- a/doc/modules/expcore.gui.elem-button.html +++ b/doc/modules/expcore.gui.elem-button.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -217,7 +217,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.html b/doc/modules/expcore.gui.html index 529f0c66..810d6e38 100644 --- a/doc/modules/expcore.gui.html +++ b/doc/modules/expcore.gui.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.instances.html b/doc/modules/expcore.gui.instances.html index 68442e01..b379c6a8 100644 --- a/doc/modules/expcore.gui.instances.html +++ b/doc/modules/expcore.gui.instances.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.left.html b/doc/modules/expcore.gui.left.html index 12eada3e..b49d8a7b 100644 --- a/doc/modules/expcore.gui.left.html +++ b/doc/modules/expcore.gui.left.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -566,7 +566,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.popups.html b/doc/modules/expcore.gui.popups.html index 15afc4c7..25d85846 100644 --- a/doc/modules/expcore.gui.popups.html +++ b/doc/modules/expcore.gui.popups.html @@ -56,8 +56,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -73,8 +73,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -345,7 +345,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.progress-bar.html b/doc/modules/expcore.gui.progress-bar.html index 58889949..06f0c8f3 100644 --- a/doc/modules/expcore.gui.progress-bar.html +++ b/doc/modules/expcore.gui.progress-bar.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -550,7 +550,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.slider.html b/doc/modules/expcore.gui.slider.html index bcf7524f..be824dd5 100644 --- a/doc/modules/expcore.gui.slider.html +++ b/doc/modules/expcore.gui.slider.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -281,7 +281,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.test.html b/doc/modules/expcore.gui.test.html index 014cefb2..be35af41 100644 --- a/doc/modules/expcore.gui.test.html +++ b/doc/modules/expcore.gui.test.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -113,7 +113,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.text.html b/doc/modules/expcore.gui.text.html index f34a17e8..27709f0f 100644 --- a/doc/modules/expcore.gui.text.html +++ b/doc/modules/expcore.gui.text.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -283,7 +283,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.gui.toolbar.html b/doc/modules/expcore.gui.toolbar.html index 1c578bb1..663424de 100644 --- a/doc/modules/expcore.gui.toolbar.html +++ b/doc/modules/expcore.gui.toolbar.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -205,7 +205,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/Permissions_Groups.html b/doc/modules/expcore.permission_groups.html similarity index 91% rename from doc/modules/Permissions_Groups.html rename to doc/modules/expcore.permission_groups.html index 33aafbb1..33781f3f 100644 --- a/doc/modules/Permissions_Groups.html +++ b/doc/modules/expcore.permission_groups.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -99,7 +99,7 @@
    -

    Module Permissions_Groups

    +

    Module expcore.permission_groups

    Permission group making for factorio so you never have to make one by hand again

    [[

    @@ -112,27 +112,27 @@

    Functions

    - + - + - + - + - + - + @@ -193,8 +193,8 @@
    - - new_group (name) + + Permissions_Groups.new_group (name)
    Defines a new permission group that can have it actions set in the config @@ -220,8 +220,8 @@
    - - get_group_by_name (name) + + Permissions_Groups.get_group_by_name (name)
    Returns the group with the given name, case sensitive @@ -247,8 +247,8 @@
    - - get_group_from_player (player) + + Permissions_Groups.get_group_from_player (player)
    Returns the group that a player is in @@ -274,8 +274,8 @@
    - - reload_permissions () + + Permissions_Groups.reload_permissions ()
    Reloads/creates all permission groups and sets them to they configured state @@ -288,8 +288,8 @@
    - - lockdown_permissions (exempt) + + Permissions_Groups.lockdown_permissions (exempt)
    Removes all permissions from every permission group except for "Default" and any passed as exempt @@ -315,8 +315,8 @@
    - - set_player_group (player, group) + + Permissions_Groups.set_player_group (player, group)
    Sets a player's group to the one given, a player can only have one group at a time @@ -653,7 +653,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/Commands.html b/doc/modules/expcore.roles.html similarity index 99% rename from doc/modules/Commands.html rename to doc/modules/expcore.roles.html index 5f570a52..493741d1 100644 --- a/doc/modules/Commands.html +++ b/doc/modules/expcore.roles.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -99,7 +99,7 @@
    -

    Module Commands

    +

    Module expcore.roles

    Factorio role system to manage custom permissions

    [[

    @@ -1300,7 +1300,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/expcore.store.html b/doc/modules/expcore.store.html index d5aa81cc..57e11bed 100644 --- a/doc/modules/expcore.store.html +++ b/doc/modules/expcore.store.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -457,7 +457,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.addons.advanced-start.html b/doc/modules/modules.addons.advanced-start.html index b619211a..771f4611 100644 --- a/doc/modules/modules.addons.advanced-start.html +++ b/doc/modules/modules.addons.advanced-start.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.addons.chat-popups.html b/doc/modules/modules.addons.chat-popups.html index 3d6e6856..b7f53d32 100644 --- a/doc/modules/modules.addons.chat-popups.html +++ b/doc/modules/modules.addons.chat-popups.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.addons.damage-popups.html b/doc/modules/modules.addons.damage-popups.html index 307f5a0a..7789ebd5 100644 --- a/doc/modules/modules.addons.damage-popups.html +++ b/doc/modules/modules.addons.damage-popups.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -112,7 +112,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.gui.player-list.html b/doc/modules/modules.gui.player-list.html index 39274a18..7fc8957c 100644 --- a/doc/modules/modules.gui.player-list.html +++ b/doc/modules/modules.gui.player-list.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.gui.rocket-info.html b/doc/modules/modules.gui.rocket-info.html index 182cdfd7..310b86a0 100644 --- a/doc/modules/modules.gui.rocket-info.html +++ b/doc/modules/modules.gui.rocket-info.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.gui.science-info.html b/doc/modules/modules.gui.science-info.html index 5dea5ee0..8df96f38 100644 --- a/doc/modules/modules.gui.science-info.html +++ b/doc/modules/modules.gui.science-info.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/modules.gui.task-list.html b/doc/modules/modules.gui.task-list.html index bb085dff..a14412da 100644 --- a/doc/modules/modules.gui.task-list.html +++ b/doc/modules/modules.gui.task-list.html @@ -51,8 +51,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -68,8 +68,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -111,7 +111,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.alien_evolution_progress.html b/doc/modules/utils.alien_evolution_progress.html index 8395e327..a26633ee 100644 --- a/doc/modules/utils.alien_evolution_progress.html +++ b/doc/modules/utils.alien_evolution_progress.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -151,7 +151,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawners will have 50% on
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.core.html b/doc/modules/utils.core.html index 0f39df00..41b857d2 100644 --- a/doc/modules/utils.core.html +++ b/doc/modules/utils.core.html @@ -56,8 +56,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -73,8 +73,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -445,7 +445,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.debug.html b/doc/modules/utils.debug.html index d52a38b5..2c4eb4aa 100644 --- a/doc/modules/utils.debug.html +++ b/doc/modules/utils.debug.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -299,7 +299,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.event.html b/doc/modules/utils.event.html index 708f0421..2a9f5538 100644 --- a/doc/modules/utils.event.html +++ b/doc/modules/utils.event.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -561,7 +561,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.event_core.html b/doc/modules/utils.event_core.html index 2358f09f..c0f45322 100644 --- a/doc/modules/utils.event_core.html +++ b/doc/modules/utils.event_core.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -197,7 +197,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.math.html b/doc/modules/utils.math.html index 8d5bff64..2760964b 100644 --- a/doc/modules/utils.math.html +++ b/doc/modules/utils.math.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -154,7 +154,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.recipe_locker.html b/doc/modules/utils.recipe_locker.html index e1457859..756989d6 100644 --- a/doc/modules/utils.recipe_locker.html +++ b/doc/modules/utils.recipe_locker.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -148,7 +148,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.state_machine.html b/doc/modules/utils.state_machine.html index 55295f83..69b4697f 100644 --- a/doc/modules/utils.state_machine.html +++ b/doc/modules/utils.state_machine.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -309,7 +309,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.table.html b/doc/modules/utils.table.html index c7621cea..cfe0c528 100644 --- a/doc/modules/utils.table.html +++ b/doc/modules/utils.table.html @@ -56,8 +56,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -73,8 +73,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -576,7 +576,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.task.html b/doc/modules/utils.task.html index cc0fe691..fa44cb8b 100644 --- a/doc/modules/utils.task.html +++ b/doc/modules/utils.task.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -188,7 +188,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/doc/modules/utils.timestamp.html b/doc/modules/utils.timestamp.html index 84b2893a..e2b2a781 100644 --- a/doc/modules/utils.timestamp.html +++ b/doc/modules/utils.timestamp.html @@ -55,8 +55,8 @@
  • config.spawn_area
  • config.warnings
  • control
  • -
  • Commands
  • -
  • Common
  • +
  • expcore.commands
  • +
  • expcore.common
  • expcore.gui
  • expcore.gui.buttons
  • expcore.gui.center
  • @@ -72,8 +72,8 @@
  • expcore.gui.test
  • expcore.gui.text
  • expcore.gui.toolbar
  • -
  • Permissions_Groups
  • -
  • Commands
  • +
  • expcore.permission_groups
  • +
  • expcore.roles
  • expcore.store
  • modules.addons.advanced-start
  • modules.addons.chat-popups
  • @@ -210,7 +210,7 @@
    generated by LDoc 1.4.3 -Last updated 2019-05-29 22:26:12 +Last updated 2019-05-29 22:30:49
    diff --git a/expcore/commands.lua b/expcore/commands.lua index c27bea4a..feb40942 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -1,6 +1,5 @@ --- Factorio command making module that makes commands with better parse and more modularity -- @author Cooldude2606 --- @module Commands --[[ >>>>Example Authenticator: The command system is most useful when you can control who can use commands; to do this would would need to diff --git a/expcore/common.lua b/expcore/common.lua index b640a9ca..40c1aa30 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -1,6 +1,5 @@ --- Adds some commonly used functions used in many modules -- @author cooldude2606 --- @module Common --[[ >>>>Functions List (see function for more detail): Common.type_check(value,test_type) --- Compare types faster for faster validation of prams diff --git a/expcore/permission_groups.lua b/expcore/permission_groups.lua index a87f3b18..2d667db9 100644 --- a/expcore/permission_groups.lua +++ b/expcore/permission_groups.lua @@ -1,6 +1,5 @@ --- Permission group making for factorio so you never have to make one by hand again -- @author Cooldude2606 --- @module Permissions_Groups --[[ >>>>Example Group (Allow All) diff --git a/expcore/roles.lua b/expcore/roles.lua index 9dddcbb4..8737fbde 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -1,6 +1,5 @@ --- Factorio role system to manage custom permissions -- @author Cooldude2606 --- @module Commands --[[ >>>>Using Role System (Frontend): When a map first starts you will want to define on mass all the players you expect to join and the roles to give them: From 2fc58e2e4782eeb93dd29074368ea40c53d0c387 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 13:15:55 +0100 Subject: [PATCH 34/41] Fixed role change not updating buttons --- modules/gui/rocket-info.lua | 4 ++++ modules/gui/task-list.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 129b7c73..fc8c8503 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -628,4 +628,8 @@ Event.on_nth_tick(150,function() end end) +--- Makes sure the right buttons are present when role changes +Event.add(Roles.player_role_assigned,rocket_info 'redraw') +Event.add(Roles.player_role_unassigned,rocket_info 'redraw') + return rocket_info \ No newline at end of file diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 9dad2e48..586502e1 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -406,4 +406,8 @@ Store.register(task_store,function(value,task_id) end end) +--- Makess sure the right buttons are present when roles change +Event.add(Roles.player_role_assigned,task_list 'redraw') +Event.add(Roles.player_role_unassigned,task_list 'redraw') + return task_list \ No newline at end of file From 5b3241b3a63513e9eb5be30d80eddd0e02528753 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 13:36:39 +0100 Subject: [PATCH 35/41] Added checks to player list buttons --- config/action_buttons.lua | 49 ++++++++++++++++++++++++++++++------- locale/en/gui.cfg | 1 + modules/gui/rocket-info.lua | 2 ++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index 10002094..dd5d65ea 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -10,6 +10,7 @@ local Game = require 'utils.game' local Reports = require 'modules.addons.reports-control' local Warnings = require 'modules.addons.warnings-control' local Jail = require 'modules.addons.jail-control' +local Colors = require 'resources.color_presets' local format_chat_player_name = ext_require('expcore.common','format_chat_player_name') local action_player_store = 'gui.left.player-list.action-player' @@ -56,8 +57,13 @@ Gui.new_button() :set_tooltip{'player-list.goto-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) - teleport(player,action_player) + local action_player_name = get_action_player(player) + local action_player = Game.get_player_from_any(action_player_name) + if not player.character or not action_player.character then + player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) + else + teleport(player,action_player) + end end) -- teleports the action player to the user @@ -67,8 +73,13 @@ Gui.new_button() :set_tooltip{'player-list.bring-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) - teleport(action_player,player) + local action_player_name = get_action_player(player) + local action_player = Game.get_player_from_any(action_player_name) + if not player.character or not action_player.character then + player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) + else + teleport(action_player,player) + end end) -- kills the action player, if there are alive @@ -78,9 +89,12 @@ Gui.new_button() :set_tooltip{'player-list.kill-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) + local action_player_name = get_action_player(player) + local action_player = Game.get_player_from_any(action_player_name) if action_player.character then action_player.character.die() + else + player.print({'expcom-kill.already-dead'},Colors.orange_red) end end) @@ -91,7 +105,12 @@ Gui.new_button() :set_tooltip{'player-list.report-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set_child(action_name_store,player.name,'command/report') + local action_player = get_action_player(player) + if Reports.player_is_reported_by(action_player,player.name) then + player.print({'expcom-report.already-reported'},Colors.orange_red) + else + Store.set_child(action_name_store,player.name,'command/report') + end end) local function report_player_callback(player,reason) @@ -126,7 +145,12 @@ Gui.new_button() :set_tooltip{'player-list.jail-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set_child(action_name_store,player.name,'command/jail') + local action_player,action_player_name_color = get_action_player(player) + if Roles.player_has_role(action_player,'Jail') then + player.print({'expcom-jail.already-jailed',action_player_name_color},Colors.orange_red) + else + Store.set_child(action_name_store,player.name,'command/jail') + end end) local function jail_player_callback(player,reason) @@ -143,11 +167,18 @@ Gui.new_button() :set_tooltip{'player-list.temp-ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - Store.set_child(action_name_store,player.name,'command/temp-ban') + local action_player,action_player_name_color = get_action_player(player) + if Roles.player_has_role(action_player,'Jail') then + player.print({'expcom-jail.already-banned',action_player_name_color},Colors.orange_red) + else + Store.set_child(action_name_store,player.name,'command/temp-ban') + end end) local function temp_ban_player_callback(player,reason) - local action_player = get_action_player(player) + local action_player,action_player_name_color = get_action_player(player) + local by_player_name_color = format_chat_player_name(player) + game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} Jail.temp_ban_player(action_player,player.name,reason) end diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 882562a3..872cdf3e 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -52,6 +52,7 @@ progress-label-tooltip=View on map progress-launched=Launched progress-caption=__1__% progress-tooltip=This silo has launched __1__ rockets +launch-failed=Failed to launch rocket, please wait a few seconds and try again. [science-info] main-caption=Science Packs diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index fc8c8503..53c2fd58 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -84,6 +84,8 @@ end) local progress_label = element.parent.parent[rocket_silo_name].label progress_label.caption = {'rocket-info.progress-launched'} progress_label.style.font_color = Colors.green + else + player.print({'rocket-info.launch-failed'},Colors.orange_red) end end) From 558574c8659f9f40a3e60be6863d91cbc508e95c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 13:44:22 +0100 Subject: [PATCH 36/41] Added check for player offline in action bar --- config/action_buttons.lua | 52 ++++++++++++++++++------------------- modules/gui/player-list.lua | 33 ++++++++++++++++------- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/config/action_buttons.lua b/config/action_buttons.lua index dd5d65ea..71ec2ee2 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -33,7 +33,7 @@ local function auth_lower_role(player,action_player_name) end -- gets the action player and a coloured name for the action to be used on -local function get_action_player(player) +local function get_action_player_name(player) local action_player_name = Store.get_child(action_player_store,player.name) local action_player = Game.get_player_from_any(action_player_name) local action_player_name_color = format_chat_player_name(action_player) @@ -57,7 +57,7 @@ Gui.new_button() :set_tooltip{'player-list.goto-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player(player) + local action_player_name = get_action_player_name(player) local action_player = Game.get_player_from_any(action_player_name) if not player.character or not action_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) @@ -73,7 +73,7 @@ Gui.new_button() :set_tooltip{'player-list.bring-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player(player) + local action_player_name = get_action_player_name(player) local action_player = Game.get_player_from_any(action_player_name) if not player.character or not action_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) @@ -89,7 +89,7 @@ Gui.new_button() :set_tooltip{'player-list.kill-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player_name = get_action_player(player) + local action_player_name = get_action_player_name(player) local action_player = Game.get_player_from_any(action_player_name) if action_player.character then action_player.character.die() @@ -105,8 +105,8 @@ Gui.new_button() :set_tooltip{'player-list.report-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player = get_action_player(player) - if Reports.player_is_reported_by(action_player,player.name) then + local action_player_name = get_action_player_name(player) + if Reports.player_is_reported_by(action_player_name,player.name) then player.print({'expcom-report.already-reported'},Colors.orange_red) else Store.set_child(action_name_store,player.name,'command/report') @@ -114,11 +114,11 @@ Gui.new_button() end) local function report_player_callback(player,reason) - local action_player,action_player_name_color = get_action_player(player) + local action_player_name,action_player_name_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-report.non-admin',action_player_name_color,reason} Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) - Reports.report_player(action_player,reason,player.name) + Reports.report_player(action_player_name,reason,player.name) end -- gives the action player a warning, requires a reason @@ -132,10 +132,10 @@ Gui.new_button() end) local function warn_player_callback(player,reason) - local action_player,action_player_name_color = get_action_player(player) + local action_player_name,action_player_name_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} - Warnings.add_warnings(action_player,player.name) + Warnings.add_warnings(action_player_name,player.name) end -- jails the action player, requires a reason @@ -145,8 +145,8 @@ Gui.new_button() :set_tooltip{'player-list.jail-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player,action_player_name_color = get_action_player(player) - if Roles.player_has_role(action_player,'Jail') then + local action_player_name,action_player_name_color = get_action_player_name(player) + if Roles.player_has_role(action_player_name,'Jail') then player.print({'expcom-jail.already-jailed',action_player_name_color},Colors.orange_red) else Store.set_child(action_name_store,player.name,'command/jail') @@ -154,10 +154,10 @@ Gui.new_button() end) local function jail_player_callback(player,reason) - local action_player,action_player_name_color = get_action_player(player) + local action_player_name,action_player_name_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} - Jail.jail_player(action_player,player.name) + Jail.jail_player(action_player_name,player.name) end -- temp bans the action player, requires a reason @@ -167,8 +167,8 @@ Gui.new_button() :set_tooltip{'player-list.temp-ban-player'} :set_style('tool_button',tool_button_style) :on_click(function(player,element) - local action_player,action_player_name_color = get_action_player(player) - if Roles.player_has_role(action_player,'Jail') then + local action_player_name,action_player_name_color = get_action_player_name(player) + if Roles.player_has_role(action_player_name,'Jail') then player.print({'expcom-jail.already-banned',action_player_name_color},Colors.orange_red) else Store.set_child(action_name_store,player.name,'command/temp-ban') @@ -176,7 +176,7 @@ Gui.new_button() end) local function temp_ban_player_callback(player,reason) - local action_player,action_player_name_color = get_action_player(player) + local action_player,action_player_name_color = get_action_player_name(player) local by_player_name_color = format_chat_player_name(player) game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} Jail.temp_ban_player(action_player,player.name,reason) @@ -193,7 +193,7 @@ Gui.new_button() end) local function kick_player_callback(player,reason) - local action_player = get_action_player(player) + local action_player = get_action_player_name(player) game.kick_player(action_player,reason) end @@ -208,32 +208,32 @@ Gui.new_button() end) local function ban_player_callback(player,reason) - local action_player = get_action_player(player) + local action_player = get_action_player_name(player) game.ban_player(action_player,reason) end return { ['command/teleport'] = { - auth=function(player,action_player_name) - return player.name ~= action_player_name + auth=function(player,action_player) + return player.name ~= action_player.name end, -- cant teleport to your self goto_player, bring_player }, ['command/kill'] = { - auth=function(player,action_player_name) - if player.name == action_player_name then + auth=function(player,action_player) + if player.name == action_player.name then return true elseif Roles.player_allowed(player,'command/kill/always') then - return auth_lower_role(player,action_player_name) + return auth_lower_role(player,action_player) end end, -- player must be lower role, or your self kill_player }, ['command/report'] = { - auth=function(player,action_player_name) + auth=function(player,action_player) if not Roles.player_allowed(player,'command/give-warning') then - return not Roles.player_has_flag(action_player_name,'report-immune') + return not Roles.player_has_flag(action_player,'report-immune') end end, -- can report any player that isnt immune and you arnt able to give warnings reason_callback=report_player_callback, diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index c10fab2f..73fa7671 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -194,17 +194,23 @@ local player_list_name local function update_action_bar(player) local frame = Gui.classes.left_frames.get_frame(player_list_name,player) local element = frame.container.action_bar - local action_player = Store.get_child(action_player_store,player.name) + local action_player_name = Store.get_child(action_player_store,player.name) - if not action_player then + if not action_player_name then element.visible = false else - element.visible = true - for action_name,buttons in pairs(config) do - if buttons.auth and not buttons.auth(player,action_player) then - element[action_name].visible = false - elseif Roles.player_allowed(player,action_name) then - element[action_name].visible = true + local action_player = Game.get_player_from_any(action_player_name) + if not action_player.connected then + element.visible = false + Store.set(action_player_store,player.name) -- clears store if player is offline + else + element.visible = true + for action_name,buttons in pairs(config) do + if buttons.auth and not buttons.auth(player,action_player) then + element[action_name].visible = false + elseif Roles.player_allowed(player,action_name) then + element[action_name].visible = true + end end end end @@ -318,7 +324,16 @@ Store.register(action_name_store,function(value,category) local player = Game.get_player_from_any(category) local frame = Gui.classes.left_frames.get_frame(player_list_name,player) local element = frame.container.reason_bar - element.visible = value ~= nil + if value then + local action_player = Game.get_player_from_any(value) + if action_player.connected then + element.visible = true + else + Store.set_child(action_name_store,category) -- clears store if player is offline + end + else + element.visible = false + end end) --- Many events which trigger the gui to be re drawn, it will also update the times every 30 seconds From 882886218fd61c24961aa35026ecafeb1bd9b53b Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 13:45:06 +0100 Subject: [PATCH 37/41] Required event in task-list --- modules/gui/task-list.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 586502e1..2c1a8dcd 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -2,6 +2,7 @@ local Gui = require 'expcore.gui' local Store = require 'expcore.store' local Global = require 'utils.global' +local Event = require 'utils.event' local Roles = require 'expcore.roles' local Token = require 'utils.token' local config = require 'config.tasks' From 3443943b900b71bbae0bc9363440975f52f96f77 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 17:46:08 +0100 Subject: [PATCH 38/41] Auto launch added tanks to 17.44 --- README.md | 4 ++-- modules/gui/rocket-info.lua | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a150c64a..7f54976d 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i | Scenario Version* | Version Name | Factorio Version** | |---|---|---| -| [v5.6](s5.6) | Information Guis | [v0.17.43](f0.17.43) | +| [v5.6](s5.6) | Information Guis | [v0.17.44](f0.17.44) | | [v5.5](s5.5) | Gui System | [v0.17.43](f0.17.43) | | [v5.4](s5.4) | Admin Controls | [v0.17.32](f0.17.32) | | [v5.3](s5.3) | Custom Roles | [v0.17.28](f0.17.28) | @@ -85,7 +85,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i [s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 [s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 -[f0.17.43]: https://wiki.factorio.com/Version_history/0.17.0#0.17.43 +[f0.17.44]: https://wiki.factorio.com/Version_history/0.17.0#0.17.44 [f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 [f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 [f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index 53c2fd58..8109f320 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -104,18 +104,17 @@ end) end) :on_click(function(player,element) local force = player.force - local rocket_silo_name = element.parent.name:sub(7) - local rocket_silo = rocket_silos[force.name][rocket_silo_name] - local active = true -- need to test for auto launch + local rocket_silo_name = element.parent.name:sub(8) + local rocket_silo_data = rocket_silos[force.name][rocket_silo_name] + local active = rocket_silo_data.entity.auto_launch -- need to test for auto launch if active then - player.print('WIP; We currently have no way to test or set the auto launch of a rocket so this button does not work!') element.sprite = 'utility/play' element.tooltip = {'rocket-info.toggle-rocket-tooltip'} - -- insert function to disable auto launch + rocket_silo_data.entity.auto_launch = false else element.sprite = 'utility/stop' element.tooltip = {'rocket-info.toggle-rocket-tooltip-disabled'} - -- insert function to enable auto launch + rocket_silo_data.entity.auto_launch = true end end) @@ -359,8 +358,8 @@ end --- Creats the different buttons used with the rocket silos local function generate_progress_buttons(player,element,rocket_silo_data) local silo_name = rocket_silo_data.name - local status = rocket_silo_data.entity.status == 21 - local active = false -- need way to check this + local status = rocket_silo_data.entity.status == defines.entity_status.waiting_to_launch_rocket + local active = rocket_silo_data.entity.auto_launch if player_allowed(player,'toggle_active') then local button_element = element['toggle-'..silo_name] @@ -371,10 +370,11 @@ local function generate_progress_buttons(player,element,rocket_silo_data) button_element = toggle_rocket(element,silo_name) end - button_element.enabled = false -- remove once check is added if active then + button_element.tooltip = {'rocket-info.toggle-rocket-tooltip'} button_element.sprite = 'utility/stop' else + button_element.tooltip = {'rocket-info.toggle-rocket-tooltip-disabled'} button_element.sprite = 'utility/play' end end From d2be730b7a0c3f97a7c3f83bd3f91be9d947bb0e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 18:22:33 +0100 Subject: [PATCH 39/41] Task list made simpler --- modules/gui/task-list.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index 2c1a8dcd..e61eca3d 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -183,14 +183,8 @@ function generate_task(player,element,task_id) local task_area = element[task_id] if not task_area then -- label to show the task number - local top_align = element.add{ + element.add{ name='count-'..task_id, - type='flow' - } - top_align.style.vertical_align = 'top' - top_align.style.vertically_stretchable = true - top_align.add{ - name='label', type='label', caption=task_number..')' } @@ -202,14 +196,11 @@ function generate_task(player,element,task_id) type='flow', } Gui.set_padding(task_area) - task_area.style.vertical_align = 'top' -- if the player can edit then it adds the edit and delete button if player_allowed_edit(player) then local flow = Gui.create_right_align(element,'edit-'..task_id) flow.caption = task_id - flow.style.vertical_align = 'top' - flow.style.vertically_stretchable = true edit_task(flow) discard_task(flow) @@ -218,7 +209,7 @@ function generate_task(player,element,task_id) end -- update the number indexes and the current editing players - element['count-'..task_id].label.caption = task_number..')' + element['count-'..task_id].caption = task_number..')' if element['edit-'..task_id] then local players = table_keys(details.editing) if #players > 0 then @@ -357,7 +348,8 @@ local function generate_container(player,element) name='table', type='table', column_count=col_count, - draw_horizontal_lines=true + draw_horizontal_lines=true, + vertical_centering=false } Gui.set_padding(flow_table) flow_table.style.horizontally_stretchable = true From 378b13dea60272add5c54dc90343658fd11bd467 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 30 May 2019 23:21:22 +0100 Subject: [PATCH 40/41] Fixed days not showing with format time --- expcore/common.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/common.lua b/expcore/common.lua index 40c1aa30..bed708be 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -238,7 +238,7 @@ function Common.format_time(ticks,options) rtn = rtn and {div,rtn,value} or value end end - append(options.day,rtn_days) + append(options.days,rtn_days) append(options.hours,rtn_hours) append(options.minutes,rtn_minutes) append(options.seconds,rtn_seconds) From 6d16f6d698327f2c85d2ea757ac72553bacdda09 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 31 May 2019 00:14:12 +0100 Subject: [PATCH 41/41] added accumulators to scorched earch --- config/scorched_earth.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/scorched_earth.lua b/config/scorched_earth.lua index bf683d45..1a46e20d 100644 --- a/config/scorched_earth.lua +++ b/config/scorched_earth.lua @@ -108,6 +108,7 @@ return { ['rocket-silo']=true, ['pumpjack']=true, ['electric-mining-drill']=true, - ['roboport']=true + ['roboport']=true, + ['accumulator']=true } } \ No newline at end of file
    new_group (name)Permissions_Groups.new_group (name) Defines a new permission group that can have it actions set in the config
    get_group_by_name (name)Permissions_Groups.get_group_by_name (name) Returns the group with the given name, case sensitive
    get_group_from_player (player)Permissions_Groups.get_group_from_player (player) Returns the group that a player is in
    reload_permissions ()Permissions_Groups.reload_permissions () Reloads/creates all permission groups and sets them to they configured state
    lockdown_permissions (exempt)Permissions_Groups.lockdown_permissions (exempt) Removes all permissions from every permission group except for "Default" and any passed as exempt
    set_player_group (player, group)Permissions_Groups.set_player_group (player, group) Sets a player's group to the one given, a player can only have one group at a time