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

Module config.advanced_start

+

This file is used to setup the map starting settings and the items players will start with

+

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

Module config.expcore-commands.auth_roles

+

This will make commands only work if the role has been allowed it in the role config

+

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

Module config.expcore-commands.parse_roles

+

Adds some parse functions that can be used with the role system

+

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

Module config.popup_messages

+

A combination of config settings for different popup values like chat and damage

+

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

Module config.roles

+

This is the main config file for the role system; file includes defines for roles and role flags and default values

+

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

Module config.scorched_earth

+

This file controls the placement/degrading of tiles as players build and walk

+

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

Module config.spawn_area

+

Used 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)

+

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

Module config.warnings

+

Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.

+

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

Module expcore.gui

+

This file is used to require all the different elements of the gui module + each module has an outline here but for more details see their seperate files in ./gui

+

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

Module expcore.gui.instances

+

This file is a breakout from core which forcues on instance management of defines +[[

+

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

Module modules.addons.advanced-start

+

Adds a better method of player starting items based on production levels.

+

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

Module modules.addons.chat-popups

+

Creates flying text entities when a player sends a message in chat + also displays a ping above users who are named in the message

+

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

Module modules.addons.damage-popups

+

Displays the amount of dmg that is done by players to entities + also shows player health when a player is attacked

+

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

Module modules.gui.player-list

+

Gui left frame define for a player list

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + 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 + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module modules.gui.rocket-info

+

Adds a rocket infomation gui which shows general stats, milestones and build progress of rockets

+

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

Module modules.gui.science-info

+

Adds a science info gui that shows production usage and net for the different science packs as well as an eta

+

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

Module modules.gui.task-list

+

Adds a task list to the game which players can add remove and edit items on

+

+ + + +
+
+ + + + +
+
+
+generated by LDoc 1.4.3 +Last updated 2019-05-29 22:22:59 +
+
+ + 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)