From 84a9c869a33e8299df1ba7f38f33ea8373c1dd9c Mon Sep 17 00:00:00 2001
From: Cooldude2606
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Commands
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
+ Core
+
+
+
+
Addons
Modules
Explosive Gaming's server scenario for 0.17
+ + +Core Module - Commands + - Factorio command making module that makes commands with better parse and more modularity
+ + + + + + + +
+---- Example Authenticator:
+ -- The command system is most useful when you can control who can use commands; to do this would would need to
+ -- define an authenticator which is ran every time a command is run; in this example I will show a simple one
+ -- that requires some commands to require the user to be a game admin:
+
+ -- When the authenticator is called be the command handler it will be passed 4 vales:
+ -- 1) the player who used the command
+ -- 2) the name of the command that is being used
+ -- 3) any flags which have been set for this command, this is a table of values set using :set_flag(name,value)
+ -- 4) the reject function which is the preferred method to prevent execution of the command
+
+ -- For our admin only example we will set a flag to true when we want it do be admin only so when we define the
+ -- command will will use :set_flag('admin_only',true) and then inside the authenticator we will test if the flag
+ -- is present using: if flags.admin_only then
+
+ -- Although no return is required to allow the command to execute it is best practice to return true; we do this in
+ -- two cases in our authenticator:
+ -- 1) when the "admin_only" flag is not set, which we take to mean any one can use it
+ -- 2) when the "admin_only" flag is set, and the player is admin
+
+ -- Now when the user is not an admin and the command requires you to be an admin then we must reject the request:
+ -- 1) return false -- this is the most basic block and should only be used while testing
+ -- 2) return reject -- returning the reject function is only an option as a fail safe, same as returning false
+ -- 3) reject() -- this will block execution without returning to allow further code to be ran in the authenticator
+ -- 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned
+ -- 5) return reject() -- using return on either case above is best practice as you should execute all code before rejecting
+
+ -- Example Code:
+ Commands.add_authenticator(function(player,command,flags,reject)
+ if flags.admin_only then -- our test for the "admin_only" flag
+ if player.admin then
+ return true -- true return 2
+ else
+ return reject('This command is for admins only!') -- reject return 5 with a custom error message
+ end
+ else
+ return true -- true return 1
+ end
+ end)
+
+---- Example Parse:
+ -- Before you go making commands it is important to understand the most powerful feature of this command handler,
+ -- when you define a command you are able to type the params and have then be parsed by an handler so before your
+ -- command is ever executed you can be sure that all the params are valid. This module should be paired with a general
+ -- command parse but you may want to create your own:
+
+ -- For our example we will create a parse to accept only integer numbers in a given range:
+ -- 1) we will give it the name "number-range-int" this is the "type" that the input is expected to be
+ -- 2) when we define the type we will also define the min and max of the range so we can use the function more than once
+ -- Example parse usage:
+ :add_param('repeat_count',false,'number-range-int',5,10) -- range 5 to 10 inclusive
+
+ -- The command parse will be passed 3 params and any other you define, in our case:
+ -- 1) the input that has been given by the user for this param, the role of this function is to transform this value
+ -- nb: the input is a string but can be nil if the param is marked as optional
+ -- 2) the player who is using the command, this is always present
+ -- 3) the reject function to throw an error to the user, this is always present
+ -- 4) the range min, this is user defined and has the value given when the param is defined
+ -- 5) the range max, this is user defined and has the value given when the param is defined
+
+ -- When returning from the param parse you again have a few options with how to do this:
+ -- 1) you return the new value for the param (any non nil value) this value is then passed to the command callback
+ -- 2) not returning will cause a generic invalid error and the command callback is blocked, not recommenced
+ -- 3) return reject -- this is just a failsafe in case the function is not called, same as no return
+ -- 4) return reject() -- will give a shorter error message as you pass a nil custom error
+ -- 5) return reject('Number entered is not in range: '..range_min..', '..range_max) -- returns a custom error the the user
+ -- nb: if you do not return reject after you call it then you are still returning nil so there will be a duplicate message
+
+ -- It should be noted that if you want to expand on an existing parse you can use Commands.parse(type,input,player,reject)
+ -- and this value will either return a new value for the input or nil, if it is nil you should return nil to prevent double
+ -- messages to the user:
+ input = Commands.parse('number-int',input,player,reject)
+ if not input then return end -- nil check
+
+ -- Example Code:
+ Commands.add_parse('number-range-int',function(input,player,reject,range_min,range_max)
+ local rtn = tonumber(input) and math.floor(tonumber(input)) or nil -- converts input to number
+ if not rtn or rtn < range_min or rtn > range_max then
+ -- the input is either not a number or is outside the range
+ return reject('Number entered is not in range: '..range_min..', '..range_max)
+ else
+ -- returns the input as a number value rather than a string, thus the param is now the correct type
+ return rtn
+ end
+ end)
+
+---- Example Command:
+ -- How for the fun part making the commands, the commands can be set up with any number of params and flags that you want,
+ -- you can add aliases for the commands and set default values for optional params and of course register your command callback
+ -- in our example we will just have a command that will repeat the users name in chat X amount of times and only allow admins to use it.
+
+ -- First we create the new command, nb this will not register the command to the game this is done at the end, we will call
+ -- the command "repeat-name" and set the help message as follows:
+ Commands.new_command('repeat-name','Will repeat you name a number of times in chat.')
+
+ -- Now for our first param we will call "repeat-count" and it will be a required value between 1 and 5 inclusive:
+ :add_param('repeat-count',false,'number-range-int',1,5)
+
+ -- Our second param we need a custom parse for but we have not defined it, this is an option for when it is unlikely for
+ -- any other command to use the same input type; however in our case it will just be a boolean which should be noted as being
+ -- included in the general command parse config. As for the param its self it will be called "smiley" and will be optional with
+ -- a default value of false:
+ :add_param('smiley',true,function(input,player,reject)
+ -- since it is optional the input can be nil, in which case we just return
+ if not input then return end
+ -- if it is not nil then we check for a truthy value
+ if input:lower() == 'true' or input:lower() == 'yes' then
+ return true
+ else
+ -- note that because we did not return nil or reject then false will be passed to command callback, see example parse
+ return false
+ end
+ end)
+
+ -- Once all params are defined you can now define some default values if you have optional params, the default value will be used only
+ -- when no value is given as input, if an invalid value is given then the command will still fail and this value will not be used, the
+ -- default can also be a function which is passed the player using the command and returns a value. Here we set the default for "smiley" to false:
+ :set_defaults{smiley=false}
+
+ -- Another example of defaults if we have: item, amount[opt], player[opt]
+ :set_defaults{
+ amount = 50, -- more than one value can be set at a time
+ player = function(player)
+ return player -- default is the player using the command
+ end
+ }
+
+ -- Now the params are set up we can alter how the command works, we can set auth flags, add aliases to this command or enable "auto concat"
+ -- which is when you want all extra words to be concatenated onto the end of the last param, useful for reason or messages:
+ :set_flag('admin_only',true) -- in our case we want "admin_only" to be set to true so only admins can use the command
+ :add_alias('name','rname') -- we also add two aliases here: "name" and "rname" which point to this command
+ -- :enable_auto_concat() we do not use this in our case but this can also be used to enable the "auto concat" feature
+
+ -- And finally we want to register a callback to this command, the callback is what defines what the command does, can be as complex as you
+ -- want it to be to as simple as our example; the command receives two params plus all that you have defines:
+ -- 1) the player who used the command
+ -- 2) in our case repeat_count which will be a number
+ -- 3) in our case smiley which will be a boolean
+ -- 4) the raw input; this param is always last as is always present as a catch all
+ :register(function(player,repeat_count,smiley,raw)
+ -- this is to show the value for raw as this is an example command, the log file will also show this
+ game.print(player.name..' used a command with input: '..raw)
+ local msg = ') '..player.name
+ if smiley then
+ -- this is where that smiley param is used
+ msg = ':'..msg
+ end
+ for 1 = 1,repeat_count do
+ -- this print function will return ANY value to the user in a desync safe manor, this includes if the command was used through rcon
+ Command.print(1..msg)
+ end
+ -- see below for what else can be used here
+ end)
+
+ -- Some other useful functions that can be used are:
+ Commands.print(any,colour[opt]) -- this will return any value value to the user including if it is ran through rcon console
+ Commands.error(message[opt]) -- this returns a warning to the user, aka an error that does not prevent execution of the command
+ return Commands.error(message[opt]) -- this returns an error to the user, and will halt the command execution, ie no success message is returned
+ Commands.success(message[opt]) -- used to return a success message however don't use this method see below
+ return Commands.success(message[opt]) -- will return the success message to the user and your given message, halts execution
+ return <any> if any value is returned then it will be returned to the player via a Commands.success call
+
+ -- Example Code:
+ Commands.new_command('repeat-name','Will repeat you name a number of times in chat.')
+ :add_param('repeat-count',false,'number-range-int',1,5) -- required int in range 1 to 5 inclusive
+ :add_param('smiley',true,function(input,player,reject) -- optional boolean default false
+ if not input then return end
+ if input:lower() == 'true' or input:lower() == 'yes' then
+ return true
+ else
+ return false
+ end
+ end)
+ :set_defaults{smiley=false}
+ :set_flag('admin_only',true) -- command is admin only
+ :add_alias('name','rname') -- allow alias: name and rname
+ :register(function(player,repeat_count,smiley,raw)
+ game.print(player.name..' used a command with input: '..raw)
+ local msg = ') '..player.name
+ if smiley then
+ msg = ':'..msg
+ end
+ for 1 = 1,repeat_count do
+ Command.print(1..msg)
+ end
+ end)
+
+
+
+
+
+ | utils.game | +
| expcore.common | +
| add_authenticator(callback) | +Adds an authorization callback, function used to check if a player if allowed to use a command | +
| remove_authenticator(callback) | +Removes an authorization callback | +
| authorize(player, command_name) | +Mostly used internally, calls all authorization callbacks, returns if the player is authorized | +
| get([player]) | +Gets all commands that a player is allowed to use, game commands not included | +
| search(keyword[, allowed_player]) | +Searches command names and help messages to find possible commands, game commands included | +
| add_parse(name, callback) | +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 | +
| remove_parse(name) | +Removes a parse function, see add_parse for adding them | +
| parse(name, input, player, reject) | +Intended to be used within other parse functions, runs a parse and returns success and new value | +
| new_command(name, help) | +Creates a new command object to added details to, note this does not register the command to the game | +
| Commands._prototype:add_param(name[, optional=false][, parse=pass function through][, ...]) | +Adds a new param to the command this will be displayed in the help and used to parse the input | +
| Commands._prototype:set_defaults(defaults) | +Adds default values to params only matters if the param is optional, if default value is a function it is called with param player | +
| Commands._prototype:set_flag(name, value) | +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 | +
| Commands._prototype:add_alias(any) | +Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working | +
| Commands._prototype:enable_auto_concat() | +Enables auto concatenation of any params on the end so quotes are not needed for last param + nb: this will disable max param checking as they will be concatenated onto the end of that last param + this can be useful for reasons or longs text, can only have one per command | +
| Commands._prototype:register(callback) | +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 | +
| error([error_message][, play_sound]) | +Sends an error message to the player and returns a constant to return to command handler to exit execution + 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 | +
| internal_error(success, command_name, error_message) | +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 | +
| success([value]) | +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 | +
| run_command(command_event) | +Main event function that is ran for all commands, used internally please avoid direct use | +
Adds an authorization callback, function used to check if a player if allowed to use a command
+ + + + Parameters: + +Removes an authorization callback
+ + + + Parameters: + +Mostly used internally, calls all authorization callbacks, returns if the player is authorized
+ + + + Parameters: + +Gets all commands that a player is allowed to use, game commands not included
+ + + + Parameters: + +Searches command names and help messages to find possible commands, game commands included
+ + + + Parameters: + +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
+ + + + Parameters: + +Removes a parse function, see add_parse for adding them
+ + + + Parameters: + +Intended to be used within other parse functions, runs a parse and returns success and new value
+ + + + Parameters: + +Creates a new command object to added details to, note this does not register the command to the game
+ + + + Parameters: + +Adds a new param to the command this will be displayed in the help and used to parse the input
+ + + + Parameters: + +Adds default values to params only matters if the param is optional, if default value is a function it is called with param player
+ + + + Parameters: + +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
+ + + + Parameters: + +Adds an alias or multiple that will also be registered with the same callback, eg /teleport can be /tp with both working
+ + + + Parameters: + +command:add_alias('aliasOne','aliasTwo','etc')
+
+
+
+ Enables auto concatenation of any params on the end so quotes are not needed for last param + nb: this will disable max param checking as they will be concatenated onto the end of that last param + this can be useful for reasons or longs text, can only have one per command
+ + + + + + + Returns: +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
+ + + + Parameters: + +Sends an error message to the player and returns a constant to return to command handler to exit execution + 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
+ + + + Parameters: + +return Commands.error()
+
+
+
+ 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
+ + + + Parameters: + +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
+ + + + Parameters: + +Main event function that is ran for all commands, used internally please avoid direct use
+ + + + Parameters: + +Explosive Gaming's server scenario for 0.17
+ + +Core Module - Common Library + - Adds some commonly used functions used in many modules
+ + + + + + + + + + + + +| resources.color_presets | +
| utils.game | +
| util | +
| 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 entities 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_values(tbl[, sorted][, as_string]) | +Returns a copy of all of the values in the table. | +
| table_keys(tbl[, sorted][, as_string]) | +Returns a copy of all of the keys in the 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 alternative 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 | +
Compare types faster for faster validation of params
+ + + + Parameters: + +type_check('foo','string') -- return true
+ type_check('foo') -- return false
+
+
+
+ Raises an error if the value is of the wrong type
+ + + + Parameters: + +type_check_error('foo','number','Value must be a number') -- will raise error "Value must be a number"
+
+
+
+ Raises an error when the value is the incorrect type, uses a consistent error message format
+ + + + Parameters: + +param_check('foo','number','repeat_count',2) -- will raise error "Invalid param #02 given to <anon>; repeat_count is not of type number"
+
+
+
+ Will return a value of any type to the player/server console, allows colour for in-game players
+ + + + Parameters: + +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
+
+
+
+ Writes a table object to a file in json format
+ + + + Parameters: + +Calls a require that will not error if the file is not found
+ + + + Parameters: + +local file = opt_require('file.not.present') -- will not cause any error
+
+
+
+ Calls a require and returns only the keys given, file must return a table
+ + + + Parameters: + +local extract, param_check = ext_require('expcore.common','extract','param_check') --- @dep expcore.common
+
+
+
+ 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: + +Moves items to the position and stores them in the closest entity of the type given
+ + + + Parameters: + +https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4a2/map_gen/maps/diggy/debug.lua#L31 + Prints a colored value on a location.
+ + + + Parameters: + +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: + +Clears all flying text entities on a surface
+ + + + Parameters: + +Tests if a string contains a given substring.
+ + + + Parameters: + +Extracts certain keys from a table
+ + + + Parameters: + +local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
+
+
+
+ Converts a table to an enum
+ + + + Parameters: + +Returns the closest match to the input
+ + + + Parameters: + +Returns a copy of all of the values in the table.
+ + + + Parameters: + +Returns a copy of all of the keys in the table.
+ + + + Parameters: + +Returns the list is a sorted way that would be expected by people (this is by key)
+ + + + Parameters: + +Returns the list is a sorted way that would be expected by people (this is by key) (faster alternative than above)
+ + + + Parameters: + +Returns a message with valid chat tags to change its colour
+ + + + Parameters: + +Returns a message with valid chat tags to change its colour, using localization
+ + + + Parameters: + +Returns the players name in the players color
+ + + + Parameters: + +Explosive Gaming's server scenario for 0.17
+ + +Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started
+ + + + + + + + + + + + +| expcore.gui.core | +
| expcore.gui.instances | +
| expcore.gui.elements.buttons | +
| expcore.gui.elements.checkbox | +
| expcore.gui.elements.dropdown | +
| expcore.gui.elements.slider | +
| expcore.gui.elements.text | +
| expcore.gui.elements.elem-button | +
| expcore.gui.elements.progress-bar | +
| expcore.gui.concepts.toolbar | +
| expcore.gui.concepts.left | +
| expcore.gui.concepts.center | +
| expcore.gui.concepts.popups | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.gui.concepts.toolbar | +|
| utils.game | +|
| CenterFrames.get_flow(player) | +Gets the center flow for a player | +
| CenterFrames.clear_flow(player) | +Clears the center flow for a player | +
| CenterFrames.draw_frame(player, name) | +Draws the center frame for a player, if already open then will do nothing | +
| CenterFrames.redraw_frame(player, name) | +Draws the center frame for a player, if already open then will destroy it and redraw | +
| CenterFrames.toggle_frame(player, name[, state]) | +Toggles if the frame is currently open or not, will open if closed and close if open | +
| CenterFrames.new_frame(permission_name) | +Creates a new center frame define | +
| CenterFrames._prototype:set_auto_focus([state=true]) | +Sets the frame to be the current active gui when opened and closes all other frames | +
| CenterFrames._prototype:draw_frame(player) | +Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame) | +
| CenterFrames._prototype:redraw_frame(player) | +Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame) | +
| CenterFrames._prototype:toggle_frame(player) | +Toggles if the frame is open, if open it will close it and if closed it will open it | +
| CenterFrames._prototype:event_handler([action=update]) | +Creates an event handler that will trigger one of its functions, use with Event.add | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.gui.concepts.toolbar | +|
| expcore.gui.elements.buttons | +|
| mod-gui | +|
| utils.game | +|
| utils.event | +|
| 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 visibility of a left frame, or sets its visibility state | +
| LeftFrames.new_frame(permission_name) | +Creates a new left frame define | +
| LeftFrames._prototype:set_open_by_default([state=true]) | +Sets if the frame is visible when a player joins, can also be a function to return a boolean | +
| LeftFrames._prototype:set_direction(direction) | +Sets the direction of the frame, either vertical or horizontal | +
| LeftFrames._prototype:_internal_draw(player) | +Creates the gui for the first time, used internally | +
| LeftFrames._prototype:get_frame(player) | +Gets the frame for this define from the left frame flow | +
| LeftFrames._prototype:is_open(player) | +Returns if the player currently has this define visible | +
| LeftFrames._prototype:toggle(player) | +Toggles the visibility of the left frame | +
| LeftFrames._prototype:update(player) | +Updates the contents of the left frame, first tries update callback, other wise will clear and redraw | +
| LeftFrames._prototype:update_all([update_offline=false]) | +Updates the frame for all players, see update | +
| LeftFrames._prototype:redraw(player) | +Redraws the frame by calling on_draw, will always clear the frame | +
| LeftFrames._prototype:redraw_all([update_offline=false]) | +Redraws the frame for all players, see redraw | +
| LeftFrames._prototype:event_handler([action=update]) | +Creates an event handler that will trigger one of its functions, use with Event.add | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| utils.event | +|
| expcore.gui.elements.progress-bar | +|
| expcore.gui.elements.buttons | +|
| mod-gui | +|
| resources.color_presets | +|
| utils.global | +|
| PopupFrames.get_flow(player) | +Gets the left flow that contains the popup frames | +
| PopupFrames.open(define_name, player[, open_time], ...) | +Opens a popup for the player, can give the amount of time it is open as well as params for the draw function | +
| PopupFrames.close_progress | +Progress bar which when depleted will close the popup frame | +
| PopupFrames.close_button | +A button which can be used to close the gui before the timer runs out | +
| PopupFrames.new_popup([name]) | +Creates a new popup frame define | +
| PopupFrames._prototype:set_default_open_time(amount) | +Sets the default open time for the popup, will be used if non is provided with open | +
| PopupFrames._prototype:open(player[, open_time], ...) | +Opens this define for a player, can be given open time and any other params for the draw function | +
| expcore.gui.core | +|
| expcore.gui.elements.buttons | +|
| expcore.roles | +|
| utils.event | +|
| utils.game | +|
| mod-gui | +|
| Toolbar.new_button([name]) | +Adds a new button to the toolbar | +
| Toolbar.add_button(button) | +Adds an existing buttton to the toolbar | +
| Toolbar.update(player) | +Updates the player's toolbar with an new buttons or expected change in auth return | +
| utils.gui | +|
| utils.game | +|
| new_define(prototype[, debug_name]) | +Used to create new element defines from a class prototype, please use the own given by the class | +
| get_define(name[, internal]) | +Gets an element define give the uid, debug name or a copy of the element define | +
| categorize_by_player(element) | +A categorize function to be used with add_store, each player has their own value | +
| categorize_by_force(element) | +A categorize function to be used with add_store, each force has its own value | +
| categorize_by_surface(element) | +A categorize function to be used with add_store, each surface has its own value | +
| draw(name, element) | +Draws a copy of the element define to the parent element, see draw_to | +
| toggle_enabled(element) | +Will toggle the enabled state of an element | +
| toggle_visible(element) | +Will toggle the visiblity of an element | +
| set_padding(element[, up=0][, down=0][, left=0][, right=0]) | +Sets the padding for a gui element | +
| set_padding_style(style[, up=0][, down=0][, left=0][, right=0]) | +Sets the padding for a gui style | +
| create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center']) | +Allows the creation of an alignment flow to place elements into | +
| destroy_if_valid(element) | +Destroies an element but tests for it being present and valid first | +
| create_scroll_table(element, table_size, maximal_height[, name='scroll']) | +Creates a scroll area with a table inside, table can be any size | +
| create_header(element, caption[, tooltip][, right_align][, name='header']) | +Creates a header section with a label and button area | +
| mod-gui | +|
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| Button.new_button([name]) | +Creates a new button element define | +
| Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) | +Adds sprites to a button making it a sprite button | +
| Button._prototype:set_click_filter(filter[, ...]) | +Adds a click / mouse button filter to the button | +
| Button._prototype:set_key_filter(filter[, ...]) | +Adds a control key filter to the button | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.store | +|
| utils.game | +|
| Checkbox.new_checkbox([name]) | +Creates a new checkbox element define | +
| Checkbox.new_radiobutton([name]) | +Creates a new radiobutton element define, has all functions checkbox has | +
| Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) | +Adds this radiobutton to be an option in the given option set (only one can be true at a time) | +
| Checkbox._prototype_radiobutton:get_store(category, internal) | +Gets the stored value of the radiobutton or the option set if present | +
| Checkbox._prototype_radiobutton:set_store(category, value, internal) | +Sets the stored value of the radiobutton or the option set if present | +
| Checkbox.new_option_set(name, callback, categorize) | +Registers a new option set that can be linked to radiobuttons (only one can be true at a time) | +
| Checkbox.draw_option_set(name, element) | +Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) | +
| Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) | +Sets all radiobutton in a element to false (unless excluded) and can act recursively | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| Dropdown.new_dropdown([name]) | +Creates a new dropdown element define | +
| Dropdown.new_list_box([name]) | +Creates a new list box element define | +
| Dropdown._prototype:new_static_options(options[, ...], the) | +Adds new static options to the dropdown which will trigger the general callback | +
| Dropdown._prototype:new_dynamic_options(callback) | +Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options) | +
| Dropdown._prototype:add_option_callback(option, callback) | +Adds a case specific callback which will only run when that option is selected (general case still triggered) | +
| Dropdown.select_value(element, value) | +Selects the option from a dropdown or list box given the value rather than key | +
| Dropdown.get_selected_value(element) | +Returns the currently selected value rather than index | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| ElemButton.new_elem_button([name]) | +Creates a new elem button element define | +
| ElemButton._prototype.set_type | +Sets the type of the elem button, the type is required so this must be called at least once | +
| ElemButton._prototype:set_default(value) | +Sets the default value for the elem button, this may be a function or a string | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.global | +|
| utils.game | +|
| ProgressBar.set_maximum(element, amount) | +Sets the maximum value that represents the end value of the progress bar | +
| ProgressBar.increment(element[, amount=1]) | +Increases the value of the progressbar, if a define is given all of its instances have incremented | +
| ProgressBar.decrement(element[, amount=1]) | +Decreases the value of the progressbar, if a define is given all of its instances have decremented | +
| ProgressBar.new_progressbar([name]) | +Creates a new progressbar element define | +
| ProgressBar._prototype:set_default_maximum(amount) | +Sets the maximum value that represents the end value of the progress bar | +
| ProgressBar._prototype:use_count_down([state=true]) | +Will set the progress bar to start at 1 and trigger when it hits 0 | +
| ProgressBar._prototype:increment([amount=1][, category]) | +Increases the value of the progressbar | +
| ProgressBar._prototype:increment_filtered([amount=1], filter) | +Increases the value of the progressbar, if the filter condition is met, does not work with store | +
| ProgressBar._prototype:decrement([amount=1][, category]) | +Decreases the value of the progressbar | +
| ProgressBar._prototype:decrement_filtered([amount=1], filter) | +Decreases the value of the progressbar, if the filter condition is met, does not work with store | +
| ProgressBar._prototype:add_element(element[, maximum]) | +Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have | +
| ProgressBar._prototype:reset_element(element) | +Resets an element, or its store, to be back at the start, either 1 or 0 | +
| ProgressBar._prototype:event_counter([filter]) | +Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented | +
| ProgressBar._prototype:event_countdown([filter]) | +Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| expcore.gui.instances | +|
| utils.game | +|
| Slider.new_slider([name]) | +Creates a new slider element define | +
| Slider._prototype:set_range([min][, max]) | +Sets the range of a slider, if not used will use default values for a slider | +
| Slider._prototype:draw_label(element) | +Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player | +
| Slider._prototype:enable_auto_draw_label([state=true]) | +Enables auto draw of the label, the label will share the same parent element as the slider | +
| expcore.gui.core | +|
| expcore.gui.prototype | +|
| utils.game | +|
| Text.new_text_field([name]) | +Creates a new text field element define | +
| Text.new_text_box([name]) | +Creates a new text box element define | +
| Text._prototype_box:set_selectable([state=true]) | +Sets the text box to be selectable | +
| Text._prototype_box:set_word_wrap([state=true]) | +Sets the text box to have word wrap | +
| Text._prototype_box:set_read_only([state=true]) | +Sets the text box to be read only | +
| utils.global | +|
| Instances.has_categories(name) | +Returns if a instance group has a categorise function; must be registered | +
| Instances.is_registered(name) | +Returns if the given name is a registered instance group | +
| Instances.register(name[, categorise]) | +Registers the name of an instance group to allow for storing element instances | +
| Instances.add_element(name, element) | +Adds an element to the instance group under the correct category; must be registered | +
| Instances.get_elements_raw(name[, category]) | +Gets all element instances without first removing any invalid ones; used internally and must be registered | +
| Instances.get_valid_elements(name[, category][, callback]) | +Gets all valid element instances and has the option of running a callback on those that are valid | +
| Instances.unregistered_add_element(name, category, element) | +A version of add_element that does not require the group to be registered | +
| Instances.unregistered_get_elements(name, category[, callback]) | +A version of get_elements that does not require the group to be registered | +
| utils.game | +|
| expcore.store | +|
| expcore.gui.instances | +|
| Constructor.event(event_name) | +Creates a new function to add functions to an event handler | +
| Constructor.extend(new_prototype) | +Extents a prototype with the base functions of all gui prototypes, no metatables | +
| Constructor.store(sync, callback) | +Creates a new function which adds a store to a gui define | +
| Constructor.setter(value_type, key[, second_key]) | +Creates a setter function that checks the type when a value is set | +
| Prototype:uid() | +Gets the uid for the element define | +
| Prototype.debug_name | +Sets a debug alias for the define | +
| Prototype.set_caption | +Sets the caption for the element define | +
| Prototype.set_tooltip | +Sets the tooltip for the element define | +
| Prototype.set_pre_authenticator | +Sets an authenticator that blocks the draw function if check fails | +
| Prototype.set_post_authenticator | +Sets an authenticator that disables the element if check fails | +
| Prototype.on_draw | +Registers a callback to the on_draw event | +
| Prototype.on_style_update | +Registers a callback to the on_style_update event | +
| Prototype:set_style(style[, callback]) | +Sets the style for the element define | +
| Prototype:set_embedded_flow(state) | +Sets the element to be drawn inside a nameless flow, can be given a name using a function | +
| Prototype:raise_event(event_name, ...) | +Raises a custom event for this define, any number of params can be given | +
| Prototype:draw_to(element) | +The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions | +
| Prototype:get_store(category) | +Gets the value in this elements store, category needed if categorize function used | +
| Prototype:set_store(category, value) | +Sets the value in this elements store, category needed if categorize function used | +
| Prototype:clear_store([category]) | +Sets the value in this elements store to nil, category needed if categorize function used | +
| expcore.gui | +
| expcore.common | +
| resources.color_presets | +
| utils.event | +
| expcore.store | +
Gets the center flow for a player
+ + + + Parameters: + +Clears the center flow for a player
+ + + + Parameters: + +Draws the center frame for a player, if already open then will do nothing
+ + + + Parameters: + +Draws the center frame for a player, if already open then will destroy it and redraw
+ + + + Parameters: + +Toggles if the frame is currently open or not, will open if closed and close if open
+ + + + Parameters: + +Creates a new center frame define
+ + + + Parameters: + +Sets the frame to be the current active gui when opened and closes all other frames
+ + + + Parameters: + +Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
+ + + + Parameters: + +Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
+ + + + Parameters: + +Toggles if the frame is open, if open it will close it and if closed it will open it
+ + + + Parameters: + +Creates an event handler that will trigger one of its functions, use with Event.add
+ + + + Parameters: + +