From ad10ed0b5af9819591672145e76d742ec9e26cb1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 17 Apr 2020 17:46:42 +0100 Subject: [PATCH 001/106] Fixed boolean auth on topflow --- expcore/gui/top_flow.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/expcore/gui/top_flow.lua b/expcore/gui/top_flow.lua index 1f50fc47..3001d88d 100644 --- a/expcore/gui/top_flow.lua +++ b/expcore/gui/top_flow.lua @@ -73,7 +73,8 @@ function Gui.update_top_flow(player) end -- Set the visible state - element.visible = is_visible and authenticator(player) or false + local allowed = type(authenticator) == 'function' and authenticator(player) or authenticator + element.visible = is_visible and allowed or false end end From a52f447ff94f775cd6439ca68fb5ec30025f6059 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sat, 16 May 2020 16:36:38 +0100 Subject: [PATCH 002/106] Added quickbar preset command --- config/expcore/roles.lua | 1 + config/preset_player_quickbar.lua | 8 ++++++++ modules/commands/quickbar.lua | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 config/preset_player_quickbar.lua create mode 100644 modules/commands/quickbar.lua diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 763fd132..2e5a1d7d 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -141,6 +141,7 @@ Roles.new_role('Sponsor','Spon') 'command/home-get', 'command/return', 'fast-tree-decon', + 'command/load-quickbar' } Roles.new_role('Supporter','Sup') diff --git a/config/preset_player_quickbar.lua b/config/preset_player_quickbar.lua new file mode 100644 index 00000000..9764291b --- /dev/null +++ b/config/preset_player_quickbar.lua @@ -0,0 +1,8 @@ +--- Preset quickbar items that players can load +-- @config Preset-Player-Quickbar + +return { + players={ --- @setting players list of all players and their quickbar items + dangerarea={'transport-belt','fast-transport-belt'} + } +} diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua new file mode 100644 index 00000000..db22b6b0 --- /dev/null +++ b/modules/commands/quickbar.lua @@ -0,0 +1,26 @@ +--[[-- Commands Module - Quickbar + - Adds a command that allows players to load Quickbar presets + @commands LoadQuickbar +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Game = require 'utils.game' --- @dep utils.game +local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar +require 'config.expcore.command_general_parse' + + +--- Changes the amount of bonus you receive +-- @command bonus +-- @tparam number amount range 0-50 the percent increase for your bonus +Commands.new_command('load-quickbar','Loads your preset Quickbar items') +:register(function(player) + if config.players[player.name] then + local custom_quickbar = config.players[player.name] + for i, item_name in ipairs(custom_quickbar) do + player.set_quick_bar_slot(i, item_name) + end + else + Commands.print('Quickbar preset not found','red') + end +end) From 54b657ca841f67c1ea38883723d793adbb1849d1 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sat, 16 May 2020 16:40:10 +0100 Subject: [PATCH 003/106] Alter documentation --- modules/commands/quickbar.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index db22b6b0..72886cbf 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -10,9 +10,8 @@ local config = require 'config.preset_player_quickbar' --- @dep config.preset_pl require 'config.expcore.command_general_parse' ---- Changes the amount of bonus you receive --- @command bonus --- @tparam number amount range 0-50 the percent increase for your bonus +--- Loads your quickbar preset +-- @command load-quickbar Commands.new_command('load-quickbar','Loads your preset Quickbar items') :register(function(player) if config.players[player.name] then From ffbc96fb8498032f545b0caee6c6af2a0f024634 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sat, 16 May 2020 16:44:28 +0100 Subject: [PATCH 004/106] Load module under game commands --- config/_file_loader.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/_file_loader.lua b/config/_file_loader.lua index c78f6bde..c6ea3ff9 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -27,6 +27,7 @@ return { 'modules.commands.find', 'modules.commands.bonus', 'modules.commands.home', + 'modules.commands.quickbar', -- QoL Addons 'modules.addons.station-auto-name', 'modules.addons.greetings', @@ -57,4 +58,4 @@ return { 'config.expcore.command_runtime_disable', -- allows commands to be enabled and disabled during runtime 'config.expcore.permission_groups', -- loads some predefined permission groups 'config.expcore.roles', -- loads some predefined roles -} \ No newline at end of file +} From 408b5d7abd8647372b4f9074de76574c680edcf5 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sat, 16 May 2020 17:45:10 +0100 Subject: [PATCH 005/106] Removed player config level and useing error command --- config/preset_player_quickbar.lua | 4 +--- modules/commands/quickbar.lua | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/config/preset_player_quickbar.lua b/config/preset_player_quickbar.lua index 9764291b..079ccd87 100644 --- a/config/preset_player_quickbar.lua +++ b/config/preset_player_quickbar.lua @@ -2,7 +2,5 @@ -- @config Preset-Player-Quickbar return { - players={ --- @setting players list of all players and their quickbar items - dangerarea={'transport-belt','fast-transport-belt'} - } + dangerarea={'transport-belt','fast-transport-belt'} } diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index 72886cbf..dae64e24 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -14,12 +14,12 @@ require 'config.expcore.command_general_parse' -- @command load-quickbar Commands.new_command('load-quickbar','Loads your preset Quickbar items') :register(function(player) - if config.players[player.name] then - local custom_quickbar = config.players[player.name] + if config[player.name] then + local custom_quickbar = config[player.name] for i, item_name in ipairs(custom_quickbar) do player.set_quick_bar_slot(i, item_name) end else - Commands.print('Quickbar preset not found','red') + Commands.error('Quickbar preset not found') end end) From d0a23a1a5906cd49cff7b8b6a7d61e268dc2f012 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sat, 16 May 2020 22:44:30 +0100 Subject: [PATCH 006/106] Iterate save using pairs instaid of ipairs, remove erronus require, add save fuction --- config/expcore/roles.lua | 3 ++- modules/commands/quickbar.lua | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 2e5a1d7d..7d1fd4e1 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -141,7 +141,8 @@ Roles.new_role('Sponsor','Spon') 'command/home-get', 'command/return', 'fast-tree-decon', - 'command/load-quickbar' + 'command/load-quickbar', + 'command/save-quickbar' } Roles.new_role('Supporter','Sup') diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index dae64e24..8c64f3aa 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -1,13 +1,13 @@ --[[-- Commands Module - Quickbar - Adds a command that allows players to load Quickbar presets @commands LoadQuickbar + @commands SaveQuickbar ]] local Commands = require 'expcore.commands' --- @dep expcore.commands local Roles = require 'expcore.roles' --- @dep expcore.roles local Game = require 'utils.game' --- @dep utils.game local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar -require 'config.expcore.command_general_parse' --- Loads your quickbar preset @@ -16,10 +16,29 @@ Commands.new_command('load-quickbar','Loads your preset Quickbar items') :register(function(player) if config[player.name] then local custom_quickbar = config[player.name] - for i, item_name in ipairs(custom_quickbar) do - player.set_quick_bar_slot(i, item_name) + for i, item_name in pairs(custom_quickbar) do + if item_name ~= nil and item_name ~= '' then + player.set_quick_bar_slot(i, item_name) + end end else Commands.error('Quickbar preset not found') end end) + +--- Saves your quickbar preset to the script-output folder +-- @command save-quickbar +Commands.new_command('save-quickbar','Saves your Quickbar preset items to file') +:register(function(player) + local quickbar_names = {} + for i=1, 100 do + local slot = player.get_quick_bar_slot(i) + if slot ~= nil then + table.insert(quickbar_names, slot.name) + else + table.insert(quickbar_names, "") + end + end + game.write_file("quickbar_preset.txt", game.table_to_json(quickbar_names), false) + Commands.print("Quickbar saved to local script-output folder") +end) From 6481cf9755e4dae91f2961089b5784e48d216a57 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sun, 17 May 2020 11:24:13 +0100 Subject: [PATCH 007/106] Added toolbar aliases, Save as LUA table --- config/preset_player_quickbar.lua | 2 +- modules/commands/quickbar.lua | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/preset_player_quickbar.lua b/config/preset_player_quickbar.lua index 079ccd87..fb3ad815 100644 --- a/config/preset_player_quickbar.lua +++ b/config/preset_player_quickbar.lua @@ -2,5 +2,5 @@ -- @config Preset-Player-Quickbar return { - dangerarea={'transport-belt','fast-transport-belt'} + dangerarea={"transport-belt",[2]="fast-transport-belt","express-transport-belt",[11]="transport-belt",[23]="fast-transport-belt",[33]="express-transport-belt"} } diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index 8c64f3aa..2a8e1cf8 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -13,12 +13,13 @@ local config = require 'config.preset_player_quickbar' --- @dep config.preset_pl --- Loads your quickbar preset -- @command load-quickbar Commands.new_command('load-quickbar','Loads your preset Quickbar items') +:add_alias('load-toolbar') :register(function(player) if config[player.name] then local custom_quickbar = config[player.name] for i, item_name in pairs(custom_quickbar) do if item_name ~= nil and item_name ~= '' then - player.set_quick_bar_slot(i, item_name) + player.set_quick_bar_slot(i, item_name) end end else @@ -29,16 +30,15 @@ end) --- Saves your quickbar preset to the script-output folder -- @command save-quickbar Commands.new_command('save-quickbar','Saves your Quickbar preset items to file') +:add_alias('save-toolbar') :register(function(player) local quickbar_names = {} for i=1, 100 do local slot = player.get_quick_bar_slot(i) if slot ~= nil then - table.insert(quickbar_names, slot.name) - else - table.insert(quickbar_names, "") + table.insert(quickbar_names, i, slot.name) end end - game.write_file("quickbar_preset.txt", game.table_to_json(quickbar_names), false) - Commands.print("Quickbar saved to local script-output folder") + game.write_file("quickbar_preset.txt", player.name .. " = " .. serpent.line(quickbar_names) .. "\n", true) + Commands.print("Quickbar saved") end) From 91f88b61e9d5b8565dc2f846255ec936e56cbc89 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sun, 17 May 2020 19:47:19 +0100 Subject: [PATCH 008/106] Resolve single @command --- modules/commands/quickbar.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index 2a8e1cf8..89974b85 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -1,7 +1,6 @@ --[[-- Commands Module - Quickbar - Adds a command that allows players to load Quickbar presets - @commands LoadQuickbar - @commands SaveQuickbar + @commands Quickbar ]] local Commands = require 'expcore.commands' --- @dep expcore.commands From af07b76d98babae0f31c0b9c460472c3d7b73cd3 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sun, 17 May 2020 19:48:07 +0100 Subject: [PATCH 009/106] Perfomance fix for adding to table --- modules/commands/quickbar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index 89974b85..f03a4efc 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -35,7 +35,7 @@ Commands.new_command('save-quickbar','Saves your Quickbar preset items to file') for i=1, 100 do local slot = player.get_quick_bar_slot(i) if slot ~= nil then - table.insert(quickbar_names, i, slot.name) + quickbar_names[i] = slot.name end end game.write_file("quickbar_preset.txt", player.name .. " = " .. serpent.line(quickbar_names) .. "\n", true) From e8c9043fbc0bbd4b29c1ef82ddec22cd03bdc916 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sun, 17 May 2020 20:18:02 +0100 Subject: [PATCH 010/106] Updated preset --- config/preset_player_quickbar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/preset_player_quickbar.lua b/config/preset_player_quickbar.lua index fb3ad815..de0ea7ef 100644 --- a/config/preset_player_quickbar.lua +++ b/config/preset_player_quickbar.lua @@ -2,5 +2,5 @@ -- @config Preset-Player-Quickbar return { - dangerarea={"transport-belt",[2]="fast-transport-belt","express-transport-belt",[11]="transport-belt",[23]="fast-transport-belt",[33]="express-transport-belt"} + dangerarea = {"transport-belt", "underground-belt", "splitter", "pipe", "pipe-to-ground", "inserter", "fast-inserter", "long-handed-inserter", "stack-inserter", "roboport", "small-electric-pole", "medium-electric-pole", "big-electric-pole", "substation", nil, "rail", "rail-signal", "rail-chain-signal", "landfill", "cliff-explosives", "fast-transport-belt", "fast-underground-belt", "fast-splitter", "pipe", "pipe-to-ground", "fast-inserter", "long-handed-inserter", "stack-inserter", "stack-filter-inserter", "roboport", [81] = "red-wire", [82] = "green-wire", [83] = "arithmetic-combinator", [84] = "decider-combinator", [85] = "constant-combinator", [86] = "power-switch", [91] = "logistic-chest-active-provider", [92] = "logistic-chest-passive-provider", [93] = "logistic-chest-storage", [94] = "logistic-chest-buffer", [95] = "logistic-chest-requester", [96] = "roboport"} } From 0c6278a57fe5ba0d9950309a8a4c004f3cb4bca9 Mon Sep 17 00:00:00 2001 From: Kevin Taylor Date: Sun, 17 May 2020 20:32:38 +0100 Subject: [PATCH 011/106] Latest luacheckrc --- Factorio-luacheckrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Factorio-luacheckrc b/Factorio-luacheckrc index 0c0518d1..53d12a83 160000 --- a/Factorio-luacheckrc +++ b/Factorio-luacheckrc @@ -1 +1 @@ -Subproject commit 0c0518d165b0fcee714f9e00b014afd7aba9fbee +Subproject commit 53d12a834fe0657e4be17df67a93c51af4e3981e From d926100c2daca4ab31064a36f0fe1c1c5b631297 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 21 May 2020 16:48:31 +0100 Subject: [PATCH 012/106] Module Layout --- expcore/datastore.lua | 131 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 expcore/datastore.lua diff --git a/expcore/datastore.lua b/expcore/datastore.lua new file mode 100644 index 00000000..371e76f6 --- /dev/null +++ b/expcore/datastore.lua @@ -0,0 +1,131 @@ + +local Event = require 'utils.event' --- @dep utils.event + +local DatastoreManager = {} +local Datastores = {} +local Datastore = {} + +--- Save datastores in the global table +global.datastores = Datastores +Event.on_load(function() + Datastores = global.datastores +end) + +----- Datastore Manager ----- + +--- Make a new datastore +function DatastoreManager.connect(tableName, saveToDisk, propagateChanges) + +end + +--- Make a new datastore that is contained within another +function DatastoreManager.combine(datastore, subTableName) + +end + +--- Ingest the result from a request +function DatastoreManager.ingest(action, tableName, key, valueJson) + +end + +--- Commonly used serializer, returns the objects name +function DatastoreManager.name_serializer(rawKey) + +end + +----- Datastore ----- + +--- Request a value from an external source +function Datastore:request(key) + +end + +--- Save a value to an external source +function Datastore:save(key) + +end + +--- Save a value to an external source and remove locally +function Datastore:unload(key) + +end + +--- Remove a value locally and on the external source +function Datastore:remove(key) + +end + +--- Get a value from local storage +function Datastore:get(key, default) + +end + +--- Set a value in local storage +function Datastore:set(key, value) + +end + +--- Increment the value in local storage, only works for number values +function Datastore:increment(key, delta) + +end + +--- Use a callback function to update the value locally +function Datastore:update(key, callback) + +end + +--- Use to send a message over the connection, works regardless of saveToDisk and propagateChanges +function Datastore:message(key, message) + +end + +--- Get all keys in the datastore, optional filter callback +function Datastore:get_all(callback) + +end + +--- Save all the keys in the datastore, optional filter callback +function Datastore:save_all(callback) + +end + +--- Unload all the keys in the datastore, optional filter callback +function Datastore:unload_all(callback) + +end + +--- Set a callback that will be used to serialize keys which aren't strings +function Datastore:set_serializer(callback) + +end + +----- Events ----- + +--- Register a callback that triggers only when data is received +function Datastore:on_received(callback) + +end + +--- Register a callback that triggers before data is saved +function Datastore:on_save(callback) + +end + +--- Register a callback that triggers before data is unloaded +function Datastore:on_unload(callback) + +end + +--- Register a callback that triggers when a message is received +function Datastore:on_message(callback) + +end + +--- Register a callback that triggers any time a value is changed +function Datastore:on_update(callback) + +end + +----- Module Return ----- +return DatastoreManager \ No newline at end of file From 07caa9c4a22a87a7cc456e8273863fbe3e98b13d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 21 May 2020 20:47:56 +0100 Subject: [PATCH 013/106] Added datastore --- expcore/datastore.lua | 267 +++++++++++++++++++++++++++------ modules/commands/interface.lua | 3 +- 2 files changed, 219 insertions(+), 51 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 371e76f6..0c6c22c9 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -9,123 +9,290 @@ local Datastore = {} global.datastores = Datastores Event.on_load(function() Datastores = global.datastores + for _, datastore in pairs(Datastores) do + setmetatable(datastore, DatastoreManager.metatable) + end end) ----- Datastore Manager ----- +-- @section datastoreManager + +--- Metatable used on datastores +DatastoreManager.metatable = { + __newidnex = function(_, _, _) error('Datastore can not be modified', 2) end, + __call = function(self, ...) return self:get(...) end, + __index = Datastore +} --- Make a new datastore -function DatastoreManager.connect(tableName, saveToDisk, propagateChanges) +function DatastoreManager.connect(tableName, saveToDisk, autoSave, propagateChanges) + if Datastores[tableName] then return Datastores[tableName] end + local new_datastore = { + name = tableName, + auto_save = autoSave or false, + save_to_disk = saveToDisk or false, + propagate_changes = propagateChanges or false, + serializer = false, + combined = false, + events = {}, + data = {} + } + + Datastores[tableName] = new_datastore + return setmetatable(new_datastore, DatastoreManager.metatable) end --- Make a new datastore that is contained within another function DatastoreManager.combine(datastore, subTableName) - + local new_datastore = DatastoreManager.connect(subTableName) + new_datastore.serializer = datastore.serializer + new_datastore.auto_save = datastore.auto_save + new_datastore.combined = datastore + return new_datastore end --- Ingest the result from a request +local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end function DatastoreManager.ingest(action, tableName, key, valueJson) + local datastore = assert(Datastores[tableName], 'Datastore ingest error, Datastore not found '..tostring(tableName)) + assert(type(action) == 'string', 'Datastore ingest error, Action is not a string got: '..type(action)) + assert(type(key) == 'string', 'Datastore ingest error, Key is not a string got: '..type(key)) + + if action == 'remove' then + datastore:raw_set(key) + + elseif action == 'message' then + local success, value = xpcall(game.json_to_table, ingest_error, valueJson) + if not success or value == nil then return end + datastore:raise_event('on_message', key, value) + + elseif action == 'propagate' then + local success, value = xpcall(game.json_to_table, ingest_error, valueJson) + if not success or value == nil then return end + value = datastore:raise_event('on_received', key, value) + datastore:set(key, value) + + end end --- Commonly used serializer, returns the objects name function DatastoreManager.name_serializer(rawKey) - + return rawKey.name end ----- Datastore ----- +-- @section datastore + +--- Internal, Get the data following combine logic +function Datastore:raw_get(key, isTable) + if self.combined then + local data = self.combined:raw_get(key, true) + if data[self.name] == nil and isTable then + data[self.name] = {} + end + return data[self.name] + else + if self.data[key] == nil and isTable then + self.data[key] = {} + end + return self.data[key] + end +end + +--- Internal, Set the data following combine logic +function Datastore:raw_set(key, value) + if self.combined then + local data = self.combined:raw_get(key, true) + data[self.name] = value + else + self.data[key] = value + end +end + +--- Internal, return the serialized key +local function serialize_error(err) error('An error ocurred in a datastore serializer: '..err) end +function Datastore:serialize(rawKey) + if type(rawKey) == 'string' then return rawKey end + assert(self.serializer, 'Datastore does not have a serializer and received non string key') + local success, key = xpcall(self.serializer, serialize_error, rawKey) + return success and key or nil +end + +--- Internal, writes an event to the output file to be saved and/or propagated +function Datastore:write_action(action, key, value) + local data = {action, self.name, '"'..key..'"'} + if value ~= nil then + data[4] = type(value) == 'table' and '"'..game.table_to_json(value)..'"' or '"'..tostring(value)..'"' + end + game.write_file('datastore.pipe', table.concat(data, ' ')..'\n', true, 0) +end --- Request a value from an external source function Datastore:request(key) - + if self.combined then return self.combined:request(key) end + key = self:serialize(key) + self:write_action('request', key) end --- Save a value to an external source function Datastore:save(key) - + if self.combined then return self.combined:save(key) end + if not self.save_to_disk then return end + key = self:serialize(key) + local value = self:raw_get(key) + value = self:raise_event('on_save', key, value) + local action = self.propagateChanges and 'propagate' or 'save' + self:write_action(action, key, value) end --- Save a value to an external source and remove locally function Datastore:unload(key) - -end - ---- Remove a value locally and on the external source -function Datastore:remove(key) - -end - ---- Get a value from local storage -function Datastore:get(key, default) - -end - ---- Set a value in local storage -function Datastore:set(key, value) - -end - ---- Increment the value in local storage, only works for number values -function Datastore:increment(key, delta) - -end - ---- Use a callback function to update the value locally -function Datastore:update(key, callback) - + if self.combined then return self.combined:unload(key) end + key = self:serialize(key) + self:save(key) + self:raw_set(key) end --- Use to send a message over the connection, works regardless of saveToDisk and propagateChanges function Datastore:message(key, message) + key = self:serialize(key) + self:write_action('message', key, message) +end +--- Remove a value locally and on the external source, works regardless of propagateChanges +function Datastore:remove(key) + key = self:serialize(key) + self:raw_set(key) + self:write_action('remove', key) + if self.combined and self.combined.auto_save then return self.combined:save(key) end +end + +--- Get a value from local storage +function Datastore:get(key, default) + key = self:serialize(key) + local value = self:raw_get(key) + if value ~= nil then return value end + return table.deep_copy(default) +end + +--- Set a value in local storage +function Datastore:set(key, value) + key = self:serialize(key) + self:raw_set(key, value) + self:raise_event('on_update', key, value) + if self.auto_save then self:save(key) end + return value +end + +--- Increment the value in local storage, only works for number values +function Datastore:increment(key, delta) + key = self:serialize(key) + local value = self:raw_get(key) or 0 + return Datastore:set(key, value + (delta or 1)) +end + +--- Use a callback function to update the value locally +local function update_error(err) error('An error ocurred in datastore update: '..err, 2) end +function Datastore:update(key, callback) + key = self:serialize(key) + local value = self:raw_get(key) + local success, new_value = xpcall(callback, update_error, key, value) + if success and new_value ~= nil then + self:set(key, new_value) + else + self:raise_event('on_update', key, value) + if self.auto_save then self:save(key) end + end +end + +--- Used to filter elements from a table +local function filter_error(err) print('An error ocurred in a datastore filter:', err) end +local function filter(tbl, callback) + if not callback then return tbl end + local rtn = {} + for key, value in pairs(tbl) do + local success, add = xpcall(callback, filter_error, key, value) + if success and add then rtn[key] = value end + end + return rtn end --- Get all keys in the datastore, optional filter callback function Datastore:get_all(callback) - + if not self.combined then + return filter(self.data, callback) + else + local name = self.name + local data = self.combined:get_all() + for key, value in pairs(data) do + data[key] = value[name] + end + return filter(data, callback) + end end --- Save all the keys in the datastore, optional filter callback function Datastore:save_all(callback) - + local data = self:get_all(callback) + for key in pairs(data) do self:save(key) end end --- Unload all the keys in the datastore, optional filter callback function Datastore:unload_all(callback) - + local data = self:get_all(callback) + for key in pairs(data) do self:unload(key) end end --- Set a callback that will be used to serialize keys which aren't strings function Datastore:set_serializer(callback) - + assert(type(callback) == 'function', 'Callback must be a function') + self.serializer = callback end ----- Events ----- +-- @section events + +--- Raise a custom event on this datastore +local function event_error(err) print('An error ocurred in a datastore event handler:', err) end +function Datastore:raise_event(event_name, key, value) + local handlers = self.events[event_name] + if not handlers then return value end + for _, handler in ipairs(handlers) do + local success, new_value = xpcall(handler, event_error, key, value) + if success and new_value ~= nil then value = new_value end + end + return value +end + +--- Returns a function which will add a callback to an event +local function event_factory(event_name) + return function(self, callback) + assert(type(callback) == 'function', 'Handler must be a function') + local handlers = self.events[event_name] + if not handlers then + self.events[event_name] = { callback } + else + handlers[#handlers+1] = callback + end + end +end --- Register a callback that triggers only when data is received -function Datastore:on_received(callback) - -end +Datastore.on_received = event_factory('on_received') --- Register a callback that triggers before data is saved -function Datastore:on_save(callback) - -end +Datastore.on_save = event_factory('on_save') --- Register a callback that triggers before data is unloaded -function Datastore:on_unload(callback) - -end +Datastore.on_unload = event_factory('on_unload') --- Register a callback that triggers when a message is received -function Datastore:on_message(callback) - -end +Datastore.on_message = event_factory('on_message') --- Register a callback that triggers any time a value is changed -function Datastore:on_update(callback) - -end +Datastore.on_update = event_factory('on_update') ----- Module Return ----- return DatastoreManager \ No newline at end of file diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index a826d286..f5c8b12f 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -17,7 +17,8 @@ local interface_modules = { ['Roles']='expcore.roles', ['Store']='expcore.store', ['Gui']='expcore.gui', - ['Async']='expcore.async' + ['Async']='expcore.async', + ['Datastore']='expcore.datastore' } -- loads all the modules given in the above table From 29fee79feaa08f6043d4308527d2ac91c3f362cc Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 21 May 2020 22:17:02 +0100 Subject: [PATCH 014/106] Added player data --- config/_file_loader.lua | 13 +++-- config/expcore/command_general_parse.lua | 6 +-- config/expcore/roles.lua | 2 + expcore/datastore.lua | 23 +++++---- expcore/playerdata.lua | 63 ++++++++++++++++++++++++ locale/en/expcore.cfg | 4 ++ 6 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 expcore/playerdata.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index c6ea3ff9..bb45f8e7 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -6,7 +6,9 @@ return { --'example.file_not_loaded', 'modules.factorio-control', -- base factorio free play scenario - -- Game Commands + 'expcore.playerdata', + + --- Game Commands 'modules.commands.me', 'modules.commands.kill', 'modules.commands.admin-chat', @@ -28,7 +30,8 @@ return { 'modules.commands.bonus', 'modules.commands.home', 'modules.commands.quickbar', - -- QoL Addons + + --- Addons 'modules.addons.station-auto-name', 'modules.addons.greetings', 'modules.addons.chat-popups', @@ -43,7 +46,8 @@ return { 'modules.addons.discord-alerts', 'modules.addons.chat-reply', 'modules.addons.tree-decon', - -- GUI + + --- GUI 'modules.gui.readme', 'modules.gui.rocket-info', 'modules.gui.science-info', @@ -52,7 +56,8 @@ return { 'modules.gui.player-list', 'modules.gui.server-ups', 'modules.commands.debug', - -- Config Files + + --- Config Files 'config.expcore.command_auth_admin', -- commands tagged with admin_only are blocked for non admins 'config.expcore.command_auth_roles', -- commands must be allowed via the role config 'config.expcore.command_runtime_disable', -- allows commands to be enabled and disabled during runtime diff --git a/config/expcore/command_general_parse.lua b/config/expcore/command_general_parse.lua index 7b9e282a..9cbf9a72 100644 --- a/config/expcore/command_general_parse.lua +++ b/config/expcore/command_general_parse.lua @@ -40,12 +40,12 @@ end) Commands.add_parse('string-options',function(input,player,reject,options) if not input then return end -- nil check input = input:lower() - for option in options do + for _, option in ipairs(options) do if input == option:lower() then - return true + return option end end - return reject{'reject-string-options',options:concat(', ')} + return reject{'expcore-commands.reject-string-options', table.concat(options, ', ')} end) Commands.add_parse('string-max-length',function(input,player,reject,max_length) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 7d1fd4e1..578e2a8e 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -220,6 +220,8 @@ local default = Roles.new_role('Guest','') 'command/report', 'command/ratio', 'command/server-ups', + 'command/data-policy', + 'command/set-data-policy', 'gui/player-list', 'gui/rocket-info', 'gui/science-info', diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 0c6c22c9..863933a1 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -4,6 +4,7 @@ local Event = require 'utils.event' --- @dep utils.event local DatastoreManager = {} local Datastores = {} local Datastore = {} +local copy = table.deep_copy --- Save datastores in the global table global.datastores = Datastores @@ -129,6 +130,15 @@ function Datastore:write_action(action, key, value) game.write_file('datastore.pipe', table.concat(data, ' ')..'\n', true, 0) end +--- Set a callback that will be used to serialize keys which aren't strings +function Datastore:set_serializer(callback) + assert(type(callback) == 'function', 'Callback must be a function') + self.serializer = callback +end + +--- Create a new datastore which is combined into this one +Datastore.combine = DatastoreManager.combine + --- Request a value from an external source function Datastore:request(key) if self.combined then return self.combined:request(key) end @@ -138,11 +148,11 @@ end --- Save a value to an external source function Datastore:save(key) - if self.combined then return self.combined:save(key) end + if self.combined then self.combined:save(key) end if not self.save_to_disk then return end key = self:serialize(key) local value = self:raw_get(key) - value = self:raise_event('on_save', key, value) + value = self:raise_event('on_save', key, copy(value)) local action = self.propagateChanges and 'propagate' or 'save' self:write_action(action, key, value) end @@ -151,6 +161,7 @@ end function Datastore:unload(key) if self.combined then return self.combined:unload(key) end key = self:serialize(key) + self:raise_event('on_unload', key, copy(self:raw_get(key))) self:save(key) self:raw_set(key) end @@ -174,7 +185,7 @@ function Datastore:get(key, default) key = self:serialize(key) local value = self:raw_get(key) if value ~= nil then return value end - return table.deep_copy(default) + return copy(default) end --- Set a value in local storage @@ -245,12 +256,6 @@ function Datastore:unload_all(callback) for key in pairs(data) do self:unload(key) end end ---- Set a callback that will be used to serialize keys which aren't strings -function Datastore:set_serializer(callback) - assert(type(callback) == 'function', 'Callback must be a function') - self.serializer = callback -end - ----- Events ----- -- @section events diff --git a/expcore/playerdata.lua b/expcore/playerdata.lua new file mode 100644 index 00000000..f400f4ca --- /dev/null +++ b/expcore/playerdata.lua @@ -0,0 +1,63 @@ + +local Event = require 'utils.event' --- @dep utils.event +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' --- @dep config.expcore.command_general_parse + +--- Common player data that acts as the root store for player data +local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk +PlayerData:set_serializer(Datastore.name_serializer) -- use player name + +--- Store and enum for the data collection policy +local DataCollectionPolicy = PlayerData:combine('DataCollectionPolicy') +local PolicyEnum = { 'All', 'Tracking', 'Settings', 'Required' } +for k,v in ipairs(PolicyEnum) do PolicyEnum[v] = k end + +--- Sets your data collection policy +-- @command set-data-policy +Commands.new_command('set-data-policy', 'Allows you to set your data collection policy') +:add_param('option', false, 'string-options', PolicyEnum) +:register(function(player, option) + DataCollectionPolicy:set(player, option) + return {'expcore-data.set-policy', option} +end) + +--- Gets your data collection policy +-- @command data-policy +Commands.new_command('data-policy', 'Shows you what your current data collection policy is') +:register(function(player) + return {'expcore-data.get-policy', DataCollectionPolicy:get(player, 'All')} +end) + +--- Remove data that the player doesnt want to have stored +PlayerData:on_save(function(player_name, player_data) + local collectData = DataCollectionPolicy:get(player_name, 'All') + collectData = PolicyEnum[collectData] + if collectData == PolicyEnum.All then return player_data end + + local saved_player_data = { PlayerRequired = player_data.PlayerRequired, DataCollectionPolicy = PolicyEnum[collectData] } + if collectData <= PolicyEnum.Settings then saved_player_data.PlayerSettings = player_data.PlayerSettings end + if collectData <= PolicyEnum.Tracking then saved_player_data.PlayerTracking = player_data.PlayerTracking end + + return saved_player_data +end) + +--- Load player data when they join +Event.add(defines.events.on_player_joined_game, function(event) + PlayerData:request(game.players[event.player_index]) +end) + +--- Unload player data when they leave +Event.add(defines.events.on_player_left_game, function(event) + PlayerData:unload(game.players[event.player_index]) +end) + +----- Module Return ----- +return { + All = PlayerData, -- Root for all of a players data + Tracking = PlayerData:combine('PlayerTracking'), -- Common place for tracing stats + Settings = PlayerData:combine('PlayerSettings'), -- Common place for settings + Required = PlayerData:combine('PlayerRequired'), -- Common place for required data + DataCollectionPolicy = DataCollectionPolicy, -- Stores what data groups will be saved + PolicyEnum = PolicyEnum -- Enum for the allowed options for the data collection policy +} \ No newline at end of file diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index ce4d3d45..ea0a5d0c 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -36,3 +36,7 @@ button_tooltip=Shows/hides the toolbar. [expcore-gui] left-button-tooltip=Hide all open windows. + +[expcore-data] +set-policy=You data collection policy has been set to __1__. Existing data will not be effected until you rejoin. +get-policy=You data collection policy is __1__. Use /set-data-policy to change this. \ No newline at end of file From df2a79780914a2631884b3e0a7809cc12d005def Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 21 May 2020 22:31:34 +0100 Subject: [PATCH 015/106] Renamed to player_data --- expcore/{playerdata.lua => player_data.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename expcore/{playerdata.lua => player_data.lua} (100%) diff --git a/expcore/playerdata.lua b/expcore/player_data.lua similarity index 100% rename from expcore/playerdata.lua rename to expcore/player_data.lua From d283acca3bfc62d4cf1cd0d9f6469a6eafff8eb9 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 21 May 2020 22:32:10 +0100 Subject: [PATCH 016/106] Removed player data from file loader --- config/_file_loader.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/config/_file_loader.lua b/config/_file_loader.lua index bb45f8e7..acab613a 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -6,7 +6,6 @@ return { --'example.file_not_loaded', 'modules.factorio-control', -- base factorio free play scenario - 'expcore.playerdata', --- Game Commands 'modules.commands.me', From 537980cda430babfeca7011c94215e7571ec041e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 22 May 2020 20:18:00 +0100 Subject: [PATCH 017/106] Few bug fixes for datastore --- config/_file_loader.lua | 1 + config/expcore/roles.lua | 4 +- expcore/datastore.lua | 164 +++++++++++++++++++++++---------------- expcore/player_data.lua | 51 ++++++------ locale/en/expcore.cfg | 4 +- 5 files changed, 131 insertions(+), 93 deletions(-) diff --git a/config/_file_loader.lua b/config/_file_loader.lua index acab613a..ce035ac0 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -6,6 +6,7 @@ return { --'example.file_not_loaded', 'modules.factorio-control', -- base factorio free play scenario + 'expcore.player_data', --- Game Commands 'modules.commands.me', diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 578e2a8e..4d9f9dad 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -220,8 +220,8 @@ local default = Roles.new_role('Guest','') 'command/report', 'command/ratio', 'command/server-ups', - 'command/data-policy', - 'command/set-data-policy', + 'command/data-preference', + 'command/set-data-preference', 'gui/player-list', 'gui/rocket-info', 'gui/science-info', diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 863933a1..31f65189 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -4,14 +4,15 @@ local Event = require 'utils.event' --- @dep utils.event local DatastoreManager = {} local Datastores = {} local Datastore = {} +local Data = {} local copy = table.deep_copy --- Save datastores in the global table -global.datastores = Datastores +global.datastores = Data Event.on_load(function() - Datastores = global.datastores - for _, datastore in pairs(Datastores) do - setmetatable(datastore, DatastoreManager.metatable) + Data = global.datastores + for tableName, datastore in pairs(Datastores) do + datastore.data = Data[tableName] end end) @@ -20,40 +21,52 @@ end) --- Metatable used on datastores DatastoreManager.metatable = { + __index = function(self, key) return rawget(self.children, key) or rawget(Datastore, key) end, __newidnex = function(_, _, _) error('Datastore can not be modified', 2) end, - __call = function(self, ...) return self:get(...) end, - __index = Datastore + __call = function(self, ...) return self:get(...) end } ---- Make a new datastore +--- Make a new datastore connection, if a connection already exists then it is returned function DatastoreManager.connect(tableName, saveToDisk, autoSave, propagateChanges) if Datastores[tableName] then return Datastores[tableName] end + if _LIFECYCLE ~= _STAGE.control then + -- Only allow this function to be called during the control stage + error('New datastore connection can not be created during runtime', 2) + end local new_datastore = { name = tableName, + table_name = tableName, auto_save = autoSave or false, save_to_disk = saveToDisk or false, propagate_changes = propagateChanges or false, serializer = false, - combined = false, + parent = false, + children = {}, + metadata = {}, events = {}, data = {} } + Data[tableName] = new_datastore.data Datastores[tableName] = new_datastore return setmetatable(new_datastore, DatastoreManager.metatable) end ---- Make a new datastore that is contained within another +--- Make a new datastore that stores its data inside of another one function DatastoreManager.combine(datastore, subTableName) - local new_datastore = DatastoreManager.connect(subTableName) + local new_datastore = DatastoreManager.connect(datastore.name..'.'..subTableName) + datastore.children[subTableName] = new_datastore new_datastore.serializer = datastore.serializer new_datastore.auto_save = datastore.auto_save - new_datastore.combined = datastore + new_datastore.table_name = subTableName + new_datastore.parent = datastore + Data[new_datastore.name] = nil + new_datastore.data = nil return new_datastore end ---- Ingest the result from a request +--- Ingest the result from a request, this is used through a rcon interface to sync data local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end function DatastoreManager.ingest(action, tableName, key, valueJson) local datastore = assert(Datastores[tableName], 'Datastore ingest error, Datastore not found '..tostring(tableName)) @@ -71,14 +84,14 @@ function DatastoreManager.ingest(action, tableName, key, valueJson) elseif action == 'propagate' then local success, value = xpcall(game.json_to_table, ingest_error, valueJson) if not success or value == nil then return end - value = datastore:raise_event('on_received', key, value) + value = datastore:raise_event('on_load', key, value) datastore:set(key, value) end end ---- Commonly used serializer, returns the objects name +--- Commonly used serializer, returns the name of the object function DatastoreManager.name_serializer(rawKey) return rawKey.name end @@ -86,33 +99,31 @@ end ----- Datastore ----- -- @section datastore ---- Internal, Get the data following combine logic -function Datastore:raw_get(key, isTable) - if self.combined then - local data = self.combined:raw_get(key, true) - if data[self.name] == nil and isTable then - data[self.name] = {} - end - return data[self.name] - else - if self.data[key] == nil and isTable then - self.data[key] = {} - end - return self.data[key] +--- Internal, Get data following combine logic +function Datastore:raw_get(key, fromChild) + local data = self.data + if self.parent then + data = self.parent:raw_get(key, true) + key = self.table_name end + local value = data[key] + if value ~= nil then return value end + if fromChild then value = {} end + data[key] = value + return value end ---- Internal, Set the data following combine logic +--- Internal, Set data following combine logic function Datastore:raw_set(key, value) - if self.combined then - local data = self.combined:raw_get(key, true) - data[self.name] = value + if self.parent then + local data = self.parent:raw_get(key, true) + data[self.table_name] = value else self.data[key] = value end end ---- Internal, return the serialized key +--- Internal, Return the serialized key local function serialize_error(err) error('An error ocurred in a datastore serializer: '..err) end function Datastore:serialize(rawKey) if type(rawKey) == 'string' then return rawKey end @@ -121,7 +132,7 @@ function Datastore:serialize(rawKey) return success and key or nil end ---- Internal, writes an event to the output file to be saved and/or propagated +--- Internal, Writes an event to the output file to be saved and/or propagated function Datastore:write_action(action, key, value) local data = {action, self.name, '"'..key..'"'} if value ~= nil then @@ -136,30 +147,37 @@ function Datastore:set_serializer(callback) self.serializer = callback end ---- Create a new datastore which is combined into this one +--- Set metadata tags on this datastore which can be accessed by other scripts +function Datastore:set_metadata(tags) + local metadata = self.metadata + for key, value in pairs(tags) do + metadata[key] = value + end +end + +--- Create a new datastore which is stores its data inside of this datastore Datastore.combine = DatastoreManager.combine ---- Request a value from an external source +--- Request a value from an external source, will trigger on_load when data is received function Datastore:request(key) - if self.combined then return self.combined:request(key) end + if self.parent then return self.parent:request(key) end key = self:serialize(key) self:write_action('request', key) end ---- Save a value to an external source +--- Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true function Datastore:save(key) - if self.combined then self.combined:save(key) end + if self.parent then self.parent:save(key) end if not self.save_to_disk then return end key = self:serialize(key) - local value = self:raw_get(key) - value = self:raise_event('on_save', key, copy(value)) + local value = self:raise_event('on_save', key, copy(self:raw_get(key))) local action = self.propagateChanges and 'propagate' or 'save' self:write_action(action, key, value) end ---- Save a value to an external source and remove locally +--- Save a value to an external source and remove locally, will trigger on_unload then on_save, save_to_disk is not required for on_unload function Datastore:unload(key) - if self.combined then return self.combined:unload(key) end + if self.parent then return self.parent:unload(key) end key = self:serialize(key) self:raise_event('on_unload', key, copy(self:raw_get(key))) self:save(key) @@ -177,10 +195,10 @@ function Datastore:remove(key) key = self:serialize(key) self:raw_set(key) self:write_action('remove', key) - if self.combined and self.combined.auto_save then return self.combined:save(key) end + if self.parent and self.parent.auto_save then return self.parent:save(key) end end ---- Get a value from local storage +--- Get a value from local storage, option to have a default value function Datastore:get(key, default) key = self:serialize(key) local value = self:raw_get(key) @@ -188,7 +206,7 @@ function Datastore:get(key, default) return copy(default) end ---- Set a value in local storage +--- Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save function Datastore:set(key, value) key = self:serialize(key) self:raw_set(key, value) @@ -197,14 +215,14 @@ function Datastore:set(key, value) return value end ---- Increment the value in local storage, only works for number values +--- Increment the value in local storage, only works for number values, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save function Datastore:increment(key, delta) key = self:serialize(key) local value = self:raw_get(key) or 0 return Datastore:set(key, value + (delta or 1)) end ---- Use a callback function to update the value locally +--- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save local function update_error(err) error('An error ocurred in datastore update: '..err, 2) end function Datastore:update(key, callback) key = self:serialize(key) @@ -218,7 +236,7 @@ function Datastore:update(key, callback) end end ---- Used to filter elements from a table +--- Internal, Used to filter elements from a table local function filter_error(err) print('An error ocurred in a datastore filter:', err) end local function filter(tbl, callback) if not callback then return tbl end @@ -230,15 +248,15 @@ local function filter(tbl, callback) return rtn end ---- Get all keys in the datastore, optional filter callback +--- Get all keys in this datastore, optional filter callback function Datastore:get_all(callback) - if not self.combined then + if not self.parent then return filter(self.data, callback) else - local name = self.name - local data = self.combined:get_all() + local table_name = self.table_name + local data = self.parent:get_all() for key, value in pairs(data) do - data[key] = value[name] + data[key] = value[table_name] end return filter(data, callback) end @@ -259,19 +277,33 @@ end ----- Events ----- -- @section events ---- Raise a custom event on this datastore +--- Internal, Raise an event on this datastore local function event_error(err) print('An error ocurred in a datastore event handler:', err) end -function Datastore:raise_event(event_name, key, value) +function Datastore:raise_event(event_name, key, value, source) + -- Raise the event for the children of this datastore + if source ~= 'child' then + for table_name, child in pairs(self.children) do + value[table_name] = child:raise_event(event_name, key, value[table_name], 'parent') + end + end + + -- Raise the event for this datastore local handlers = self.events[event_name] - if not handlers then return value end - for _, handler in ipairs(handlers) do - local success, new_value = xpcall(handler, event_error, key, value) - if success and new_value ~= nil then value = new_value end + if handlers then + for _, handler in ipairs(handlers) do + local success, new_value = xpcall(handler, event_error, key, value) + if success and new_value ~= nil then value = new_value end + end + end + + -- Raise the event for the parent of this datastore + if source ~= 'parent' and self.parent then + self.parent:raise_event(event_name, key, self.parent:raw_get(key), 'child') end return value end ---- Returns a function which will add a callback to an event +--- Internal, Returns a function which will add a callback to an event local function event_factory(event_name) return function(self, callback) assert(type(callback) == 'function', 'Handler must be a function') @@ -284,19 +316,19 @@ local function event_factory(event_name) end end ---- Register a callback that triggers only when data is received -Datastore.on_received = event_factory('on_received') +--- Register a callback that triggers when data is loaded from an external source, returned value is saved locally +Datastore.on_load = event_factory('on_load') ---- Register a callback that triggers before data is saved +--- Register a callback that triggers before data is saved, returned value is saved externally Datastore.on_save = event_factory('on_save') ---- Register a callback that triggers before data is unloaded +--- Register a callback that triggers before data is unloaded, returned value is ignored Datastore.on_unload = event_factory('on_unload') ---- Register a callback that triggers when a message is received +--- Register a callback that triggers when a message is received, returned value is ignored Datastore.on_message = event_factory('on_message') ---- Register a callback that triggers any time a value is changed +--- Register a callback that triggers any time a value is changed, returned value is ignored Datastore.on_update = event_factory('on_update') ----- Module Return ----- diff --git a/expcore/player_data.lua b/expcore/player_data.lua index f400f4ca..827abf1e 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -8,40 +8,45 @@ require 'config.expcore.command_general_parse' --- @dep config.expcore.command_g local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk PlayerData:set_serializer(Datastore.name_serializer) -- use player name ---- Store and enum for the data collection policy -local DataCollectionPolicy = PlayerData:combine('DataCollectionPolicy') -local PolicyEnum = { 'All', 'Tracking', 'Settings', 'Required' } -for k,v in ipairs(PolicyEnum) do PolicyEnum[v] = k end +--- Store and enum for the data saving preference +local DataSavingPreference = PlayerData:combine('DataSavingPreference') +local PreferenceEnum = { 'All', 'Statistics', 'Settings', 'Required' } +for k,v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end ---- Sets your data collection policy --- @command set-data-policy -Commands.new_command('set-data-policy', 'Allows you to set your data collection policy') -:add_param('option', false, 'string-options', PolicyEnum) +--- Sets your data saving preference +-- @command set-data-preference +Commands.new_command('set-data-preference', 'Allows you to set your data saving preference') +:add_param('option', false, 'string-options', PreferenceEnum) :register(function(player, option) - DataCollectionPolicy:set(player, option) - return {'expcore-data.set-policy', option} + DataSavingPreference:set(player, option) + return {'expcore-data.set-preference', option} end) ---- Gets your data collection policy --- @command data-policy -Commands.new_command('data-policy', 'Shows you what your current data collection policy is') +--- Gets your data saving preference +-- @command data-preference +Commands.new_command('data-preference', 'Shows you what your current data saving preference is') :register(function(player) - return {'expcore-data.get-policy', DataCollectionPolicy:get(player, 'All')} + return {'expcore-data.get-preference', DataSavingPreference:get(player, 'All')} end) --- Remove data that the player doesnt want to have stored PlayerData:on_save(function(player_name, player_data) - local collectData = DataCollectionPolicy:get(player_name, 'All') - collectData = PolicyEnum[collectData] - if collectData == PolicyEnum.All then return player_data end + local dataPreference = DataSavingPreference:get(player_name, 'All') + dataPreference = PreferenceEnum[dataPreference] + if dataPreference == PreferenceEnum.All then return player_data end - local saved_player_data = { PlayerRequired = player_data.PlayerRequired, DataCollectionPolicy = PolicyEnum[collectData] } - if collectData <= PolicyEnum.Settings then saved_player_data.PlayerSettings = player_data.PlayerSettings end - if collectData <= PolicyEnum.Tracking then saved_player_data.PlayerTracking = player_data.PlayerTracking end + local saved_player_data = { PlayerRequired = player_data.PlayerRequired, DataSavingPreference = PreferenceEnum[dataPreference] } + if dataPreference <= PreferenceEnum.Settings then saved_player_data.PlayerSettings = player_data.PlayerSettings end + if dataPreference <= PreferenceEnum.Statistics then saved_player_data.PlayerStatistics = player_data.PlayerStatistics end return saved_player_data end) +--- Display your data preference when your data loads +DataSavingPreference:on_load(function(player_name, dataPreference) + game.players[player_name].print{'expcore-data.get-preference', dataPreference or 'All'} +end) + --- Load player data when they join Event.add(defines.events.on_player_joined_game, function(event) PlayerData:request(game.players[event.player_index]) @@ -55,9 +60,9 @@ end) ----- Module Return ----- return { All = PlayerData, -- Root for all of a players data - Tracking = PlayerData:combine('PlayerTracking'), -- Common place for tracing stats + Statistics = PlayerData:combine('PlayerStatistics'), -- Common place for stats Settings = PlayerData:combine('PlayerSettings'), -- Common place for settings Required = PlayerData:combine('PlayerRequired'), -- Common place for required data - DataCollectionPolicy = DataCollectionPolicy, -- Stores what data groups will be saved - PolicyEnum = PolicyEnum -- Enum for the allowed options for the data collection policy + DataSavingPreference = DataSavingPreference, -- Stores what data groups will be saved + PreferenceEnum = PreferenceEnum -- Enum for the allowed options for data saving preference } \ No newline at end of file diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index ea0a5d0c..5fd4fefe 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -38,5 +38,5 @@ button_tooltip=Shows/hides the toolbar. left-button-tooltip=Hide all open windows. [expcore-data] -set-policy=You data collection policy has been set to __1__. Existing data will not be effected until you rejoin. -get-policy=You data collection policy is __1__. Use /set-data-policy to change this. \ No newline at end of file +set-preference=You data saving preference has been set to __1__. Existing data will not be effected until you rejoin. +get-preference=You data saving preference is __1__. Use /set-data-preference to change this. \ No newline at end of file From b6699df3aae7bb4f13ddad0b2b71ebfc4521aa2d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 23 May 2020 22:50:34 +0100 Subject: [PATCH 018/106] Added datastore to debug --- expcore/datastore.lua | 38 +++++- modules/gui/debug/expcore_datastore_view.lua | 131 +++++++++++++++++++ modules/gui/debug/global_view.lua | 2 +- modules/gui/debug/main_view.lua | 1 + 4 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 modules/gui/debug/expcore_datastore_view.lua diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 31f65189..f9f81b59 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -91,6 +91,13 @@ function DatastoreManager.ingest(action, tableName, key, valueJson) end +--- Debug, Use to get all datastores, or return debug info on a datastore +function DatastoreManager.debug(tableName) + if not tableName then return Datastores end + local datastore = assert(Datastores[tableName], 'Datastore not found '..tostring(tableName)) + return datastore:debug() +end + --- Commonly used serializer, returns the name of the object function DatastoreManager.name_serializer(rawKey) return rawKey.name @@ -99,6 +106,30 @@ end ----- Datastore ----- -- @section datastore +--- Debug, Get the debug info for this datastore +function Datastore:debug() + local debug_info = {} + + if self.parent then + debug_info.parent = self.parent.name + else + debug_info.settings = { auto_save = self.auto_save, save_to_disk = self.save_to_disk, propagate_changes = self.propagate_changes, serializer = not not self.serializer } + end + + local children = {} + for name in pairs(self.children) do children[#children+1] = name end + if #children > 0 then debug_info.children = children end + + local events = {} + for name, handlers in pairs(self.events) do events[name] = #handlers end + if next(events) then debug_info.events = events end + + if next(self.metadata) then debug_info.metadata = self.metadata end + debug_info.data = self:get_all() + + return debug_info +end + --- Internal, Get data following combine logic function Datastore:raw_get(key, fromChild) local data = self.data @@ -171,7 +202,7 @@ function Datastore:save(key) if not self.save_to_disk then return end key = self:serialize(key) local value = self:raise_event('on_save', key, copy(self:raw_get(key))) - local action = self.propagateChanges and 'propagate' or 'save' + local action = self.propagate_changes and 'propagate' or 'save' self:write_action(action, key, value) end @@ -253,9 +284,8 @@ function Datastore:get_all(callback) if not self.parent then return filter(self.data, callback) else - local table_name = self.table_name - local data = self.parent:get_all() - for key, value in pairs(data) do + local data, table_name = {}, self.table_name + for key, value in pairs(self.parent:get_all()) do data[key] = value[table_name] end return filter(data, callback) diff --git a/modules/gui/debug/expcore_datastore_view.lua b/modules/gui/debug/expcore_datastore_view.lua new file mode 100644 index 00000000..f7a9912f --- /dev/null +++ b/modules/gui/debug/expcore_datastore_view.lua @@ -0,0 +1,131 @@ +local Gui = require 'utils.gui' --- @dep utils.gui +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore +local Color = require 'utils.color_presets' --- @dep utils.color_presets +local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model + +local dump = Model.dump +local dump_text = Model.dump_text +local concat = table.concat + +local Public = {} + +local header_name = Gui.uid_name() +local left_panel_name = Gui.uid_name() +local right_panel_name = Gui.uid_name() +local input_text_box_name = Gui.uid_name() +local refresh_name = Gui.uid_name() + +Public.name = 'Datastore' + +function Public.show(container) + local main_flow = container.add {type = 'flow', direction = 'horizontal'} + + local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name} + local left_panel_style = left_panel.style + left_panel_style.width = 300 + + for name in pairs(table.keysort(Datastore.debug())) do + local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = name} + Gui.set_data(header, name) + end + + local right_flow = main_flow.add {type = 'flow', direction = 'vertical'} + + local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'} + + local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name} + local input_text_box_style = input_text_box.style + input_text_box_style.horizontally_stretchable = true + input_text_box_style.height = 32 + input_text_box_style.maximal_width = 1000 + + local refresh_button = + right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'} + local refresh_button_style = refresh_button.style + refresh_button_style.width = 32 + refresh_button_style.height = 32 + + local right_panel = right_flow.add {type = 'text-box', name = right_panel_name} + right_panel.read_only = true + right_panel.selectable = true + + local right_panel_style = right_panel.style + right_panel_style.vertically_stretchable = true + right_panel_style.horizontally_stretchable = true + right_panel_style.maximal_width = 1000 + right_panel_style.maximal_height = 1000 + + local data = { + right_panel = right_panel, + input_text_box = input_text_box, + selected_header = nil + } + + Gui.set_data(input_text_box, data) + Gui.set_data(left_panel, data) + Gui.set_data(refresh_button, data) +end + +Gui.on_click( + header_name, + function(event) + local element = event.element + local tableName = Gui.get_data(element) + + local left_panel = element.parent.parent + local data = Gui.get_data(left_panel) + local right_panel = data.right_panel + local selected_header = data.selected_header + local input_text_box = data.input_text_box + + if selected_header then + selected_header.style.font_color = Color.white + end + + element.style.font_color = Color.orange + data.selected_header = element + + input_text_box.text = tableName + input_text_box.style.font_color = Color.black + + local content = Datastore.debug(tableName) + local content_string = {} + for key, value in pairs(content) do + content_string[#content_string+1] = key:gsub('^%l', string.upper)..' = '..dump(value) + end + right_panel.text = concat(content_string, '\n') + end +) + +local function update_dump(text_input, data) + local content = Datastore.debug(text_input.text) + local content_string = {} + for key, value in pairs(content) do + content_string[#content_string+1] = key:gsub('^%l', string.upper)..' = '..dump(value) + end + data.right_panel.text = concat(content_string, '\n') +end + +Gui.on_text_changed( + input_text_box_name, + function(event) + local element = event.element + local data = Gui.get_data(element) + + update_dump(element, data) + end +) + +Gui.on_click( + refresh_name, + function(event) + local element = event.element + local data = Gui.get_data(element) + + local input_text_box = data.input_text_box + + update_dump(input_text_box, data) + end +) + +return Public diff --git a/modules/gui/debug/global_view.lua b/modules/gui/debug/global_view.lua index 3ab51d8d..aff9a6fd 100644 --- a/modules/gui/debug/global_view.lua +++ b/modules/gui/debug/global_view.lua @@ -8,7 +8,7 @@ local concat = table.concat local Public = {} -local ignore = {tokens = true, data_store = true} +local ignore = {tokens = true, data_store = true, datastores = true} local header_name = Gui.uid_name() local left_panel_name = Gui.uid_name() diff --git a/modules/gui/debug/main_view.lua b/modules/gui/debug/main_view.lua index 0771bdb1..bdc93f43 100644 --- a/modules/gui/debug/main_view.lua +++ b/modules/gui/debug/main_view.lua @@ -5,6 +5,7 @@ local Public = {} local pages = { require 'modules.gui.debug.redmew_global_view', + require 'modules.gui.debug.expcore_datastore_view', require 'modules.gui.debug.expcore_store_view', require 'modules.gui.debug.expcore_gui_view', require 'modules.gui.debug.global_view', From 08a86aac09e299a6a0ca18b5b6a217efc32c7eec Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 25 May 2020 02:11:45 +0100 Subject: [PATCH 019/106] Added doc comments --- expcore/datastore.lua | 669 ++++++++++++++++++++++++++++++++++------ expcore/player_data.lua | 48 ++- 2 files changed, 612 insertions(+), 105 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index f9f81b59..4189aaef 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -1,3 +1,150 @@ +--[[-- Core Module - Datastore +- A module used to store data in the global table with the option to have it sync to an external source. +@core Datastore +@alias DatastoreManager + +@usage-- Types of Datastore +-- This datastore will not save data externally and can be used to watch for updates on values within it +-- A common use might be to store data for a gui and only update the gui when a value changes +local LocalDatastore = Datastore.connect('LocalDatastore') + +-- This datastore will allow you to use the save and request method, this allows you to have persistent data +-- Should be used over auto save as it creates less save requests, but this means you need to tell the data to be saved +-- We use this type for player data as we know the data only needs to be saved when the player leaves +local PersistentDatastore = Datastore.connect('PersistentDatastore', true) -- save_to_disk + +-- This datastore is the same as above but the save method will be called automatically when ever you change a value +-- An auto save datastore should be used if the data does not change often, this can be global settings and things of that sort +-- If it is at all possible to setup events to unload and/or save the data then this is preferable +local AutosaveDatastore = Datastore.connect('AutosaveDatastore', true, true) -- save_to_disk, auto_save + +-- Finally you can have a datastore that propagates its changes to all other connected servers, this means request does not need to be used +-- This should be used when you might have data conflicts while saving, this is done by pushing the saved value to all active servers +-- The request method has little use after server start as any external changes to the value will be pushed automatically +-- Auto save can also be used with this type and you should follow the same guidelines above for when this should be avoided +local PropagateDatastore = Datastore.connect('PropagateDatastore', true, false, true) -- save_to_disk, propagate_changes + +@usage-- Using Datastores Locally +-- Once you have your datastore connection setup, any further requests with connect will return the same datastore +-- This is important to know because the settings passed as parameters you have an effect when it is first created + +-- One useful thing that you might want to set up before runtime is a serializer, this will convert non string keys into strings +-- This serializer will allow use to pass a player object and still have it serialized to the players name +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set_serializer(function(rawKey) + return rawKey.name +end) + +-- If we want to get data from the datastore we can use get or get_all +local value = ExampleData:get(player, defaultValue) +local values = ExampleData:get_all() + +-- If we want to set data then we can use set, increment, update, or update_all +ExampleData:set(player, 10) +ExampleData:increment(player) +ExampleData:update(player, function(player_name, value) + return value * 2 +end) +ExampleData:update_all(function(player_name, value) + return value * 2 +end) + +-- If we want to remove data then we use remove +ExampleData:remove(player) + +-- We can also listen for updates to a value done by any of the above methods with on_update +ExampleData:on_update(function(player_name, value) + game.print(player_name..' has had their example data updated to '..tostring(value)) +end) + +@usage-- Using Datastore Externally +-- If save_to_disk is used then this opens up the option for persistent data which you can request, save, and remove +-- All of the local methods are still usable put now there is the option for extra events +-- In order for this to work there must be an external script to read datastore.pipe and inject with Datastore.ingest + +-- To request data you would use request and the on_load event, this event can be used to modify data before it is used +ExampleData:request(player) +ExampleData:on_load(function(player_name, value) + game.print('Loaded example data for '..player_name) + -- A value can be returned here to overwrite the received value +end) + +-- To save data you would use save and the on_save event, this event can be used to modify data before it is saved +ExampleData:save(player) +ExampleData:on_save(function(player_name, value) + game.print('Saved example data for '..player_name) + -- A value can be returned here to overwrite the value which is saved +end) + +-- To remove data locally but not externally, like if a player logs off, you would use unload and on_unload +ExampleData:unload(player) +ExampleData:on_unload(function(player_name, value) + game.print('Unloaded example data for '..player_name) + -- Any return is ignored, this is event is for cleaning up other data +end) + +@usage-- Using Datastore Messaging +-- The message action can be used regardless of save_to_disk being set as no data is saved, but an external script is still required +-- These messages can be used to send data to other servers which doesnt need to be saved such as shouts or commands +-- Using messages is quite simple only using message and on_message +ExampleData:message(key, message) +ExampleData:on_message(function(key, message) + game.print('Received message '..message) +end) + +@usage-- Combined Datastores +-- A combined datastore is a datastore which stores its data inside of another datastore +-- This means that the data is stored more efficiently in the external database and less requests need to be made +-- To understand how combined datastores work think of each key in the parent as a table where the sub datastore is a key in that table +-- Player data is the most used version of the combined datastore, below is how the player data module is setup +local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk +PlayerData:set_serializer(Datastore.name_serializer) -- use player name as key +PlayerData:combine('Statistics') +PlayerData:combine('Settings') +PlayerData:combine('Required') + +-- You can then further combine datastores to any depth, below we add some possible settings and statistics that we might use +-- Although we dont in this example, each of these functions returns the datastore object which you should use as a local value +PlayerData.Settings:combine('Color') +PlayerData.Settings:combine('Quickbar') +PlayerData.Settings:combine('JoinMessage') +PlayerData.Statistics:combine('Playtime') +PlayerData.Statistics:combine('JoinCount') + +-- Because sub datastore work just like a normal datastore you dont need any special code, using get and set will still return as if it wasnt a sub datastore +-- Things like the serializer and the datastore settings are always the same as the parent so you dont need to worry about setting up the serializer each time +-- And because save, request, and unload methods all point to the root datastore you are able to request and save your data as normal + +-- If you used get_all on PlayerData this is what you would get: +{ + Cooldude2606 = { + Settings = { + Color = 'ColorValue', + Quickbar = 'QuickbarValue', + JoinMessage = 'JoinMessageValue' + }, + Statistics = { + Playtime = 'PlaytimeValue', + JoinCount = 'JoinCountValue' + } + } +} + +-- If you used get_all on PlayerData.Settings this is what you would get: +{ + Cooldude2606 = { + Color = 'ColorValue', + Quickbar = 'QuickbarValue', + JoinMessage = 'JoinMessageValue' + } +} + +-- If you used get_all on PlayerData.Settings.Color this is what you would get: +{ + Cooldude2606 = 'ColorValue' +} + +]] local Event = require 'utils.event' --- @dep utils.event @@ -11,8 +158,8 @@ local copy = table.deep_copy global.datastores = Data Event.on_load(function() Data = global.datastores - for tableName, datastore in pairs(Datastores) do - datastore.data = Data[tableName] + for datastoreName, datastore in pairs(Datastores) do + datastore.data = Data[datastoreName] end end) @@ -26,17 +173,27 @@ DatastoreManager.metatable = { __call = function(self, ...) return self:get(...) end } ---- Make a new datastore connection, if a connection already exists then it is returned -function DatastoreManager.connect(tableName, saveToDisk, autoSave, propagateChanges) - if Datastores[tableName] then return Datastores[tableName] end +--[[-- Make a new datastore connection, if a connection already exists then it is returned +@tparam string datastoreName The name that you want the new datastore to have, this can not have any whitespace +@tparam[opt=false] boolean saveToDisk When set to true, using the save method with write the data to datastore.pipe +@tparam[opt=false] boolean autoSave When set to true, using any method which modifies data will cause the data to be saved +@tparam[opt=false] boolean propagateChanges When set to true, using the save method will send the data to all other connected servers +@treturn table The new datastore connection that can be used to access and modify data in the datastore + +@usage-- Connecting to the test datastore which will allow saving to disk +local ExampleData = Datastore.connect('ExampleData', true) -- saveToDisk + +]] +function DatastoreManager.connect(datastoreName, saveToDisk, autoSave, propagateChanges) + if Datastores[datastoreName] then return Datastores[datastoreName] end if _LIFECYCLE ~= _STAGE.control then -- Only allow this function to be called during the control stage error('New datastore connection can not be created during runtime', 2) end local new_datastore = { - name = tableName, - table_name = tableName, + name = datastoreName, + value_name = datastoreName, auto_save = autoSave or false, save_to_disk = saveToDisk or false, propagate_changes = propagateChanges or false, @@ -48,28 +205,38 @@ function DatastoreManager.connect(tableName, saveToDisk, autoSave, propagateChan data = {} } - Data[tableName] = new_datastore.data - Datastores[tableName] = new_datastore + Data[datastoreName] = new_datastore.data + Datastores[datastoreName] = new_datastore return setmetatable(new_datastore, DatastoreManager.metatable) end ---- Make a new datastore that stores its data inside of another one -function DatastoreManager.combine(datastore, subTableName) - local new_datastore = DatastoreManager.connect(datastore.name..'.'..subTableName) - datastore.children[subTableName] = new_datastore - new_datastore.serializer = datastore.serializer - new_datastore.auto_save = datastore.auto_save - new_datastore.table_name = subTableName - new_datastore.parent = datastore - Data[new_datastore.name] = nil - new_datastore.data = nil - return new_datastore +--[[-- Make a new datastore that stores its data inside of another one +@tparam string datastoreName The name of the datastore that will contain the data for the new datastore +@tparam string subDatastoreName The name of the new datastore, this name will also be used as the key inside the parent datastore +@treturn table The new datastore connection that can be used to access and modify data in the datastore + +@usage-- Setting up a datastore which stores its data inside of another datastore +local BarData = Datastore.combine('ExampleData', 'Bar') + +]] +function DatastoreManager.combine(datastoreName, subDatastoreName) + local datastore = assert(Datastores[datastoreName], 'Datastore not found '..tostring(datastoreName)) + return datastore:combine(subDatastoreName) end ---- Ingest the result from a request, this is used through a rcon interface to sync data +--[[-- Ingest the result from a request, this is used through a rcon interface to sync data +@tparam string action The action that should be done, can be: remove, message, propagate, or request +@tparam string datastoreName The name of the datastore that should have the action done to it +@tparam string key The key of that datastore that is having the action done to it +@tparam string valueJson The json string for the value being ingested, remove does not require a value + +@usage-- Replying to a data request +Datastore.ingest('request', 'ExampleData', 'TestKey', 'Foo') + +]] local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end -function DatastoreManager.ingest(action, tableName, key, valueJson) - local datastore = assert(Datastores[tableName], 'Datastore ingest error, Datastore not found '..tostring(tableName)) +function DatastoreManager.ingest(action, datastoreName, key, valueJson) + local datastore = assert(Datastores[datastoreName], 'Datastore ingest error, Datastore not found '..tostring(datastoreName)) assert(type(action) == 'string', 'Datastore ingest error, Action is not a string got: '..type(action)) assert(type(key) == 'string', 'Datastore ingest error, Key is not a string got: '..type(key)) @@ -78,12 +245,14 @@ function DatastoreManager.ingest(action, tableName, key, valueJson) elseif action == 'message' then local success, value = xpcall(game.json_to_table, ingest_error, valueJson) - if not success or value == nil then return end + if not success then return end + if value == nil then value = valueJson end datastore:raise_event('on_message', key, value) - elseif action == 'propagate' then + elseif action == 'propagate' or action == 'request' then local success, value = xpcall(game.json_to_table, ingest_error, valueJson) - if not success or value == nil then return end + if not success then return end + if value == nil then value = valueJson end value = datastore:raise_event('on_load', key, value) datastore:set(key, value) @@ -91,22 +260,46 @@ function DatastoreManager.ingest(action, tableName, key, valueJson) end ---- Debug, Use to get all datastores, or return debug info on a datastore -function DatastoreManager.debug(tableName) - if not tableName then return Datastores end - local datastore = assert(Datastores[tableName], 'Datastore not found '..tostring(tableName)) +--[[-- Debug, Use to get all datastores, or return debug info on a datastore +@tparam[opt] string datastoreName The name of the datastore to get the debug info of + +@usage-- Get all the datastores +local datastores = Datastore.debug() + +@usage-- Getting the debug info for a datastore +local debug_info = Datastore.debug('ExampleData') + +]] +function DatastoreManager.debug(datastoreName) + if not datastoreName then return Datastores end + local datastore = assert(Datastores[datastoreName], 'Datastore not found '..tostring(datastoreName)) return datastore:debug() end ---- Commonly used serializer, returns the name of the object +--[[-- Commonly used serializer, returns the name of the object +@tparam any rawKey The raw key that will be serialized, this can be things like player, force, surface, etc +@treturn string The name of the object that was passed + +@usage-- Using the name serializer for your datastore +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set_serializer(Datastore.name_serializer) + +]] function DatastoreManager.name_serializer(rawKey) return rawKey.name end ------ Datastore ----- --- @section datastore +----- Datastore Internal ----- +-- @section datastore-internal ---- Debug, Get the debug info for this datastore +--[[-- Debug, Get the debug info for this datastore +@treturn table The debug info for this datastore, contains stuff like parent, settings, children, etc + +@usage-- Get the debug info for a datastore +local ExampleData = Datastore.connect('ExampleData') +local debug_info = ExampleData:debug() + +]] function Datastore:debug() local debug_info = {} @@ -130,12 +323,20 @@ function Datastore:debug() return debug_info end ---- Internal, Get data following combine logic +--[[-- Internal, Get data following combine logic +@tparam string key The key to get the value of from this datastore +@tparam[opt=false] boolean fromChild If the get request came from a child of this datastore +@treturn any The value that was stored at this key in this datastore + +@usage-- Internal, Get the data from a datastore +local value = self:raw_get('TestKey') + +]] function Datastore:raw_get(key, fromChild) local data = self.data if self.parent then data = self.parent:raw_get(key, true) - key = self.table_name + key = self.value_name end local value = data[key] if value ~= nil then return value end @@ -144,18 +345,32 @@ function Datastore:raw_get(key, fromChild) return value end ---- Internal, Set data following combine logic +--[[-- Internal, Set data following combine logic +@tparam string key The key to set the value of in this datastore +@tparam any value The value that will be set at this key + +@usage-- Internal, Set the value in a datastore +self:raw_set('TestKey', 'Foo') + +]] function Datastore:raw_set(key, value) if self.parent then local data = self.parent:raw_get(key, true) - data[self.table_name] = value + data[self.value_name] = value else self.data[key] = value end end ---- Internal, Return the serialized key local function serialize_error(err) error('An error ocurred in a datastore serializer: '..err) end +--[[-- Internal, Return the serialized key +@tparam any rawKey The key that needs to be serialized, if it is already a string then it is returned +@treturn string The key after it has been serialized + +@usage-- Internal, Ensure that the key is a string +key = self:serialize(key) + +]] function Datastore:serialize(rawKey) if type(rawKey) == 'string' then return rawKey end assert(self.serializer, 'Datastore does not have a serializer and received non string key') @@ -163,7 +378,18 @@ function Datastore:serialize(rawKey) return success and key or nil end ---- Internal, Writes an event to the output file to be saved and/or propagated +--[[-- Internal, Writes an event to the output file to be saved and/or propagated +@tparam string action The action that should be wrote to datastore.pipe, can be request, remove, message, save, propagate +@tparam string key The key that the action is being preformed on +@tparam any value The value that should be used with the action + +@usage-- Write a data request to datastore.pipe +self:write_action('request', 'TestKey') + +@usage-- Write a data save to datastore.pipe +self:write_action('save', 'TestKey', 'Foo') + +]] function Datastore:write_action(action, key, value) local data = {action, self.name, '"'..key..'"'} if value ~= nil then @@ -172,13 +398,57 @@ function Datastore:write_action(action, key, value) game.write_file('datastore.pipe', table.concat(data, ' ')..'\n', true, 0) end ---- Set a callback that will be used to serialize keys which aren't strings +----- Datastore ----- +-- @section datastore + +--[[-- Create a new datastore which is stores its data inside of this datastore +@tparam string subDatastoreName The name of the datastore that will have its data stored in this datastore +@treturn table The new datastore that was created inside of this datastore + +@usage-- Add a new sub datastore +local ExampleData = Datastore.connect('ExampleData') +local BarData = ExampleData:combine('Bar') + +]] +function Datastore:combine(subDatastoreName) + local new_datastore = DatastoreManager.connect(self.name..'.'..subDatastoreName) + self.children[subDatastoreName] = new_datastore + new_datastore.value_name = subDatastoreName + new_datastore.serializer = self.serializer + new_datastore.auto_save = self.auto_save + new_datastore.parent = self + Data[new_datastore.name] = nil + new_datastore.data = nil + return new_datastore +end + +--[[-- Set a callback that will be used to serialize keys which aren't strings +@tparam function callback The function that will be used to serialize non string keys passed as an argument + +@usage-- Set a custom serializer, this would be the same as Datastore.name_serializer +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set_serializer(function(rawKey) + return rawKey.name +end) + +]] function Datastore:set_serializer(callback) assert(type(callback) == 'function', 'Callback must be a function') self.serializer = callback end ---- Set metadata tags on this datastore which can be accessed by other scripts +--[[-- Set metadata tags on this datastore which can be accessed by other scripts +@tparam table tags A table of tags that you want to set in the metadata for this datastore + +@usage-- Adding metadata that could be used by a gui to help understand the stored data +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set_metadata{ + caption = 'Test Data', + tooltip = 'Data used for testing datastores', + type = 'table' +} + +]] function Datastore:set_metadata(tags) local metadata = self.metadata for key, value in pairs(tags) do @@ -186,50 +456,15 @@ function Datastore:set_metadata(tags) end end ---- Create a new datastore which is stores its data inside of this datastore -Datastore.combine = DatastoreManager.combine +--[[-- Get a value from local storage, option to have a default value +@tparam any key The key that you want to get the value of, must be a string unless a serializer is set +@tparam[opt] any default The default value that will be returned if no value is found in the datastore ---- Request a value from an external source, will trigger on_load when data is received -function Datastore:request(key) - if self.parent then return self.parent:request(key) end - key = self:serialize(key) - self:write_action('request', key) -end +@usage-- Get a key from the datastore, the default will be deep copied if no value exists in the datastore +local ExampleData = Datastore.connect('ExampleData') +local value = ExampleData:get('TestKey') ---- Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true -function Datastore:save(key) - if self.parent then self.parent:save(key) end - if not self.save_to_disk then return end - key = self:serialize(key) - local value = self:raise_event('on_save', key, copy(self:raw_get(key))) - local action = self.propagate_changes and 'propagate' or 'save' - self:write_action(action, key, value) -end - ---- Save a value to an external source and remove locally, will trigger on_unload then on_save, save_to_disk is not required for on_unload -function Datastore:unload(key) - if self.parent then return self.parent:unload(key) end - key = self:serialize(key) - self:raise_event('on_unload', key, copy(self:raw_get(key))) - self:save(key) - self:raw_set(key) -end - ---- Use to send a message over the connection, works regardless of saveToDisk and propagateChanges -function Datastore:message(key, message) - key = self:serialize(key) - self:write_action('message', key, message) -end - ---- Remove a value locally and on the external source, works regardless of propagateChanges -function Datastore:remove(key) - key = self:serialize(key) - self:raw_set(key) - self:write_action('remove', key) - if self.parent and self.parent.auto_save then return self.parent:save(key) end -end - ---- Get a value from local storage, option to have a default value +]] function Datastore:get(key, default) key = self:serialize(key) local value = self:raw_get(key) @@ -237,7 +472,15 @@ function Datastore:get(key, default) return copy(default) end ---- Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save +--[[-- Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save +@tparam any key The key that you want to set the value of, must be a string unless a serializer is set +@tparam any value The value that you want to set for this key + +@usage-- Set a value in the datastore, this will trigger on_update, if auto_save is true then will trigger save +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set('TestKey', 'Foo') + +]] function Datastore:set(key, value) key = self:serialize(key) self:raw_set(key, value) @@ -246,15 +489,33 @@ function Datastore:set(key, value) return value end ---- Increment the value in local storage, only works for number values, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save +--[[-- Increment the value in local storage, only works for number values, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save +@tparam any key The key that you want to increment the value of, must be a string unless a serializer is set +@tparam[opt=1] number delta The amount that you want to increment the value by, can be negative or a decimal + +@usage-- Increment a value in a datastore, the value must be a number or nil, if nil 0 is used as the start value +local ExampleData = Datastore.connect('ExampleData') +ExampleData:increment('TestNumber') + +]] function Datastore:increment(key, delta) key = self:serialize(key) local value = self:raw_get(key) or 0 return Datastore:set(key, value + (delta or 1)) end ---- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save local function update_error(err) error('An error ocurred in datastore update: '..err, 2) end +--[[-- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save +@tparam any key The key that you want to apply the update to, must be a string unless a serializer is set +@tparam function callback The function that will be used to update the value at this key + +@usage-- Using a function to update a value, if a value is returned then this will be the new value +local ExampleData = Datastore.connect('ExampleData') +ExampleData:increment('TestKey', function(key, value) + return value..value +end) + +]] function Datastore:update(key, callback) key = self:serialize(key) local value = self:raw_get(key) @@ -267,8 +528,33 @@ function Datastore:update(key, callback) end end ---- Internal, Used to filter elements from a table +--[[-- Remove a value locally and on the external source, works regardless of propagateChanges +@tparam any key The key that you want to remove locally and externally, must be a string unless a serializer is set + +@usage-- Remove a key locally and externally +local ExampleData = Datastore.connect('ExampleData') +ExampleData:remove('TestKey') + +]] +function Datastore:remove(key) + key = self:serialize(key) + self:raw_set(key) + self:write_action('remove', key) + if self.parent and self.parent.auto_save then return self.parent:save(key) end +end + local function filter_error(err) print('An error ocurred in a datastore filter:', err) end +--[[-- Internal, Used to filter elements from a table +@tparam table tbl The table that will have the filter applied to it +@tparam[opt] function callback The function that will be used as a filter, if none giving then the provided table is returned +@treturn table The table which has only the key values pairs which passed the filter + +@usage-- Internal, Filter a table by the values it contains, return true to keep the key value pair +local filtered_table = filter({5,3,4,1,2}, function(key, value) + return value > 2 +end) + +]] local function filter(tbl, callback) if not callback then return tbl end local rtn = {} @@ -279,26 +565,153 @@ local function filter(tbl, callback) return rtn end ---- Get all keys in this datastore, optional filter callback +--[[-- Get all keys in this datastore, optional filter callback +@tparam[opt] function callback The filter function that can be used to filter the results returned +@treturn table All the data that is in this datastore, filtered if a filter was provided + +@usage-- Get all the data in this datastore +local ExampleData = Datastore.connect('ExampleData') +local data = ExampleData:get_all() + +@usage-- Get all the data in this datastore, with a filter +local ExampleData = Datastore.connect('ExampleData') +local data = ExampleData:get_all(function(key, value) + return type(value) == 'string' +end) + +]] function Datastore:get_all(callback) if not self.parent then return filter(self.data, callback) else - local data, table_name = {}, self.table_name + local data, value_name = {}, self.value_name for key, value in pairs(self.parent:get_all()) do - data[key] = value[table_name] + data[key] = value[value_name] end return filter(data, callback) end end ---- Save all the keys in the datastore, optional filter callback +--[[-- Update all keys in this datastore using the same update function +@tparam function callback The update function that will be applied to each key + +@usage-- Get all the data in this datastore, with a filter +local ExampleData = Datastore.connect('ExampleData') +ExampleData:update_all(function(key, value) + return value..value +end) + +]] +function Datastore:update_all(callback) + local data = self:get_all() + for key, value in pairs(data) do + local success, new_value = xpcall(callback, update_error, key, value) + if success and new_value ~= nil then + self:set(key, new_value) + else + self:raise_event('on_update', key, value) + if self.auto_save then self:save(key) end + end + end +end + +----- Datastore External ----- +-- @section datastore-external + +--[[-- Request a value from an external source, will trigger on_load when data is received +@tparam any key The key that you want to request from an external source, must be a string unless a serializer is set + +@usage-- Request a key from an external source, on_load is triggered when data is received +local ExampleData = Datastore.connect('ExampleData') +ExampleData:request('TestKey') + +]] +function Datastore:request(key) + if self.parent then return self.parent:request(key) end + key = self:serialize(key) + self:write_action('request', key) +end + +--[[-- Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true +@tparam any key The key that you want to save to an external source, must be a string unless a serializer is set + +@usage-- Save a key to an external source, save_to_disk must be set to true for there to be any effect +local ExampleData = Datastore.connect('ExampleData') +ExampleData:save('TestKey') + +]] +function Datastore:save(key) + if self.parent then self.parent:save(key) end + if not self.save_to_disk then return end + key = self:serialize(key) + local value = self:raise_event('on_save', key, copy(self:raw_get(key))) + local action = self.propagate_changes and 'propagate' or 'save' + self:write_action(action, key, value) +end + +--[[-- Save a value to an external source and remove locally, will trigger on_unload then on_save, save_to_disk is not required for on_unload +@tparam any key The key that you want to unload from the datastore, must be a string unless a serializer is set + +@usage-- Unload a key from the datastore, get will now return nil and value will be saved externally if save_to_disk is set to true +local ExampleData = Datastore.connect('ExampleData') +ExampleData:unload('TestKey') + +]] +function Datastore:unload(key) + if self.parent then return self.parent:unload(key) end + key = self:serialize(key) + self:raise_event('on_unload', key, copy(self:raw_get(key))) + self:save(key) + self:raw_set(key) +end + +--[[-- Use to send a message over the connection, works regardless of saveToDisk and propagateChanges +@tparam any key The key that you want to send a message over, must be a string unless a serializer is set +@tparam any message The message that you want to send to other connected servers, or external source + +@usage-- Send a message to other servers on this key, can listen for messages with on_message +local ExampleData = Datastore.connect('ExampleData') +ExampleData:message('TestKey', 'Foo') + +]] +function Datastore:message(key, message) + key = self:serialize(key) + self:write_action('message', key, message) +end + +--[[-- Save all the keys in the datastore, optional filter callback +@tparam[opt] function callback The filter function that can be used to filter the keys saved + +@usage-- Save all the data in this datastore +local ExampleData = Datastore.connect('ExampleData') +local data = ExampleData:save_all() + +@usage-- Save all the data in this datastore, with a filter +local ExampleData = Datastore.connect('ExampleData') +ExampleData:save_all(function(key, value) + return type(value) == 'string' +end) + +]] function Datastore:save_all(callback) local data = self:get_all(callback) for key in pairs(data) do self:save(key) end end ---- Unload all the keys in the datastore, optional filter callback +--[[-- Unload all the keys in the datastore, optional filter callback +@tparam[opt] function callback The filter function that can be used to filter the keys unloaded + +@usage-- Unload all the data in this datastore +local ExampleData = Datastore.connect('ExampleData') +ExampleData:unload_all() + +@usage-- Unload all the data in this datastore, with a filter +local ExampleData = Datastore.connect('ExampleData') +ExampleData:unload_all(function(key, value) + return type(value) == 'string' +end) + +]] function Datastore:unload_all(callback) local data = self:get_all(callback) for key in pairs(data) do self:unload(key) end @@ -307,13 +720,23 @@ end ----- Events ----- -- @section events ---- Internal, Raise an event on this datastore local function event_error(err) print('An error ocurred in a datastore event handler:', err) end +--[[-- Internal, Raise an event on this datastore +@tparam string event_name The name of the event to raise for this datastore +@tparam string key The key that this event is being raised for +@tparam[opt] any value The current value that this key has, might be a deep copy of the value +@tparam[opt] string source Where this call came from, used to do event recursion so can be parent or child +@treturn any The value that is left after being passed through all the event handlers + +@usage-- Internal, Getting the value that should be saved +value = self:raise_event('on_save', key, value) + +]] function Datastore:raise_event(event_name, key, value, source) -- Raise the event for the children of this datastore if source ~= 'child' then - for table_name, child in pairs(self.children) do - value[table_name] = child:raise_event(event_name, key, value[table_name], 'parent') + for value_name, child in pairs(self.children) do + value[value_name] = child:raise_event(event_name, key, value[value_name], 'parent') end end @@ -333,7 +756,14 @@ function Datastore:raise_event(event_name, key, value, source) return value end ---- Internal, Returns a function which will add a callback to an event +--[[-- Internal, Returns a function which will add a callback to an event +@tparam string event_name The name of the event that this should create a handler adder for +@treturn function The function that can be used to add handlers to this event + +@usage-- Internal, Get the function to add handlers to on_load +Datastore.on_load = event_factory('on_load') + +]] local function event_factory(event_name) return function(self, callback) assert(type(callback) == 'function', 'Handler must be a function') @@ -346,19 +776,54 @@ local function event_factory(event_name) end end ---- Register a callback that triggers when data is loaded from an external source, returned value is saved locally +--[[-- Register a callback that triggers when data is loaded from an external source, returned value is saved locally +@tparam function callback The handler that will be registered to the on_load event +@usage-- Adding a handler to on_load, returned value will be saved locally, can be used to deserialize the value beyond a normal json +local ExampleData = Datastore.connect('ExampleData') +ExampleData:on_load(function(key, value) + game.print('Test data loaded for: '..key) +end) +]] Datastore.on_load = event_factory('on_load') ---- Register a callback that triggers before data is saved, returned value is saved externally +--[[-- Register a callback that triggers before data is saved, returned value is saved externally +@tparam function callback The handler that will be registered to the on_load event +@usage-- Adding a handler to on_save, returned value will be saved externally, can be used to serialize the value beyond a normal json +local ExampleData = Datastore.connect('ExampleData') +ExampleData:on_save(function(key, value) + game.print('Test data saved for: '..key) +end) +]] Datastore.on_save = event_factory('on_save') ---- Register a callback that triggers before data is unloaded, returned value is ignored +--[[-- Register a callback that triggers before data is unloaded, returned value is ignored +@tparam function callback The handler that will be registered to the on_load event +@usage-- Adding a handler to on_unload, returned value is ignored, can be used to clean up guis or local values related to this data +local ExampleData = Datastore.connect('ExampleData') +ExampleData:on_load(function(key, value) + game.print('Test data unloaded for: '..key) +end) +]] Datastore.on_unload = event_factory('on_unload') ---- Register a callback that triggers when a message is received, returned value is ignored +--[[-- Register a callback that triggers when a message is received, returned value is ignored +@tparam function callback The handler that will be registered to the on_load event +@usage-- Adding a handler to on_message, returned value is ignored, can be used to receive messages from other connected servers without saving data +local ExampleData = Datastore.connect('ExampleData') +ExampleData:on_message(function(key, value) + game.print('Test data message for: '..key) +end) +]] Datastore.on_message = event_factory('on_message') ---- Register a callback that triggers any time a value is changed, returned value is ignored +--[[-- Register a callback that triggers any time a value is changed, returned value is ignored +@tparam function callback The handler that will be registered to the on_load event +@usage-- Adding a handler to on_update, returned value is ignored, can be used to update guis or send messages when data is changed +local ExampleData = Datastore.connect('ExampleData') +ExampleData:on_update(function(key, value) + game.print('Test data updated for: '..key) +end) +]] Datastore.on_update = event_factory('on_update') ----- Module Return ----- diff --git a/expcore/player_data.lua b/expcore/player_data.lua index 827abf1e..268cdaca 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -1,3 +1,45 @@ +--[[-- Core Module - PlayerData +- A module used to store player data in a central datastore to minimize data requests and saves. +@core PlayerData + +@usage-- Adding a colour setting for players +local PlayerData = require 'expcore.player_data' +local PlayerColors = PlayerData.Settings:combine('Color') + +-- Set the players color when their data is loaded +PlayerColors:on_load(function(player_name, color) + local player = game.players[player_name] + player.color = color +end) + +-- Overwrite the saved color with the players current color +PlayerColors:on_save(function(player_name, _) + local player = game.players[player_name] + return player.color -- overwrite existing data with the current color +end) + +@usage-- Add a playtime statistic for players +local Event = require 'utils.event' +local PlayerData = require 'expcore.player_data' +local Playtime = PlayerData.Statistics:combine('Playtime') + +-- When playtime reaches an hour interval tell the player and say thanks +Playtime:on_update(function(player_name, playtime) + if playtime % 60 == 0 then + local hours = playtime / 60 + local player = game.players[player_name] + player.print('Thanks for playing on our servers, you have played for '..hours..' hours!') + end +end) + +-- Update playtime for players, data is only loaded for online players so update_all can be used +Event.add_on_nth_tick(3600, function() + Playtime:update_all(function(player_name, playtime) + return playtime + 1 + end) +end) + +]] local Event = require 'utils.event' --- @dep utils.event local Datastore = require 'expcore.datastore' --- @dep expcore.datastore @@ -60,9 +102,9 @@ end) ----- Module Return ----- return { All = PlayerData, -- Root for all of a players data - Statistics = PlayerData:combine('PlayerStatistics'), -- Common place for stats - Settings = PlayerData:combine('PlayerSettings'), -- Common place for settings - Required = PlayerData:combine('PlayerRequired'), -- Common place for required data + Statistics = PlayerData:combine('Statistics'), -- Common place for stats + Settings = PlayerData:combine('Settings'), -- Common place for settings + Required = PlayerData:combine('Required'), -- Common place for required data DataSavingPreference = DataSavingPreference, -- Stores what data groups will be saved PreferenceEnum = PreferenceEnum -- Enum for the allowed options for data saving preference } \ No newline at end of file From 8124af99b3916982c752df379072330ab2884268 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 03:11:28 +0100 Subject: [PATCH 020/106] Added dev-deploy.yml --- .github/workflows/dev-deploy.yml | 47 ++++++++++++++++++++++++++++++++ docs/config.ld | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dev-deploy.yml diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml new file mode 100644 index 00000000..ee815db9 --- /dev/null +++ b/.github/workflows/dev-deploy.yml @@ -0,0 +1,47 @@ +name: Dev Deploy + +on: + push: + branches: + - dev + paths-ignore: + - 'docs/**' + - '.luacheckrc' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Checkout submodules + uses: textbook/git-checkout-submodule-action@master + with: + remote: true + + - name: Update .luacheckrc + run: cp ./Factorio-luacheckrc/.luacheckrc . + + - name: Install Lua + uses: leafo/gh-actions-lua@v5 + + - name: Install LuaRocks + uses: leafo/gh-actions-luarocks@v2 + + - name: Install LDoc + run: luarocks install ldoc 1.4.4-1 + + - name: Generate Documents + working-directory: docs + run: ldoc -i . + + - name: Commit changes + uses: EndBug/add-and-commit@v4 + with: + message: "Automattic Doc Update" + add: "./docs/** .luacheckrc" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/config.ld b/docs/config.ld index 43e5bfdc..30e23b4b 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -1,4 +1,4 @@ -file = '../' +file = { '../', exclude = { '../.install', '../.lua', '../.luarocks' } } dir = '../docs' project = 'ExpGaming Scenario' title = 'ExpGaming Scenario' From d898f87115a1736971bc8811b0356f6b7163a5b8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 16:09:06 +0100 Subject: [PATCH 021/106] Added pull request ci --- .github/workflows/dev-deploy.yml | 8 ------- .github/workflows/luacheck.yml | 41 ++++++++++++++++++++++++++++++++ .gitmodules | 3 --- 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/luacheck.yml delete mode 100644 .gitmodules diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index ee815db9..fc0f9fa8 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -17,14 +17,6 @@ jobs: with: fetch-depth: 0 - - name: Checkout submodules - uses: textbook/git-checkout-submodule-action@master - with: - remote: true - - - name: Update .luacheckrc - run: cp ./Factorio-luacheckrc/.luacheckrc . - - name: Install Lua uses: leafo/gh-actions-lua@v5 diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 00000000..a0ecba7e --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,41 @@ +name: CI Luacheck + +on: pull_request + +jobs: + luacheck: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_BASE_REF#refs/heads/})" + id: extract_branch + + - name: Lint + uses: Roang-zero1/factorio-mod-luacheck@master + with: + luacheckrc_url: https://raw.githubusercontent.com/explosivegaming/scenario/${{ steps.extract_branch.outputs.branch }}/.luacheckrc + + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install Lua + uses: leafo/gh-actions-lua@v5 + + - name: Install LuaRocks + uses: leafo/gh-actions-luarocks@v2 + + - name: Install LDoc + run: luarocks install ldoc 1.4.4-1 + + - name: Generate Documents + working-directory: docs + run: ldoc -i . \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 522fac32..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Factorio-luacheckrc"] - path = Factorio-luacheckrc - url = https://github.com/Nexela/Factorio-luacheckrc From 9b01a0276334cef1645e06f6f1f59751ee7ec07a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 16:11:02 +0100 Subject: [PATCH 022/106] Fixed syntax error --- .github/workflows/luacheck.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml index a0ecba7e..abf770ab 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/luacheck.yml @@ -23,9 +23,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Install Lua uses: leafo/gh-actions-lua@v5 From 2aaeb06be3e719117a252df75dda46a50973c83b Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 16:18:35 +0100 Subject: [PATCH 023/106] Removed Submodule --- Factorio-luacheckrc | 1 - 1 file changed, 1 deletion(-) delete mode 160000 Factorio-luacheckrc diff --git a/Factorio-luacheckrc b/Factorio-luacheckrc deleted file mode 160000 index 53d12a83..00000000 --- a/Factorio-luacheckrc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 53d12a834fe0657e4be17df67a93c51af4e3981e From 32507492b8ae5784d58871f334e444dad5d230af Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:21:10 +0100 Subject: [PATCH 024/106] Fixed Existing Lua Check Errors --- .luacheckrc | 8 + config/advanced_start.lua | 60 +++--- config/expcore/command_auth_admin.lua | 5 +- config/expcore/command_auth_roles.lua | 3 +- config/expcore/command_general_parse.lua | 41 ++--- config/expcore/command_role_parse.lua | 25 +-- config/expcore/command_runtime_disable.lua | 5 +- control.lua | 14 +- expcore/async.lua | 12 +- expcore/commands.lua | 162 ++++++++-------- expcore/common.lua | 167 +++++++++-------- expcore/gui/_require.lua | 14 +- expcore/gui/core_defines.lua | 8 +- expcore/gui/defines.lua | 42 ++--- expcore/gui/helper_functions.lua | 6 +- expcore/gui/left_flow.lua | 12 +- expcore/gui/prototype.lua | 24 +-- expcore/gui/top_flow.lua | 6 +- expcore/permission_groups.lua | 30 +-- expcore/roles.lua | 198 ++++++++++---------- expcore/store.lua | 114 ++++++------ modules/addons/advanced-start.lua | 16 +- modules/addons/chat-popups.lua | 8 +- modules/addons/chat-reply.lua | 16 +- modules/addons/compilatron.lua | 18 +- modules/addons/damage-popups.lua | 8 +- modules/addons/death-logger.lua | 30 +-- modules/addons/discord-alerts.lua | 70 +++---- modules/addons/greetings.lua | 6 +- modules/addons/pollution-grading.lua | 2 +- modules/addons/random-player-colours.lua | 8 +- modules/addons/scorched-earth.lua | 40 ++-- modules/addons/spawn-area.lua | 74 ++++---- modules/addons/station-auto-name.lua | 109 ++++++----- modules/addons/tree-decon.lua | 4 +- modules/commands/admin-chat.lua | 10 +- modules/commands/bonus.lua | 38 ++-- modules/commands/cheat-mode.lua | 8 +- modules/commands/clear-inventory.lua | 10 +- modules/commands/debug.lua | 2 +- modules/commands/find.lua | 10 +- modules/commands/help.lua | 34 ++-- modules/commands/home.lua | 36 ++-- modules/commands/interface.lua | 42 ++--- modules/commands/jail.lua | 52 +++--- modules/commands/kill.lua | 8 +- modules/commands/me.lua | 8 +- modules/commands/quickbar.lua | 7 +- modules/commands/rainbow.lua | 36 ++-- modules/commands/ratio.lua | 71 ++++--- modules/commands/repair.lua | 18 +- modules/commands/reports.lua | 56 +++--- modules/commands/roles.lua | 50 ++--- modules/commands/spawn.lua | 16 +- modules/commands/tag.lua | 14 +- modules/commands/teleport.lua | 34 ++-- modules/commands/warnings.lua | 54 +++--- modules/control/jail.lua | 36 ++-- modules/control/production.lua | 78 ++++---- modules/control/reports.lua | 36 ++-- modules/control/rockets.lua | 28 +-- modules/control/tasks.lua | 44 ++--- modules/control/warnings.lua | 62 +++---- modules/control/warps.lua | 100 +++++----- modules/factorio-control.lua | 4 +- modules/gui/player-list.lua | 163 ++++++++-------- modules/gui/readme.lua | 74 ++++---- modules/gui/rocket-info.lua | 160 ++++++++-------- modules/gui/science-info.lua | 92 +++++----- modules/gui/server-ups.lua | 14 +- modules/gui/task-list.lua | 102 +++++------ modules/gui/warp-list.lua | 204 ++++++++++----------- overrides/inspect.lua | 20 +- overrides/require.lua | 1 - overrides/table.lua | 40 ++-- utils/gui.lua | 2 +- 76 files changed, 1622 insertions(+), 1617 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 98d8fa3e..0550e042 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -70,6 +70,14 @@ do -- Assume Factorio Control Stage as Default } end +do -- RedMew and ExpGaming overrides + globals = { + 'math', 'table', + 'print', 'require', 'unpack', 'inspect', 'loadstring', 'ServerCommands', 'Debug', + '_C', '_DEBUG', '_CHEATS', '_DUMP_ENV', '_LIFECYCLE', '_STAGE', + } +end + do -- Set default prototype files files['**/data.lua'].std = STD_DATA files['**/data-updates.lua'].std = STD_DATA diff --git a/config/advanced_start.lua b/config/advanced_start.lua index c5b56854..ef827f1c 100644 --- a/config/advanced_start.lua +++ b/config/advanced_start.lua @@ -4,15 +4,17 @@ --- These are called factories because they return another function -- use these as a simple methods of adding new items -- they will do most of the work for you --- ['item-name']=factory(params) +-- ['item-name'] = factory(params) +-- luacheck:ignore 212/amount_made 212/items_made 212/player -- Use these to adjust for ticks ie game.tick < 5*minutes +-- luacheck:ignore 211/seconds 211/minutes 211/hours local seconds, minutes, hours = 60, 3600, 216000 --- Use to make a split point for the number of items given based on time --- ['stone-furnace']=cutoff_time(5*minutes,4,0) -- before 5 minutes give four items after 5 minutes give none -local function cutoff_time(time,before,after) - return function(amount_made,items_made,player) +-- ['stone-furnace']=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none +local function cutoff_time(time, before, after) + return function(amount_made, items_made, player) if game.tick < time then return before else return after end @@ -20,9 +22,9 @@ local function cutoff_time(time,before,after) end --- Use to make a split point for the number of items given based on amount made --- ['firearm-magazine']=cutoff_amount_made(100,10,0) -- give 10 items until 100 items have been made -local function cutoff_amount_made(amount,before,after) - return function(amount_made,items_made,player) +-- ['firearm-magazine']=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made +local function cutoff_amount_made(amount, before, after) + return function(amount_made, items_made, player) if amount_made < amount then return before else return after end @@ -30,9 +32,9 @@ local function cutoff_amount_made(amount,before,after) end --- Same as above but will not give any items if x amount has been made of another item, useful for tiers --- ['light-armor']=cutoff_amount_made_unless(5,0,1,'heavy-armor',5) -- give light armor once 5 have been made unless 5 heavy armor has been made -local function cutoff_amount_made_unless(amount,before,after,second_item,second_amount) - return function(amount_made,items_made,player) +-- ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5) -- give light armor once 5 have been made unless 5 heavy armor has been made +local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount) + return function(amount_made, items_made, player) if items_made(second_item) < second_amount then if amount_made < amount then return before else return after @@ -43,11 +45,11 @@ local function cutoff_amount_made_unless(amount,before,after,second_item,second_ end -- Use for mass production items where you want the amount to change based on the amount already made --- ['iron-plate']=scale_amount_made(5*minutes,10,10) -- for first 5 minutes give 10 items then after apply a factor of 10 -local function scale_amount_made(amount,before,scalar) - return function(amount_made,items_made,player) +-- ['iron-plate']=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10 +local function scale_amount_made(amount, before, scalar) + return function(amount_made, items_made, player) if amount_made < amount then return before - else return (amount_made*scalar)/math.pow(game.tick/minutes,2) + else return (amount_made*scalar)/math.pow(game.tick/minutes, 2) end end end @@ -65,30 +67,30 @@ return { skip_intro=true, --- @setting skip_intro skips the intro given in the default factorio free play scenario skip_victory=true, --- @setting skip_victory will skip the victory screen when a rocket is launched disable_base_game_silo_script=true, --- @setting disable_base_game_silo_script will not load the silo script at all - research_queue_from_start=true, --- @setting research_queue_from_start when true the research queue is useible from the start + research_queue_from_start=true, --- @setting research_queue_from_start when true the research queue is useable from the start friendly_fire=false, --- @setting friendly_fire weather players will be able to attack each other on the same force enemy_expansion=false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load chart_radius=10*32, --- @setting chart_radius the number of tiles that will be charted when the map starts items = { --- @setting items items and there condition for being given - -- ['item-name'] = function(amount_made,production_stats,player) return end -- 0 means no items given + -- ['item-name'] = function(amount_made, production_stats, player) return end -- 0 means no items given -- Plates - ['iron-plate']=scale_amount_made(100,10,10), - ['copper-plate']=scale_amount_made(100,0,8), - ['steel-plate']=scale_amount_made(100,0,4), + ['iron-plate']=scale_amount_made(100, 10, 10), + ['copper-plate']=scale_amount_made(100, 0,8), + ['steel-plate']=scale_amount_made(100, 0,4), -- Secondary Items - ['electronic-circuit']=scale_amount_made(1000,0,6), - ['iron-gear-wheel']=scale_amount_made(1000,0,6), + ['electronic-circuit']=scale_amount_made(1000, 0,6), + ['iron-gear-wheel']=scale_amount_made(1000, 0,6), -- Starting Items - ['burner-mining-drill']=cutoff_time(10*minutes,4,0), - ['stone-furnace']=cutoff_time(10*minutes,4,0), + ['burner-mining-drill']=cutoff_time(10*minutes, 4,0), + ['stone-furnace']=cutoff_time(10*minutes, 4,0), -- Armor - ['light-armor']=cutoff_amount_made_unless(5,0,1,'heavy-armor',5), - ['heavy-armor']=cutoff_amount_made(5,0,1), + ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5), + ['heavy-armor']=cutoff_amount_made(5, 0,1), -- Weapon - ['pistol']=cutoff_amount_made_unless(0,1,1,'submachine-gun',5), - ['submachine-gun']=cutoff_amount_made(5,0,1), + ['pistol']=cutoff_amount_made_unless(0, 1,1,'submachine-gun',5), + ['submachine-gun']=cutoff_amount_made(5, 0,1), -- Ammo - ['firearm-magazine']=cutoff_amount_made_unless(100,10,0,'piercing-rounds-magazine',100), - ['piercing-rounds-magazine']=cutoff_amount_made(100,0,10), + ['firearm-magazine']=cutoff_amount_made_unless(100, 10, 0,'piercing-rounds-magazine',100), + ['piercing-rounds-magazine']=cutoff_amount_made(100, 0,10), } } diff --git a/config/expcore/command_auth_admin.lua b/config/expcore/command_auth_admin.lua index 5f2b8723..360e6ee8 100644 --- a/config/expcore/command_auth_admin.lua +++ b/config/expcore/command_auth_admin.lua @@ -1,11 +1,12 @@ ---- This is a very simple config file which adds a admin only auth functio; +--- 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 -- @config Commands-Auth-Admin local Commands = require 'expcore.commands' --- @dep expcore.commands -Commands.add_authenticator(function(player,command,tags,reject) +-- luacheck:ignore 212/command +Commands.add_authenticator(function(player, command, tags, reject) if tags.admin_only then if player.admin then return true diff --git a/config/expcore/command_auth_roles.lua b/config/expcore/command_auth_roles.lua index cb7e0db9..3fb6f968 100644 --- a/config/expcore/command_auth_roles.lua +++ b/config/expcore/command_auth_roles.lua @@ -4,7 +4,8 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands local Roles = require 'expcore.roles' --- @dep expcore.roles -Commands.add_authenticator(function(player,command,tags,reject) +-- luacheck:ignore 212/tags +Commands.add_authenticator(function(player, command, tags, reject) if Roles.player_allowed(player,'command/'..command) then return true else diff --git a/config/expcore/command_general_parse.lua b/config/expcore/command_general_parse.lua index 7b9e282a..4876738a 100644 --- a/config/expcore/command_general_parse.lua +++ b/config/expcore/command_general_parse.lua @@ -1,7 +1,7 @@ --[[-- 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; +use Commands.add_parse('name',function(input, player, reject) end) to add a parse; see ./expcore/commands.lua for more details @config Commands-Parse @usage Adds Parses: @@ -22,9 +22,8 @@ see ./expcore/commands.lua for more details local Commands = require 'expcore.commands' --- @dep expcore.commands local Game = require 'utils.game' --- @dep utils.game - - -Commands.add_parse('boolean',function(input,player,reject) +-- luacheck:ignore 212/player +Commands.add_parse('boolean',function(input, player) if not input then return end -- nil check input = input:lower() if input == 'yes' @@ -37,7 +36,7 @@ Commands.add_parse('boolean',function(input,player,reject) end end) -Commands.add_parse('string-options',function(input,player,reject,options) +Commands.add_parse('string-options',function(input, player, reject, options) if not input then return end -- nil check input = input:lower() for option in options do @@ -48,7 +47,7 @@ Commands.add_parse('string-options',function(input,player,reject,options) return reject{'reject-string-options',options:concat(', ')} end) -Commands.add_parse('string-max-length',function(input,player,reject,max_length) +Commands.add_parse('string-max-length',function(input, player, reject, max_length) if not input then return end -- nil check local length = input:len() if length > max_length then @@ -58,7 +57,7 @@ Commands.add_parse('string-max-length',function(input,player,reject,max_length) end end) -Commands.add_parse('number',function(input,player,reject) +Commands.add_parse('number',function(input, player, reject) if not input then return end -- nil check local number = tonumber(input) if not number then @@ -68,7 +67,7 @@ Commands.add_parse('number',function(input,player,reject) end end) -Commands.add_parse('integer',function(input,player,reject) +Commands.add_parse('integer',function(input, player, reject) if not input then return end -- nil check local number = tonumber(input) if not number then @@ -78,27 +77,27 @@ Commands.add_parse('integer',function(input,player,reject) end end) -Commands.add_parse('number-range',function(input,player,reject,range_min,range_max) - local number = Commands.parse('number',input,player,reject) +Commands.add_parse('number-range',function(input, player, reject, range_min, range_max) + local number = Commands.parse('number',input, player, reject) if not number then return end -- nil check if number < range_min or number > range_max then - return reject{'expcore-commands.reject-number-range',range_min,range_max} + return reject{'expcore-commands.reject-number-range',range_min, range_max} else return number end end) -Commands.add_parse('integer-range',function(input,player,reject,range_min,range_max) - local number = Commands.parse('integer',input,player,reject) +Commands.add_parse('integer-range',function(input, player, reject, range_min, range_max) + local number = Commands.parse('integer',input, player, reject) if not number then return end -- nil check if number < range_min or number > range_max then - return reject{'expcore-commands.reject-number-range',range_min,range_max} + return reject{'expcore-commands.reject-number-range',range_min, range_max} else return number end end) -Commands.add_parse('player',function(input,player,reject) +Commands.add_parse('player',function(input, player, reject) if not input then return end -- nil check local input_player = Game.get_player_from_any(input) if not input_player then @@ -108,8 +107,8 @@ Commands.add_parse('player',function(input,player,reject) end end) -Commands.add_parse('player-online',function(input,player,reject) - local input_player = Commands.parse('player',input,player,reject) +Commands.add_parse('player-online',function(input, player, reject) + local input_player = Commands.parse('player',input, player, reject) if not input_player then return end -- nil check if not input_player.connected then return reject{'expcore-commands.reject-player-online'} @@ -118,8 +117,8 @@ Commands.add_parse('player-online',function(input,player,reject) end end) -Commands.add_parse('player-alive',function(input,player,reject) - local input_player = Commands.parse('player-online',input,player,reject) +Commands.add_parse('player-alive',function(input, player, reject) + local input_player = Commands.parse('player-online',input, player, reject) if not input_player then return end -- nil check if not input_player.character or not input_player.character.health or input_player.character.health <= 0 then return reject{'expcore-commands.reject-player-alive'} @@ -128,7 +127,7 @@ Commands.add_parse('player-alive',function(input,player,reject) end end) -Commands.add_parse('force',function(input,player,reject) +Commands.add_parse('force',function(input, player, reject) if not input then return end -- nil check local force = game.forces[input] if not force then @@ -138,7 +137,7 @@ Commands.add_parse('force',function(input,player,reject) end end) -Commands.add_parse('surface',function(input,player,reject) +Commands.add_parse('surface',function(input, player, reject) if not input then return end local surface = game.surfaces[input] if not surface then diff --git a/config/expcore/command_role_parse.lua b/config/expcore/command_role_parse.lua index 12e76bbc..211fbc15 100644 --- a/config/expcore/command_role_parse.lua +++ b/config/expcore/command_role_parse.lua @@ -12,14 +12,15 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles local auto_complete = _C.auto_complete --- @dep expcore.common require 'config.expcore.command_general_parse' -Commands.add_parse('role',function(input,player,reject) +-- luacheck:ignore 212/player +Commands.add_parse('role',function(input, player, reject) if not input then return end local roles = Roles.config.order local rev_roles = {} - for i=#roles,1,-1 do - table.insert(rev_roles,roles[i]) + for i=#roles, 1,-1 do + table.insert(rev_roles, roles[i]) end - local role = auto_complete(rev_roles,input) + local role = auto_complete(rev_roles, input) role = Roles.get_role_by_name(role) if not role then return reject{'expcore-role.reject-role'} @@ -28,8 +29,8 @@ Commands.add_parse('role',function(input,player,reject) end end) -Commands.add_parse('player-role',function(input,player,reject) - local input_player = Commands.parse('player',input,player,reject) +Commands.add_parse('player-role',function(input, player, reject) + local input_player = Commands.parse('player',input, player, reject) if not input_player then return end -- nil check local player_highest = Roles.get_player_highest_role(player) local input_player_highest = Roles.get_player_highest_role(input_player) @@ -40,14 +41,14 @@ Commands.add_parse('player-role',function(input,player,reject) end end) -Commands.add_parse('player-role-online',function(input,player,reject) - local input_player = Commands.parse('player-role',input,player,reject) +Commands.add_parse('player-role-online',function(input, player, reject) + local input_player = Commands.parse('player-role',input, player, reject) if not input_player then return end -- nil check - return Commands.parse('player-online',input_player,player,reject) + return Commands.parse('player-online',input_player, player, reject) end) -Commands.add_parse('player-role-alive',function(input,player,reject) - local input_player = Commands.parse('player-role',input,player,reject) +Commands.add_parse('player-role-alive',function(input, player, reject) + local input_player = Commands.parse('player-role',input, player, reject) if not input_player then return end -- nil check - return Commands.parse('player-alive',input_player,player,reject) + return Commands.parse('player-alive',input_player, player, reject) end) \ No newline at end of file diff --git a/config/expcore/command_runtime_disable.lua b/config/expcore/command_runtime_disable.lua index 204869f5..1d6cde03 100644 --- a/config/expcore/command_runtime_disable.lua +++ b/config/expcore/command_runtime_disable.lua @@ -6,7 +6,7 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands local Global = require 'utils.global' --- @dep utils.global local disabled_commands = {} -Global.register(disabled_commands,function(tbl) +Global.register(disabled_commands, function(tbl) disabled_commands = tbl end) @@ -22,7 +22,8 @@ function Commands.enable(command_name) disabled_commands[command_name] = nil end -Commands.add_authenticator(function(player,command,tags,reject) +-- luacheck:ignore 212/player 212/tags +Commands.add_authenticator(function(player, command, tags, reject) if disabled_commands[command] then return reject{'command-auth.command-disabled'} else diff --git a/control.lua b/control.lua index 78565269..ea6df602 100644 --- a/control.lua +++ b/control.lua @@ -22,23 +22,23 @@ log('[INFO] Getting file loader config') local files = require 'config._file_loader' --- @dep config._file_loader -- Loads all files from the config and logs that they are loaded -local total_file_count = string.format('%3d',#files) +local total_file_count = string.format('%3d', #files) local errors = {} -for index,path in pairs(files) do +for index, path in pairs(files) do -- Loads the next file in the list - log(string.format('[INFO] Loading file %3d/%s (%s)',index,total_file_count,path)) - local success,file = pcall(require,path) + log(string.format('[INFO] Loading file %3d/%s (%s)', index, total_file_count, path)) + local success, file = pcall(require, path) -- Error Checking if not success then -- Failed to load a file log('[ERROR] Failed to load file: '..path) - table.insert(errors,'[ERROR] '..path..' :: '..file) + table.insert(errors, '[ERROR] '..path..' :: '..file) elseif type(file) == 'string' and file:find('not found') then -- Returned a file not found message log('[ERROR] File not found: '..path) - table.insert(errors,'[ERROR] '..path..' :: Not Found') + table.insert(errors, '[ERROR] '..path..' :: Not Found') end end @@ -49,5 +49,5 @@ require 'overrides.require' -- Logs all errors again to make it make it easy to find log('[INFO] All files loaded with '..#errors..' errors:') -for _,error in pairs(errors) do log(error) end +for _, error in pairs(errors) do log(error) end log('[END] -----| Explosive Gaming Scenario Loader |-----') \ No newline at end of file diff --git a/expcore/async.lua b/expcore/async.lua index 473580ae..edfb3a45 100644 --- a/expcore/async.lua +++ b/expcore/async.lua @@ -16,11 +16,11 @@ Async.register(function(player) end) -- This will allow us to bypass the error by running one tick later outside of any player scope -Async(promote_player,game.player) +Async(promote_player, game.player) -- Here we make an sync function that we want to have a delay, note the delay is not defined here local print_message = -Async.register(function(player,message) +Async.register(function(player, message) player.print(message) end) @@ -71,7 +71,7 @@ Async.register = Token.register Async.run(set_admin, player, true) ]] -function Async.run(token,...) +function Async.run(token, ...) Task.queue_task(internal_run, { token = token, params = {...} @@ -87,15 +87,15 @@ end Async.wait(300, print_to_player, 'Hello, World!') ]] -function Async.wait(ticks,token,...) +function Async.wait(ticks, token, ...) Task.set_timeout_in_ticks(ticks, internal_run, { token = token, params = {...} }) end -return setmetatable(Async,{ - __call = function(self,...) +return setmetatable(Async, { + __call = function(self, ...) self.run(...) end }) \ No newline at end of file diff --git a/expcore/commands.lua b/expcore/commands.lua index a249ee93..42b4bcbe 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -25,7 +25,7 @@ end) msg = ':'..msg end - for 1 = 1,repeat_count do + for 1 = 1, repeat_count do Command.print(1..msg) end end) @@ -91,7 +91,7 @@ end) -- this is where that smiley param is used msg = ':'..msg end - for 1 = 1,repeat_count do + 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 @@ -99,7 +99,7 @@ end) end) -- Other values that can be returned from register -Commands.print(any,colour[opt]) -- this will return any value value to the user including if it is ran through rcon console +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 @@ -178,7 +178,7 @@ 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) +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 @@ -192,7 +192,7 @@ end) ]] local Game = require 'utils.game' --- @dep utils.game -local player_return,write_json = _C.player_return, _C.write_json --- @dep expcore.common +local player_return, write_json = _C.player_return, _C.write_json --- @dep expcore.common local Commands = { --- Values returned by the signal functions to cause the command system to react @@ -235,7 +235,7 @@ end) ]] function Commands.add_authenticator(callback) - table.insert(Commands.authorization,callback) + table.insert(Commands.authorization, callback) return #Commands.authorization end @@ -251,13 +251,13 @@ function Commands.remove_authenticator(callback) if type(callback) == 'number' then -- if a number is passed then it is assumed to be the index if Commands.authorization[callback] then - table.remove(Commands.authorization,callback) + table.remove(Commands.authorization, callback) return true end else -- will search the array and remove the key local index - for key,value in pairs(Commands.authorization) do + for key, value in pairs(Commands.authorization) do if value == callback then index = key break @@ -265,7 +265,7 @@ function Commands.remove_authenticator(callback) end -- if the function was found it is removed if index then - table.remove(Commands.authorization,index) + table.remove(Commands.authorization, index) return true end end @@ -284,7 +284,7 @@ end local authorized, status = Commands.authorize(game.player, 'repeat-name') ]] -function Commands.authorize(player,command_name) +function Commands.authorize(player, command_name) local failed if not player then return true end local command_data = Commands.commands[command_name] @@ -297,9 +297,9 @@ function Commands.authorize(player,command_name) end -- loops over each authorization callback if any return false or unauthorized command will fail - for _,callback in pairs(Commands.authorization) do + for _, callback in pairs(Commands.authorization) do -- callback(player: LuaPlayer, command: string, flags: table, reject: function(error_message?: string)) - local success, rtn = pcall(callback,player,command_name,command_data.flags,auth_fail) + local success, rtn = pcall(callback, player, command_name, command_data.flags, auth_fail) -- error handler if not success then -- the callback failed to run @@ -341,8 +341,8 @@ function Commands.get(player) player = Game.get_player_from_any(player) if not player then return Commands.commands end local allowed = {} - for name,command_data in pairs(Commands.commands) do - if Commands.authorize(player,name) then + for name, command_data in pairs(Commands.commands) do + if Commands.authorize(player, name) then allowed[name]=command_data end end @@ -361,20 +361,20 @@ local commands = Commands.search('repeat') local commands = Commands.search('repeat', game.player) ]] -function Commands.search(keyword,player) +function Commands.search(keyword, player) local custom_commands = Commands.get(player) local matches = {} keyword = keyword:lower() -- loops over custom commands - for name,command_data in pairs(custom_commands) do + for name, command_data in pairs(custom_commands) do -- combines name help and aliases into one message to be searched - local search = string.format('%s %s %s',name,command_data.help,table.concat(command_data.aliases,' ')) + local search = string.format('%s %s %s', name, command_data.help, table.concat(command_data.aliases, ' ')) if search:lower():match(keyword) then matches[name] = command_data end end -- loops over the names of game commands - for name,description in pairs(commands.game_commands) do + for name, description in pairs(commands.game_commands) do if name:lower():match(keyword) then -- because game commands lack some stuff that the custom ones have they are formated matches[name] = { @@ -411,7 +411,7 @@ Commands.add_parse('number-range-int', function(input, player, reject, range_min end) ]] -function Commands.add_parse(name,callback) +function Commands.add_parse(name, callback) if Commands.parse_functions[name] then return false else @@ -442,10 +442,10 @@ end local parsed_input = Commands.parse('number-range-int', '7', player, reject, 1, 10) -- valid range 1 to 10 ]] -function Commands.parse(name,input,player,reject,...) +function Commands.parse(name, input, player, reject, ...) if not Commands.parse_functions[name] then return end - local success,rtn = pcall(Commands.parse_functions[name],input,player,reject,...) - if not success then error(rtn,2) return end + local success, rtn = pcall(Commands.parse_functions[name], input, player, reject, ...) + if not success then error(rtn, 2) return end if not rtn then return end if rtn == Commands.defines.error then return end return rtn @@ -465,11 +465,11 @@ local command = Commands.new_command('repeat-name', 'Will repeat you name a number of times in chat.') ]] -function Commands.new_command(name,help) +function Commands.new_command(name, help) local command = setmetatable({ name=name, help=help, - callback=function() Commands.internal_error(false,name,'No callback registered') end, + callback=function() Commands.internal_error(false, name, 'No callback registered') end, auto_concat=false, min_param_count=0, max_param_count=0, @@ -500,10 +500,10 @@ command:add_param('smiley', true, function(input, player, reject) end) ]] -function Commands._prototype:add_param(name,optional,parse,...) +function Commands._prototype:add_param(name, optional, parse, ...) local parse_args = {...} if type(optional) ~= 'boolean' then - parse_args = {parse,...} + parse_args = {parse, ...} parse = optional optional = false end @@ -535,7 +535,7 @@ command:set_defaults{ ]] function Commands._prototype:set_defaults(defaults) - for name,value in pairs(defaults) do + for name, value in pairs(defaults) do if self.params[name] then self.params[name].default = value end @@ -555,7 +555,7 @@ command:set_flag('admin_only', true) command:set_flag('admin_only') ]] -function Commands._prototype:set_flag(name,value) +function Commands._prototype:set_flag(name, value) value = value or true self.flags[name] = value return self @@ -570,8 +570,8 @@ command:add_alias('name', 'rname') ]] function Commands._prototype:add_alias(...) - for _,alias in pairs({...}) do - table.insert(self.aliases,alias) + for _, alias in pairs({...}) do + table.insert(self.aliases, alias) --Commands.alias_map[alias] = self.name end return self @@ -600,7 +600,7 @@ command:register(function(player, repeat_count, smiley, _) local msg = ') '..player.name if smiley then msg = ':'..msg end - for 1 = 1,repeat_count do + for 1 = 1, repeat_count do Command.print(1..msg) end end) @@ -610,26 +610,26 @@ function Commands._prototype:register(callback) -- generates a description to be used self.callback = callback local description = '' - for param_name,param_details in pairs(self.params) do + for param_name, param_details in pairs(self.params) do if param_details.optional then - description = string.format('%s [%s]',description,param_name) + description = string.format('%s [%s]', description, param_name) else - description = string.format('%s <%s>',description,param_name) + description = string.format('%s <%s>', description, param_name) end end self.description = description -- registers the command under its own name - commands.add_command(self.name,{'expcore-commands.command-help',description,self.help},function(command_event) - local success, err = pcall(Commands.run_command,command_event) + commands.add_command(self.name, {'expcore-commands.command-help', description, self.help}, function(command_event) + local success, err = pcall(Commands.run_command, command_event) if not success then log('[ERROR] command/'..self.name..' :: '..err) end end) -- adds any aliases that it has - for _,alias in pairs(self.aliases) do + for _, alias in pairs(self.aliases) do if not commands.commands[alias] and not commands.game_commands[alias] then - commands.add_command(alias,{'expcore-commands.command-help',description,self.help},function(command_event) + commands.add_command(alias, {'expcore-commands.command-help', description, self.help}, function(command_event) command_event.name = self.name - local success, err = pcall(Commands.run_command,command_event) - Commands.internal_error(success,self.name,err) + local success, err = pcall(Commands.run_command, command_event) + Commands.internal_error(success, self.name, err) end) end end @@ -649,9 +649,9 @@ nb: this is for non fatal errors meaning there is no log of this event, use duri return Commands.error('The player you selected is offline') ]] -function Commands.error(error_message,play_sound) +function Commands.error(error_message, play_sound) error_message = error_message or '' - player_return({'expcore-commands.command-fail',error_message},'orange_red') + player_return({'expcore-commands.command-fail', error_message}, 'orange_red') if play_sound ~= false then play_sound = play_sound or 'utility/wire_pickup' if game.player then game.player.play_sound{path=play_sound} end @@ -673,10 +673,10 @@ if Commands.internal_error(success, command_data.name, err) then end ]] -function Commands.internal_error(success,command_name,error_message) +function Commands.internal_error(success, command_name, error_message) if not success then - Commands.error('Internal Error, Please contact an admin','utility/cannot_build') - log{'expcore-commands.command-error-log-format',command_name,error_message} + Commands.error('Internal Error, Please contact an admin', 'utility/cannot_build') + log{'expcore-commands.command-error-log-format', command_name, error_message} end return not success end @@ -695,7 +695,7 @@ return 'Your message has been printed' ]] function Commands.success(value) if value ~= nil then player_return(value) end - player_return({'expcore-commands.command-ran'},'cyan') + player_return({'expcore-commands.command-ran'}, 'cyan') return Commands.defines.success end @@ -710,9 +710,9 @@ Commands.print('Your command is in progress') ]] -- logs command usage to file -local function command_log(player,command,comment,params,raw,details) +local function command_log(player, command, comment, params, raw, details) local player_name = player and player.name or '' - write_json('log/commands.log',{ + write_json('log/commands.log', { player_name=player_name, command_name=command.name, comment=comment, @@ -734,27 +734,27 @@ function Commands.run_command(command_event) end -- checks if player is allowed to use the command - local authorized, auth_fail = Commands.authorize(player,command_data.name) + local authorized, auth_fail = Commands.authorize(player, command_data.name) if not authorized then - command_log(player,command_data,'Failed Auth',{},command_event.parameter) - Commands.error(auth_fail,'utility/cannot_build') + command_log(player, command_data, 'Failed Auth', {}, command_event.parameter) + Commands.error(auth_fail, 'utility/cannot_build') return end -- null param check if command_data.min_param_count > 0 and not command_event.parameter then - command_log(player,command_data,'No Params Given',{},command_event.parameter) - Commands.error({'expcore-commands.invalid-inputs',command_data.name,command_data.description}) + command_log(player, command_data, 'No Params Given', {}, command_event.parameter) + Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) return end -- splits the arguments local input_string = command_event.parameter or '' local quote_params = {} -- stores any " " params - input_string = input_string:gsub(' "[^"]-"',function(w) + input_string = input_string:gsub(' "[^"]-"', function(w) -- finds all " " params are removes spaces for the next part - local no_spaces = w:gsub('%s','_') - local no_quotes = w:sub(2,-2) + local no_spaces = w:gsub('%s', '_') + local no_quotes = w:sub(2, -2) quote_params[no_spaces]=no_quotes if command_data.auto_concat then -- if auto concat then don't remove quotes as it should be included later @@ -772,8 +772,8 @@ function Commands.run_command(command_event) -- there are too many params given to the command if not command_data.auto_concat then -- error as they should not be more - command_log(player,command_data,'Invalid Input: Too Many Params',raw_params,input_string) - Commands.error({'expcore-commands.invalid-inputs',command_data.name,command_data.description}) + command_log(player, command_data, 'Invalid Input: Too Many Params', raw_params, input_string) + Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) return else -- concat to the last param @@ -789,10 +789,10 @@ function Commands.run_command(command_event) -- all words are added to an array if quote_params[word] then -- if it was a " " param then the spaces are re added now - table.insert(raw_params,quote_params[word]) + table.insert(raw_params, quote_params[word]) last_index = last_index + 1 else - table.insert(raw_params,word) + table.insert(raw_params, word) last_index = last_index + 1 end end @@ -801,8 +801,8 @@ function Commands.run_command(command_event) -- checks param count local param_count = #raw_params if param_count < command_data.min_param_count then - command_log(player,command_data,'Invalid Input: Not Enough Params',raw_params,input_string) - Commands.error({'expcore-commands.invalid-inputs',command_data.name,command_data.description}) + command_log(player, command_data, 'Invalid Input: Not Enough Params', raw_params, input_string) + Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) return end @@ -817,58 +817,58 @@ function Commands.run_command(command_event) end if not type(parse_callback) == 'function' then -- if its not a function throw and error - Commands.internal_error(false,command_data.name,'Invalid param parse '..tostring(param_data.parse)) - command_log(player,command_data,'Internal Error: Invalid Param Parse',params,command_event.parameter,tostring(param_data.parse)) + Commands.internal_error(false, command_data.name, 'Invalid param parse '..tostring(param_data.parse)) + command_log(player, command_data, 'Internal Error: Invalid Param Parse', params, command_event.parameter, tostring(param_data.parse)) return end -- used below as the reject function local parse_fail = function(error_message) error_message = error_message or '' - command_log(player,command_data,'Invalid Param Given',raw_params,input_string) - return Commands.error{'expcore-commands.invalid-param',param_name,error_message} + command_log(player, command_data, 'Invalid Param Given', raw_params, input_string) + return Commands.error{'expcore-commands.invalid-param', param_name, error_message} end -- input: string, player: LuaPlayer, reject: function, ... extra args - local success,param_parsed = pcall(parse_callback,raw_params[index],player,parse_fail,unpack(param_data.parse_args)) - if Commands.internal_error(success,command_data.name,param_parsed) then - return command_log(player,command_data,'Internal Error: Param Parse Fail',params,command_event.parameter,param_parsed) + local success, param_parsed = pcall(parse_callback, raw_params[index], player, parse_fail, unpack(param_data.parse_args)) + if Commands.internal_error(success, command_data.name, param_parsed) then + return command_log(player, command_data, 'Internal Error: Param Parse Fail', params, command_event.parameter, param_parsed) end if param_data.optional == true and raw_params[index] == nil then -- if it is optional and param is nil then it is set to default param_parsed = param_data.default if type(param_parsed) == 'function' then -- player: LuaPlayer - success,param_parsed = pcall(param_parsed,player) - if Commands.internal_error(success,command_data.name,param_parsed) then - return command_log(player,command_data,'Internal Error: Default Value Fail',params,command_event.parameter,param_parsed) + success, param_parsed = pcall(param_parsed, player) + if Commands.internal_error(success, command_data.name, param_parsed) then + return command_log(player, command_data, 'Internal Error: Default Value Fail', params, command_event.parameter, param_parsed) end end elseif param_parsed == nil or param_parsed == Commands.defines.error or param_parsed == parse_fail then -- no value was returned or error was returned, if nil then give generic error if not param_parsed == Commands.defines.error then - command_log(player,command_data,'Invalid Param Given',raw_params,input_string,param_name) - Commands.error{'expcore-commands.command-error-param-format',param_name,'please make sure it is the correct type'} + command_log(player, command_data, 'Invalid Param Given', raw_params, input_string, param_name) + Commands.error{'expcore-commands.command-error-param-format', param_name, 'please make sure it is the correct type'} end return end -- adds the param to the table to be passed to the command callback - table.insert(params,param_parsed) + table.insert(params, param_parsed) index=index+1 end -- runs the command -- player: LuaPlayer, ... command params, raw: string - table.insert(params,command_data.max_param_count+1,input_string) - local success, err = pcall(command_data.callback,player,unpack(params)) - if Commands.internal_error(success,command_data.name,err) then - return command_log(player,command_data,'Internal Error: Command Callback Fail',raw_params,command_event.parameter,err) + table.insert(params, command_data.max_param_count+1, input_string) + local success, err = pcall(command_data.callback, player, unpack(params)) + if Commands.internal_error(success, command_data.name, err) then + return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err) end if err == Commands.defines.error or err == Commands.error then - return command_log(player,command_data,'Custom Error',raw_params,input_string) + return command_log(player, command_data, 'Custom Error', raw_params, input_string) elseif err ~= Commands.defines.success and err ~= Commands.success then -- in this case the user has not received any output Commands.success(err) end - command_log(player,command_data,'Success',raw_params,input_string) + command_log(player, command_data, 'Success', raw_params, input_string) end return Commands \ No newline at end of file diff --git a/expcore/common.lua b/expcore/common.lua index e51b3edb..64886316 100644 --- a/expcore/common.lua +++ b/expcore/common.lua @@ -42,7 +42,7 @@ type_error(value, 'number', 'Value must be a number') ]] function Common.type_error(value, test_type, error_message, level) level = level and level+1 or 2 - return Common.type_check(value,test_type) or error(error_message,level) + return Common.type_check(value, test_type) or error(error_message, level) end --[[-- Asserts the argument is one of type test_types @@ -51,7 +51,7 @@ end @treturn boolean true if value is one of test_types @usage-- Check for a string or table -local is_string_or_table = multi_type_check(value, {'string','table'}) +local is_string_or_table = multi_type_check(value, {'string', 'table'}) ]] function Common.multi_type_check(value, test_types) @@ -72,12 +72,12 @@ end @treturn boolean true if no error was called @usage-- Raise error if value is not a string or table -multi_type_error('foo', {'string','table'}, 'Value must be a string or table') +multi_type_error('foo', {'string', 'table'}, 'Value must be a string or table') ]] function Common.multi_type_error(value, test_types, error_message, level) level = level and level+1 or 2 - return Common.mult_type_check(value, test_types) or error(error_message,level) + return Common.mult_type_check(value, test_types) or error(error_message, level) end --[[-- Raises an error when the value is the incorrect type, uses a consistent error message format @@ -95,15 +95,15 @@ validate_argument_type(value, 'number', 2, 'repeat_count') ]] function Common.validate_argument_type(value, test_type, param_number, param_name) - if not Common.test_type(value,test_type) then - local function_name = debug.getinfo(2,'n').name or '' + if not Common.test_type(value, test_type) then + local function_name = debug.getinfo(2, 'n').name or '' local error_message if param_name then error_message = string.format('Bad argument #%d to %q; %q is of type %s expected %s', param_number, function_name, param_name, type(value), test_type) else error_message = string.format('Bad argument #%d to %q; argument is of type %s expected %s', param_number, function_name, type(value), test_type) end - return error(error_message,3) + return error(error_message, 3) end return true end @@ -116,22 +116,22 @@ end @treturn boolean true if no error was raised @usage-- Output: "Bad argument #2 to ""; argument is of type number expected string or table" -validate_argument_type(value, {'string','table'}, 2) +validate_argument_type(value, {'string', 'table'}, 2) @usage-- Output: "Bad argument #2 to ""; "player" is of type number expected string or table" -validate_argument_type(value, {'string','table'}, 2, 'player') +validate_argument_type(value, {'string', 'table'}, 2, 'player') ]] function Common.validate_argument_multi_type(value, test_types, param_number, param_name) - if not Common.multi_type_check(value,test_types) then - local function_name = debug.getinfo(2,'n').name or '' + if not Common.multi_type_check(value, test_types) then + local function_name = debug.getinfo(2, 'n').name or '' local error_message if param_name then - error_message = string.format('Bad argument #%2d to %q; %q is of type %s expected %s', param_number, function_name, param_name, type(value), table.concat(test_types,' or ')) + error_message = string.format('Bad argument #%2d to %q; %q is of type %s expected %s', param_number, function_name, param_name, type(value), table.concat(test_types, ' or ')) else - error_message = string.format('Bad argument #%2d to %q; argument is of type %s expected %s', param_number, function_name, type(value), table.concat(test_types,' or ')) + error_message = string.format('Bad argument #%2d to %q; argument is of type %s expected %s', param_number, function_name, type(value), table.concat(test_types, ' or ')) end - return error(error_message,3) + return error(error_message, 3) end return true end @@ -140,8 +140,8 @@ end -- @usage error_if_runtime() function Common.error_if_runtime() if _LIFECYCLE == 8 then - local function_name = debug.getinfo(2,'n').name or '' - error(function_name..' can not be called during runtime',3) + local function_name = debug.getinfo(2, 'n').name or '' + error(function_name..' can not be called during runtime', 3) end end @@ -149,8 +149,8 @@ end -- @usage error_if_runetime_closure(func) function Common.error_if_runetime_closure(func) if _LIFECYCLE == 8 and Debug.is_closure(func) then - local function_name = debug.getinfo(2,'n').name or '' - error(function_name..' can not be called during runtime with a closure',3) + local function_name = debug.getinfo(2, 'n').name or '' + error(function_name..' can not be called during runtime with a closure', 3) end end @@ -180,7 +180,7 @@ end local value = Common.resolve_value(self.defaut_value, self) ]] -function Common.resolve_value(value,...) +function Common.resolve_value(value, ...) return value and type(value) == 'function' and value(...) or value end @@ -201,7 +201,7 @@ end -- @usage comma_value(input_number) function Common.comma_value(n) -- credit http://richard.warburton.it local left, num, right = string.match(n, '^([^%d]*%d)(%d*)(.-)$') - return left .. (num:reverse():gsub('(%d%d%d)', '%1,'):reverse()) .. right + return left .. (num:reverse():gsub('(%d%d%d)', '%1, '):reverse()) .. right end --[[-- Sets a table element to value while also returning value. @@ -227,8 +227,8 @@ end write_json('dump', tbl) ]] -function Common.write_json(path,tbl) - game.write_file(path,game.table_to_json(tbl)..'\n',true,0) +function Common.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 @@ -241,9 +241,9 @@ local Module = opt_require 'expcore.common' ]] function Common.opt_require(path) - local success, rtn = pcall(require,path) + local success, rtn = pcall(require, path) if success then return rtn - else return nil,rtn end + else return nil, rtn end end --[[-- Returns a desync safe file path for the current file @@ -273,17 +273,17 @@ local colors = enum{ ]] function Common.enum(tbl) local rtn = {} - for k,v in pairs(tbl) do + for k, v in pairs(tbl) do if type(k) ~= 'number' then rtn[v]=k end end - for k,v in pairs(tbl) do + for k, v in pairs(tbl) do if type(k) == 'number' then - table.insert(rtn,v) + table.insert(rtn, v) end end - for k,v in pairs(rtn) do + for k, v in pairs(rtn) do rtn[v]=k end return rtn @@ -306,20 +306,19 @@ local value = auto_complete(tbl, "foo", true) local key = auto_complete(tbl, "foo", true, true) ]] -function Common.auto_complete(options,input,use_key,rtn_key) - local rtn = {} +function Common.auto_complete(options, input, use_key, rtn_key) if type(input) ~= 'string' then return end input = input:lower() - for key,value in pairs(options) do + for key, value in pairs(options) do local check = use_key and key or value - if Common.string_contains(string.lower(check),input) then + if Common.string_contains(string.lower(check), input) then return rtn_key and key or value end end end ---- Formating. --- @section formating +--- Formatting. +-- @section formatting --[[-- Returns a valid string with the name of the actor of a command. @tparam string player_name the name of the player to use rather than server, used only if game.player is nil @@ -335,32 +334,32 @@ end --[[-- Returns a message with valid chat tags to change its colour @tparam string message the message that will be in the output -@tparam table color a color which contains r,g,b as its keys +@tparam table color a color which contains r, g, b as its keys @treturn string the message with the color tags included @usage-- Use factorio tags to color a chat message local message = format_chat_colour('Hello, World!', { r=355, g=100, b=100 }) ]] -function Common.format_chat_colour(message,color) +function Common.format_chat_colour(message, color) color = color or Colours.white - local color_tag = '[color='..math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3)..']' - return string.format('%s%s[/color]',color_tag,message) + local color_tag = '[color='..math.round(color.r, 3)..', '..math.round(color.g, 3)..', '..math.round(color.b, 3)..']' + return string.format('%s%s[/color]', color_tag, message) end --[[-- Returns a message with valid chat tags to change its colour, using localization @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 +@tparam table color a color which contains r, g, b as its keys @treturn table the message with the color tags included @usage-- Use factorio tags and locale strings to color a chat message local message = format_chat_colour_localized('Hello, World!', { r=355, g=100, b=100 }) ]] -function Common.format_chat_colour_localized(message,color) +function Common.format_chat_colour_localized(message, color) color = color or Colours.white - color = math.round(color.r,3)..','..math.round(color.g,3)..','..math.round(color.b,3) - return {'color-tag',color,message} + color = math.round(color.r, 3)..', '..math.round(color.g, 3)..', '..math.round(color.b, 3) + return {'color-tag', color, message} end --[[-- Returns the players name in the players color @@ -372,14 +371,14 @@ end local message = format_chat_player_name(game.player, true) ]] -function Common.format_chat_player_name(player,raw_string) +function Common.format_chat_player_name(player, raw_string) player = Game.get_player_from_any(player) local player_name = player and player.name or '' local player_chat_colour = player and player.chat_color or Colours.white if raw_string then - return Common.format_chat_colour(player_name,player_chat_colour) + return Common.format_chat_colour(player_name, player_chat_colour) else - return Common.format_chat_colour_localized(player_name,player_chat_colour) + return Common.format_chat_colour_localized(player_name, player_chat_colour) end end @@ -398,16 +397,16 @@ player_return('Hello, World!', 'green') player_return('Hello, World!', nil, player) ]] -function Common.player_return(value,colour,player) - colour = Common.type_check(colour,'table') and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white +function Common.player_return(value, colour, player) + colour = Common.type_check(colour, 'table') and colour or Colours[colour] ~= Colours.white and Colours[colour] or Colours.white player = player or game.player -- converts the value to a string local returnAsString - if Common.type_check(value,'table') or type(value) == 'userdata' then - if Common.type_check(value.__self,'userdata') or type(value) == 'userdata' then + if Common.type_check(value, 'table') or type(value) == 'userdata' then + if Common.type_check(value.__self, 'userdata') or type(value) == 'userdata' then -- value is userdata returnAsString = 'Cant Display Userdata' - elseif Common.type_check(value[1],'string') and string.find(value[1],'.+[.].+') and not string.find(value[1],'%s') then + elseif Common.type_check(value[1], 'string') and string.find(value[1], '.+[.].+') and not string.find(value[1], '%s') then -- value is a locale string returnAsString = value elseif getmetatable(value) ~= nil and not tostring(value):find('table: 0x') then @@ -415,9 +414,9 @@ function Common.player_return(value,colour,player) returnAsString = tostring(value) else -- value is a table - returnAsString = table.inspect(value,{depth=5,indent=' ',newline='\n'}) + returnAsString = table.inspect(value, {depth=5, indent=' ', newline='\n'}) end - elseif Common.type_check(value,'function') then + elseif Common.type_check(value, 'function') then -- value is a function returnAsString = 'Cant Display Functions' else returnAsString = tostring(value) end @@ -425,10 +424,10 @@ function Common.player_return(value,colour,player) if player then -- allows any valid player identifier to be used player = Game.get_player_from_any(player) - if not player then error('Invalid Player given to player_return',2) end + if not player then error('Invalid Player given to player_return', 2) end -- plays a nice sound that is different to normal message sound player.play_sound{path='utility/scenario_message'} - player.print(returnAsString,colour) + player.print(returnAsString, colour) else rcon.print(returnAsString) end end @@ -452,7 +451,7 @@ local time = format_time(18000, { hours=true, minutes=true, seconds=true, string local time = format_time(18000, { hours=true, minutes=true, seconds=true, string=true, null=true }) ]] -function Common.format_time(ticks,options) +function Common.format_time(ticks, options) -- Sets up the options options = options or { days=false, @@ -508,31 +507,31 @@ function Common.format_time(ticks,options) rtn_minutes = long and rtn_minutes..' minutes' or rtn_minutes..'m' rtn_seconds = long and rtn_seconds..' seconds' or rtn_seconds..'s' else - rtn_days = {suffix..'days'..suffix_2,rtn_days} - rtn_hours = {suffix..'hours'..suffix_2,rtn_hours} - rtn_minutes = {suffix..'minutes'..suffix_2,rtn_minutes} - rtn_seconds = {suffix..'seconds'..suffix_2,rtn_seconds} + rtn_days = {suffix..'days'..suffix_2, rtn_days} + rtn_hours = {suffix..'hours'..suffix_2, rtn_hours} + rtn_minutes = {suffix..'minutes'..suffix_2, rtn_minutes} + rtn_seconds = {suffix..'seconds'..suffix_2, rtn_seconds} end elseif not options.null then -- weather string or not it has same format - rtn_days = string.format('%02d',rtn_days) - rtn_hours = string.format('%02d',rtn_hours) - rtn_minutes = string.format('%02d',rtn_minutes) - rtn_seconds = string.format('%02d',rtn_seconds) + rtn_days = string.format('%02d', rtn_days) + rtn_hours = string.format('%02d', rtn_hours) + rtn_minutes = string.format('%02d', rtn_minutes) + rtn_seconds = string.format('%02d', rtn_seconds) end -- The final return is construed local rtn - local append = function(dom,value) + local append = function(dom, value) if dom and options.string then rtn = rtn and rtn..div..value or value elseif dom then - rtn = rtn and {div,rtn,value} or value + rtn = rtn and {div, rtn, value} or value end end - append(options.days,rtn_days) - append(options.hours,rtn_hours) - append(options.minutes,rtn_minutes) - append(options.seconds,rtn_seconds) + append(options.days, rtn_days) + append(options.hours, rtn_hours) + append(options.minutes, rtn_minutes) + append(options.seconds, rtn_seconds) return rtn end @@ -542,31 +541,31 @@ end --[[-- Moves items to the position and stores them in the closest entity of the type given @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={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 @treturn LuaEntity the last chest that had items inserted into it -@usage-- Copy all the items in a players inventory and place them in chests at {0,0} +@usage-- Copy all the items in a players inventory and place them in chests at {0, 0} move_items(game.player.get_main_inventory().get_contents()) ]] -function Common.move_items(items,surface,position,radius,chest_type) +function Common.move_items(items, surface, position, radius, chest_type) chest_type = chest_type or 'iron-chest' surface = surface or game.surfaces[1] if position and type(position) ~= 'table' then return end if type(items) ~= 'table' then return end -- Finds all entities of the given type - local p = position or {x=0,y=0} + local p = position or {x=0, y=0} local r = radius or 32 - local entities = surface.find_entities_filtered{area={{p.x-r,p.y-r},{p.x+r,p.y+r}},name=chest_type} or {} + local entities = surface.find_entities_filtered{area={{p.x-r, p.y-r}, {p.x+r, p.y+r}}, name=chest_type} or {} local count = #entities local current = 1 -- Makes a new empty chest when it is needed local function make_new_chest() - local pos = surface.find_non_colliding_position(chest_type,position,32,1) - local chest = surface.create_entity{name=chest_type,position=pos,force='neutral'} - table.insert(entities,chest) + local pos = surface.find_non_colliding_position(chest_type, position, 32, 1) + local chest = surface.create_entity{name=chest_type, position=pos, force='neutral'} + table.insert(entities, chest) count = count + 1 return chest end @@ -581,16 +580,16 @@ function Common.move_items(items,surface,position,radius,chest_type) return chest else -- Other wise it is removed from the list - table.remove(entities,current) + table.remove(entities, current) count = count - 1 end end -- Inserts the items into the chests local last_chest - for item_name,item_count in pairs(items) do - local chest = next_chest{name=item_name,count=item_count} - if not chest then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius',item.name,surface.name,p.x,p.y)) end - Util.insert_safe(chest,{[item_name]=item_count}) + for item_name, item_count in pairs(items) do + local chest = next_chest{name=item_name, count=item_count} + if not chest then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius', item_name, surface.name, p.x, p.y)) end + Util.insert_safe(chest, {[item_name]=item_count}) last_chest = chest end return last_chest @@ -606,7 +605,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 @tparam[opt=0] number offset the offset in the +x +y direction @tparam[opt=false] boolean immutable if immutable, only set, never do a surface lookup, values never change -@usage-- Place a 0 at {0,0} +@usage-- Place a 0 at {0, 0} print_grid_value(0, game.player.surface, { x=0, y=0 }) ]] @@ -664,7 +663,7 @@ clear_flying_text(game.player.surface) ]] function Common.clear_flying_text(surface) local entities = surface.find_entities_filtered{name ='flying-text'} - for _,entity in pairs(entities) do + for _, entity in pairs(entities) do if entity and entity.valid then entity.destroy() end diff --git a/expcore/gui/_require.lua b/expcore/gui/_require.lua index 306c354d..51fc0a14 100644 --- a/expcore/gui/_require.lua +++ b/expcore/gui/_require.lua @@ -18,7 +18,7 @@ Gui.element{ @usage-- Making a factory function for a button which is contained within a flow -- This method is for when you still want to register event handlers but cant use the table method local example_flow_with_button = -Gui.element(function(event_trigger,parent,...) +Gui.element(function(event_trigger, parent, ...) -- ... shows that all other arguments from the factory call are passed to this function -- Here we are adding a flow which we will then later add a button to local flow = @@ -60,7 +60,7 @@ Gui.element{ caption = 'Example Button', style = 'forward_button' -- factorio styles can be applied here } -:style(function(style,element,...) +:style(function(style, element, ...) -- style is the current style object for the elemenent -- element is the element that is being changed -- ... shows that all other arguments from the factory call are passed to this function @@ -76,7 +76,7 @@ Gui.element{ type = 'button', caption = 'Example Button' } -:on_click(function(player,element,event) +:on_click(function(player, element, event) -- player is the player who interacted with the element to cause the event -- element is a refrence to the element which caused the event -- event is a raw refrence to the event data if player and element are not enough @@ -98,21 +98,21 @@ Gui.element{ width = 18, height = 20 } -:on_click(function(player,_,_) +:on_click(function(player, _,_) Gui.hide_left_flow(player) end) @usage-- Eample from defines, Gui.alignment, called like: Gui.alignment(parent, name, horizontal_align, vertical_align) -- Notice how _ are used to blank arguments that are not needed in that context and how they line up with above Gui.alignment = -Gui.element(function(_,parent,name,_,_) +Gui.element(function(_, parent, name, _,_) return parent.add{ name = name or 'alignment', type = 'flow', } end) -:style(function(style,_,_,horizontal_align,vertical_align) - style.padding = {1,2} +:style(function(style, _,_, horizontal_align, vertical_align) + style.padding = {1, 2} style.vertical_align = vertical_align or 'center' style.horizontal_align = horizontal_align or 'right' style.vertically_stretchable = style.vertical_align ~= 'center' diff --git a/expcore/gui/core_defines.lua b/expcore/gui/core_defines.lua index 0a545a34..50e3ec09 100644 --- a/expcore/gui/core_defines.lua +++ b/expcore/gui/core_defines.lua @@ -23,7 +23,7 @@ Gui.element{ width = 18, height = 36 } -:on_click(function(player,_,_) +:on_click(function(player, _,_) Gui.toggle_top_flow(player) end) Gui.core_defines.hide_top_flow = hide_top_flow @@ -42,7 +42,7 @@ Gui.element{ width = 18, height = 20 } -:on_click(function(player,_,_) +:on_click(function(player, _,_) Gui.toggle_top_flow(player) end) Gui.core_defines.show_top_flow = show_top_flow @@ -61,13 +61,13 @@ Gui.element{ width = 18, height = 20 } -:on_click(function(player,_,_) +:on_click(function(player, _,_) Gui.hide_left_flow(player) end) Gui.core_defines.hide_left_flow = hide_left_flow --- Draw the core elements when a player joins the game -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] -- Draw the top flow diff --git a/expcore/gui/defines.lua b/expcore/gui/defines.lua index b61322e7..bb1e01f3 100644 --- a/expcore/gui/defines.lua +++ b/expcore/gui/defines.lua @@ -17,21 +17,21 @@ local Gui = require 'expcore.gui.prototype' @treturn LuaGuiElement the alignment flow that was created @usage-- Adding a right align flow -local alignment = Gui.alignment(element,'example_right_alignment') +local alignment = Gui.alignment(element, 'example_right_alignment') @usage-- Adding a horizontal center and top align flow -local alignment = Gui.alignment(element,'example_center_top_alignment','center','top') +local alignment = Gui.alignment(element, 'example_center_top_alignment', 'center', 'top') ]] Gui.alignment = -Gui.element(function(_,parent,name,_,_) +Gui.element(function(_, parent, name, _,_) return parent.add{ name = name or 'alignment', type = 'flow', } end) -:style(function(style,_,_,horizontal_align,vertical_align) - style.padding = {1,2} +:style(function(style, _,_, horizontal_align, vertical_align) + style.padding = {1, 2} style.vertical_align = vertical_align or 'center' style.horizontal_align = horizontal_align or 'right' style.vertically_stretchable = style.vertical_align ~= 'center' @@ -47,11 +47,11 @@ end) @treturn LuaGuiElement the table that was created @usage-- Adding a scroll table with max height of 200 and column count of 3 -local scroll_table = Gui.scroll_table(element,200,3) +local scroll_table = Gui.scroll_table(element, 200, 3) ]] Gui.scroll_table = -Gui.element(function(_,parent,height,column_count,name) +Gui.element(function(_, parent, height, column_count, name) -- Draw the scroll local scroll_pane = parent.add{ @@ -65,7 +65,7 @@ Gui.element(function(_,parent,height,column_count,name) -- Set the style of the scroll pane local scroll_style = scroll_pane.style - scroll_style.padding = {1,3} + scroll_style.padding = {1, 3} scroll_style.maximal_height = height scroll_style.horizontally_stretchable = true @@ -105,7 +105,7 @@ local header = Gui.header( ]] Gui.header = -Gui.element(function(_,parent,caption,tooltip,add_alignment,name) +Gui.element(function(_, parent, caption, tooltip, add_alignment, name) -- Draw the header local header = parent.add{ @@ -116,7 +116,7 @@ Gui.element(function(_,parent,caption,tooltip,add_alignment,name) -- Change the style of the header local style = header.style - style.padding = {2,4} + style.padding = {2, 4} style.use_header_filler = false style.horizontally_stretchable = true @@ -153,7 +153,7 @@ local footer = Gui.footer( ]] Gui.footer = -Gui.element(function(_,parent,caption,tooltip,add_alignment,name) +Gui.element(function(_, parent, caption, tooltip, add_alignment, name) -- Draw the header local footer = parent.add{ @@ -164,7 +164,7 @@ Gui.element(function(_,parent,caption,tooltip,add_alignment,name) -- Change the style of the footer local style = footer.style - style.padding = {2,4} + style.padding = {2, 4} style.use_header_filler = false style.horizontally_stretchable = true @@ -190,11 +190,11 @@ end) @tparam number width the minimal width that the frame will have @usage-- Adding a container as a base -local container = Gui.container(parent,'my_container',200) +local container = Gui.container(parent, 'my_container', 200) ]] Gui.container = -Gui.element(function(_,parent,name,_) +Gui.element(function(_, parent, name, _) -- Draw the external container local frame = parent.add{ @@ -210,7 +210,7 @@ Gui.element(function(_,parent,name,_) style = 'window_content_frame_packed' } end) -:style(function(style,element,_,width) +:style(function(style, element, _,width) style.vertically_stretchable = false local frame_style = element.parent.style frame_style.padding = 2 @@ -227,16 +227,16 @@ local bar = Gui.bar(parent, 100) ]] Gui.bar = -Gui.element(function(_,parent) +Gui.element(function(_, parent) return parent.add{ type = 'progressbar', size = 1, value = 1 } end) -:style(function(style,_,width) +:style(function(style, _,width) style.height = 3 - style.color = {r=255,g=255,b=255} + style.color = {r=255, g=255, b=255} if width then style.width = width else style.horizontally_stretchable = true end end) @@ -253,7 +253,7 @@ local label = Gui.centered_label(parent, 100, 'This is centered') ]] Gui.centered_label = -Gui.element(function(_,parent,width,caption,tooltip) +Gui.element(function(_, parent, width, caption, tooltip) local label = parent.add{ type = 'label', caption = caption, @@ -281,11 +281,11 @@ local label = Gui.centered_label(parent, 100, 'This is centered') ]] Gui.title_label = -Gui.element(function(_,parent,width,caption,tooltip) +Gui.element(function(_, parent, width, caption, tooltip) local title_flow = parent.add{ type='flow' } title_flow.style.vertical_align = 'center' - Gui.bar(title_flow,width) + Gui.bar(title_flow, width) local title_label = title_flow.add{ type = 'label', caption = caption, diff --git a/expcore/gui/helper_functions.lua b/expcore/gui/helper_functions.lua index c303fb15..5346c593 100644 --- a/expcore/gui/helper_functions.lua +++ b/expcore/gui/helper_functions.lua @@ -30,7 +30,7 @@ end local new_enabled_state = Gui.toggle_enabled_state(element) ]] -function Gui.toggle_enabled_state(element,state) +function Gui.toggle_enabled_state(element, state) if not element or not element.valid then return end if state == nil then state = not element.enabled end element.enabled = state @@ -46,7 +46,7 @@ end local new_visible_state = Gui.toggle_visible_state(element) ]] -function Gui.toggle_visible_state(element,state) +function Gui.toggle_visible_state(element, state) if not element or not element.valid then return end if state == nil then state = not element.visible end element.visible = state @@ -82,7 +82,7 @@ Gui.element{ :style(Gui.sprite_style(20)) ]] -function Gui.sprite_style(size,padding,style) +function Gui.sprite_style(size, padding, style) style = style or {} style.padding = padding or -2 style.height = size diff --git a/expcore/gui/left_flow.lua b/expcore/gui/left_flow.lua index 4befce31..42f02655 100644 --- a/expcore/gui/left_flow.lua +++ b/expcore/gui/left_flow.lua @@ -55,11 +55,11 @@ Gui.left_toolbar_button('entity/inserter', 'Nothing to see here', example_flow_w end) ]] -function Gui.left_toolbar_button(sprite,tooltip,element_define,authenticator) - local button = Gui.toolbar_button(sprite,tooltip,authenticator) +function Gui.left_toolbar_button(sprite, tooltip, element_define, authenticator) + local button = Gui.toolbar_button(sprite, tooltip, authenticator) -- Add on_click handler to handle click events comming from the player - button:on_click(function(player,_,_) + button:on_click(function(player, _,_) local top_flow = Gui.get_top_flow(player) local element = top_flow[button.name] local visibility_state = Gui.toggle_left_element(player, element_define) @@ -169,7 +169,7 @@ function Gui.hide_left_flow(player) -- Set the visible state of all elements in the flow hide_button.visible = false - for name,_ in pairs(Gui.left_elements) do + for name, _ in pairs(Gui.left_elements) do left_flow[name].visible = false -- Check if the the element has a toobar button attached @@ -202,7 +202,7 @@ end local frame = Gui.get_left_element(game.player, example_flow_with_button) ]] -function Gui.get_left_element(player,element_define) +function Gui.get_left_element(player, element_define) local left_flow = Gui.get_left_flow(player) return left_flow[element_define.name] end @@ -220,7 +220,7 @@ Gui.toggle_top_flow(game.player, example_flow_with_button) Gui.toggle_top_flow(game.player, example_flow_with_button, true) ]] -function Gui.toggle_left_element(player,element_define,state) +function Gui.toggle_left_element(player, element_define, state) local left_flow = Gui.get_left_flow(player) local top_flow = Gui.get_top_flow(player) diff --git a/expcore/gui/prototype.lua b/expcore/gui/prototype.lua index f7803602..8bd7a644 100644 --- a/expcore/gui/prototype.lua +++ b/expcore/gui/prototype.lua @@ -22,9 +22,9 @@ local Gui = { _prototype_element = {}, --- The prototype metatable applied to new element defines _mt_element = { - __call = function(self,parent,...) - local element = self._draw(self.name,parent,...) - if self._style then self._style(element.style,element,...) end + __call = function(self, parent, ...) + local element = self._draw(self.name, parent, ...) + if self._style then self._style(element.style, element, ...) end return element end } @@ -50,7 +50,7 @@ Gui.element{ @usage-- Using element defines with a custom factory function -- This method can be used if you still want to be able register event handlers but it is too complex to be compatible with LuaGuiElement.add local example_flow_with_button = -Gui.element(function(event_trigger,parent,...) +Gui.element(function(event_trigger, parent, ...) -- ... shows that all other arguments from the factory call are passed to this function -- parent is the element which was passed to the factory function where you should add your new element -- here we are adding a flow which we will then later add a button to @@ -90,7 +90,7 @@ function Gui.element(element_define) if type(element_define) == 'table' then Gui.debug_info[name].draw = element_define element_define.name = name - element._draw = function(_,parent) + element._draw = function(_, parent) return parent.add(element_define) end else @@ -131,7 +131,7 @@ Gui.element{ caption = 'Example Button', style = 'forward_button' -- factorio styles can be applied here } -:style(function(style,element,...) +:style(function(style, element, ...) -- style is the current style object for the elemenent -- element is the element that is being changed -- ... shows that all other arguments from the factory call are passed to this function @@ -147,7 +147,7 @@ function Gui._prototype_element:style(style_define) if type(style_define) == 'table' then Gui.debug_info[self.name].style = style_define self._style = function(style) - for key,value in pairs(style_define) do + for key, value in pairs(style_define) do style[key] = value end end @@ -171,8 +171,8 @@ element_deinfe:on_custom_event('my_custom_event', function(event) end) ]] -function Gui._prototype_element:on_custom_event(event_name,handler) - table.insert(Gui.debug_info[self.name].events,event_name) +function Gui._prototype_element:on_custom_event(event_name, handler) + table.insert(Gui.debug_info[self.name].events, event_name) Gui.events[event_name] = event_name self[event_name] = handler return self @@ -210,7 +210,7 @@ function Gui._prototype_element:raise_custom_event(event) end event.player = player - local success, err = pcall(handler,player,element,event) + local success, err = pcall(handler, player, element, event) if not success then error('There as been an error with an event handler for a gui element:\n\t'..err) end @@ -227,8 +227,8 @@ local function event_handler_factory(event_name) element_define:raise_custom_event(event) end) - return function(self,handler) - table.insert(Gui.debug_info[self.name].events,debug.getinfo(1, "n").name) + return function(self, handler) + table.insert(Gui.debug_info[self.name].events, debug.getinfo(1, "n").name) self[event_name] = handler return self end diff --git a/expcore/gui/top_flow.lua b/expcore/gui/top_flow.lua index 3001d88d..e2cb38c1 100644 --- a/expcore/gui/top_flow.lua +++ b/expcore/gui/top_flow.lua @@ -87,10 +87,10 @@ end Gui.toggle_top_flow(game.player) @usage-- Open your top flow -Gui.toggle_top_flow(game.player,true) +Gui.toggle_top_flow(game.player, true) ]] -function Gui.toggle_top_flow(player,state) +function Gui.toggle_top_flow(player, state) -- Get the top flow and hide button local top_flow = Gui.get_top_flow(player) if state == nil then state = not top_flow.visible end @@ -130,7 +130,7 @@ Gui.left_toolbar_button('entity/inserter', 'Nothing to see here', function(playe end) ]] -function Gui.toolbar_button(sprite,tooltip,authenticator) +function Gui.toolbar_button(sprite, tooltip, authenticator) return Gui.element{ type = 'sprite-button', sprite = sprite, diff --git a/expcore/permission_groups.lua b/expcore/permission_groups.lua index 5b88331f..30ac6039 100644 --- a/expcore/permission_groups.lua +++ b/expcore/permission_groups.lua @@ -35,14 +35,14 @@ local Permissions_Groups = { -- Async function to add players to permission groups local add_to_permission_group = -Async.register(function(permission_group,player) +Async.register(function(permission_group, player) permission_group.add_player(player) end) Permissions_Groups.async_token_add_to_permission_group = add_to_permission_group -- Async function to remove players from permission groups local remove_from_permission_group = -Async.register(function(permission_group,player) +Async.register(function(permission_group, player) permission_group.remove_player(player) end) Permissions_Groups.async_token_remove_from_permission_group = remove_from_permission_group @@ -64,7 +64,7 @@ function Permissions_Groups.new_group(name) name=name, actions={}, allow_all_actions=true - },{ + }, { __index= Permissions_Groups._prototype }) Permissions_Groups.groups[name] = group @@ -111,7 +111,7 @@ Groups.reload_permissions() ]] function Permissions_Groups.reload_permissions() - for _,group in pairs(Permissions_Groups.groups) do + for _, group in pairs(Permissions_Groups.groups) do group:create() end end @@ -125,7 +125,7 @@ end Groups.set_player_group(game.player, 'Admin') ]] -function Permissions_Groups.set_player_group(player,group) +function Permissions_Groups.set_player_group(player, group) player = Game.get_player_from_any(player) group = Permissions_Groups.get_group_by_name(group) if not group or not player then return false end @@ -146,7 +146,7 @@ end group:set_action('toggle_map_editor', false) ]] -function Permissions_Groups._prototype:set_action(action,state) +function Permissions_Groups._prototype:set_action(action, state) if type(action) == 'string' then action = defines.input_action[action] end @@ -168,8 +168,8 @@ function Permissions_Groups._prototype:allow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _,action in pairs(actions) do - self:set_action(action,true) + for _, action in pairs(actions) do + self:set_action(action, true) end return self end @@ -192,8 +192,8 @@ function Permissions_Groups._prototype:disallow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _,action in pairs(actions) do - self:set_action(action,false) + for _, action in pairs(actions) do + self:set_action(action, false) end return self end @@ -257,8 +257,8 @@ function Permissions_Groups._prototype:create() if not group then group = game.permissions.create_group(self.name) end - for _,action in pairs(defines.input_action) do - group.set_allows_action(action,self:is_allowed(action)) + for _, action in pairs(defines.input_action) do + group.set_allows_action(action, self:is_allowed(action)) end return group end @@ -324,9 +324,9 @@ function Permissions_Groups._prototype:get_players(online) if online == nil then return group.players else - for _,player in pairs(group.players) do + for _, player in pairs(group.players) do if player.connected == online then - table.insert(player,player) + table.insert(player, player) end end end @@ -344,7 +344,7 @@ group:print('Hello, World!') ]] function Permissions_Groups._prototype:print(message) local players = self:get_players(true) - for _,player in pairs(players) do + for _, player in pairs(players) do player.print(message) end return #players diff --git a/expcore/roles.lua b/expcore/roles.lua index 65485c00..f7be5f23 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -6,13 +6,13 @@ @usage--- Using Role System (assignment): --When a map first starts you will want to define on mass all the players you expect to join and the roles to give them: Roles.override_player_roles{ - Cooldude2606 = {'Owner','Admin','Member'}, + Cooldude2606 = {'Owner', 'Admin', 'Member'}, NotCooldude2606 = {'Member'} } --Once the game is running you still want to be able to give role and remove them which is when you would use: -Roles.assign_player(player,'Admin',by_player_name) -- this will give the "Admin" role to the player -Roles.unassign_player(player,{'Admin','Moderator'},by_player_name) -- this will remove "Admin" and "Moderator" role in one go +Roles.assign_player(player, 'Admin', by_player_name) -- this will give the "Admin" role to the player +Roles.unassign_player(player, {'Admin', 'Moderator'}, by_player_name) -- this will remove "Admin" and "Moderator" role in one go @usage--- Using Role System (role testing): --To comparer two players you can comparer the index of they highest roles, can be used when you want to allow a "write" down type system: @@ -22,9 +22,9 @@ Roles.get_player_highest_role(playerOne).index < Roles.get_player_highest_role(p Roles.get_player_roles(player) -- the return is an array that can be looped over however this is not in particular order --Finally you may want to test if a player has a certain role, flag or action allowed which is when you would use: -Roles.player_has_role(player,'Admin') -- you can provide a role name if you only want a name based system -Roles.player_has_flag(player,'is_donator') -- your roles can be grouped together with flags such as is_donator -Roles.player_allowed(player,'game modifiers') -- or you can have an action based system where each action is something the player can do +Roles.player_has_role(player, 'Admin') -- you can provide a role name if you only want a name based system +Roles.player_has_flag(player, 'is_donator') -- your roles can be grouped together with flags such as is_donator +Roles.player_allowed(player, 'game modifiers') -- or you can have an action based system where each action is something the player can do @usage--- Example Flag Define: --Flags can be used to group multiple roles and actions under one catch all, for example if you want a piece of code to only @@ -32,7 +32,7 @@ Roles.player_allowed(player,'game modifiers') -- or you can have an action based --a player has that tag present: -- give you donators a speed boost when they join; these functions aren't required but can be useful -Roles.define_flag_trigger('is_donator',function(player,state) +Roles.define_flag_trigger('is_donator', function(player, state) if state then player.character_running_speed_modifier = 1.5 else @@ -45,30 +45,30 @@ Roles.new_role('Donator') :set_flag('is_donator') -- and in your code you would test for -if Roles.player_has_flag(player,'is_donator') then +if Roles.player_has_flag(player, 'is_donator') then -- some donator only code end @usage--- Example Role Define: --You can't use a role system without any roles so first you must define your roles; each role has a minimum of a name with --the option for a shorthand: -Roles.new_role('Administrator','Admin') +Roles.new_role('Administrator', 'Admin') --Next you will want to add any extras you want to have, such as a tag, colour, permission group or any custom flags: -Roles.new_role('Administrator','Admin') +Roles.new_role('Administrator', 'Admin') :set_custom_tag('[Admin]') -:set_custom_color('red') -- this can be {r=0,g=0,b=0} or a predefined value +:set_custom_color('red') -- this can be {r=0, g=0, b=0} or a predefined value :set_permission_group('Staff') -- a second argument can be added if you have not used the custom permission group config :set_flag('is_admin') --You will then want to decide if you want to allow all actions, this should of course be used sparely: -Roles.new_role('Administrator','Admin') +Roles.new_role('Administrator', 'Admin') ...extras... :set_allow_all() --If you don't do this want this as i would advise you do then you will want to define what the role can do; this comes with --an optional inheritance system if you like those sort of things in which case disallow may also be of some use to you: -Roles.new_role('Administrator','Admin') +Roles.new_role('Administrator', 'Admin') ...extras... :set_parent('Moderator') -- the admin can do anything that a moderator can do :allow{ -- these actions can be anything just try to keep them without conflicts @@ -77,7 +77,7 @@ Roles.new_role('Administrator','Admin') } --Here is what the finished admin role would look like: -Roles.new_role('Administrator','Admin') +Roles.new_role('Administrator', 'Admin') :set_custom_tag('[Admin]') :set_custom_color('red') :set_permission_group('Staff') @@ -132,10 +132,10 @@ local Roles = { } --- When global is loaded it will have the metatable re-assigned to the roles -Global.register(Roles.config,function(tbl) +Global.register(Roles.config, function(tbl) Roles.config = tbl - for _,role in pairs(Roles.config.roles) do - setmetatable(role,{__index=Roles._prototype}) + for _, role in pairs(Roles.config.roles) do + setmetatable(role, {__index=Roles._prototype}) local parent = Roles.config.roles[role.parent] if parent then setmetatable(role.allowed_actions, {__index=parent.allowed_actions}) @@ -150,7 +150,7 @@ end) --- Internal function used to trigger a few different things when roles are changed -- this is the raw internal trigger as the other function is called at other times -- there is a second half called role_update which triggers after the event call, it also is called when a player joins -local function emit_player_roles_updated(player,type,roles,by_player_name,skip_game_print) +local function emit_player_roles_updated(player, type, roles, by_player_name, skip_game_print) by_player_name = game.player and game.player.name or by_player_name or '' local by_player = Game.get_player_from_any(by_player_name) local by_player_index = by_player and by_player.index or 0 @@ -161,30 +161,30 @@ local function emit_player_roles_updated(player,type,roles,by_player_name,skip_g end -- convert the roles to objects and get the names of the roles local role_names = {} - for index,role in pairs(roles) do + for index, role in pairs(roles) do role = Roles.get_role_from_any(role) if role then roles[index] = role - table.insert(role_names,role.name) + table.insert(role_names, role.name) end end -- output to all the different locations: game print, player sound, event trigger and role log if not skip_game_print then - game.print({'expcore-roles.game-message-'..type,player.name,table.concat(role_names,', '),by_player_name},Colours.cyan) + game.print({'expcore-roles.game-message-'..type, player.name, table.concat(role_names, ', '), by_player_name}, Colours.cyan) end if type == 'assign' then player.play_sound{path='utility/achievement_unlocked'} else player.play_sound{path='utility/game_lost'} end - script.raise_event(event,{ + script.raise_event(event, { name=event, tick=game.tick, player_index=player.index, by_player_index=by_player_index, roles=roles }) - write_json('log/roles.log',{ + write_json('log/roles.log', { player_name=player.name, by_player_name=by_player_name, type=type, @@ -201,11 +201,11 @@ game.player.print(Roles.debug()) ]] function Roles.debug() local output = '' - for index,role_name in pairs(Roles.config.order) do + for index, role_name in pairs(Roles.config.order) do local role = Roles.config.roles[role_name] local color = role.custom_color or Colours.white - color = string.format('[color=%d,%d,%d]',color.r,color.g,color.b) - output = output..string.format('\n%s %s) %s[/color]',color,index,serpent.line(role)) + color = string.format('[color=%d, %d, %d]', color.r, color.g, color.b) + output = output..string.format('\n%s %s) %s[/color]', color, index, serpent.line(role)) end return output end @@ -215,11 +215,11 @@ end @tparam string message the message to send to the players @usage-- Print a message to the given roles -Roles.print_to_roles({'Administrator','Moderator'}, 'Hello, World!') +Roles.print_to_roles({'Administrator', 'Moderator'}, 'Hello, World!') ]] -function Roles.print_to_roles(roles,message) - for _,role in pairs(roles) do +function Roles.print_to_roles(roles, message) + for _, role in pairs(roles) do role = Roles.get_role_from_any(role) if role then role:print(message) end end @@ -233,16 +233,16 @@ end Roles.print_to_roles_higher('Moderator', 'Hello, World!') ]] -function Roles.print_to_roles_higher(role,message) +function Roles.print_to_roles_higher(role, message) role = Roles.get_role_from_any(role) if not role then return end local roles = {} - for index,role_name in pairs(Roles.config.order) do + for index, role_name in pairs(Roles.config.order) do if index <= role.index and role_name ~= Roles.config.internal.default then - table.insert(roles,role_name) + table.insert(roles, role_name) end end - Roles.print_to_roles(roles,message) + Roles.print_to_roles(roles, message) end --[[-- Prints a message to all players who have the given role or one which is lower (excluding default) @@ -253,16 +253,16 @@ end Roles.print_to_roles_higher('Moderator', 'Hello, World!') ]] -function Roles.print_to_roles_lower(role,message) +function Roles.print_to_roles_lower(role, message) role = Roles.get_role_from_any(role) if not role then return end local roles = {} - for index,role_name in pairs(Roles.config.order) do + for index, role_name in pairs(Roles.config.order) do if index >= role.index and role_name ~= Roles.config.internal.default then - table.insert(roles,role_name) + table.insert(roles, role_name) end end - Roles.print_to_roles(roles,message) + Roles.print_to_roles(roles, message) end --[[-- Get a role for the given name @@ -290,7 +290,7 @@ function Roles.get_role_by_order(index) return Roles.config.roles[name] end ---[[-- Gets a role from a name,index or role object (where it is just returned) +--[[-- 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 ?number|string|table any the value used to find the role @treturn Roles._prototype the role that was found or nil see above @@ -325,8 +325,8 @@ function Roles.get_player_roles(player) local roles = Roles.config.players[player.name] or {} local default = Roles.config.roles[Roles.config.internal.default] local rtn = {default} - for _,role_name in pairs(roles) do - table.insert(rtn,Roles.config.roles[role_name]) + for _, role_name in pairs(roles) do + table.insert(rtn, Roles.config.roles[role_name]) end return rtn end @@ -343,7 +343,7 @@ function Roles.get_player_highest_role(player) local roles = Roles.get_player_roles(player) if not roles then return end local highest - for _,role in pairs(roles) do + for _, role in pairs(roles) do if not highest or role.index < highest.index then highest = role end @@ -369,13 +369,13 @@ Roles.assign_player(game.player, 'Moderator') Roles.assign_player('Cooldude2606', 'Moderator', nil, true) ]] -function Roles.assign_player(player,roles,by_player_name,skip_checks,silent) +function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) local valid_player = Game.get_player_from_any(player) if not skip_checks and not valid_player then return end if type(roles) ~= 'table' or roles.name then roles = {roles} end - for _,role in pairs(roles) do + for _, role in pairs(roles) do role = Roles.get_role_from_any(role) if role then role:add_player(valid_player or player, valid_player == nil, true) @@ -400,14 +400,14 @@ Roles.unassign_player(game.player, 'Moderator') Roles.unassign_player('Cooldude2606', 'Moderator', nil, true) ]] -function Roles.unassign_player(player,roles,by_player_name,skip_checks,silent) +function Roles.unassign_player(player, roles, by_player_name, skip_checks, silent) local valid_player = Game.get_player_from_any(player) if not skip_checks and not valid_player then return end if not player then return end if type(roles) ~= 'table' or roles.name then roles = {roles} end - for _,role in pairs(roles) do + for _, role in pairs(roles) do role = Roles.get_role_from_any(role) if role then role:remove_player(valid_player or player, valid_player == nil, true) @@ -427,12 +427,12 @@ Roles.override_player_roles('Cooldude2606', {'Moderator'}) @usage-- Override all existing roles, effects all users not just ones listed Roles.override_player_roles{ - ['Cooldude2606'] = {'Administrator','Moderator'}, - ['arty714'] = {'Administrator','Moderator'}, + ['Cooldude2606'] = {'Administrator', 'Moderator'}, + ['arty714'] = {'Administrator', 'Moderator'}, } ]] -function Roles.override_player_roles(player_name,roles) +function Roles.override_player_roles(player_name, roles) if not roles then Roles.config.players = player_name else @@ -453,12 +453,12 @@ end local has_role = Roles.player_has_role(game.player, 'Moderator') ]] -function Roles.player_has_role(player,search_role) +function Roles.player_has_role(player, search_role) local roles = Roles.get_player_roles(player) if not roles then return end search_role = Roles.get_role_from_any(search_role) if not search_role then return end - for _,role in pairs(roles) do + for _, role in pairs(roles) do if role.name == search_role.name then return true end end return false @@ -473,10 +473,10 @@ end local has_flag = Roles.player_has_flag(game.player, 'is_donator') ]] -function Roles.player_has_flag(player,flag_name) +function Roles.player_has_flag(player, flag_name) local roles = Roles.get_player_roles(player) if not roles then return end - for _,role in pairs(roles) do + for _, role in pairs(roles) do if role:has_flag(flag_name) then return true end @@ -493,10 +493,10 @@ end local has_flag = Roles.player_has_flag(game.player, 'is_donator') ]] -function Roles.player_allowed(player,action) +function Roles.player_allowed(player, action) local roles = Roles.get_player_roles(player) if not roles then return end - for _,role in pairs(roles) do + for _, role in pairs(roles) do if role:is_allowed(action) then return true end @@ -527,31 +527,31 @@ function Roles.define_role_order(order) _C.error_if_runtime() Roles.config.order = {} local done = {} - for _,role in ipairs(order) do + for _, role in ipairs(order) do if type(role) == 'table' and role.name then done[role.name] = true - table.insert(Roles.config.order,role.name) + table.insert(Roles.config.order, role.name) else done[role] = true - table.insert(Roles.config.order,role) + table.insert(Roles.config.order, role) end end -- Check no roles were missed - for role_name,_ in pairs(Roles.config.roles) do + for role_name, _ in pairs(Roles.config.roles) do if not done[role_name] then - error('Role missing '..role_name..' from role order, all defined roles must be included.',2) + error('Role missing '..role_name..' from role order, all defined roles must be included.', 2) end end -- Re-links roles to they parents as this is called at the end of the config - for index,role_name in pairs(Roles.config.order) do + for index, role_name in pairs(Roles.config.order) do local role = Roles.config.roles[role_name] if not role then - error('Role with name '..role_name..' has not beed defined, either define it or remove it from the order list.',2) + error('Role with name '..role_name..' has not beed defined, either define it or remove it from the order list.', 2) end role.index = index local parent = Roles.config.roles[role.parent] if parent then - setmetatable(role.allowed_actions,{__index=parent.allowed_actions}) + setmetatable(role.allowed_actions, {__index=parent.allowed_actions}) end end end @@ -566,7 +566,7 @@ Roles.define_flag_trigger('is_donator', function(player, state) end) ]] -function Roles.define_flag_trigger(name,callback) +function Roles.define_flag_trigger(name, callback) _C.error_if_runtime() Roles.config.flags[name] = Async.register(callback) end @@ -607,7 +607,7 @@ end local role = Roles.new_role('Moderator', 'Mod') ]] -function Roles.new_role(name,short_hand) +function Roles.new_role(name, short_hand) _C.error_if_runtime() if Roles.config.roles[name] then return error('Role name is non unique') end local role = setmetatable({ @@ -616,7 +616,7 @@ function Roles.new_role(name,short_hand) allowed_actions={}, allow_all_actions=false, flags={} - },{__index=Roles._prototype}) + }, {__index=Roles._prototype}) Roles.config.roles[name] = role return role end @@ -654,7 +654,7 @@ function Roles._prototype:allow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _,action in pairs(actions) do + for _, action in pairs(actions) do self.allowed_actions[action]=true end return self @@ -675,7 +675,7 @@ function Roles._prototype:disallow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _,action in pairs(actions) do + for _, action in pairs(actions) do self.allowed_actions[action]=false end return self @@ -707,13 +707,13 @@ end role:set_flag('is_admin') ]] -function Roles._prototype:set_flag(name,value) +function Roles._prototype:set_flag(name, value) if value == nil then value = true end self.flags[name] = not not value -- not not forces a boolean value return self end ---[[-- Clears all flags from this role, individual flags can be removed with set_flag(name,false) +--[[-- Clears all flags from this role, individual flags can be removed with set_flag(name, false) @treturn Roles._prototype allows chaining @usage-- Remove all flags from a role @@ -779,10 +779,10 @@ end role:set_permission_group('Admin') ]] -function Roles._prototype:set_permission_group(name,use_factorio_api) +function Roles._prototype:set_permission_group(name, use_factorio_api) _C.error_if_runtime() if use_factorio_api then - self.permission_group = {true,name} + self.permission_group = {true, name} else local group = Groups.get_group_by_name(name) if not group then return end @@ -854,7 +854,7 @@ end role:add_player(game.player) ]] -function Roles._prototype:add_player(player,skip_check,skip_event) +function Roles._prototype:add_player(player, skip_check, skip_event) player = Game.get_player_from_any(player) -- Default role cant have players added or removed if self.name == Roles.config.internal.default then return end @@ -869,16 +869,16 @@ function Roles._prototype:add_player(player,skip_check,skip_event) -- Add the role name to the player's roles local player_roles = Roles.config.players[player.name] if player_roles then - for _,role_name in pairs(player_roles) do + for _, role_name in pairs(player_roles) do if role_name == self.name then return false end end - table.insert(player_roles,self.name) + table.insert(player_roles, self.name) else Roles.config.players[player.name] = {self.name} end -- Emits event if required if not skip_event then - emit_player_roles_updated(player,'assign',{self}) + emit_player_roles_updated(player, 'assign', {self}) end return true end @@ -893,7 +893,7 @@ end role:remove_player(game.player) ]] -function Roles._prototype:remove_player(player,skip_check,skip_event) +function Roles._prototype:remove_player(player, skip_check, skip_event) player = Game.get_player_from_any(player) -- Default role cant have players added or removed if self.name == Roles.config.internal.default then return end @@ -909,9 +909,9 @@ function Roles._prototype:remove_player(player,skip_check,skip_event) local player_roles = Roles.config.players[player.name] local rtn = false if player_roles then - for index,role_name in pairs(player_roles) do + for index, role_name in pairs(player_roles) do if role_name == self.name then - table.remove(player_roles,index) + table.remove(player_roles, index) rtn = true break end @@ -922,7 +922,7 @@ function Roles._prototype:remove_player(player,skip_check,skip_event) end -- Emits event if required if not skip_event then - emit_player_roles_updated(player,'unassign',{self}) + emit_player_roles_updated(player, 'unassign', {self}) end return rtn end @@ -941,15 +941,15 @@ local players = role:get_players(true) function Roles._prototype:get_players(online) local players = {} -- Gets all players that have this role - for player_name,player_roles in pairs(Roles.config.players) do - for _,role_name in pairs(player_roles) do + for player_name, player_roles in pairs(Roles.config.players) do + for _, role_name in pairs(player_roles) do if role_name == self.name then - table.insert(players,player_name) + table.insert(players, player_name) end end end -- Convert the player names to LuaPlayer - for index,player_name in pairs(players) do + for index, player_name in pairs(players) do players[index] = Game.get_player_from_any(player_name) end -- Filter by online if param is defined @@ -957,9 +957,9 @@ function Roles._prototype:get_players(online) return players else local filtered = {} - for _,player in pairs(players) do + for _, player in pairs(players) do if player.connected == online then - table.insert(filtered,player) + table.insert(filtered, player) end end return filtered @@ -976,7 +976,7 @@ role:print('Hello, World!') ]] function Roles._prototype:print(message) local players = self:get_players(true) - for _,player in pairs(players) do + for _, player in pairs(players) do player.print(message) end return #players @@ -987,7 +987,7 @@ local function role_update(event) local player = Game.get_player_by_index(event.player_index) -- Updates flags given to the player for flag, async_token in pairs(Roles.config.flags) do - local state = Roles.player_has_flag(player,flag) + local state = Roles.player_has_flag(player, flag) Async(async_token, player, state) end -- Updates the players permission group @@ -1005,22 +1005,22 @@ local function role_update(event) end --- When a player joined or has a role change then the update is triggered -Event.add(Roles.events.on_role_assigned,role_update) -Event.add(Roles.events.on_role_unassigned,role_update) -Event.add(defines.events.on_player_joined_game,role_update) +Event.add(Roles.events.on_role_assigned, role_update) +Event.add(Roles.events.on_role_unassigned, role_update) +Event.add(defines.events.on_player_joined_game, role_update) -- Every 60 seconds the auto promote check is preformed -Event.on_nth_tick(3600,function() +Event.on_nth_tick(3600, function() local promotes = {} - for _,player in pairs(game.connected_players) do - for _,role in pairs(Roles.config.roles) do + for _, player in pairs(game.connected_players) do + for _, role in pairs(Roles.config.roles) do if role.auto_promote_condition then - local success,err = pcall(role.auto_promote_condition,player) + local success, err = pcall(role.auto_promote_condition, player) if not success then - log{'expcore-roles.error-log-format-promote',role.name,err} + log{'expcore-roles.error-log-format-promote', role.name, err} else - if err == true and not Roles.player_has_role(player,role) then + if err == true and not Roles.player_has_role(player, role) then if promotes[player.name] then - table.insert(promotes[player.name],role.name) + table.insert(promotes[player.name], role.name) else promotes[player.name] = {role.name} end @@ -1029,8 +1029,8 @@ Event.on_nth_tick(3600,function() end end end - for player_name,roles in pairs(promotes) do - Roles.assign_player(player_name,roles) + for player_name, roles in pairs(promotes) do + Roles.assign_player(player_name, roles) end end) diff --git a/expcore/store.lua b/expcore/store.lua index ffb2afa8..c6353d64 100644 --- a/expcore/store.lua +++ b/expcore/store.lua @@ -9,13 +9,13 @@ local Store = require 'expcore.store' --- @dep expcore.store local scenario_diffculty = Store.register() -- When the store is changed this function will trigger -Store.watch(scenario_diffculty,function(value) +Store.watch(scenario_diffculty, function(value) game.print('The scenario diffculty has been set to '..value) end) -Store.set(scenario_diffculty,'hard') -- Set the value stored to 'hard' +Store.set(scenario_diffculty, 'hard') -- Set the value stored to 'hard' Store.get(scenario_diffculty) -- Returns 'hard' -Store.update(scenario_diffculty,function(value) -- Will set value to 'normal' if no value is present +Store.update(scenario_diffculty, function(value) -- Will set value to 'normal' if no value is present return not value and 'normal' end) @@ -27,13 +27,13 @@ local player_scores = Store.register(function(player) -- Use player name as the end) -- When any key in the store is changed this function will trigger -Store.watch(player_scores,function(value,key,old_value) +Store.watch(player_scores, function(value, key, old_value) game.print(key..' now has a score of '..value) end) -Store.set(player_scores,game.player,10) -- Set your score to 10 -Store.get(scenario_diffculty,game.player) -- Returns 10 -Store.update(scenario_diffculty,game.player,function(value) -- Add 1 to your score +Store.set(player_scores, game.player, 10) -- Set your score to 10 +Store.get(scenario_diffculty, game.player) -- Returns 10 +Store.update(scenario_diffculty, game.player, function(value) -- Add 1 to your score return value + 1 end) @@ -79,33 +79,33 @@ local player_scores = Store.register(function(player) end) -- player_scores is a valid store and key will be your player name -local key = Store.validate(player_scores,game.player) +local key = Store.validate(player_scores, game.player) ]] -function Store.validate(store,key,error_stack) +function Store.validate(store, key, error_stack) error_stack = error_stack or 1 if type(store) ~= 'number' then -- Store is not a number and so if not valid - error('Store uid given is not a number; recived type '..type(store),error_stack+1) + error('Store uid given is not a number; recived type '..type(store), error_stack+1) elseif store > Store.uid then -- Store is a number but it is out of range, ie larger than the current highest uid - error('Store uid is out of range; recived '..tostring(store),error_stack+1) + error('Store uid is out of range; recived '..tostring(store), error_stack+1) elseif key ~= nil and type(key) ~= 'string' and Store.serializers[store] == nil then -- Key is present but is not a string and there is no serializer registered - error('Store key is not a string and no serializer has been registered; recived '..type(key),error_stack+1) + error('Store key is not a string and no serializer has been registered; recived '..type(key), error_stack+1) elseif key ~= nil then -- Key is present and so it is serialized and returned local serializer = Store.serializers[store] if type(key) ~= 'string' then - local success, serialized_key = pcall(serializer,key) + local success, serialized_key = pcall(serializer, key) if not success then -- Serializer casued an error while serializing the key - error('Store watcher casued an error:\n\t'..key,error_stack+1) + error('Store watcher casued an error:\n\t'..key, error_stack+1) elseif type(serialized_key) ~= 'string' then -- Serializer was successful but failed to return a string value - error('Store key serializer did not return a string; recived type '..type(key),error_stack+1) + error('Store key serializer did not return a string; recived type '..type(key), error_stack+1) end return serialized_key @@ -161,12 +161,12 @@ end local scenario_diffculty = Store.register() -- Register the watcher so that when we change the value the message is printed -Store.watch(scenario_diffculty,function(value) +Store.watch(scenario_diffculty, function(value) game.print('The scenario diffculty has been set to '..value) end) -- Set a new value for the diffculty and see that it has printed to the game -Store.set(scenario_diffculty,'hard') +Store.set(scenario_diffculty, 'hard') @usage-- Printing the changed value to all players, with keys -- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects @@ -175,21 +175,21 @@ local player_scores = Store.register(function(player) end) -- Register the watcher so that when we change the value the message is printed -Store.watch(player_scores,function(value,key,old_value) +Store.watch(player_scores, function(value, key, old_value) game.print(key..' now has a score of '..value) end) -- Set a new value for your score and see that it has printed to the game -Store.set(player_scores,game.player,10) +Store.set(player_scores, game.player, 10) ]] -function Store.watch(store,watcher) +function Store.watch(store, watcher) if _LIFECYCLE ~= _STAGE.control then -- Only allow this function to be called during the control stage error('Store watcher can not be registered durring runtime', 2) end - Store.validate(store,nil,2) + Store.validate(store, nil, 2) -- Add the watchers table if it does not exist local watchers = Store.watchers[store] @@ -224,14 +224,14 @@ local player_scores = Store.register(function(player) end) -- Get your current score -local my_score = Store.get(player_scores,game.player) +local my_score = Store.get(player_scores, game.player) -- Get all scores lcoal scores = Store.get(player_scores) ]] -function Store.get(store,key) - key = Store.validate(store,key,2) +function Store.get(store, key) + key = Store.validate(store, key, 2) -- Get the data from the data store local data = data_store[store] @@ -266,14 +266,14 @@ local player_scores = Store.register(function(player) end) -- Clear your score -Store.clear(player_scores,game.player) +Store.clear(player_scores, game.player) -- Clear all scores Store.clear(player_scores) ]] -function Store.clear(store,key) - key = Store.validate(store,key,2) +function Store.clear(store, key) + key = Store.validate(store, key, 2) local old_value -- Check if there is a key being used @@ -288,7 +288,7 @@ function Store.clear(store,key) end -- Trigger any watch functions - Store.raw_trigger(store,key,nil,old_value) + Store.raw_trigger(store, key, nil, old_value) end --[[-- Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them @@ -301,7 +301,7 @@ end local scenario_diffculty = Store.register() -- Set the new scenario diffculty -Store.set(scenario_diffculty,'hard') +Store.set(scenario_diffculty, 'hard') @usage-- Set data in a store with keys -- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects @@ -310,16 +310,16 @@ local player_scores = Store.register(function(player) end) -- Set your current score -Store.set(player_scores,game.player,10) +Store.set(player_scores, game.player, 10) -- Set all scores, note this might not have much use -Store.set(player_scores,{ +Store.set(player_scores, { [game.player.name] = 10, ['SomeOtherPlayer'] = 0 }) ]] -function Store.set(store,key,value) +function Store.set(store, key, value) -- Allow for key to be optional if value == nil then value = key @@ -327,7 +327,7 @@ function Store.set(store,key,value) end -- Check the store is valid - key = Store.validate(store,key,2) + key = Store.validate(store, key, 2) local old_value -- If there is a key being used then the store must be a able @@ -343,7 +343,7 @@ function Store.set(store,key,value) end -- Trigger any watchers - Store.raw_trigger(store,key,value,old_value) + Store.raw_trigger(store, key, value, old_value) end --[[-- Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them @@ -356,10 +356,10 @@ end local game_score = Store.register() -- Setting a default value -Store.set(game_score,0) +Store.set(game_score, 0) -- We now will update the game score by one, we return the value so that it is set as the new value in the store -Store.update(game_score,function(value) +Store.update(game_score, function(value) return value + 1 end) @@ -370,7 +370,7 @@ local player_data = Store.register(function(player) end) -- Setting a default value for your player, used to show the table structure -Store.set(player_data,game.player,{ +Store.set(player_data, game.player, { group = 'Admin', role = 'Owner', show_group_config = false @@ -378,12 +378,12 @@ Store.set(player_data,game.player,{ -- Updating the show_group_config key in your player data, note that it would be harder to call set every time -- We do not need to return anything in this case as we are not replacing all the data -Store.update(player_data,game.player,function(data) +Store.update(player_data, game.player, function(data) data.show_group_config = not data.show_group_config end) ]] -function Store.update(store,key,updater) +function Store.update(store, key, updater) -- Allow for key to be nil if updater == nil then updater = key @@ -391,7 +391,7 @@ function Store.update(store,key,updater) end -- Check the store is valid - key = Store.validate(store,key,2) + key = Store.validate(store, key, 2) local value, old_value -- If a key is used then the store must be a table @@ -420,7 +420,7 @@ function Store.update(store,key,updater) end -- Trigger any watchers - Store.raw_trigger(store,key,value,old_value) + Store.raw_trigger(store, key, value, old_value) end --[[-- Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present @@ -434,7 +434,7 @@ local player_data = Store.register(function(player) end) -- Setting a default value for your player, used to show the table structure -Store.set(player_data,game.player,{ +Store.set(player_data, game.player, { group = 'Admin', role = 'Owner', show_group_config = false @@ -443,13 +443,13 @@ Store.set(player_data,game.player,{ -- Updating the show_group_config key for all players, note that it would be harder to call set every time -- We do not need to return anything in this case as we are not replacing all the data -- We also have access to the current key being updated if needed -Store.map(player_data,function(data,key) +Store.map(player_data, function(data, key) data.show_group_config = not data.show_group_config end) ]] -function Store.map(store,updater) - Store.validate(store,nil,2) +function Store.map(store, updater) + Store.validate(store, nil, 2) -- Get all that data in the store and check its a table local data = data_store[store] @@ -458,12 +458,12 @@ function Store.map(store,updater) end -- Loop over all the keys and call the updater, setting value if returned, and calling watcher functions - for key,value in pairs(data) do - local rtn = updater(value,key) + for key, value in pairs(data) do + local rtn = updater(value, key) if rtn then data[key] = rtn end - Store.raw_trigger(store,key,data[key],value) + Store.raw_trigger(store, key, data[key], value) end end @@ -478,16 +478,16 @@ local scenario_diffculty = Store.register() Store.trigger(scenario_diffculty) ]] -function Store.trigger(store,key) - key = Store.validate(store,key,2) +function Store.trigger(store, key) + key = Store.validate(store, key, 2) -- Get the data from the data store local data = data_store[store] if key then data = data[key] - Store.raw_trigger(store,key,data,data) + Store.raw_trigger(store, key, data, data) else - Store.raw_trigger(store,key,data,data) + Store.raw_trigger(store, key, data, data) end end @@ -503,16 +503,16 @@ local scenario_diffculty = Store.register() -- Trigger the watchers with a fake change of diffculty -- This is mostly used internally but it can be useful in other cases -Store.raw_trigger(scenario_diffculty,nil,'normal','normal') +Store.raw_trigger(scenario_diffculty, nil, 'normal', 'normal') ]] -function Store.raw_trigger(store,key,value,old_value) - key = Store.validate(store,key,2) +function Store.raw_trigger(store, key, value, old_value) + key = Store.validate(store, key, 2) -- Get the watchers and then loop over them local watchers = Store.watchers[store] or {} - for _,watcher in pairs(watchers) do - local success, err = pcall(watcher,value,key,old_value) + for _, watcher in pairs(watchers) do + local success, err = pcall(watcher, value, key, old_value) if not success then error('Store watcher casued an error:\n\t'..err) end diff --git a/modules/addons/advanced-start.lua b/modules/addons/advanced-start.lua index 3e93c853..a6952b54 100644 --- a/modules/addons/advanced-start.lua +++ b/modules/addons/advanced-start.lua @@ -17,31 +17,31 @@ Event.add(defines.events.on_player_created, function(event) player.force.chart(player.surface, {{p.x-r, p.y-r}, {p.x+r, p.y+r}}) end -- spawn items - for item,callback in pairs(items) do + for item, callback in pairs(items) do if type(callback) == 'function' then local stats = player.force.item_production_statistics local made = stats.get_input_count(item) - local success,count = pcall(callback,made,stats.get_input_count,player) + local success, count = pcall(callback, made, stats.get_input_count, player) count = math.floor(count) if success and count > 0 then - player.insert{name=item,count=count} + player.insert{name=item, count=count} end end end end) Event.on_init(function() - remote.call('freeplay','set_created_items',{}) - remote.call('freeplay','set_chart_distance',0) - remote.call('freeplay','set_skip_intro',config.skip_intro) + remote.call('freeplay', 'set_created_items', {}) + remote.call('freeplay', 'set_chart_distance', 0) + remote.call('freeplay', 'set_skip_intro', config.skip_intro) if config.research_queue_from_start then - for _,force in pairs(game.forces) do + for _, force in pairs(game.forces) do force.research_queue_enabled = true end end if not config.disable_base_game_silo_script then if config.skip_victory then - remote.call('silo_script','set_no_victory',true) + remote.call('silo_script', 'set_no_victory', true) end end end) \ No newline at end of file diff --git a/modules/addons/chat-popups.lua b/modules/addons/chat-popups.lua index d27672a6..ab197e7d 100644 --- a/modules/addons/chat-popups.lua +++ b/modules/addons/chat-popups.lua @@ -8,7 +8,7 @@ local config = require 'config.popup_messages' --- @dep config.popup_messages local send_text = Game.print_player_floating_text -- (player_index, text, color) -Event.add(defines.events.on_console_chat,function(event) +Event.add(defines.events.on_console_chat, function(event) if not event.player_index or event.player_index < 1 then return end local player = Game.get_player_by_index(event.player_index) @@ -18,7 +18,7 @@ Event.add(defines.events.on_console_chat,function(event) -- Sends the message as text above them if config.show_player_messages then - send_text(player.index,{'chat-popup.message',player.name,event.message},player.chat_color) + send_text(player.index, {'chat-popup.message', player.name, event.message}, player.chat_color) end if not config.show_player_mentions then return end @@ -27,10 +27,10 @@ Event.add(defines.events.on_console_chat,function(event) local search_string = event.message:lower():gsub("%s+", "") -- Loops over online players to see if they name is included - for _,mentioned_player in pairs(game.connected_players) do + for _, mentioned_player in pairs(game.connected_players) do if mentioned_player.index ~= player.index then if search_string:match(mentioned_player.name:lower(), 1, true) then - send_text(mentioned_player.index,{'chat-popup.ping',player.name},player.chat_color) + send_text(mentioned_player.index, {'chat-popup.ping', player.name}, player.chat_color) end end end diff --git a/modules/addons/chat-reply.lua b/modules/addons/chat-reply.lua index a4685ef3..2d63cd70 100644 --- a/modules/addons/chat-reply.lua +++ b/modules/addons/chat-reply.lua @@ -6,17 +6,17 @@ local Game = require 'utils.game' --- @dep utils.game local Roles = require 'expcore.roles' --- @dep expcore.roles local config = require 'config.chat_reply' --- @dep config.chat_reply -Event.add(defines.events.on_console_chat,function(event) +Event.add(defines.events.on_console_chat, function(event) local player_index = event.player_index if not player_index or player_index < 1 then return end local player = Game.get_player_by_index(player_index) local message = event.message:lower():gsub("%s+", "") local allowed = true if config.command_admin_only and not player.admin then allowed = false end - if config.command_permission and not Roles.player_allowed(player,config.command_permission) then allowed = false end + if config.command_permission and not Roles.player_allowed(player, config.command_permission) then allowed = false end local prefix = config.command_prefix - for key_word,reply in pairs(config.messages) do + for key_word, reply in pairs(config.messages) do if message:find(key_word) then if type(reply) == 'function' then reply = reply(player) @@ -24,29 +24,29 @@ Event.add(defines.events.on_console_chat,function(event) if message:find(prefix..key_word) then if allowed then - game.print{'chat-bot.reply',reply} + game.print{'chat-bot.reply', reply} else player.print{'chat-bot.disallow'} end elseif not allowed then - player.print{'chat-bot.reply',reply} + player.print{'chat-bot.reply', reply} end end end if not allowed then return end - for key_word,reply in pairs(config.commands) do + for key_word, reply in pairs(config.commands) do if message:find(prefix..key_word) then if type(reply) == 'function' then reply = reply(player) if reply then - game.print{'chat-bot.reply',reply} + game.print{'chat-bot.reply', reply} end else - game.print{'chat-bot.reply',reply} + game.print{'chat-bot.reply', reply} end end diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index 0fe347b9..a987aff1 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -18,7 +18,7 @@ local Public = { Global.register({ compilatrons = Public.compilatrons, current_messages = Public.current_messages -},function(tbl) +}, function(tbl) Public.compilatrons = tbl.compilatrons Public.current_messages = tbl.current_messages end) @@ -42,7 +42,7 @@ local callback = local function circle_messages() for name, ent in pairs(Public.compilatrons) do if not ent.valid then - Public.spawn_compilatron(game.players[1].surface,name) + Public.spawn_compilatron(game.players[1].surface, name) end local current_message = Public.current_messages[name] local msg_number @@ -66,7 +66,7 @@ Event.on_nth_tick(config.message_cycle, circle_messages) --- This will add a compilatron to the global and start his message cycle -- @tparam LuaEntity entity the compilatron entity that moves around --- @tparam string name the name of the location that the complitron is at +-- @tparam string name the name of the location that the compilatron is at function Public.add_compilatron(entity, name) if not entity and not entity.valid then return @@ -85,19 +85,19 @@ end --- This spawns a new compilatron on a surface with the given location tag (not a position) -- @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) +function Public.spawn_compilatron(surface, location) local position = locations[location] local pos = surface.find_non_colliding_position('compilatron', position, 1.5, 0.5) - local compi = surface.create_entity {name='compilatron',position=pos,force=game.forces.neutral} - Public.add_compilatron(compi,location) + local compi = surface.create_entity {name='compilatron', position=pos, force=game.forces.neutral} + Public.add_compilatron(compi, location) end -- When the first player is created this will create all compilatrons that are resisted in the config -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end local player = Game.get_player_by_index(event.player_index) - for location,pos in pairs(locations) do - Public.spawn_compilatron(player.surface,location) + for location in pairs(locations) do + Public.spawn_compilatron(player.surface, location) end end) diff --git a/modules/addons/damage-popups.lua b/modules/addons/damage-popups.lua index 17016977..b6cb1662 100644 --- a/modules/addons/damage-popups.lua +++ b/modules/addons/damage-popups.lua @@ -12,21 +12,21 @@ Event.add(defines.events.on_entity_damaged, function(event) local damage = math.floor(event.original_damage_amount) local health = math.floor(entity.health) local health_percentage = entity.get_health_ratio() - local text_colour = {r=1-health_percentage,g=health_percentage,b=0} + local text_colour = {r=1-health_percentage, g=health_percentage, b=0} -- Gets the location of the text local size = entity.get_radius() if size < 1 then size = 1 end local r = (math.random()-0.5)*size*config.damage_location_variance local p = entity.position - local position = {x=p.x+r,y=p.y-size} + local position = {x=p.x+r, y=p.y-size} -- Sets the message local message if entity.name == 'character' and config.show_player_health then - message = {'damage-popup.player-health',health} + message = {'damage-popup.player-health', health} elseif entity.name ~= 'character' and cause and cause.name == 'character' and config.show_player_damage then - message = {'damage-popup.player-damage',damage} + message = {'damage-popup.player-damage', damage} end -- Outputs the message as floating text diff --git a/modules/addons/death-logger.lua b/modules/addons/death-logger.lua index 2e6d90d0..f3fc56f6 100644 --- a/modules/addons/death-logger.lua +++ b/modules/addons/death-logger.lua @@ -5,13 +5,13 @@ local Event = require 'utils.event' --- @dep utils.event local Game = require 'utils.game' --- @dep utils.game local Global = require 'utils.global' --- @dep utils.global local config = require 'config.death_logger' --- @dep config.death_logger -local format_time,move_items = _C.format_time, _C.move_items --- @dep expcore.common +local format_time, move_items = _C.format_time, _C.move_items --- @dep expcore.common local deaths = { archive={} -- deaths moved here after body is gone - --{player_name='Cooldude2606',time_of_death='15H 15M',position={x=0,y=0},corpse=LuaEntity,tag=LuaCustomChartTag} + --{player_name='Cooldude2606', time_of_death='15H 15M', position={x=0, y=0}, corpse=LuaEntity, tag=LuaCustomChartTag} } -Global.register(deaths,function(tbl) +Global.register(deaths, function(tbl) deaths = tbl end) @@ -20,10 +20,10 @@ local function create_map_tag(death) local player = Game.get_player_from_any(death.player_name) local message = player.name..' died' if config.include_time_of_death then - local time = format_time(death.time_of_death,{hours=true,minutes=true,string=true}) + local time = format_time(death.time_of_death, {hours=true, minutes=true, string=true}) message = message..' at '..time end - death.tag = player.force.add_chart_tag(player.surface,{ + death.tag = player.force.add_chart_tag(player.surface, { position=death.position, icon=config.map_icon, text=message @@ -33,7 +33,7 @@ end --- Checks that all map tags are present and valid -- adds missing ones, deletes expired ones local function check_map_tags() - for index,death in ipairs(deaths) do + for index, death in ipairs(deaths) do local map_tag = death.tag local corpse = death.corpse -- Check the corpse is valid @@ -51,19 +51,19 @@ local function check_map_tags() -- Move the death to the archive death.corpse = nil death.tag = nil - table.insert(deaths.archive,death) - table.remove(deaths,index) + table.insert(deaths.archive, death) + table.remove(deaths, index) end end end -- when a player dies a new death is added to the records and a map marker is made -Event.add(defines.events.on_player_died,function(event) +Event.add(defines.events.on_player_died, function(event) local player = Game.get_player_by_index(event.player_index) - local corpse = player.surface.find_entity('character-corpse',player.position) + local corpse = player.surface.find_entity('character-corpse', player.position) if config.use_chests_as_bodies then local items = corpse.get_inventory(defines.inventory.character_corpse).get_contents() - local chest = move_items(items,corpse.surface,corpse.position) + local chest = move_items(items, corpse.surface, corpse.position) chest.destructible = false corpse.destroy() corpse = chest @@ -77,22 +77,22 @@ Event.add(defines.events.on_player_died,function(event) if config.show_map_markers then create_map_tag(death) end - table.insert(deaths,death) + table.insert(deaths, death) end) -- every 5 min all bodies are checked for valid map tags if config.show_map_markers then local check_period = 60*60*5 -- five minutes - Event.on_nth_tick(check_period,function(event) + Event.on_nth_tick(check_period, function() check_map_tags() end) end if config.auto_collect_bodies then - Event.add(defines.events.on_character_corpse_expired,function(event) + Event.add(defines.events.on_character_corpse_expired, function(event) local corpse = event.corpse local items = corpse.get_inventory(defines.inventory.character_corpse).get_contents() - move_items(items,corpse.surface,{x=0,y=0}) + move_items(items, corpse.surface, {x=0, y=0}) end) end diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index a76c4a79..a62f81cb 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -4,7 +4,7 @@ local Event = require 'utils.event' --- @dep utils.event local Game = require 'utils.game' --- @dep utils.game local Colors = require 'utils.color_presets' --- @dep utils.color_presets -local write_json,format_time = _C.write_json, _C.format_time --- @dep expcore.common +local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common local config = require 'config.discord_alerts' --- @dep config.discord_alerts local function get_player_name(event) @@ -16,8 +16,8 @@ local function to_hex(color) local hex_digits = '0123456789ABCDEF' local function hex(bit) local major, minor = math.modf(bit/16) - major,minor = major+1,minor*16+1 - return hex_digits:sub(major,major)..hex_digits:sub(minor,minor) + major, minor = major+1, minor*16+1 + return hex_digits:sub(major, major)..hex_digits:sub(minor, minor) end return '0x'..hex(color.r)..hex(color.g)..hex(color.b) @@ -33,24 +33,24 @@ local function emit_event(args) end local tick = args.tick or 0 - local tick_formated = format_time(tick,{hours = true,minutes = true,string = true,long = true}) + local tick_formated = format_time(tick, {hours = true, minutes = true, string = true, long = true}) local players_online = 0 local admins_online = 0 - for _,player in pairs(game.connected_players) do + for _, player in pairs(game.connected_players) do players_online = players_online+1 if player.admin then admins_online = admins_online + 1 end end - local done = {title=true,color=true,description=true} + local done = {title=true, color=true, description=true} local fields = {{ name='Server Details', - value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s',players_online,admins_online,tick_formated) + value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s', players_online, admins_online, tick_formated) }} - for key,value in pairs(args) do + for key, value in pairs(args) do if not done[key] then done[key] = true local field = { @@ -59,17 +59,17 @@ local function emit_event(args) inline=false } - local new_value, inline = value:gsub('','',1) + local new_value, inline = value:gsub('', '', 1) if inline then field.value = new_value field.inline = true end - table.insert(fields,field) + table.insert(fields, field) end end - write_json('log/discord.log',{ + write_json('log/discord.log', { title=title, description=description, color=color, @@ -80,8 +80,8 @@ end --- Reports added and removed if config.player_reports then local Reports = require 'modules.control.reports' --- @dep modules.control.reports - Event.add(Reports.events.on_player_reported,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Reports.events.on_player_reported, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Report', description='A player was reported', @@ -91,7 +91,7 @@ if config.player_reports then ['Reason:']=event.reason } end) - Event.add(Reports.events.on_report_removed,function(event) + Event.add(Reports.events.on_report_removed, function(event) local player_name = get_player_name(event) emit_event{ title='Report Removed', @@ -106,8 +106,8 @@ end --- Warnings added and removed if config.player_warnings then local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings - Event.add(Warnings.events.on_warning_added,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Warnings.events.on_warning_added, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Warning', description='A player has been given a warning', @@ -117,8 +117,8 @@ if config.player_warnings then ['Reason:']=event.reason } end) - Event.add(Warnings.events.on_warning_removed,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Warnings.events.on_warning_removed, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Warning Removed', description='A player has a warning removed', @@ -132,8 +132,8 @@ end --- When a player is jailed or unjailed if config.player_jail then local Jail = require 'modules.control.jail' - Event.add(Jail.events.on_player_jailed,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Jail.events.on_player_jailed, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Jail', description='A player has been jailed', @@ -143,8 +143,8 @@ if config.player_jail then ['Reason:']=event.reason } end) - Event.add(Jail.events.on_player_unjailed,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Jail.events.on_player_unjailed, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Unjail', description='A player has been unjailed', @@ -158,8 +158,8 @@ end --- When a player is tempbanned if config.player_temp_ban then local Jail = require 'modules.control.jail' - Event.add(Jail.events.on_player_temp_banned,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Jail.events.on_player_temp_banned, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Temp Ban', description='A player has been temp banned', @@ -169,8 +169,8 @@ if config.player_temp_ban then ['Reason:']=event.reason } end) - Event.add(Jail.events.on_player_untemp_banned,function(event) - local player_name,by_player_name = get_player_name(event) + Event.add(Jail.events.on_player_untemp_banned, function(event) + local player_name, by_player_name = get_player_name(event) emit_event{ title='Temp Ban Removed', description='A player has been untemp banned', @@ -183,7 +183,7 @@ end --- Ban and unban if config.player_bans then - Event.add(defines.events.on_player_banned,function(event) + Event.add(defines.events.on_player_banned, function(event) if event.by_player then local by_player = Game.get_player_by_index(event.by_player) emit_event{ @@ -196,7 +196,7 @@ if config.player_bans then } end end) - Event.add(defines.events.on_player_unbanned,function(event) + Event.add(defines.events.on_player_unbanned, function(event) if event.by_player then local by_player = Game.get_player_by_index(event.by_player) emit_event{ @@ -212,7 +212,7 @@ end --- Mute and unmute if config.player_mutes then - Event.add(defines.events.on_player_muted,function(event) + Event.add(defines.events.on_player_muted, function(event) local player_name = get_player_name(event) emit_event{ title='Muted', @@ -221,7 +221,7 @@ if config.player_mutes then ['Player:']=''..player_name } end) - Event.add(defines.events.on_player_unmuted,function(event) + Event.add(defines.events.on_player_unmuted, function(event) local player_name = get_player_name(event) emit_event{ title='Un-Muted', @@ -234,7 +234,7 @@ end --- Kick if config.player_kicks then - Event.add(defines.events.on_player_kicked,function(event) + Event.add(defines.events.on_player_kicked, function(event) if event.by_player then local player_name = get_player_name(event) local by_player = Game.get_player_by_index(event.by_player) @@ -252,7 +252,7 @@ end --- Promote and demote if config.player_promotes then - Event.add(defines.events.on_player_promoted,function(event) + Event.add(defines.events.on_player_promoted, function(event) local player_name = get_player_name(event) emit_event{ title='Promote', @@ -261,7 +261,7 @@ if config.player_promotes then ['Player:']=''..player_name } end) - Event.add(defines.events.on_player_demoted,function(event) + Event.add(defines.events.on_player_demoted, function(event) local player_name = get_player_name(event) emit_event{ title='Demote', @@ -273,12 +273,12 @@ if config.player_promotes then end --- Other commands -Event.add(defines.events.on_console_command,function(event) +Event.add(defines.events.on_console_command, function(event) if event.player_index then local player_name = get_player_name(event) if config[event.command] then emit_event{ - title=event.command:gsub('^%l',string.upper), + title=event.command:gsub('^%l', string.upper), description='/'..event.command..' was used', color=Colors.grey, ['By:']=''..player_name, diff --git a/modules/addons/greetings.lua b/modules/addons/greetings.lua index 4541f42e..093cf1b5 100644 --- a/modules/addons/greetings.lua +++ b/modules/addons/greetings.lua @@ -7,7 +7,7 @@ local config = require 'config.join_messages' --- @dep config.join_messages local Global = require 'utils.global' --- @dep utils.global require 'overrides.table' -Global.register(config,function(tbl) +Global.register(config, function(tbl) config = tbl end) @@ -16,9 +16,9 @@ function(event) local player = Game.get_player_by_index(event.player_index) local custom_message = config[player.name] if custom_message then - game.print(custom_message,player.color) + game.print(custom_message, player.color) else - player.print{'greetings.greet',{'links.discord'}} + player.print{'greetings.greet', {'links.discord'}} end end diff --git a/modules/addons/pollution-grading.lua b/modules/addons/pollution-grading.lua index dd4b0914..872cd758 100644 --- a/modules/addons/pollution-grading.lua +++ b/modules/addons/pollution-grading.lua @@ -5,7 +5,7 @@ local Event = require 'utils.event' --- @dep utils.event local config = require 'config.pollution_grading' --- @dep config.pollution_grading local delay = config.update_delay * 3600 -- convert from minutes to ticks -Event.on_nth_tick(delay,function() +Event.on_nth_tick(delay, function() local surface = game.surfaces[1] local true_max = surface.get_pollution(config.reference_point) local max = true_max*config.max_scalar diff --git a/modules/addons/random-player-colours.lua b/modules/addons/random-player-colours.lua index 30526f20..17b95ddb 100644 --- a/modules/addons/random-player-colours.lua +++ b/modules/addons/random-player-colours.lua @@ -8,22 +8,22 @@ local config = require 'config.preset_player_colours' --- @dep config.preset_pla local Global = require 'utils.global' --- @dep utils.global require 'overrides.table' -Global.register(config,function(tbl) +Global.register(config, function(tbl) config = tbl end) -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) local player = Game.get_player_by_index(event.player_index) local color = 'white' if config.players[player.name] then color = config.players[player.name] else while config.disallow[color] do - color = table.get_random_dictionary_entry(Colours,true) + color = table.get_random_dictionary_entry(Colours, true) end color = Colours[color] end - color = {r=color.r/255,g=color.g/255,b=color.b/255,a=0.5} + color = {r=color.r/255, g=color.g/255, b=color.b/255, a=0.5} player.color = color player.chat_color = color end) \ No newline at end of file diff --git a/modules/addons/scorched-earth.lua b/modules/addons/scorched-earth.lua index c6c822c5..6e342f54 100644 --- a/modules/addons/scorched-earth.lua +++ b/modules/addons/scorched-earth.lua @@ -9,7 +9,7 @@ local config = require 'config.scorched_earth' --- @dep config.scorched_earth -- Loops over the config and finds the wile which has the highest value for strength local max_strength = 0 -for _,strength in pairs(config.strengths) do +for _, strength in pairs(config.strengths) do if strength > max_strength then max_strength = strength end @@ -22,12 +22,12 @@ Global.register(debug_players, function(tbl) end) -- Will degrade a tile down to the next tile when called -local function degrade(surface,position) +local function degrade(surface, position) local tile = surface.get_tile(position) local tile_name = tile.name local degrade_tile_name = config.degrade_order[tile_name] if not degrade_tile_name then return end - surface.set_tiles{{name=degrade_tile_name,position=position}} + surface.set_tiles{{name=degrade_tile_name, position=position}} end -- Same as degrade but will degrade all tiles that are under an entity @@ -42,12 +42,12 @@ local function degrade_entity(entity) for x = lt.x, rb.x do -- x loop local px = position.x+x for y = lt.y, rb.y do -- y loop - local p = {x=px,y=position.y+y} + local p = {x=px, y=position.y+y} local tile = surface.get_tile(p) local tile_name = tile.name local degrade_tile_name = config.degrade_order[tile_name] if not degrade_tile_name then return end - table.insert(tiles,{name=degrade_tile_name,position=p}) + table.insert(tiles, {name=degrade_tile_name, position=p}) end end surface.set_tiles(tiles) @@ -62,15 +62,15 @@ local function get_probability(strength) end -- Gets the mean of the strengths around a tile to give the strength at that position -local function get_tile_strength(surface,position) +local function get_tile_strength(surface, position) local tile = surface.get_tile(position) local tile_name = tile.name local strength = config.strengths[tile_name] if not strength then return end - for x = -1,1 do -- x loop + for x = -1, 1 do -- x loop local px = position.x + x - for y = -1,1 do -- y loop - local check_tile = surface.get_tile{x=px,y=position.y+y} + for y = -1, 1 do -- y loop + local check_tile = surface.get_tile{x=px, y=position.y+y} local check_tile_name = check_tile.name local check_strength = config.strengths[check_tile_name] or 0 strength = strength + check_strength @@ -80,12 +80,12 @@ local function get_tile_strength(surface,position) end -- Same as get_tile_strength but returns to a in game text rather than as a value -local function debug_get_tile_strength(surface,position) - for x = -3,3 do -- x loop +local function debug_get_tile_strength(surface, position) + for x = -3, 3 do -- x loop local px = position.x+x - for y = -3,3 do -- y loop - local p = {x=px,y=position.y+y} - local strength = get_tile_strength(surface,p) or 0 + for y = -3, 3 do -- y loop + local p = {x=px, y=position.y+y} + local strength = get_tile_strength(surface, p) or 0 local tile = surface.get_tile(p) print_grid_value(get_probability(strength)*config.weakness_value, surface, tile.position) end @@ -97,13 +97,13 @@ Event.add(defines.events.on_player_changed_position, function(event) local player = Game.get_player_by_index(event.player_index) local surface = player.surface local position = player.position - local strength = get_tile_strength(surface,position) + local strength = get_tile_strength(surface, position) if not strength then return end if get_probability(strength) > math.random() then - degrade(surface,position) + degrade(surface, position) end if debug_players[player.name] then - debug_get_tile_strength(surface,position) + debug_get_tile_strength(surface, position) end end) @@ -112,7 +112,7 @@ Event.add(defines.events.on_built_entity, function(event) local entity = event.created_entity local surface = entity.surface local position = entity.position - local strength = get_tile_strength(surface,position) + local strength = get_tile_strength(surface, position) if not strength then return end if get_probability(strength)*config.weakness_value > math.random() then degrade_entity(entity) @@ -124,7 +124,7 @@ Event.add(defines.events.on_robot_built_entity, function(event) local entity = event.created_entity local surface = entity.surface local position = entity.position - local strength = get_tile_strength(surface,position) + local strength = get_tile_strength(surface, position) if not strength then return end if get_probability(strength)*config.weakness_value > math.random() then degrade_entity(entity) @@ -132,7 +132,7 @@ Event.add(defines.events.on_robot_built_entity, function(event) end) -- Used as a way to access the global table -return function(player_name,state) +return function(player_name, state) local player = Game.get_player_from_any(player_name) clear_flying_text(player.surface) debug_players[player_name] = state diff --git a/modules/addons/spawn-area.lua b/modules/addons/spawn-area.lua index dcdbb5f0..dfff3f1b 100644 --- a/modules/addons/spawn-area.lua +++ b/modules/addons/spawn-area.lua @@ -10,7 +10,7 @@ local entities = config.entities local belts = config.afk_belts.locations local turrets = config.infinite_ammo_turrets.locations -Global.register(turrets,function(tbl) +Global.register(turrets, function(tbl) turrets = tbl end) @@ -19,13 +19,13 @@ local function get_spawn_force() local force = game.forces['Spawn'] if force and force.valid then return force end force = game.create_force('Spawn') - force.set_cease_fire('player',true) - game.forces['player'].set_cease_fire('Spawn',true) + force.set_cease_fire('player', true) + game.forces['player'].set_cease_fire('Spawn', true) return force end -- protects and entity so players cant do anything to it -local function protect_entity(entity,set_force) +local function protect_entity(entity, set_force) if entity and entity.valid then entity.destructible = false entity.minable = false @@ -39,40 +39,40 @@ end -- handles the infinite ammo turrets local function spawn_turrets() if config.infinite_ammo_turrets.enabled then - for _,turret_pos in pairs(turrets) do + for _, turret_pos in pairs(turrets) do local surface = game.surfaces[turret_pos.surface] local pos = turret_pos.position - local turret = surface.find_entity('gun-turret',pos) + local turret = surface.find_entity('gun-turret', pos) -- Makes a new turret if it is not found if not turret or not turret.valid then - turret = surface.create_entity{name='gun-turret',position=pos,force='Spawn'} - protect_entity(turret,true) + turret = surface.create_entity{name='gun-turret', position=pos, force='Spawn'} + protect_entity(turret, true) end -- adds ammo to the turret local inv = turret.get_inventory(defines.inventory.turret_ammo) - if inv.can_insert{name=config.infinite_ammo_turrets.ammo_type,count=10} then - inv.insert{name=config.infinite_ammo_turrets.ammo_type,count=10} + if inv.can_insert{name=config.infinite_ammo_turrets.ammo_type, count=10} then + inv.insert{name=config.infinite_ammo_turrets.ammo_type, count=10} end end end end -- makes a 2x2 afk belt where set in config -local function spawn_belts(surface,position) - local belt_details = {{-0.5,-0.5,2},{0.5,-0.5,4},{-0.5,0.5,0},{0.5,0.5,6}} -- x,y,dir - for _,belt_set in pairs(belts) do +local function spawn_belts(surface, position) + local belt_details = {{-0.5, -0.5, 2}, {0.5, -0.5, 4}, {-0.5, 0.5, 0}, {0.5, 0.5, 6}} -- x, y,dir + for _, belt_set in pairs(belts) do local o = position local p = belt_set - for _,belt in pairs(belt_details) do - local pos = {x=o.x+p.x+belt[1],y=o.y+p.y+belt[2]} - local belt_entity = surface.create_entity{name='transport-belt',position=pos,force='neutral',direction=belt[3]} + for _, belt in pairs(belt_details) do + local pos = {x=o.x+p.x+belt[1], y=o.y+p.y+belt[2]} + local belt_entity = surface.create_entity{name='transport-belt', position=pos, force='neutral', direction=belt[3]} protect_entity(belt_entity) end end end -- generates an area with no water and removes entities in the decon area -local function spawn_base(surface,position) +local function spawn_base(surface, position) local dr = config.corrections.deconstruction_radius local dr2 = dr^2 local dtile = config.corrections.deconstruction_tile @@ -86,17 +86,17 @@ local function spawn_base(surface,position) for y = -pr, pr do -- loop over y local y2 = y^2 local prod = x2+y2 - local p = {x=position.x+x,y=position.y+y} + local p = {x=position.x+x, y=position.y+y} if prod < dr2 then -- if it is inside the decon radius - table.insert(tiles_to_make,{name=dtile,position=p}) - local entities_to_remove = surface.find_entities_filtered{area={{p.x-1,p.y-1},{p.x,p.y}}} - for _,entity in pairs(entities_to_remove) do + table.insert(tiles_to_make, {name=dtile, position=p}) + local entities_to_remove = surface.find_entities_filtered{area={{p.x-1, p.y-1}, {p.x, p.y}}} + for _, entity in pairs(entities_to_remove) do if entity.name ~= 'character' then entity.destroy() end end elseif prod < pr2 then -- if it is inside the pattern radius - table.insert(tiles_to_make,{name=ptile,position=p}) + table.insert(tiles_to_make, {name=ptile, position=p}) end end end @@ -104,30 +104,30 @@ local function spawn_base(surface,position) end -- generates the pattern that is in the config -local function spawn_pattern(surface,position) +local function spawn_pattern(surface, position) local tiles_to_make = {} local ptile = config.corrections.pattern_tile local o = config.corrections.offset - local p = {x=position.x+o.x,y=position.y+o.y} - for _,tile in pairs(tiles) do - table.insert(tiles_to_make,{name=ptile,position={tile[1]+p.x,tile[2]+p.y}}) + local p = {x=position.x+o.x, y=position.y+o.y} + for _, tile in pairs(tiles) do + table.insert(tiles_to_make, {name=ptile, position={tile[1]+p.x, tile[2]+p.y}}) end surface.set_tiles(tiles_to_make) end -- generates the entities that are in the config -local function spawn_entities(surface,position) +local function spawn_entities(surface, position) local o = config.corrections.offset - local p = {x=position.x+o.x,y=position.y+o.y} - for _,entity in pairs(entities) do - entity = surface.create_entity{name=entity[1],position={entity[2]+p.x,entity[3]+p.y},force='neutral'} + local p = {x=position.x+o.x, y=position.y+o.y} + for _, entity in pairs(entities) do + entity = surface.create_entity{name=entity[1], position={entity[2]+p.x, entity[3]+p.y}, force='neutral'} protect_entity(entity) entity.operable = true end end local refill_time = 60*60*5 -- 5 minutes -Event.on_nth_tick(refill_time,function() +Event.on_nth_tick(refill_time, function() if game.tick < 10 then return end spawn_turrets() end) @@ -135,15 +135,15 @@ end) Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end local player = Game.get_player_by_index(event.player_index) - local p = {x=0,y=0} + local p = {x=0, y=0} local s = player.surface - spawn_base(s,p) - spawn_pattern(s,p) + spawn_base(s, p) + spawn_pattern(s, p) get_spawn_force() - spawn_entities(s,p) - spawn_belts(s,p) + spawn_entities(s, p) + spawn_belts(s, p) spawn_turrets() - player.teleport(p,s) + player.teleport(p, s) end) -- Way to access global table diff --git a/modules/addons/station-auto-name.lua b/modules/addons/station-auto-name.lua index 2710890e..6b3d28e5 100644 --- a/modules/addons/station-auto-name.lua +++ b/modules/addons/station-auto-name.lua @@ -1,54 +1,7 @@ ---LuaPlayerBuiltEntityEventFilters ---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}}) local Event = require 'utils.event' --- @dep utils.event -local station_name_changer = -function(event) - local enetety = event.created_entity - local name = enetety.name - if name == "train-stop" then --only do the event if its a trainstop - local boundingbox = enetety.bounding_box - -- expanded box for recourse search: - local bounding2 = { {boundingbox.left_top.x -100 ,boundingbox.left_top.y -100} , {boundingbox.right_bottom.x +100,boundingbox.right_bottom.y +100 } } - --gets all resources in bounding_box2: - local recoursec = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"} - - if #recoursec > 0 then -- save cpu time if their are no recourses in bounding_box2 - local closest_distance - local px,py = boundingbox.left_top.x,boundingbox.left_top.y - local recourse_closed - - --Check which recource is closest - for i, item in ipairs(recoursec) do - local dx, dy = px - item.bounding_box.left_top.x, py - item.bounding_box.left_top.y - local distance = (dx*dx)+(dy*dy) - if not closest_distance or distance < closest_distance then - recourse_closed = item - closest_distance = distance - end - - end - - - local item_name = recourse_closed.name - if item_name then -- prevent errors if something went wrong - local item_name2 = item_name:gsub("^%l", string.upper):gsub('-',' ') -- removing the - and making first letter capital - - local Item_ore_fluid = "item" - if item_name == "crude-oil" then - Item_ore_fluid = "fluid" - end - --Final string: - enetety.backer_name = string.format("[L] [img=%s.%s] %s %s (%s)",Item_ore_fluid,item_name,item_name2,enetety.backer_name,Angle( enetety )) - end - end - end -end ---add func to robot and player build entities -Event.add(defines.events.on_built_entity,station_name_changer) -Event.add(defines.events.on_robot_built_entity,station_name_changer) - - --Credit to Cooldude2606 for using his lua magic to make this function. local directions = { ['W'] = -0.875, @@ -60,12 +13,58 @@ local directions = { ['S'] = 0.625, ['SW'] = 0.875 } -function Angle( enetety ) - local angle = math.atan2(enetety.position.y,enetety.position.x)/math.pi - for direction, requiredAngle in pairs(directions) do - if angle < requiredAngle then - return direction - end - end + +local function Angle(entity) + local angle = math.atan2(entity.position.y, entity.position.x)/math.pi + for direction, requiredAngle in pairs(directions) do + if angle < requiredAngle then + return direction + end + end end - \ No newline at end of file + +local function station_name_changer(event) + local entity = event.created_entity + local name = entity.name + + if name == "train-stop" then --only do the event if its a train stop + local boundingBox = entity.bounding_box + -- expanded box for recourse search: + local bounding2 = { {boundingBox.left_top.x -100 ,boundingBox.left_top.y -100} , {boundingBox.right_bottom.x +100, boundingBox.right_bottom.y +100 } } + -- gets all resources in bounding_box2: + local recourses = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"} + + if #recourses > 0 then -- save cpu time if their are no recourses in bounding_box2 + local closest_distance + local px, py = boundingBox.left_top.x, boundingBox.left_top.y + local recourse_closed + + --Check which recourse is closest + for i, item in ipairs(recourses) do + local dx, dy = px - item.bounding_box.left_top.x, py - item.bounding_box.left_top.y + local distance = (dx*dx)+(dy*dy) + if not closest_distance or distance < closest_distance then + recourse_closed = item + closest_distance = distance + end + + end + + local item_name = recourse_closed.name + if item_name then -- prevent errors if something went wrong + local item_name2 = item_name:gsub("^%l", string.upper):gsub('-', ' ') -- removing the - and making first letter capital + + local Item_ore_fluid = "item" + if item_name == "crude-oil" then + Item_ore_fluid = "fluid" + end + --Final string: + entity.backer_name = string.format("[L] [img=%s.%s] %s %s (%s)", Item_ore_fluid, item_name, item_name2, entity.backer_name, Angle( entity )) + end + end + end +end + +-- Add handler to robot and player build entities +Event.add(defines.events.on_built_entity, station_name_changer) +Event.add(defines.events.on_robot_built_entity, station_name_changer) diff --git a/modules/addons/tree-decon.lua b/modules/addons/tree-decon.lua index 75f5738b..57f44fe3 100644 --- a/modules/addons/tree-decon.lua +++ b/modules/addons/tree-decon.lua @@ -57,7 +57,7 @@ Event.add(defines.events.on_tick, function() local max_remove = math.floor(head/100)+1 local remove_count = math.random(0, max_remove) while remove_count > 0 and head > 0 do - local remove_index = math.random(1,head) + local remove_index = math.random(1, head) local entity = tree_queue[remove_index] tree_queue[remove_index] = tree_queue[head] head = head - 1 @@ -71,7 +71,7 @@ end) -- Clear the chache Event.on_nth_tick(300, function() - for key,_ in pairs(chache) do + for key, _ in pairs(chache) do chache[key] = nil end end) \ No newline at end of file diff --git a/modules/commands/admin-chat.lua b/modules/commands/admin-chat.lua index 19aae6cb..f42f1e8b 100644 --- a/modules/commands/admin-chat.lua +++ b/modules/commands/admin-chat.lua @@ -10,16 +10,16 @@ require 'config.expcore.command_general_parse' --- Sends a message in chat that only admins can see -- @command admin-chat -- @tparam string message the message to send in the admin chat -Commands.new_command('admin-chat','Sends a message in chat that only admins can see.') -:add_param('message',false) +Commands.new_command('admin-chat', 'Sends a message in chat that only admins can see.') +:add_param('message', false) :enable_auto_concat() :set_flag('admin_only') :add_alias('ac') -:register(function(player,message,raw) +:register(function(player, message) local player_name_colour = format_chat_player_name(player) - for _,return_player in pairs(game.connected_players) do + for _, return_player in pairs(game.connected_players) do if return_player.admin then - return_player.print{'expcom-admin-chat.format',player_name_colour,message} + return_player.print{'expcom-admin-chat.format', player_name_colour, message} end end return Commands.success -- prevents command complete message from showing diff --git a/modules/commands/bonus.lua b/modules/commands/bonus.lua index b39fc1f1..28327eaa 100644 --- a/modules/commands/bonus.lua +++ b/modules/commands/bonus.lua @@ -17,9 +17,9 @@ local bonus_store = Store.register(function(player) end) -- Apply a bonus amount to a player -local function apply_bonus(player,amount) +local function apply_bonus(player, amount) if not amount then return end - for bonus,min_max in pairs(config) do + for bonus, min_max in pairs(config) do local increase = min_max[2]*amount player[bonus] = min_max[1]+increase end @@ -28,32 +28,32 @@ end --- Changes the amount of bonus you receive -- @command bonus -- @tparam number amount range 0-50 the percent increase for your bonus -Commands.new_command('bonus','Changes the amount of bonus you receive') -:add_param('amount','integer-range',0,50) -:register(function(player,amount) +Commands.new_command('bonus', 'Changes the amount of bonus you receive') +:add_param('amount', 'integer-range', 0,50) +:register(function(player, amount) local percent = amount/100 - Store.set(bonus_store,player,percent) - Commands.print{'expcom-bonus.set',amount} - Commands.print({'expcom-bonus.wip'},'orange') + Store.set(bonus_store, player, percent) + Commands.print{'expcom-bonus.set', amount} + Commands.print({'expcom-bonus.wip'}, 'orange') end) -- When store is updated apply new bonus to the player -Store.watch(bonus_store,function(value,category) +Store.watch(bonus_store, function(value, category) local player = Game.get_player_from_any(category) - apply_bonus(player,value) + apply_bonus(player, value) end) -- When a player respawns re-apply bonus -Event.add(defines.events.on_player_respawned,function(event) +Event.add(defines.events.on_player_respawned, function(event) local player = Game.get_player_by_index(event.player_index) - local value = Store.get(bonus_store,player) - apply_bonus(player,value) + local value = Store.get(bonus_store, player) + apply_bonus(player, value) end) -- When a player dies allow them to have instant respawn -Event.add(defines.events.on_player_died,function(event) +Event.add(defines.events.on_player_died, function(event) local player = Game.get_player_by_index(event.player_index) - if Roles.player_has_flag(player,'instance-respawn') then + if Roles.player_has_flag(player, 'instance-respawn') then player.ticks_to_respawn = 120 end end) @@ -61,12 +61,12 @@ end) -- Remove bonus if a player no longer has access to the command local function role_update(event) local player = Game.get_player_by_index(event.player_index) - if not Roles.player_allowed(player,'command/bonus') then - Store.clear(bonus_store,player) + if not Roles.player_allowed(player, 'command/bonus') then + Store.clear(bonus_store, player) end end -Event.add(Roles.events.on_role_assigned,role_update) -Event.add(Roles.events.on_role_unassigned,role_update) +Event.add(Roles.events.on_role_assigned, role_update) +Event.add(Roles.events.on_role_unassigned, role_update) return bonus_store \ No newline at end of file diff --git a/modules/commands/cheat-mode.lua b/modules/commands/cheat-mode.lua index c2eb462a..b0214579 100644 --- a/modules/commands/cheat-mode.lua +++ b/modules/commands/cheat-mode.lua @@ -9,12 +9,12 @@ require 'config.expcore.command_general_parse' --- Toggles cheat mode for your player, or another player. -- @command toggle-cheat-mode -- @tparam[opt=self] LuaPlayer player player to toggle chest mode of, can be nil for self -Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.') -:add_param('player',true,'player') +Commands.new_command('toggle-cheat-mode', 'Toggles cheat mode for your player, or another player.') +:add_param('player', true, 'player') :set_defaults{player=function(player) return player -- default is the user using the command end} :set_flag('admin_only') -:register(function(player,action_player,raw) - action_player.cheat_mode = not action_player.cheat_mode +:register(function(_, player) + player.cheat_mode = not player.cheat_mode end) \ No newline at end of file diff --git a/modules/commands/clear-inventory.lua b/modules/commands/clear-inventory.lua index e684fb5e..806badeb 100644 --- a/modules/commands/clear-inventory.lua +++ b/modules/commands/clear-inventory.lua @@ -10,11 +10,11 @@ require 'config.expcore.command_role_parse' --- Clears a players inventory -- @command clear-inventory -- @tparam LuaPlayer player the player to clear the inventory of -Commands.new_command('clear-inventory','Clears a players inventory') -:add_param('player',false,'player-role-alive') -:add_alias('clear-inv','move-inventory','move-inv') -:register(function(player,action_player) - local inv = action_player.get_main_inventory() +Commands.new_command('clear-inventory', 'Clears a players inventory') +:add_param('player', false, 'player-role-alive') +:add_alias('clear-inv', 'move-inventory', 'move-inv') +:register(function(_, player) + local inv = player.get_main_inventory() move_items(inv.get_contents()) inv.clear() end) \ No newline at end of file diff --git a/modules/commands/debug.lua b/modules/commands/debug.lua index e29786a6..649bf6d5 100644 --- a/modules/commands/debug.lua +++ b/modules/commands/debug.lua @@ -8,7 +8,7 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands --- Opens the debug pannel for viewing tables. -- @command debug -Commands.new_command('debug','Opens the debug pannel for viewing tables.') +Commands.new_command('debug', 'Opens the debug pannel for viewing tables.') :register(function(player) DebugView.open_dubug(player) end) \ No newline at end of file diff --git a/modules/commands/find.lua b/modules/commands/find.lua index 58ab5530..13639fef 100644 --- a/modules/commands/find.lua +++ b/modules/commands/find.lua @@ -9,11 +9,11 @@ require 'config.expcore.command_general_parse' --- Find a player on your map. -- @command find-on-map -- @tparam LuaPlayer the player to find on the map -Commands.new_command('find-on-map','Find a player on your map.') -:add_param('player',false,'player-online') -:add_alias('find','zoom-to') -:register(function(player,action_player,raw) +Commands.new_command('find-on-map', 'Find a player on your map.') +:add_param('player', false, 'player-online') +:add_alias('find', 'zoom-to') +:register(function(player, action_player) local position = action_player.position - player.zoom_to_world(position,1.75) + player.zoom_to_world(position, 1.75) return Commands.success -- prevents command complete message from showing end) \ No newline at end of file diff --git a/modules/commands/help.lua b/modules/commands/help.lua index af43910d..6bb31c93 100644 --- a/modules/commands/help.lua +++ b/modules/commands/help.lua @@ -10,7 +10,7 @@ require 'config.expcore.command_general_parse' local results_per_page = 5 local search_cache = {} -Global.register(search_cache,function(tbl) +Global.register(search_cache, function(tbl) search_cache = tbl end) @@ -18,12 +18,12 @@ end) -- @command chelp -- @tparam string keyword the keyword that will be looked for -- @tparam number page the page of help to view, must be in range of pages -Commands.new_command('search-help','Searches for a keyword in all commands you are allowed to use.') -:add_alias('chelp','shelp','commands') -:add_param('keyword',true) -:add_param('page',true,'integer') -:set_defaults{keyword='',page=1} -:register(function(player,keyword,page,raw) +Commands.new_command('search-help', 'Searches for a keyword in all commands you are allowed to use.') +:add_alias('chelp', 'shelp', 'commands') +:add_param('keyword', true) +:add_param('page', true, 'integer') +:set_defaults{keyword='', page=1} +:register(function(player, keyword, page) local player_index = player and player.index or 0 -- if keyword is a number then treat it as page number if tonumber(keyword) then @@ -40,20 +40,20 @@ Commands.new_command('search-help','Searches for a keyword in all commands you a pages = {{}} local current_page = 1 local page_count = 0 - local commands = Commands.search(keyword,player) + local commands = Commands.search(keyword, player) -- loops other all commands returned by search, includes game commands - for _,command_data in pairs(commands) do + for _, command_data in pairs(commands) do -- if the number of results if greater than the number already added then it moves onto a new page if page_count >= results_per_page then page_count = 0 current_page = current_page + 1 - table.insert(pages,{}) + table.insert(pages, {}) end -- adds the new command to the page page_count = page_count + 1 found = found + 1 - local alias_format = #command_data.aliases > 0 and {'expcom-chelp.alias',table.concat(command_data.aliases,', ')} or '' - table.insert(pages[current_page],{ + local alias_format = #command_data.aliases > 0 and {'expcom-chelp.alias', table.concat(command_data.aliases, ', ')} or '' + table.insert(pages[current_page], { 'expcom-chelp.format', command_data.name, command_data.description, @@ -70,15 +70,15 @@ Commands.new_command('search-help','Searches for a keyword in all commands you a end -- print the requested page keyword = keyword == '' and '' or keyword - Commands.print({'expcom-chelp.title',keyword},'cyan') + Commands.print({'expcom-chelp.title', keyword}, 'cyan') if pages[page] then - for _,command in pairs(pages[page]) do + for _, command in pairs(pages[page]) do Commands.print(command) end - Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan') + Commands.print({'expcom-chelp.footer', found, page, #pages}, 'cyan') else - Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan') - return Commands.error{'expcom-chelp.out-of-range',page} + Commands.print({'expcom-chelp.footer', found, page, #pages}, 'cyan') + return Commands.error{'expcom-chelp.out-of-range', page} end -- blocks command complete message return Commands.success diff --git a/modules/commands/home.lua b/modules/commands/home.lua index c6ce9078..851141d9 100644 --- a/modules/commands/home.lua +++ b/modules/commands/home.lua @@ -8,16 +8,16 @@ local Global = require 'utils.global' --- @dep utils.global require 'config.expcore.command_general_parse' local homes = {} -Global.register(homes,function(tbl) +Global.register(homes, function(tbl) homes = tbl end) -local function teleport(player,position) +local function teleport(player, position) local surface = player.surface - local pos = surface.find_non_colliding_position('character',position,32,1) + local pos = surface.find_non_colliding_position('character', position, 32, 1) if not position then return false end if player.driving then player.driving = false end -- kicks a player out a vehicle if in one - player.teleport(pos,surface) + player.teleport(pos, surface) return true end @@ -30,22 +30,22 @@ end --- Teleports you to your home location -- @command home -Commands.new_command('home','Teleports you to your home location') -:register(function(player,raw) +Commands.new_command('home', 'Teleports you to your home location') +:register(function(player) local home = homes[player.index] if not home or not home[1] then return Commands.error{'expcom-home.no-home'} end local rtn = floor_pos(player.position) - teleport(player,home[1]) + teleport(player, home[1]) home[2] = rtn - Commands.print{'expcom-home.return-set',rtn.x,rtn.y} + Commands.print{'expcom-home.return-set', rtn.x, rtn.y} end) --- Sets your home location to your current position -- @command home-set -Commands.new_command('home-set','Sets your home location to your current position') -:register(function(player,raw) +Commands.new_command('home-set', 'Sets your home location to your current position') +:register(function(player) local home = homes[player.index] if not home then home = {} @@ -53,31 +53,31 @@ Commands.new_command('home-set','Sets your home location to your current positio end local pos = floor_pos(player.position) home[1] = pos - Commands.print{'expcom-home.home-set',pos.x,pos.y} + Commands.print{'expcom-home.home-set', pos.x, pos.y} end) --- Returns your current home location -- @command home-get -Commands.new_command('home-get','Returns your current home location') -:register(function(player,raw) +Commands.new_command('home-get', 'Returns your current home location') +:register(function(player) local home = homes[player.index] if not home or not home[1] then return Commands.error{'expcom-home.no-home'} end local pos = home[1] - Commands.print{'expcom-home.home-get',pos.x,pos.y} + Commands.print{'expcom-home.home-get', pos.x, pos.y} end) --- Teleports you to previous location -- @command return -Commands.new_command('return','Teleports you to previous location') -:register(function(player,raw) +Commands.new_command('return', 'Teleports you to previous location') +:register(function(player) local home = homes[player.index] if not home or not home[2] then return Commands.error{'expcom-home.no-return'} end local rtn = floor_pos(player.position) - teleport(player,home[2]) + teleport(player, home[2]) home[2] = rtn - Commands.print{'expcom-home.return-set',rtn.x,rtn.y} + Commands.print{'expcom-home.return-set', rtn.x, rtn.y} end) \ No newline at end of file diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index a826d286..69fd0a63 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -21,7 +21,7 @@ local interface_modules = { } -- loads all the modules given in the above table -for key,value in pairs(interface_modules) do +for key, value in pairs(interface_modules) do if type(value) == 'string' then interface_modules[key] = Common.opt_require(value) end @@ -29,7 +29,7 @@ end local interface_env = {} -- used as a persistent sandbox for interface commands local interface_callbacks = {} -- saves callbacks which can load new values per use -Global.register(interface_env,function(tbl) +Global.register(interface_env, function(tbl) interface_env = tbl end) @@ -38,14 +38,14 @@ end) -- @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) +local function add_interface_callback(name, callback) if type(callback) == 'function' then interface_callbacks[name] = callback end end -- this is a meta function for __index when self[key] is nil -local function get_index(self,key) +local function get_index(_, key) if interface_env[key] then return interface_env[key] elseif interface_modules[key] then @@ -56,36 +56,36 @@ end --- Sends an innovation to be ran and returns the result. -- @command interface -- @tparam string innovation the command that will be run -Commands.new_command('interface','Sends an innovation to be ran and returns the result.') -:add_param('innovation',false) +Commands.new_command('interface', 'Sends an innovation to be ran and returns the result.') +:add_param('innovation', false) :enable_auto_concat() :set_flag('admin_only') -:register(function(player,innovation,raw) +:register(function(player, innovation) if not innovation:find('%s') and not innovation:find('return') then -- if there are no spaces and return is not present then return is appended to the start innovation='return '..innovation end -- temp_env will index to interface_env and interface_modules if value not found - local temp_env = setmetatable({},{__index=get_index}) + local temp_env = setmetatable({}, {__index=get_index}) if player then -- player can be nil when it is the server - for name,callback in pairs(interface_callbacks) do + for name, callback in pairs(interface_callbacks) do -- loops over callbacks and loads the values returned - local success, rtn = pcall(callback,player) + local _, rtn = pcall(callback, player) temp_env[name]=rtn end end -- sets the global metatable to prevent new values being made - -- global will index to temp_env and new indexs saved to interface_sandbox + -- global will index to temp_env and new indexes saved to interface_sandbox local old_mt = getmetatable(_G) - setmetatable(_G,{__index=temp_env,__newindex=interface_env}) + setmetatable(_G, {__index=temp_env, __newindex=interface_env}) -- runs the innovation and returns values to the player innovation = loadstring(innovation) local success, rtn = pcall(innovation) - setmetatable(_G,old_mt) + setmetatable(_G, old_mt) if not success then if type(rtn) == 'string' then -- there may be stack trace that must be removed to avoid desyncs - rtn = rtn:gsub('%.%.%..-/temp/currently%-playing','') + rtn = rtn:gsub('%.%.%..-/temp/currently%-playing', '') end return Commands.error(rtn) else @@ -94,16 +94,16 @@ Commands.new_command('interface','Sends an innovation to be ran and returns the end) -- adds some basic callbacks for the interface -add_interface_callback('player',function(player) return player end) -add_interface_callback('surface',function(player) return player.surface end) -add_interface_callback('force',function(player) return player.force end) -add_interface_callback('position',function(player) return player.position end) -add_interface_callback('entity',function(player) return player.selected end) -add_interface_callback('tile',function(player) return player.surface.get_tile(player.position) end) +add_interface_callback('player', function(player) return player end) +add_interface_callback('surface', function(player) return player.surface end) +add_interface_callback('force', function(player) return player.force end) +add_interface_callback('position', function(player) return player.position end) +add_interface_callback('entity', function(player) return player.selected end) +add_interface_callback('tile', function(player) return player.surface.get_tile(player.position) end) return { add_interface_callback=add_interface_callback, interface_env=interface_env, interface_callbacks=interface_callbacks, - clean_stack_trace=function(str) return str:gsub('%.%.%..-/temp/currently%-playing','') end + clean_stack_trace=function(str) return str:gsub('%.%.%..-/temp/currently%-playing', '') end } \ No newline at end of file diff --git a/modules/commands/jail.lua b/modules/commands/jail.lua index 59e12500..98941616 100644 --- a/modules/commands/jail.lua +++ b/modules/commands/jail.lua @@ -12,37 +12,37 @@ require 'config.expcore.command_role_parse' -- @command jail -- @tparam LuaPlayer player the player that will be jailed -- @tparam[opt] string reason the reason why the player is being jailed -Commands.new_command('jail','Puts a player into jail and removes all other roles.') -:add_param('player',false,'player-role') -:add_param('reason',true) +Commands.new_command('jail', 'Puts a player into jail and removes all other roles.') +:add_param('player', false, 'player-role') +:add_param('reason', true) :enable_auto_concat() -:register(function(player,action_player,reason,raw) +:register(function(player, action_player, reason) reason = reason or 'Non Given.' local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) local player_name = player and player.name or '' if Jail.jail_player(action_player, player_name, reason) then - game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason} + game.print{'expcom-jail.give', action_player_name_color, by_player_name_color, reason} else - return Commands.error{'expcom-jail.already-jailed',action_player_name_color} + return Commands.error{'expcom-jail.already-jailed', action_player_name_color} end end) --- Removes a player from jail. -- @command unjail -- @tparam LuaPlayer the player that will be unjailed -Commands.new_command('unjail','Removes a player from jail.') -:add_param('player',false,'player-role') -:add_alias('clear-jail','remove-jail') +Commands.new_command('unjail', 'Removes a player from jail.') +:add_param('player', false, 'player-role') +:add_alias('clear-jail', 'remove-jail') :enable_auto_concat() -:register(function(player,action_player,raw) +:register(function(player, action_player) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) local player_name = player and player.name or '' if Jail.unjail_player(action_player, player_name) then - game.print{'expcom-jail.remove',action_player_name_color,by_player_name_color} + game.print{'expcom-jail.remove', action_player_name_color, by_player_name_color} else - return Commands.error{'expcom-jail.not-jailed',action_player_name_color} + return Commands.error{'expcom-jail.not-jailed', action_player_name_color} end end) @@ -50,33 +50,33 @@ end) -- @command temp-ban -- @tparam LuaPlayer player the player that will be temp banned -- @tparam string reason the reason that the player is being temp banned -Commands.new_command('temp-ban','Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.') -:add_param('player',false,'player-role') -:add_param('reason',false) +Commands.new_command('temp-ban', 'Temp bans a player until the next reset; this requires a reason; this will clear the players inventory.') +:add_param('player', false, 'player-role') +:add_param('reason', false) :enable_auto_concat() -:register(function(player,action_player,reason,raw) +:register(function(player, action_player, reason) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if Jail.temp_ban_player(action_player,player.name,reason) then - game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason} + if Jail.temp_ban_player(action_player, player.name, reason) then + game.print{'expcom-jail.temp-ban', action_player_name_color, by_player_name_color, reason} else - return Commands.error{'expcom-jail.already-banned',action_player_name_color} + return Commands.error{'expcom-jail.already-banned', action_player_name_color} end end) --- Removes temp ban from a player; this will not restore their items. -- @command clear-temp-ban -- @tparam LuaPlayer player the player to revoke the temp ban from -Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will not restore their items.') -:add_param('player',false,'player-role') -:add_alias('untemp-ban','remove-temp-ban') +Commands.new_command('clear-temp-ban', 'Removes temp ban from a player; this will not restore their items.') +:add_param('player', false, 'player-role') +:add_alias('untemp-ban', 'remove-temp-ban') :enable_auto_concat() -:register(function(player,action_player,raw) +:register(function(player, action_player) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if Jail.untemp_ban_player(action_player,player.name) then - game.print{'expcom-jail.temp-ban-clear',action_player_name_color,by_player_name_color} + if Jail.untemp_ban_player(action_player, player.name) then + game.print{'expcom-jail.temp-ban-clear', action_player_name_color, by_player_name_color} else - return Commands.error{'expcom-jail.not-temp-banned',action_player_name_color} + return Commands.error{'expcom-jail.not-temp-banned', action_player_name_color} end end) diff --git a/modules/commands/kill.lua b/modules/commands/kill.lua index 3fea3e9a..dad370b1 100644 --- a/modules/commands/kill.lua +++ b/modules/commands/kill.lua @@ -11,22 +11,22 @@ require 'config.expcore.command_role_parse' --- Kills yourself or another player. -- @command kill -- @tparam[opt=self] LuaPlayer player the player to kill, must be alive to be valid -Commands.new_command('kill','Kills yourself or another player.') -:add_param('player',true,'player-role-alive') +Commands.new_command('kill', 'Kills yourself or another player.') +:add_param('player', true, 'player-role-alive') :set_defaults{player=function(player) -- default is the player unless they are dead if player.character and player.character.health > 0 then return player end end} -:register(function(player,action_player,raw) +:register(function(player, action_player) if not action_player then -- can only be nil if no player given and the user is dead return Commands.error{'expcom-kill.already-dead'} end if player == action_player then action_player.character.die() - elseif Roles.player_allowed(player,'command/kill/always') then + elseif Roles.player_allowed(player, 'command/kill/always') then action_player.character.die() else return Commands.error{'expcore-commands.unauthorized'} diff --git a/modules/commands/me.lua b/modules/commands/me.lua index 9e6364e8..d13a71c9 100644 --- a/modules/commands/me.lua +++ b/modules/commands/me.lua @@ -8,10 +8,10 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands --- Sends an action message in the chat -- @command me -- @tparam string action the action that follows your name in chat -Commands.new_command('me','Sends an action message in the chat') -:add_param('action',false) +Commands.new_command('me', 'Sends an action message in the chat') +:add_param('action', false) :enable_auto_concat() -:register(function(player,action,raw) +:register(function(player, action) local player_name = player and player.name or '' - game.print(string.format('* %s %s *',player_name,action),player.chat_color) + game.print(string.format('* %s %s *', player_name, action), player.chat_color) end) \ No newline at end of file diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua index f03a4efc..c297ddfe 100644 --- a/modules/commands/quickbar.lua +++ b/modules/commands/quickbar.lua @@ -4,14 +4,11 @@ ]] local Commands = require 'expcore.commands' --- @dep expcore.commands -local Roles = require 'expcore.roles' --- @dep expcore.roles -local Game = require 'utils.game' --- @dep utils.game local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar - --- Loads your quickbar preset -- @command load-quickbar -Commands.new_command('load-quickbar','Loads your preset Quickbar items') +Commands.new_command('load-quickbar', 'Loads your preset Quickbar items') :add_alias('load-toolbar') :register(function(player) if config[player.name] then @@ -28,7 +25,7 @@ end) --- Saves your quickbar preset to the script-output folder -- @command save-quickbar -Commands.new_command('save-quickbar','Saves your Quickbar preset items to file') +Commands.new_command('save-quickbar', 'Saves your Quickbar preset items to file') :add_alias('save-toolbar') :register(function(player) local quickbar_names = {} diff --git a/modules/commands/rainbow.lua b/modules/commands/rainbow.lua index 350e0ae6..58fa8836 100644 --- a/modules/commands/rainbow.lua +++ b/modules/commands/rainbow.lua @@ -6,27 +6,27 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands local format_chat_colour = _C.format_chat_colour --- @dep expcore.common -local function step_component(c1,c2) +local function step_component(c1, c2) if c1 < 0 then - return 0,c2+c1 + return 0, c2+c1 elseif c1 > 1 then - return 1,c2-c1+1 + return 1, c2-c1+1 else - return c1,c2 + return c1, c2 end end local function step_color(color) - color.r,color.g = step_component(color.r,color.g) - color.g,color.b = step_component(color.g,color.b) - color.b,color.r = step_component(color.b,color.r) - color.r = step_component(color.r,0) + color.r, color.g = step_component(color.r, color.g) + color.g, color.b = step_component(color.g, color.b) + color.b, color.r = step_component(color.b, color.r) + color.r = step_component(color.r, 0) return color end -local function next_color(color,step) +local function next_color(color, step) step = step or 0.1 - local new_color = {r=0,g=0,b=0} + local new_color = {r=0, g=0, b=0} if color.b == 0 and color.r ~= 0 then new_color.r = color.r-step new_color.g = color.g+step @@ -43,19 +43,19 @@ end --- Sends an rainbow message in the chat -- @command rainbow -- @tparam string message the message that will be printed in chat -Commands.new_command('rainbow','Sends an rainbow message in the chat') -:add_param('message',false) +Commands.new_command('rainbow', 'Sends an rainbow message in the chat') +:add_param('message', false) :enable_auto_concat() -:register(function(player,message,raw) +:register(function(player, message) local player_name = player and player.name or '' local player_color = player and player.color or nil local color_step = 3/message:len() if color_step > 1 then color_step = 1 end - local current_color = {r=1,g=0,b=0} - local output = format_chat_colour(player_name..': ',player_color) - output = output..message:gsub('%S',function(letter) - local rtn = format_chat_colour(letter,current_color) - current_color = next_color(current_color,color_step) + local current_color = {r=1, g=0, b=0} + local output = format_chat_colour(player_name..': ', player_color) + output = output..message:gsub('%S', function(letter) + local rtn = format_chat_colour(letter, current_color) + current_color = next_color(current_color, color_step) return rtn end) game.print(output) diff --git a/modules/commands/ratio.lua b/modules/commands/ratio.lua index dcdcb116..51737d0e 100644 --- a/modules/commands/ratio.lua +++ b/modules/commands/ratio.lua @@ -2,33 +2,46 @@ local Commands = require 'expcore.commands' +local function Modules(moduleInventory) -- returns the multiplier of the modules + local effect1 = moduleInventory.get_item_count("productivity-module") -- type 1 + local effect2 = moduleInventory.get_item_count("productivity-module-2")-- type 2 + local effect3 = moduleInventory.get_item_count("productivity-module-3") -- type 3 -Commands.new_command('ratio','This command will give the input and ouput ratios of the selected machine. Use the parameter for calcualting the machines needed for that amount of items per second.') - :add_param('itemsPerSecond',true,'number') - :register(function(player,itemsPerSecond,raw) - + local multi = effect1*4+effect2*6+effect3*10 + return multi/100+1 +end + +local function AmountOfMachines(itemsPerSecond, output) + if(itemsPerSecond) then + return itemsPerSecond/output + end +end + +Commands.new_command('ratio', 'This command will give the input and output ratios of the selected machine. Use the parameter for calculating the machines needed for that amount of items per second.') + :add_param('itemsPerSecond', true, 'number') + :register(function(player, itemsPerSecond) local machine = player.selected -- selected machine if not machine then --nil check return Commands.error{'expcom-ratio.notSelecting'} end - + if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then return Commands.error{'expcom-ratio.notSelecting'} end - local recpie = machine.get_recipe() -- recpie + local recipe = machine.get_recipe() -- recipe - if not recpie then --nil check + if not recipe then --nil check return Commands.error{'expcom-ratio.notSelecting'} end - local items = recpie.ingredients -- items in that recpie - local product = recpie.products -- output items + local items = recipe.ingredients -- items in that recipe + local products = recipe.products -- output items local amountOfMachines - local moduleInvetory = machine.get_module_inventory()--the module Invetory of the machine - local mult = Modules(moduleInvetory) --function for the productivety moduals + local moduleInventory = machine.get_module_inventory()--the module Inventory of the machine + local multi = Modules(moduleInventory) --function for the productively modals if itemsPerSecond then - amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond,1/recpie.energy*machine.crafting_speed*product[1].amount*mult)) -- amount of machines + amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond, 1/recipe.energy*machine.crafting_speed*products[1].amount*multi)) -- amount of machines end if not amountOfMachines then amountOfMachines = 1 --set to 1 to make it not nil @@ -42,14 +55,13 @@ Commands.new_command('ratio','This command will give the input and ouput ratios else sprite = 'expcom-ratio.fluid-in' end - - - local ips = item.amount/recpie.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second - Commands.print {sprite,math.round(ips,3),item.name}-- full string + + local ips = item.amount/recipe.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second + Commands.print {sprite, math.round(ips, 3), item.name}-- full string end ----------------------------products---------------------------- - - for i, product in ipairs(product) do + + for i, product in ipairs(products) do local sprite -- string to make the icon work either fluid ore item if product.type == "item" then @@ -58,28 +70,13 @@ Commands.new_command('ratio','This command will give the input and ouput ratios sprite = 'expcom-ratio.fluid-out' end - local output = 1/recpie.energy*machine.crafting_speed*product.amount*mult --math on the outputs per second - Commands.print {sprite,math.round(output*amountOfMachines,3),product.name} -- full string + local output = 1/recipe.energy*machine.crafting_speed*product.amount*multi --math on the outputs per second + Commands.print {sprite, math.round(output*amountOfMachines, 3), product.name} -- full string end if amountOfMachines ~= 1 then - Commands.print{'expcom-ratio.machines',amountOfMachines} + Commands.print{'expcom-ratio.machines', amountOfMachines} end - end) -function Modules(moduleInvetory) -- returns the multeplier of the modules - local effect1 = moduleInvetory.get_item_count("productivity-module") -- type 1 - local effect2 = moduleInvetory.get_item_count("productivity-module-2")-- type 2 - local effect3 = moduleInvetory.get_item_count("productivity-module-3") -- type 3 - - local mult = effect1*4+effect2*6+effect3*10 - return mult/100+1 -end - -function AmountOfMachines(itemsPerSecond,output) - if(itemsPerSecond) then - return itemsPerSecond/output - - end -end + end) \ No newline at end of file diff --git a/modules/commands/repair.lua b/modules/commands/repair.lua index f7ff434c..c8814f3d 100644 --- a/modules/commands/repair.lua +++ b/modules/commands/repair.lua @@ -11,18 +11,18 @@ local max_time_to_live = 4294967295 -- unit32 max --- Repairs entities on your force around you -- @command repair -- @tparam number range the range to repair stuff in, there is a max limit to this -Commands.new_command('repair','Repairs entities on your force around you') -:add_param('range',false,'integer-range',1,config.max_range) -:register(function(player,range,raw) +Commands.new_command('repair', 'Repairs entities on your force around you') +:add_param('range', false, 'integer-range', 1,config.max_range) +:register(function(player, range) local revive_count = 0 local heal_count = 0 local range2 = range^2 local surface = player.surface local center = player.position - local area = {{x=center.x-range,y=center.y-range},{x=center.x+range,y=center.y+range}} + local area = {{x=center.x-range, y=center.y-range}, {x=center.x+range, y=center.y+range}} if config.allow_ghost_revive then - local ghosts = surface.find_entities_filtered({area=area,type='entity-ghost',force=player.force}) - for _,ghost in pairs(ghosts) do + local ghosts = surface.find_entities_filtered({area=area, type='entity-ghost', force=player.force}) + for _, ghost in pairs(ghosts) do if ghost.valid then local x = ghost.position.x-center.x local y = ghost.position.y-center.y @@ -36,8 +36,8 @@ Commands.new_command('repair','Repairs entities on your force around you') end end if config.allow_heal_entities then - local entities = surface.find_entities_filtered({area=area,force=player.force}) - for _,entity in pairs(entities) do + local entities = surface.find_entities_filtered({area=area, force=player.force}) + for _, entity in pairs(entities) do if entity.valid then local x = entity.position.x-center.x local y = entity.position.y-center.y @@ -48,5 +48,5 @@ Commands.new_command('repair','Repairs entities on your force around you') end end end - return Commands.success{'expcom-repair.result',revive_count,heal_count} + return Commands.success{'expcom-repair.result', revive_count, heal_count} end) \ No newline at end of file diff --git a/modules/commands/reports.lua b/modules/commands/reports.lua index 93ab6008..00aff1b2 100644 --- a/modules/commands/reports.lua +++ b/modules/commands/reports.lua @@ -13,25 +13,25 @@ require 'config.expcore.command_general_parse' -- @command report -- @tparam LuaPlayer player the player to report, some players are immune -- @tparam string reason the reason the player is being reported -Commands.new_command('report','Reports a player and notifies moderators') -:add_param('player',false,function(input,player,reject) - input = Commands.parse('player',input,player,reject) +Commands.new_command('report', 'Reports a player and notifies moderators') +:add_param('player', false, function(input, player, reject) + input = Commands.parse('player', input, player, reject) if not input then return end - if Roles.player_has_flag(input,'report-immune') then + if Roles.player_has_flag(input, 'report-immune') then return reject{'expcom-report.player-immune'} else return input end end) -:add_param('reason',false) +:add_param('reason', false) :add_alias('report-player') :enable_auto_concat() -:register(function(player,action_player,reason,raw) +:register(function(player, action_player, reason) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - if Reports.report_player(action_player,player.name,reason) then - game.print{'expcom-report.non-admin',action_player_name_color,reason} - Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason}) + if Reports.report_player(action_player, player.name, reason) then + game.print{'expcom-report.non-admin', action_player_name_color, reason} + Roles.print_to_roles_higher('Trainee', {'expcom-report.admin', action_player_name_color, by_player_name_color, reason}) else return Commands.error{'expcom-report.already-reported'} end @@ -40,25 +40,25 @@ end) --- Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them. -- @command get-reports -- @tparam LuaPlayer player the player to get the report for -Commands.new_command('get-reports','Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.') -:add_param('player',true,'player') -:add_alias('reports','list-reports') -:register(function(player,action_player,raw) - if action_player then - local reports = Reports.get_reports(action_player) - local action_player_name_color = format_chat_player_name(action_player) - Commands.print{'expcom-report.player-report-title',action_player_name_color} - for player_name,reason in pairs(reports) do +Commands.new_command('get-reports', 'Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.') +:add_param('player', true, 'player') +:add_alias('reports', 'list-reports') +:register(function(_, player) + if player then + local reports = Reports.get_reports(player) + local player_name_color = format_chat_player_name(player) + Commands.print{'expcom-report.player-report-title', player_name_color} + for player_name, reason in pairs(reports) do local by_player_name_color = format_chat_player_name(player_name) - Commands.print{'expcom-report.list',by_player_name_color,reason} + Commands.print{'expcom-report.list', by_player_name_color, reason} end else local user_reports = Reports.user_reports Commands.print{'expcom-report.player-count-title'} - for player_name,reports in pairs(user_reports) do + for player_name in pairs(user_reports) do local player_name_color = format_chat_player_name(player_name) local report_count = Reports.count_reports(player_name) - Commands.print{'expcom-report.list',player_name_color,report_count} + Commands.print{'expcom-report.list', player_name_color, report_count} end end end) @@ -67,20 +67,20 @@ end) -- @command clear-reports -- @tparam LuaPlayer player the player to clear the report(s) from -- @tparam[opt=all] LuaPlayer from-player remove only the report made by this player -Commands.new_command('clear-reports','Clears all reports from a player or just the report from one player.') -:add_param('player',false,'player') -:add_param('from-player',true,'player') -:register(function(player,action_player,from_player,raw) +Commands.new_command('clear-reports', 'Clears all reports from a player or just the report from one player.') +:add_param('player', false, 'player') +:add_param('from-player', true, 'player') +:register(function(player, action_player, from_player) if from_player then - if not Reports.remove_report(action_player,from_player.name,player.name) then + if not Reports.remove_report(action_player, from_player.name, player.name) then return Commands.error{'expcom-report.not-reported'} end else - if not Reports.remove_all(action_player,player.name) then + if not Reports.remove_all(action_player, player.name) then return Commands.error{'expcom-report.not-reported'} end end local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-report.removed',action_player_name_color,by_player_name_color} + game.print{'expcom-report.removed', action_player_name_color, by_player_name_color} end) \ No newline at end of file diff --git a/modules/commands/roles.lua b/modules/commands/roles.lua index 1005b322..20bd93d4 100644 --- a/modules/commands/roles.lua +++ b/modules/commands/roles.lua @@ -12,15 +12,15 @@ local format_chat_player_name, format_chat_colour_localized = _C.format_chat_pla -- @command assign-role -- @tparam LuaPlayer player the player to assign the role to -- @tparam string role the name of the role to assign to the player, supports auto complete after enter -Commands.new_command('assign-role','Assigns a role to a player') -:add_param('player',false,'player-role') -:add_param('role',false,'role') +Commands.new_command('assign-role', 'Assigns a role to a player') +:add_param('player', false, 'player-role') +:add_param('role', false, 'role') :set_flag('admin-only') -:add_alias('rpromote','assign','role','add-role') -:register(function(player,action_player,role,raw) +:add_alias('rpromote', 'assign', 'role', 'add-role') +:register(function(player, action_player, role) local player_highest = Roles.get_player_highest_role(player) if player_highest.index < role.index then - Roles.assign_player(action_player,role,player.name) + Roles.assign_player(action_player, role, player.name) else return Commands.error{'expcom-roles.higher-role'} end @@ -30,15 +30,15 @@ end) -- @command unassign-role -- @tparam LuaPlayer player the player to unassign the role from -- @tparam string role the name of the role to unassign from the player, supports auto complete after enter -Commands.new_command('unassign-role','Unassigns a role from a player') -:add_param('player',false,'player-role') -:add_param('role',false,'role') +Commands.new_command('unassign-role', 'Unassigns a role from a player') +:add_param('player', false, 'player-role') +:add_param('role', false, 'role') :set_flag('admin-only') -:add_alias('rdemote','unassign','rerole','remove-role') -:register(function(player,action_player,role,raw) +:add_alias('rdemote', 'unassign', 'rerole', 'remove-role') +:register(function(player, action_player, role) local player_highest = Roles.get_player_highest_role(player) if player_highest.index < role.index then - Roles.unassign_player(action_player,role,player.name) + Roles.unassign_player(action_player, role, player.name) else return Commands.error{'expcom-roles.higher-role'} end @@ -47,27 +47,27 @@ end) --- Lists all roles in they correct order -- @command list-roles -- @tparam[opt=all] LuaPlayer player list only the roles which this player has -Commands.new_command('list-roles','Lists all roles in they correct order') -:add_param('player',true,'player') -:add_alias('lsroles','roles') -:register(function(player,action_player,raw) +Commands.new_command('list-roles', 'Lists all roles in they correct order') +:add_param('player', true, 'player') +:add_alias('lsroles', 'roles') +:register(function(_, player) local roles = Roles.config.order local message = {'expcom-roles.list'} - if action_player then - roles = Roles.get_player_roles(action_player) + if player then + roles = Roles.get_player_roles(player) end - for index,role in pairs(roles) do + for index, role in pairs(roles) do role = Roles.get_role_from_any(role) local colour = role.custom_color or Colours.white - local role_name = format_chat_colour_localized(role.name,colour) + local role_name = format_chat_colour_localized(role.name, colour) if index == 1 then - message = {'expcom-roles.list',role_name} - if action_player then - local player_name_colour = format_chat_player_name(action_player) - message = {'expcom-roles.list-player',player_name_colour,role_name} + message = {'expcom-roles.list', role_name} + if player then + local player_name_colour = format_chat_player_name(player) + message = {'expcom-roles.list-player', player_name_colour, role_name} end else - message = {'expcom-roles.list-element',message,role_name} + message = {'expcom-roles.list-element', message, role_name} end end return Commands.success(message) diff --git a/modules/commands/spawn.lua b/modules/commands/spawn.lua index 0e8e7df7..bc718ea3 100644 --- a/modules/commands/spawn.lua +++ b/modules/commands/spawn.lua @@ -9,18 +9,18 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles local function teleport(player) local surface = player.surface local spawn = player.force.get_spawn_position(surface) - local position = surface.find_non_colliding_position('character',spawn,32,1) + local position = surface.find_non_colliding_position('character', spawn, 32, 1) if not position then return false end if player.driving then player.driving = false end -- kicks a player out a vehicle if in one - player.teleport(position,surface) + player.teleport(position, surface) return true end --- Teleport to spawn -- @command go-to-spawn -- @tparam[opt=self] LuaPlayer player the player to teleport to their spawn point -Commands.new_command('go-to-spawn','Teleport to spawn') -:add_param('player',true,'player-role-alive') +Commands.new_command('go-to-spawn', 'Teleport to spawn') +:add_param('player', true, 'player-role-alive') :set_defaults{ player=function(player) if player.connected and player.character and player.character.health > 0 then @@ -28,15 +28,15 @@ Commands.new_command('go-to-spawn','Teleport to spawn') end end } -:add_alias('spawn','tp-spawn') -:register(function(player,action_player) - if not action_player then +:add_alias('spawn', 'tp-spawn') +:register(function(player, action_player) + if not action_player then return Commands.error{'expcom-spawn.unavailable'} elseif action_player == player then if not teleport(player) then return Commands.error{'expcom-spawn.unavailable'} end - elseif Roles.player_allowed(player,'command/go-to-spawn/always') then + elseif Roles.player_allowed(player, 'command/go-to-spawn/always') then if not teleport(action_player) then return Commands.error{'expcom-spawn.unavailable'} end diff --git a/modules/commands/tag.lua b/modules/commands/tag.lua index a0400cf2..7b256f9c 100644 --- a/modules/commands/tag.lua +++ b/modules/commands/tag.lua @@ -11,26 +11,26 @@ require 'config.expcore.command_role_parse' --- Sets your player tag. -- @command tag -- @tparam string tag the tag that will be after the name, there is a max length -Commands.new_command('tag','Sets your player tag.') -:add_param('tag',false,'string-max-length',20) +Commands.new_command('tag', 'Sets your player tag.') +:add_param('tag', false, 'string-max-length', 20) :enable_auto_concat() -:register(function(player,tag,raw) +:register(function(player, tag) player.tag = '- '..tag end) --- Clears your tag. Or another player if you are admin. -- @command tag-clear -- @tparam[opt=self] LuaPlayer player the player to remove the tag from, nil will apply to self -Commands.new_command('tag-clear','Clears your tag. Or another player if you are admin.') -:add_param('player',true,'player-role') +Commands.new_command('tag-clear', 'Clears your tag. Or another player if you are admin.') +:add_param('player', true, 'player-role') :set_defaults{player=function(player) return player -- default is the user using the command end} -:register(function(player,action_player,raw) +:register(function(player, action_player) if action_player.index == player.index then -- no player given so removes your tag action_player.tag = '' - elseif Roles.player_allowed(player,'command/clear-tag/always') then + elseif Roles.player_allowed(player, 'command/clear-tag/always') then -- player given and user is admin so clears that player's tag action_player.tag = '' else diff --git a/modules/commands/teleport.lua b/modules/commands/teleport.lua index 5e8ea3b4..fb6fbb68 100644 --- a/modules/commands/teleport.lua +++ b/modules/commands/teleport.lua @@ -6,12 +6,12 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore.command_general_parse' -local function teleport(from_player,to_player) +local function teleport(from_player, to_player) local surface = to_player.surface - local position = surface.find_non_colliding_position('character',to_player.position,32,1) + local position = surface.find_non_colliding_position('character', to_player.position, 32, 1) if not position then return false end -- return false if no new position if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one - from_player.teleport(position,surface) + from_player.teleport(position, surface) return true end @@ -19,17 +19,17 @@ end -- @command teleport -- @tparam LuaPlayer from_player the player that will be teleported, must be alive -- @tparam LuaPlayer to_player the player to teleport to, must be online (if dead goes to where they died) -Commands.new_command('teleport','Teleports a player to another player.') -:add_param('from_player',false,'player-alive') -:add_param('to_player',false,'player-online') +Commands.new_command('teleport', 'Teleports a player to another player.') +:add_param('from_player', false, 'player-alive') +:add_param('to_player', false, 'player-online') :add_alias('tp') :set_flag('admin_only') -:register(function(player,from_player,to_player,raw) +:register(function(_, from_player, to_player) if from_player.index == to_player.index then -- return if attempting to teleport to self return Commands.error{'expcom-tp.to-self'} end - if not teleport(from_player,to_player) then + if not teleport(from_player, to_player) then -- return if the teleport failed return Commands.error{'expcom-tp.no-position-found'} end @@ -38,15 +38,15 @@ end) --- Teleports a player to you. -- @command bring -- @tparam LuaPlayer player the player that will be teleported, must be alive -Commands.new_command('bring','Teleports a player to you.') -:add_param('player',false,'player-alive') +Commands.new_command('bring', 'Teleports a player to you.') +:add_param('player', false, 'player-alive') :set_flag('admin_only') -:register(function(player,from_player,raw) +:register(function(player, from_player) if from_player.index == player.index then -- return if attempting to teleport to self return Commands.error{'expcom-tp.to-self'} end - if not teleport(from_player,player) then + if not teleport(from_player, player) then -- return if the teleport failed return Commands.error{'expcom-tp.no-position-found'} end @@ -55,16 +55,16 @@ end) --- Teleports you to a player. -- @command goto -- @tparam LuaPlayer player the player to teleport to, must be online (if dead goes to where they died) -Commands.new_command('goto','Teleports you to a player.') -:add_param('player',false,'player-online') -:add_alias('tp-me','tpme') +Commands.new_command('goto', 'Teleports you to a player.') +:add_param('player', false, 'player-online') +:add_alias('tp-me', 'tpme') :set_flag('admin_only') -:register(function(player,to_player,raw) +:register(function(player, to_player) if to_player.index == player.index then -- return if attempting to teleport to self return Commands.error{'expcom-tp.to-self'} end - if not teleport(player,to_player) then + if not teleport(player, to_player) then -- return if the teleport failed return Commands.error{'expcom-tp.no-position-found'} end diff --git a/modules/commands/warnings.lua b/modules/commands/warnings.lua index 42f7b868..888c4709 100644 --- a/modules/commands/warnings.lua +++ b/modules/commands/warnings.lua @@ -13,47 +13,47 @@ require 'config.expcore.command_role_parse' -- @command give-warning -- @tparam LuaPlayer player the player the will recive a warning -- @tparam string reason the reason the player is being given a warning -Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.') -:add_param('player',false,'player-role') -:add_param('reason',false) +Commands.new_command('give-warning', 'Gives a warning to a player; may lead to automatic script action.') +:add_param('player', false, 'player-role') +:add_param('reason', false) :add_alias('warn') :enable_auto_concat() -:register(function(player,action_player,reason,raw) - Warnings.add_warning(action_player,player.name,reason) +:register(function(player, action_player, reason) + Warnings.add_warning(action_player, player.name, reason) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason} + game.print{'expcom-warnings.received', action_player_name_color, by_player_name_color, reason} end) --- Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have. -- @command get-warnings -- @tparam[opt=list] LuaPlayer player the player to get the warning for, if nil all players are listed -Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.') -:add_param('player',true,'player') -:add_alias('warnings','list-warnings') -:register(function(player,action_player,raw) - if action_player then - local warnings = Warnings.get_warnings(action_player) - local script_warnings = Warnings.get_script_warnings(action_player) - local action_player_name_color = format_chat_player_name(action_player) - Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit} +Commands.new_command('get-warnings', 'Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.') +:add_param('player', true, 'player') +:add_alias('warnings', 'list-warnings') +:register(function(_, player) + if player then + local warnings = Warnings.get_warnings(player) + local script_warnings = Warnings.get_script_warnings(player) + local player_name_color = format_chat_player_name(player) + Commands.print{'expcom-warnings.player', player_name_color, warnings, script_warnings, config.temp_warning_limit} else local rtn = {} local user_warnings = Warnings.user_warnings local user_script_warnings = Warnings.user_script_warnings - for player_name,warnings in pairs(user_warnings) do - rtn[player_name] = {#warnings,0} + for player_name, warnings in pairs(user_warnings) do + rtn[player_name] = {#warnings, 0} end - for player_name,warnings in pairs(user_script_warnings) do + for player_name, warnings in pairs(user_script_warnings) do if not rtn[player_name] then - rtn[player_name] = {0,0} + rtn[player_name] = {0, 0} end rtn[player_name][2] = #warnings end Commands.print{'expcom-warnings.list-tilte'} - for player_name,warnings in pairs(rtn) do + for player_name, warnings in pairs(rtn) do local player_name_color = format_chat_player_name(player_name) - Commands.print{'expcom-warnings.list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit} + Commands.print{'expcom-warnings.list', player_name_color, warnings[1], warnings[2], config.temp_warning_limit} end end end) @@ -61,12 +61,12 @@ end) --- Clears all warnings (and script warnings) from a player -- @command clear-warnings -- @tparam LuaPlayer player the player to clear the warnings from -Commands.new_command('clear-warnings','Clears all warnings (and script warnings) from a player') -:add_param('player',false,'player') -:register(function(player,action_player,raw) - Warnings.clear_warnings(action_player,player.name) - Warnings.clear_script_warnings(action_player,player.name) +Commands.new_command('clear-warnings', 'Clears all warnings (and script warnings) from a player') +:add_param('player', false, 'player') +:register(function(player, action_player) + Warnings.clear_warnings(action_player, player.name) + Warnings.clear_script_warnings(action_player, player.name) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) - game.print{'expcom-warnings.cleared',action_player_name_color,by_player_name_color} + game.print{'expcom-warnings.cleared', action_player_name_color, by_player_name_color} end) \ No newline at end of file diff --git a/modules/control/jail.lua b/modules/control/jail.lua index a188d984..df46f9ce 100644 --- a/modules/control/jail.lua +++ b/modules/control/jail.lua @@ -9,15 +9,15 @@ -- This will move 'MrBiter' to the jail role and remove all other roles from them -- the player name and reason are only so they can be included in the event for user feedback - Jail.jail_player('MrBiter','Cooldude2606','Likes biters too much') + Jail.jail_player('MrBiter', 'Cooldude2606', 'Likes biters too much') -- This will give 'MrBiter' all his roles back and remove him from jail -- again as above the player name is only used in the event for user feedback - Jail.unjail_player('MrBiter','Cooldude2606') + Jail.unjail_player('MrBiter', 'Cooldude2606') -- Temp ban works the same as jail but will store the reason and move the players items to spawn -- this is meant to be used as a more permiment jail but not as strong as a ban - Jail.temp_ban_player('MrBiter','Cooldude2606','Likes biters too much') + Jail.temp_ban_player('MrBiter', 'Cooldude2606', 'Likes biters too much') ]] local Roles = require 'expcore.roles' --- @dep expcore.roles @@ -65,7 +65,7 @@ local temp_bans = Jail.temp_bans Global.register({ old_roles = old_roles, temp_bans = temp_bans -},function(tbl) +}, function(tbl) Jail.old_roles = tbl.old_roles Jail.temp_bans = tbl.temp_bans old_roles = Jail.old_roles @@ -77,8 +77,8 @@ end) -- @tparam LuaPlayer player the player who is being acted on -- @tparam string by_player_name the player who is doing the action -- @tparam string reason the reason for the action (jail and tempban only) -local function event_emit(event,player,by_player_name,reason) - script.raise_event(event,{ +local function event_emit(event, player, by_player_name, reason) + script.raise_event(event, { name=event, tick=game.tick, player_index=player.index, @@ -95,7 +95,7 @@ end -- @tparam LuaPlayer player the player to check if they are in jail -- @treturn boolean whether the player is currently in jail function Jail.is_jailed(player) - return has_role(player,'Jail') + return has_role(player, 'Jail') end --- Moves a player to jail and removes all other roles @@ -103,14 +103,14 @@ end -- @tparam string by_player_name the name of the player who is doing the jailing -- @tparam[opt='Non given.'] string reason the reason that the player is being jailed -- @treturn boolean wheather the user was jailed successfully -function Jail.jail_player(player,by_player_name,reason) +function Jail.jail_player(player, by_player_name, reason) player = valid_player(player) if not player then return end if not by_player_name then return end reason = reason or 'Non given.' - if has_role(player,'Jail') then return end + if has_role(player, 'Jail') then return end local roles = get_roles(player) old_roles[player.name] = roles @@ -126,12 +126,12 @@ end -- @tparam LuaPlayer player the player that will be unjailed -- @tparam string by_player_name the name of the player that is doing the unjail -- @treturn boolean whether the player was unjailed successfully -function Jail.unjail_player(player,by_player_name) +function Jail.unjail_player(player, by_player_name) player = valid_player(player) if not player then return end if not by_player_name then return end - if not has_role(player,'Jail') then return end + if not has_role(player, 'Jail') then return end local roles = old_roles[player.name] or {} assign_roles(player, roles, by_player_name, nil, true) @@ -160,7 +160,7 @@ end -- @tparam string by_player_name the name of the player who is doing the temp ban -- @tparam[opt='Non given.'] string reason the reason that the player is being temp banned -- @treturn boolean whether the player was successfully temp banned -function Jail.temp_ban_player(player,by_player_name,reason) +function Jail.temp_ban_player(player, by_player_name, reason) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -168,9 +168,9 @@ function Jail.temp_ban_player(player,by_player_name,reason) reason = reason or 'Non given.' if temp_bans[player.name] then return end - temp_bans[player.name] = {reason,by_player_name} + temp_bans[player.name] = {reason, by_player_name} - if not has_role(player,'Jail') then + if not has_role(player, 'Jail') then local roles = get_roles(player) old_roles[player.name] = roles @@ -182,7 +182,7 @@ function Jail.temp_ban_player(player,by_player_name,reason) move_items(inv.get_contents()) inv.clear() - event_emit(Jail.events.on_player_temp_banned,player,by_player_name,reason) + event_emit(Jail.events.on_player_temp_banned, player, by_player_name, reason) return true end @@ -191,7 +191,7 @@ end -- @tparam LuaPlayer player the player who is being removed from temp ban -- @tparam string by_player_name the name of the player who is doing the untemp ban -- @treturn boolean whether the player was successfully removed -function Jail.untemp_ban_player(player,by_player_name) +function Jail.untemp_ban_player(player, by_player_name) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -199,14 +199,14 @@ function Jail.untemp_ban_player(player,by_player_name) if not temp_bans[player.name] then return end temp_bans[player.name] = nil - if has_role(player,'Jail') then + if has_role(player, 'Jail') then local roles = old_roles[player.name] assign_roles(player, roles, by_player_name, nil, true) unassign_roles(player, 'Jail', by_player_name, nil, true) end - event_emit(Jail.events.on_player_untemp_banned,player,by_player_name) + event_emit(Jail.events.on_player_untemp_banned, player, by_player_name) return true end diff --git a/modules/control/production.lua b/modules/control/production.lua index 026bad7c..4dcf8f76 100644 --- a/modules/control/production.lua +++ b/modules/control/production.lua @@ -14,21 +14,21 @@ -- The get production function is used to get production, consumion and net -- it may be used for any item and with any precision level, use total for total - Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + Production.get_production(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute) -- The fluctuations works by compearing recent production with the average over time -- again any precision may be used, apart from one_thousand_hours as there would be no valid average - Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + Production.get_fluctuations(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute) -- ETA is calculated based on what function you use but all share a similar method -- for production eta it will take current production average given by the precision -- and work out how many ticks it will require to make the required amount (1000 by default) - Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000) + Production.get_production_eta(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute, 250000) -- Both get_color and format_number are helper functions to help format production stats - -- get_color will return green,orange,red,or grey based on the active_value - -- the passive_value is used when active_value is 0 and can only return orange,red,or grey - Production.get_color(clamp,active_value,passive_value) + -- get_color will return green, orange, red, or grey based on the active_value + -- the passive_value is used when active_value is 0 and can only return orange, red, or grey + Production.get_color(clamp, active_value, passive_value) ]] @@ -47,13 +47,13 @@ local Production = {} -- @treturn[1] defines.flow_precision_index the next precision value -- @treturn[1] number the multiplicive difference between the values function Production.precision_up(precision) - if precision == precision_index.one_second then return precision_index.one_minute,60 - elseif precision == precision_index.one_minute then return precision_index.ten_minutes,10 - elseif precision == precision_index.ten_minutes then return precision_index.one_hour,6 - elseif precision == precision_index.one_hour then return precision_index.ten_hours,10 - elseif precision == precision_index.ten_hours then return precision_index.fifty_hours,5 - elseif precision == precision_index.fifty_hours then return precision_index.two_hundred_fifty_hours,5 - elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.one_thousand_hours,4 + if precision == precision_index.one_second then return precision_index.one_minute, 60 + elseif precision == precision_index.one_minute then return precision_index.ten_minutes, 10 + elseif precision == precision_index.ten_minutes then return precision_index.one_hour, 6 + elseif precision == precision_index.one_hour then return precision_index.ten_hours, 10 + elseif precision == precision_index.ten_hours then return precision_index.fifty_hours, 5 + elseif precision == precision_index.fifty_hours then return precision_index.two_hundred_fifty_hours, 5 + elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.one_thousand_hours, 4 end end @@ -62,13 +62,13 @@ end -- @treturn[1] defines.flow_precision_index the next precision value -- @treturn[1] number the multiplicive difference between the values function Production.precision_down(precision) - if precision == precision_index.one_minute then return precision_index.one_second,60 - elseif precision == precision_index.ten_minutes then return precision_index.one_minute,10 - elseif precision == precision_index.one_hour then return precision_index.ten_minutes,6 - elseif precision == precision_index.ten_hours then return precision_index.one_hour,10 - elseif precision == precision_index.fifty_hours then return precision_index.ten_hours,5 - elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.fifty_hours,5 - elseif precision == precision_index.one_thousand_hours then return precision_index.two_hundred_fifty_hours,4 + if precision == precision_index.one_minute then return precision_index.one_second, 60 + elseif precision == precision_index.ten_minutes then return precision_index.one_minute, 10 + elseif precision == precision_index.one_hour then return precision_index.ten_minutes, 6 + elseif precision == precision_index.ten_hours then return precision_index.one_hour, 10 + elseif precision == precision_index.fifty_hours then return precision_index.ten_hours, 5 + elseif precision == precision_index.two_hundred_fifty_hours then return precision_index.fifty_hours, 5 + elseif precision == precision_index.one_thousand_hours then return precision_index.two_hundred_fifty_hours, 4 end end @@ -95,7 +95,7 @@ end -- @tparam LuaForce force the force to get the data for -- @tparam string item_name the name of the item that you want the data about -- @treturn table contains total made, used and net -function Production.get_production_total(force,item_name) +function Production.get_production_total(force, item_name) local stats = force.item_production_statistics local made = stats.get_input_count(item_name) or 0 local used = stats.get_output_count(item_name) or 0 @@ -113,10 +113,10 @@ end -- @tparam string item_name the name of the item that you want the data about -- @tparam defines.flow_precision_index precision the precision that you want the data given to -- @treturn table contains made, used and net -function Production.get_production(force,item_name,precision) +function Production.get_production(force, item_name, precision) local stats = force.item_production_statistics.get_flow_count - local made = stats{name=item_name,input=true,precision_index=precision} or 0 - local used = stats{name=item_name,input=false,precision_index=precision} or 0 + local made = stats{name=item_name, input=true, precision_index=precision} or 0 + local used = stats{name=item_name, input=false, precision_index=precision} or 0 return { made=made, @@ -131,10 +131,10 @@ end -- @tparam string item_name the name of the item that you want the data about -- @tparam defines.flow_precision_index precision the precision that you want the data given to -- @treturn table contains made, used and net -function Production.get_fluctuations(force,item_name,precision) +function Production.get_fluctuations(force, item_name, precision) local percision_up = Production.precision_up(precision) - local current = Production.get_production(force,item_name,precision) - local previous = Production.get_production(force,item_name,percision_up) + local current = Production.get_production(force, item_name, precision) + local previous = Production.get_production(force, item_name, percision_up) return { made=(current.made/previous.made)-1, @@ -150,10 +150,10 @@ end -- @tparam defines.flow_precision_index precision the precision that you want the data given to -- @tparam[opt=1000] number required the number of items that are required to be made -- @treturn number the number of ticks required to produce this ammount of items -function Production.get_production_eta(force,item_name,precision,required) +function Production.get_production_eta(force, item_name, precision, required) required = required or 1000 local ticks = Production.precision_ticks(precision) - local production = Production.get_production(force,item_name,precision) + local production = Production.get_production(force, item_name, precision) return production.made == 0 and -1 or ticks*required/production.made end @@ -163,10 +163,10 @@ end -- @tparam defines.flow_precision_index precision the precision that you want the data given to -- @tparam[opt=1000] number required the number of items that are required to be consumed -- @treturn number the number of ticks required to consume this ammount of items -function Production.get_consumsion_eta(force,item_name,precision,required) +function Production.get_consumsion_eta(force, item_name, precision, required) required = required or 1000 local ticks = Production.precision_ticks(precision) - local production = Production.get_production(force,item_name,precision) + local production = Production.get_production(force, item_name, precision) return production.used == 0 and -1 or ticks*required/production.used end @@ -176,10 +176,10 @@ end -- @tparam defines.flow_precision_index precision the precision that you want the data given to -- @tparam[opt=1000] number required the number of items that are required to be made but not used -- @treturn number the number of ticks required to produce, but not use, this ammount of items -function Production.get_net_eta(force,item_name,precision,required) +function Production.get_net_eta(force, item_name, precision, required) required = required or 1000 local ticks = Production.precision_ticks(precision) - local production = Production.get_production(force,item_name,precision) + local production = Production.get_production(force, item_name, precision) return production.net == 0 and -1 or ticks*required/production.net end @@ -191,8 +191,8 @@ end -- @tparam number clamp value which seperates the different colours -- @tparam number active_value first value tested, tested against clamp -- @tparam number passive_value second value tested, tested against 0 --- @treturn table contains r,g,b keys -function Production.get_color(clamp,active_value,passive_value) +-- @treturn table contains r, g,b keys +function Production.get_color(clamp, active_value, passive_value) if active_value > clamp then return Colors.light_green elseif active_value < -clamp then @@ -213,19 +213,19 @@ end -- @treturn[1] string the sign for the number -- @treturn[1] string the surfix for any unit used function Production.format_number(value) - local rtn = format_number(math.round(value,1),true) + local rtn = format_number(math.round(value, 1), true) local surfix = rtn:sub(-1) if value > 0 then rtn = '+'..rtn - elseif value == 0 and rtn:sub(1,1) == '-' then + elseif value == 0 and rtn:sub(1, 1) == '-' then rtn = rtn:sub(2) end if not tonumber(surfix) then - return surfix,rtn:sub(1,-2) + return surfix, rtn:sub(1, -2) else - return '',rtn + return '', rtn end end diff --git a/modules/control/reports.lua b/modules/control/reports.lua index d5d5cf1b..714e6a19 100644 --- a/modules/control/reports.lua +++ b/modules/control/reports.lua @@ -10,13 +10,13 @@ -- This will place a report on "MrBiter" (must be a valid player) the report will have been made -- by "Cooldude2606" (must be the player name) with the reason 'Liking biters too much' this can be -- seen by using Reports.get_report. - Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true + Reports.report_player('MrBiter', 'Cooldude2606', 'Liking biters too much') -- true -- The other get methods can be used to get all the reports on a player or to test if a player is reported. - Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much' + Reports.get_report('MrBiter', 'Cooldude2606') -- 'Liking biters too much' -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'. - Reports.remove_report('MrBiter','Cooldude2606') -- true + Reports.remove_report('MrBiter', 'Cooldude2606') -- true -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will -- be triggered once per report issused. @@ -48,7 +48,7 @@ local Reports = { } local user_reports = Reports.user_reports -Global.register(user_reports,function(tbl) +Global.register(user_reports, function(tbl) Reports.user_reports = tbl user_reports = Reports.user_reports end) @@ -71,7 +71,7 @@ end -- @tparam LuaPlayer player the player to get the report for -- @tparam string by_player_name the name of the player who made the report -- @treturn ?string|nil string is the reason that the player was reported, if the player is not reported -function Reports.get_report(player,by_player_name) +function Reports.get_report(player, by_player_name) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -84,7 +84,7 @@ end -- @tparam LuaPlayer player the player to check if reported -- @tparam[opt] string by_player_name when given will check if reported by this player -- @treturn boolean if the player has been reported -function Reports.is_reported(player,by_player_name) +function Reports.is_reported(player, by_player_name) player = valid_player(player) if not player then return end @@ -100,15 +100,15 @@ end -- @tparam LuaPlayer player the player to count the reports for -- @tparam[opt] function custom_count when given this function will be used to count the reports -- @treturn number the number of reports that the user has -function Reports.count_reports(player,custom_count) +function Reports.count_reports(player, custom_count) player = valid_player(player) if not player then return end local reports = user_reports[player.name] or {} if custom_count then local ctn = 0 - for by_player_name,reason in pairs(reports) do - ctn = ctn + custom_count(player,by_player_name,reason) + for by_player_name, reason in pairs(reports) do + ctn = ctn + custom_count(player, by_player_name, reason) end return ctn else @@ -125,7 +125,7 @@ end -- @tparam string by_player_name the name of the player that is making the report -- @tparam[opt='Non given.'] string reason the reason that the player is being reported -- @treturn boolean whether the report was added successfully -function Reports.report_player(player,by_player_name,reason) +function Reports.report_player(player, by_player_name, reason) player = valid_player(player) if not player then return end local player_name = player.name @@ -144,7 +144,7 @@ function Reports.report_player(player,by_player_name,reason) reports[by_player_name] = reason end - script.raise_event(Reports.events.on_player_reported,{ + script.raise_event(Reports.events.on_player_reported, { name = Reports.events.on_player_reported, tick = game.tick, player_index = player.index, @@ -159,8 +159,8 @@ end -- @tparam LuaPlayer player the player who is having the report removed from them -- @tparam string reported_by_name the player who had the report -- @tparam string removed_by_name the player who is clearing the report -local function report_removed_event(player,reported_by_name,removed_by_name) - script.raise_event(Reports.events.on_report_removed,{ +local function report_removed_event(player, reported_by_name, removed_by_name) + script.raise_event(Reports.events.on_report_removed, { name = Reports.events.on_report_removed, tick = game.tick, player_index = player.index, @@ -174,7 +174,7 @@ end -- @tparam string reported_by_name the name of the player that made the report -- @tparam string removed_by_name the name of the player who removed the report -- @treturn boolean whether the report was removed successfully -function Reports.remove_report(player,reported_by_name,removed_by_name) +function Reports.remove_report(player, reported_by_name, removed_by_name) player = valid_player(player) if not player then return end @@ -188,7 +188,7 @@ function Reports.remove_report(player,reported_by_name,removed_by_name) return false end - report_removed_event(player,reported_by_name,removed_by_name) + report_removed_event(player, reported_by_name, removed_by_name) reports[reported_by_name] = nil return true @@ -198,7 +198,7 @@ end -- @tparam LuaPlayer player the player to remove the reports from -- @tparam string removed_by_name the name of the player who removed the report -- @treturn boolean whether the reports were removed successfully -function Reports.remove_all(player,removed_by_name) +function Reports.remove_all(player, removed_by_name) player = valid_player(player) if not player then return end @@ -207,8 +207,8 @@ function Reports.remove_all(player,removed_by_name) return false end - for reported_by_name,_ in pairs(reports) do - report_removed_event(player,reported_by_name,removed_by_name) + for reported_by_name, _ in pairs(reports) do + report_removed_event(player, reported_by_name, removed_by_name) end user_reports[player.name] = nil diff --git a/modules/control/rockets.lua b/modules/control/rockets.lua index a09c74ce..f830ebfa 100644 --- a/modules/control/rockets.lua +++ b/modules/control/rockets.lua @@ -18,10 +18,10 @@ Rockets.get_silos('player') -- You can get the launch time for a rocket, meaning what game tick the 50th rocket was launched - Rockets.get_rocket_time('player',50) + Rockets.get_rocket_time('player', 50) -- The rolling average will work out the time to launch one rocket based on the last X rockets - Rockets.get_rolling_average('player',10) + Rockets.get_rolling_average('player', 10) ]] @@ -30,7 +30,7 @@ local Global = require 'utils.global' --- @dep utils.global local config = require 'config.gui.rockets' --- @dep config.rockets local largest_rolling_avg = 0 -for _,avg_over in pairs(config.stats.rolling_avg) do +for _, avg_over in pairs(config.stats.rolling_avg) do if avg_over > largest_rolling_avg then largest_rolling_avg = avg_over end @@ -49,7 +49,7 @@ Global.register({ rocket_times = rocket_times, rocket_stats = rocket_stats, rocket_silos = rocket_silos -},function(tbl) +}, function(tbl) Rockets.times = tbl.rocket_times Rockets.stats = tbl.rocket_stats Rockets.silos = tbl.rocket_silos @@ -94,9 +94,9 @@ end -- @treturn table an array of silo data that all belong to this force function Rockets.get_silos(force_name) local rtn = {} - for _,silo_data in pairs(rocket_silos) do + for _, silo_data in pairs(rocket_silos) do if silo_data.force == force_name then - table.insert(rtn,silo_data) + table.insert(rtn, silo_data) end end return rtn @@ -106,7 +106,7 @@ end -- @tparam string force_name the name of the force to get the count for -- @tparam number rocket_number the number of the rocket to get the launch time for -- @treturn number the game tick that the rocket was lanuched on -function Rockets.get_rocket_time(force_name,rocket_number) +function Rockets.get_rocket_time(force_name, rocket_number) return rocket_times[force_name] and rocket_times[force_name][rocket_number] or nil end @@ -122,7 +122,7 @@ end -- @treturn number the total number of rockets launched this game function Rockets.get_game_rocket_count() local rtn = 0 - for _,force in pairs(game.forces) do + for _, force in pairs(game.forces) do rtn = rtn + force.rockets_launched end return rtn @@ -132,7 +132,7 @@ end -- @tparam string force_name the name of the force to get the average for -- @tparam number count the distance to get the rolling average over -- @treturn number the number of ticks required to launch one rocket -function Rockets.get_rolling_average(force_name,count) +function Rockets.get_rolling_average(force_name, count) local force = game.forces[force_name] local rocket_count = force.rockets_launched if rocket_count == 0 then return 0 end @@ -146,7 +146,7 @@ function Rockets.get_rolling_average(force_name,count) end --- Event used to update the stats and the hui when a rocket is launched -Event.add(defines.events.on_rocket_launched,function(event) +Event.add(defines.events.on_rocket_launched, function(event) local entity = event.rocket_silo local silo_data = Rockets.get_silo_data(entity) local force = event.rocket_silo.force @@ -177,7 +177,7 @@ Event.add(defines.events.on_rocket_launched,function(event) rocket_times[force_name][rockets_launched] = event.tick local remove_rocket = rockets_launched-largest_rolling_avg - if remove_rocket > 0 and not table.contains(config.milestones,remove_rocket) then + if remove_rocket > 0 and not table.contains(config.milestones, remove_rocket) then rocket_times[force_name][remove_rocket] = nil end @@ -186,7 +186,7 @@ Event.add(defines.events.on_rocket_launched,function(event) end) --- When a launch is reiggered it will await reset -Event.add(defines.events.on_rocket_launch_ordered,function(event) +Event.add(defines.events.on_rocket_launch_ordered, function(event) local entity = event.rocket_silo local silo_data = Rockets.get_silo_data(entity) silo_data.awaiting_reset = true @@ -212,7 +212,7 @@ local function on_built(event) end end -Event.add(defines.events.on_built_entity,on_built) -Event.add(defines.events.on_robot_built_entity,on_built) +Event.add(defines.events.on_built_entity, on_built) +Event.add(defines.events.on_robot_built_entity, on_built) return Rockets \ No newline at end of file diff --git a/modules/control/tasks.lua b/modules/control/tasks.lua index 0806efde..0e8fb941 100644 --- a/modules/control/tasks.lua +++ b/modules/control/tasks.lua @@ -4,9 +4,9 @@ @alias Tasks @usage-- Making and then editing a new task -local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name) +local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name) -Tasks.update_task(task_id,'We need more iron!',game.player.name) +Tasks.update_task(task_id, 'We need more iron!', game.player.name) ]] @@ -18,7 +18,7 @@ local Tasks = {} -- Global lookup table for force name to task ids local force_tasks = {} -Global.register(force_tasks,function(tbl) +Global.register(force_tasks, function(tbl) force_tasks = tbl end) @@ -38,10 +38,10 @@ Tasks.store = task_store @treturn string the uid of the task which was created @usage-- Adding a new task for your force -local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name) +local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name) ]] -function Tasks.add_task(force_name,task_number,player_name,task_message) +function Tasks.add_task(force_name, task_number, player_name, task_message) -- Get a new task id local task_id = tostring(Token.uid()) task_message = task_message or 'New Task' @@ -55,9 +55,9 @@ function Tasks.add_task(force_name,task_number,player_name,task_message) -- Insert the task id into the forces tasks if task_number then - table.insert(tasks,task_number,task_id) + table.insert(tasks, task_number, task_id) else - table.insert(tasks,task_id) + table.insert(tasks, task_id) end -- Create the editing table @@ -67,7 +67,7 @@ function Tasks.add_task(force_name,task_number,player_name,task_message) end -- Add the new task to the store - Store.set(task_store,task_id,{ + Store.set(task_store, task_id, { task_id = task_id, force_name = force_name, message = task_message, @@ -87,10 +87,10 @@ Tasks.remove_task(task_id) ]] function Tasks.remove_task(task_id) - local task = Store.get(task_store,task_id) + local task = Store.get(task_store, task_id) local force_name = task.force_name - table.remove_element(force_tasks[force_name],task_id) - Store.clear(task_store,task_id) + table.remove_element(force_tasks[force_name], task_id) + Store.clear(task_store, task_id) end --[[-- Update the message and last edited information for a task @@ -99,11 +99,11 @@ end @tparam[opt='server'] string player_name the name of the player who made the edit @usage-- Updating the message for on a task -Task.update_task(task_id,'We need more iron!',game.player.name) +Task.update_task(task_id, 'We need more iron!', game.player.name) ]] -function Tasks.update_task(task_id,new_message,player_name) - Store.update(task_store,task_id,function(task) +function Tasks.update_task(task_id, new_message, player_name) + Store.update(task_store, task_id, function(task) task.last_edit_name = player_name or '' task.last_edit_time = game.tick task.message = new_message @@ -116,11 +116,11 @@ end @tparam boolean state the new state to set editing to @usage-- Setting your editing state to true -Tasks.set_editing(task_id,game.player.name,true) +Tasks.set_editing(task_id, game.player.name, true) ]] -function Tasks.set_editing(task_id,player_name,state) - Store.update(task_store,task_id,function(task) +function Tasks.set_editing(task_id, player_name, state) + Store.update(task_store, task_id, function(task) task.curently_editing[player_name] = state end) end @@ -135,7 +135,7 @@ end) ]] function Tasks.on_update(handler) - Store.watch(task_store,handler) + Store.watch(task_store, handler) end --- Getters. @@ -151,7 +151,7 @@ local task = Tasks.get_task(task_id) ]] function Tasks.get_task(task_id) - return Store.get(task_store,task_id) + return Store.get(task_store, task_id) end --[[-- Gets all the task ids that a force has @@ -172,11 +172,11 @@ end @treturn boolean weather the player is currently editing this task @usage-- Check if a player is editing a task or not -local editing = Tasks.get_editing(task_id,game.player.name) +local editing = Tasks.get_editing(task_id, game.player.name) ]] -function Tasks.get_editing(task_id,player_name) - local task = Store.get(task_store,task_id) +function Tasks.get_editing(task_id, player_name) + local task = Store.get(task_store, task_id) return task.curently_editing[player_name] end diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua index 2e6d057b..dd7bcba4 100644 --- a/modules/control/warnings.lua +++ b/modules/control/warnings.lua @@ -8,17 +8,17 @@ local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings -- This will add a warning to the player - Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters') + Warnings.add_warning('MrBiter', 'Cooldude2606', 'Killed too many biters') -- This will remove a warning from a player, second name is just who is doing the action - Warnings.remove_warning('MrBiter','Cooldude2606') + Warnings.remove_warning('MrBiter', 'Cooldude2606') -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time -- this is so it can be used for greifer protection without being too agressive - Warnings.add_script_warning('MrBiter','Killed too many biters') + Warnings.add_script_warning('MrBiter', 'Killed too many biters') -- Both normal and script warnings can also be cleared, this will remove all warnings - Warnings.clear_warnings('MrBiter','Cooldude2606') + Warnings.clear_warnings('MrBiter', 'Cooldude2606') ]] local Event = require 'utils.event' --- @dep utils.event @@ -65,7 +65,7 @@ local user_script_warnings = Warnings.user_script_warnings Global.register({ user_warnings = user_warnings, user_script_warnings = user_script_warnings -},function(tbl) +}, function(tbl) Warnings.user_warnings = tbl.user_warnings Warnings.user_script_warnings = tbl.user_script_warnings user_warnings = Warnings.user_warnings @@ -92,7 +92,7 @@ end -- @tparam string by_player_name the name of the player who is doing the action -- @tparam[opt='Non given.'] string reason the reason that the player is being warned -- @treturn number the number of warnings that the player has -function Warnings.add_warning(player,by_player_name,reason) +function Warnings.add_warning(player, by_player_name, reason) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -105,7 +105,7 @@ function Warnings.add_warning(player,by_player_name,reason) user_warnings[player.name] = warnings end - table.insert(warnings,{ + table.insert(warnings, { tick = game.tick, by_player_name = by_player_name, reason = reason @@ -113,7 +113,7 @@ function Warnings.add_warning(player,by_player_name,reason) local warning_count = #warnings - script.raise_event(Warnings.events.on_warning_added,{ + script.raise_event(Warnings.events.on_warning_added, { name = Warnings.events.on_warning_added, tick = game.tick, player_index = player.index, @@ -126,11 +126,11 @@ function Warnings.add_warning(player,by_player_name,reason) if action then local _type = type(action) if _type == 'function' then - action(player,by_player_name,warning_count) + action(player, by_player_name, warning_count) elseif _type == 'table' then local current = table.deepcopy(action) - table.insert(current,2,by_player_name) - table.insert(current,3,warning_count) + table.insert(current, 2,by_player_name) + table.insert(current, 3,warning_count) player.print(current) elseif type(action) == 'string' then player.print(action) @@ -145,8 +145,8 @@ end -- @tparam string warning_by_name the name of the player who made the warning -- @tparam string removed_by_name the name of the player who is doing the action -- @tparam number warning_count the number of warnings that the player how has -local function warning_removed_event(player,warning_by_name,removed_by_name,warning_count) - script.raise_event(Warnings.events.on_warning_removed,{ +local function warning_removed_event(player, warning_by_name, removed_by_name, warning_count) + script.raise_event(Warnings.events.on_warning_removed, { name = Warnings.events.on_warning_removed, tick = game.tick, player_index = player.index, @@ -160,7 +160,7 @@ end -- @tparam LuaPlayer player the player to remove a warning from -- @tparam string by_player_name the name of the player who is doing the action -- @treturn number the number of warnings that the player has -function Warnings.remove_warning(player,by_player_name) +function Warnings.remove_warning(player, by_player_name) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -168,9 +168,9 @@ function Warnings.remove_warning(player,by_player_name) local warnings = user_warnings[player.name] if not warnings then return end - local warning = table.remove(warnings,1) + local warning = table.remove(warnings, 1) - warning_removed_event(player,warning.by_player_name,by_player_name,#warnings) + warning_removed_event(player, warning.by_player_name, by_player_name, #warnings) return #warnings end @@ -179,7 +179,7 @@ end -- @tparam LuaPlayer player the player to clear the warnings from -- @tparam string by_player_name the name of the player who is doing the action -- @treturn boolean true when warnings were cleared succesfully -function Warnings.clear_warnings(player,by_player_name) +function Warnings.clear_warnings(player, by_player_name) player = valid_player(player) if not player then return end if not by_player_name then return end @@ -188,8 +188,8 @@ function Warnings.clear_warnings(player,by_player_name) if not warnings then return end local warning_count = #warnings - for n,warning in pairs(warnings) do - warning_removed_event(player,warning.by_player_name,by_player_name,warning_count-n) + for n, warning in pairs(warnings) do + warning_removed_event(player, warning.by_player_name, by_player_name, warning_count-n) end user_warnings[player.name] = nil @@ -215,7 +215,7 @@ end -- @tparam LuaPlayer player the player to add a script warning to -- @tparam[opt='Non given.'] string reason the reason that the player is being warned -- @treturn number the number of script warnings that the player has -function Warnings.add_script_warning(player,reason) +function Warnings.add_script_warning(player, reason) player = valid_player(player) if not player then return end @@ -227,14 +227,14 @@ function Warnings.add_script_warning(player,reason) user_script_warnings[player.name] = warnings end - table.insert(warnings,{ + table.insert(warnings, { tick = game.tick, reason = reason }) local warning_count = #warnings - script.raise_event(Warnings.events.on_script_warning_added,{ + script.raise_event(Warnings.events.on_script_warning_added, { name = Warnings.events.on_script_warning_added, tick = game.tick, player_index = player.index, @@ -243,7 +243,7 @@ function Warnings.add_script_warning(player,reason) }) if warning_count > config.script_warning_limit then - Warnings.add_warning(player,'',reason) + Warnings.add_warning(player, '', reason) end return warning_count @@ -252,8 +252,8 @@ end --- Script warning removed event tigger due to it being looped in clear script warnings -- @tparam LuaPlayer player the player who is having a script warning removed -- @tparam number warning_count the number of warning that the player has -local function script_warning_removed_event(player,warning_count) - script.raise_event(Warnings.events.on_script_warning_removed,{ +local function script_warning_removed_event(player, warning_count) + script.raise_event(Warnings.events.on_script_warning_removed, { name = Warnings.events.on_script_warning_removed, tick = game.tick, player_index = player.index, @@ -271,7 +271,7 @@ function Warnings.remove_script_warning(player) local warnings = user_script_warnings[player.name] if not warnings then return end - table.remove(warnings,1) + table.remove(warnings, 1) script_warning_removed_event(player) @@ -288,8 +288,8 @@ function Warnings.clear_script_warnings(player) if not warnings then return end local warning_count = #warnings - for n,_ in pairs(warnings) do - script_warning_removed_event(player,warning_count-n) + for n, _ in pairs(warnings) do + script_warning_removed_event(player, warning_count-n) end user_script_warnings[player.name] = nil @@ -298,11 +298,11 @@ end -- script warnings are removed after a certain amount of time to make them even more lienient local script_warning_cool_down = config.script_warning_cool_down*3600 -Event.on_nth_tick(script_warning_cool_down/4,function() +Event.on_nth_tick(script_warning_cool_down/4, function() local cutoff = game.tick - script_warning_cool_down - for player_name,script_warnings in pairs(user_script_warnings) do + for player_name, script_warnings in pairs(user_script_warnings) do if #script_warnings > 0 then - for _,warning in pairs(script_warnings) do + for _, warning in pairs(script_warnings) do if warning.tick < cutoff then Warnings.remove_script_warning(player_name) end diff --git a/modules/control/warps.lua b/modules/control/warps.lua index 897b2bc1..7e7a12e6 100644 --- a/modules/control/warps.lua +++ b/modules/control/warps.lua @@ -6,7 +6,7 @@ @usage-- Making a new spawn warp local player = game.player local force = player.force -local spawn_id = Warps.add_warp(force.name,player.surface,player.position,player.name,'Spawn') +local spawn_id = Warps.add_warp(force.name, player.surface, player.position, player.name, 'Spawn') Warps.set_spawn_warp(spawn_id, force) Warps.make_warp_tag(spawn_id) @@ -14,7 +14,7 @@ Warps.make_warp_tag(spawn_id) @usage-- Making a new warp with a warp area local player = game.player local force = player.force -local warp_id = Warps.add_warp(force.name,player.surface,player.position,player.name) +local warp_id = Warps.add_warp(force.name, player.surface, player.position, player.name) Warps.make_warp_area(warp_id) Warps.make_warp_tag(warp_id) @@ -30,7 +30,7 @@ local Warps = {} -- Global lookup table for force name to task ids local force_warps = {} -Global.register(force_warps,function(tbl) +Global.register(force_warps, function(tbl) force_warps = tbl end) @@ -39,7 +39,7 @@ local warp_store = Store.register() Warps.store = warp_store -- When a warp is updated change its chat tag and resort the warp order -Store.watch(warp_store,function(warp,warp_id) +Store.watch(warp_store, function(warp, warp_id) if warp then -- Update the map chart tag if there is one if warp.tag then @@ -55,8 +55,8 @@ Store.watch(warp_store,function(warp,warp_id) local spawn_id = warp_ids.spawn local warp_names = {} - for _,next_warp_id in pairs(warp_ids) do - local next_warp = Store.get(warp_store,next_warp_id) + for _, next_warp_id in pairs(warp_ids) do + local next_warp = Store.get(warp_store, next_warp_id) if next_warp_id ~= spawn_id then warp_names[next_warp.name..next_warp_id] = next_warp_id end @@ -64,7 +64,7 @@ Store.watch(warp_store,function(warp,warp_id) -- Sort the warp names in alphabetical order local new_warp_ids = table.get_values(table.keysort(warp_names)) - table.insert(new_warp_ids,1,spawn_id) + table.insert(new_warp_ids, 1,spawn_id) new_warp_ids.spawn = spawn_id force_warps[force_name] = new_warp_ids end @@ -83,7 +83,7 @@ local tag_added = Warps.make_warp_tag(warp_id) ]] function Warps.make_warp_tag(warp_id) - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) local name = warp.name local icon = warp.icon @@ -91,7 +91,7 @@ function Warps.make_warp_tag(warp_id) local tag = warp.tag if tag and tag.valid then tag.text = 'Warp: '..name - tag.icon = {type='item',name=icon} + tag.icon = {type='item', name=icon} return false end @@ -100,10 +100,10 @@ function Warps.make_warp_tag(warp_id) local surface = warp.surface local position = warp.position - tag = force.add_chart_tag(surface,{ - position = {position.x+0.5,position.y+0.5}, + tag = force.add_chart_tag(surface, { + position = {position.x+0.5, position.y+0.5}, text = 'Warp: '..name, - icon = {type='item',name=icon} + icon = {type='item', name=icon} }) -- Add the tag to this warp, store.update not needed as we dont want it to trigger @@ -120,7 +120,7 @@ local removed = Warps.remove_warp_tag(warp_id) ]] function Warps.remove_warp_tag(warp_id) - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) -- Check there is a tag to remove local tag = warp.tag @@ -144,7 +144,7 @@ Warps.make_warp_area(warp_id) ]] function Warps.make_warp_area(warp_id) - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) local surface = warp.surface local position = warp.position local posx = position.x @@ -164,7 +164,7 @@ function Warps.make_warp_area(warp_id) for y = -radius, radius do local y2 = y^2 if x2+y2 < radius2 then - table.insert(base_tiles,{name=base_tile,position={x+posx,y+posy}}) + table.insert(base_tiles, {name=base_tile, position={x+posx, y+posy}}) end end end @@ -172,16 +172,16 @@ function Warps.make_warp_area(warp_id) -- Add a tile patern ontop of the base local tiles = {} - for _,pos in pairs(config.tiles) do - table.insert(tiles,{name=base_tile,position={pos[1]+posx,pos[2]+posy}}) + for _, pos in pairs(config.tiles) do + table.insert(tiles, {name=base_tile, position={pos[1]+posx, pos[2]+posy}}) end surface.set_tiles(tiles) -- Add entities to the warp structure - for _,entity in pairs(config.entities) do + for _, entity in pairs(config.entities) do entity = surface.create_entity{ name=entity[1], - position={entity[2]+posx,entity[3]+posy}, + position={entity[2]+posx, entity[3]+posy}, force='neutral' } entity.destructible = false @@ -199,7 +199,7 @@ Warps.remove_warp_area(warp_id) ]] function Warps.remove_warp_area(warp_id) - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) local position = warp.position local surface = warp.surface local radius = config.standard_proximity_radius @@ -216,7 +216,7 @@ function Warps.remove_warp_area(warp_id) for y = -radius, radius do local y2 = y^2 if x2+y2 < radius2 then - table.insert(tiles,{name=base_tile,position={x+position.x,y+position.y}}) + table.insert(tiles, {name=base_tile, position={x+position.x, y+position.y}}) end end end @@ -226,11 +226,11 @@ function Warps.remove_warp_area(warp_id) local entities = surface.find_entities_filtered{ force='neutral', area={ - {position.x-radius,position.y-radius}, - {position.x+radius,position.y+radius} + {position.x-radius, position.y-radius}, + {position.x+radius, position.y+radius} } } - for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end + for _, entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end end --[[-- Set a warp to be the spawn point for a force, force must own this warp @@ -238,12 +238,12 @@ end @tparam LuaForce force the force that you want to set the spawn for @usage-- Set your forces spawn to a warp -Warps.set_spawn_warp(warp_id,game.player.force) +Warps.set_spawn_warp(warp_id, game.player.force) ]] -function Warps.set_spawn_warp(warp_id,force) +function Warps.set_spawn_warp(warp_id, force) -- Check the force owns this warp - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) if warp.force_name ~= force.name then return end -- Set this warp as the spawn @@ -263,11 +263,11 @@ end @tparam LuaPlayer player the player to teleport to the warp @usage-- Teleport yourself to a warp point -Warps.teleport_player(warp_id,game.player) +Warps.teleport_player(warp_id, game.player) ]] -function Warps.teleport_player(warp_id,player) - local warp = Store.get(warp_store,warp_id) +function Warps.teleport_player(warp_id, player) + local warp = Store.get(warp_store, warp_id) local surface = warp.surface local position = { x=warp.position.x+0.5, @@ -275,9 +275,9 @@ function Warps.teleport_player(warp_id,player) } -- Teleport the player - local goto_position = surface.find_non_colliding_position('character',position,32,1) + local goto_position = surface.find_non_colliding_position('character', position, 32, 1) if player.driving then player.driving = false end - player.teleport(goto_position,surface) + player.teleport(goto_position, surface) end --- Setters. @@ -294,10 +294,10 @@ end @usage-- Adding a new warp for your force at your position local player = game.player -local warp_id = Warps.add_warp(player.force.name,player.surface,player.position,player.name) +local warp_id = Warps.add_warp(player.force.name, player.surface, player.position, player.name) ]] -function Warps.add_warp(force_name,surface,position,player_name,warp_name) +function Warps.add_warp(force_name, surface, position, player_name, warp_name) -- Get new warp id local warp_id = tostring(Token.uid()) warp_name = warp_name or 'New warp' @@ -310,7 +310,7 @@ function Warps.add_warp(force_name,surface,position,player_name,warp_name) end -- Insert the warp id into the force warps - table.insert(warp_ids,warp_id) + table.insert(warp_ids, warp_id) -- Create the editing table local editing = {} @@ -319,7 +319,7 @@ function Warps.add_warp(force_name,surface,position,player_name,warp_name) end -- Add the new warp to the store - Store.set(warp_store,warp_id,{ + Store.set(warp_store, warp_id, { warp_id = warp_id, force_name = force_name, name = warp_name, @@ -345,12 +345,12 @@ Warps.remove_warp(warp_id) ]] function Warps.remove_warp(warp_id) - local warp = Store.get(warp_store,warp_id) + local warp = Store.get(warp_store, warp_id) local force_name = warp.force_name Warps.remove_warp_tag(warp_id) Warps.remove_warp_area(warp_id) - Store.clear(warp_store,warp_id) - table.remove_element(force_warps[force_name],warp_id) + Store.clear(warp_store, warp_id) + table.remove_element(force_warps[force_name], warp_id) end --[[-- Update the name and icon for a warp @@ -360,11 +360,11 @@ end @tparam[opt='server'] string player_name the name of the player that made the edit @usage-- Changing the name and icon for a warp -Warps.update_warp(warp_id,'My Warp','iron-plate',game.player.name) +Warps.update_warp(warp_id, 'My Warp', 'iron-plate', game.player.name) ]] -function Warps.update_warp(warp_id,new_name,new_icon,player_name) - Store.update(warp_store,warp_id,function(warp) +function Warps.update_warp(warp_id, new_name, new_icon, player_name) + Store.update(warp_store, warp_id, function(warp) warp.last_edit_name = player_name or '' warp.last_edit_time = game.tick warp.old_name = warp.name @@ -379,11 +379,11 @@ end @tparam boolean state the new state to set editing to @usage-- Setting your editing state to true -Warps.set_editing(warp_id,game.player.name,true) +Warps.set_editing(warp_id, game.player.name, true) ]] -function Warps.set_editing(warp_id,player_name,state) - Store.update(warp_store,warp_id,function(warp) +function Warps.set_editing(warp_id, player_name, state) + Store.update(warp_store, warp_id, function(warp) warp.currently_editing[player_name] = state end) end @@ -398,7 +398,7 @@ end) ]] function Warps.on_update(handler) - Store.watch(warp_store,handler) + Store.watch(warp_store, handler) end --- Getters. @@ -414,7 +414,7 @@ local warp = Warps.get_warp(warp_id) ]] function Warps.get_warp(warp_id) - return Store.get(warp_store,warp_id) + return Store.get(warp_store, warp_id) end --[[-- Gets all the warp ids that a force has @@ -448,11 +448,11 @@ end @treturn boolean weather the player is currently editing this warp @usage-- Check if a player is editing a warp or not -local editing = Warps.get_editing(warp_id,game.player.name) +local editing = Warps.get_editing(warp_id, game.player.name) ]] -function Warps.get_editing(warp_id,player_name) - local warp = Store.get(warp_store,warp_id) +function Warps.get_editing(warp_id, player_name) + local warp = Store.get(warp_store, warp_id) return warp.currently_editing[player_name] end diff --git a/modules/factorio-control.lua b/modules/factorio-control.lua index 500d1c0a..f7614f7d 100644 --- a/modules/factorio-control.lua +++ b/modules/factorio-control.lua @@ -10,7 +10,7 @@ if use_silo_script then end local global = {} -Global.register(global,function(tbl) +Global.register(global, function(tbl) global = tbl end) @@ -35,7 +35,7 @@ local respawn_items = function() end if use_silo_script then - for k,v in pairs(silo_script.get_events()) do + for k, v in pairs(silo_script.get_events()) do Event.add(k, v) end end diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 5565ca0a..82f31503 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -4,6 +4,7 @@ @alias player_list ]] +-- luacheck:ignore 211/Colors local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles local Store = require 'expcore.store' --- @dep expcore.store @@ -24,7 +25,7 @@ local selected_action_store = Store.register(function(player) end) -- Set the config to use these stores -config.set_store_uids(selected_player_store,selected_action_store) +config.set_store_uids(selected_player_store, selected_action_store) --- Button used to open the action bar -- @element open_action_bar @@ -40,13 +41,13 @@ Gui.element{ width = 8, height = 14 } -:on_click(function(player,element,_) +:on_click(function(player, element, _) local selected_player_name = element.parent.name - local old_selected_player_name = Store.get(selected_player_store,player) + local old_selected_player_name = Store.get(selected_player_store, player) if selected_player_name == old_selected_player_name then - Store.clear(selected_player_store,player) + Store.clear(selected_player_store, player) else - Store.set(selected_player_store,player,selected_player_name) + Store.set(selected_player_store, player, selected_player_name) end end) @@ -59,10 +60,10 @@ Gui.element{ tooltip = {'player-list.close-action-bar'}, style = 'shortcut_bar_button_red' } -:style(Gui.sprite_style(30,-1,{ top_margin = -1, right_margin = -1 })) -:on_click(function(player,_) - Store.clear(selected_player_store,player) - Store.clear(selected_action_store,player) +:style(Gui.sprite_style(30, -1, { top_margin = -1, right_margin = -1 })) +:on_click(function(player, _) + Store.clear(selected_player_store, player) + Store.clear(selected_action_store, player) end) --- Button used to confirm a reason @@ -74,21 +75,21 @@ Gui.element{ tooltip = {'player-list.reason-confirm'}, style = 'shortcut_bar_button_green' } -:style(Gui.sprite_style(30,-1,{ left_margin = -2, right_margin = -1 })) -:on_click(function(player,element) +:style(Gui.sprite_style(30, -1, { left_margin = -2, right_margin = -1 })) +:on_click(function(player, element) local reason = element.parent.entry.text or 'Non Given' - local action_name = Store.get(selected_action_store,player) + local action_name = Store.get(selected_action_store, player) local reason_callback = config.buttons[action_name].reason_callback - reason_callback(player,reason) - Store.clear(selected_player_store,player) - Store.clear(selected_action_store,player) + reason_callback(player, reason) + Store.clear(selected_player_store, player) + Store.clear(selected_action_store, player) element.parent.entry.text = '' end) --- Set of elements that are used to make up a row of the player table -- @element add_player_base local add_player_base = -Gui.element(function(event_trigger,parent,player_data) +Gui.element(function(event_trigger, parent, player_data) -- Add the button to open the action bar local toggle_action_bar_flow = parent.add{ type = 'flow', name = player_data.name } open_action_bar(toggle_action_bar_flow) @@ -99,13 +100,13 @@ Gui.element(function(event_trigger,parent,player_data) type = 'label', name = event_trigger, caption = player_data.name, - tooltip = {'player-list.open-map',player_data.name,player_data.tag,player_data.role_name} + tooltip = {'player-list.open-map', player_data.name, player_data.tag, player_data.role_name} } - player_name.style.padding = {0,2,0,0} + player_name.style.padding = {0, 2,0, 0} player_name.style.font_color = player_data.chat_color -- Add the time played label - local alignment = Gui.alignment(parent,'player-time-'..player_data.index) + local alignment = Gui.alignment(parent, 'player-time-'..player_data.index) local time_label = alignment.add{ name = 'label', type = 'label', @@ -116,34 +117,34 @@ Gui.element(function(event_trigger,parent,player_data) return time_label end) -:on_click(function(player,element,event) +:on_click(function(player, element, event) local selected_player_name = element.caption local selected_player = Game.get_player_from_any(selected_player_name) if event.button == defines.mouse_button_type.left then -- LMB will open the map to the selected player local position = selected_player.position - event.player.zoom_to_world(position,1.75) + event.player.zoom_to_world(position, 1.75) else -- RMB will toggle the settings - local old_selected_player_name = Store.get(selected_player_store,player) + local old_selected_player_name = Store.get(selected_player_store, player) if selected_player_name == old_selected_player_name then - Store.clear(selected_player_store,player) - Store.clear(selected_action_store,player) + Store.clear(selected_player_store, player) + Store.clear(selected_action_store, player) else - Store.set(selected_player_store,player,selected_player_name) + Store.set(selected_player_store, player, selected_player_name) end end end) -- Removes the three elements that are added as part of the base -local function remove_player_base(parent,player) +local function remove_player_base(parent, player) Gui.destroy_if_valid(parent[player.name]) Gui.destroy_if_valid(parent['player-name-'..player.index]) Gui.destroy_if_valid(parent['player-time-'..player.index]) end -- Update the time label for a player using there player time data -local function update_player_base(parent,player_time) +local function update_player_base(parent, player_time) local time_element = parent[player_time.element_name] if time_element and time_element.valid then time_element.label.caption = player_time.caption @@ -154,15 +155,15 @@ end --- Adds all the buttons and flows that make up the action bar -- @element add_action_bar local add_action_bar_buttons = -Gui.element(function(_,parent) +Gui.element(function(_, parent) close_action_bar(parent) -- Loop over all the buttons in the config - for action_name,button_data in pairs(config.buttons) do + for action_name, button_data in pairs(config.buttons) do -- Added the permission flow local permission_flow = parent.add{ type = 'flow', name = action_name } permission_flow.visible = false -- Add the buttons under that permission - for _,button in ipairs(button_data) do + for _, button in ipairs(button_data) do button(permission_flow) end end @@ -173,7 +174,7 @@ end) --- Updates the visible state of the action bar buttons local function update_action_bar(element) local player = Gui.get_player_from_element(element) - local selected_player_name = Store.get(selected_player_store,player) + local selected_player_name = Store.get(selected_player_store, player) if not selected_player_name then -- Hide the action bar when no player is selected @@ -184,16 +185,16 @@ local function update_action_bar(element) if not selected_player.connected then -- If the player is offline then reest stores element.visible = false - Store.clear(selected_player_store,player) - Store.clear(selected_action_store,player) + Store.clear(selected_player_store, player) + Store.clear(selected_action_store, player) else -- Otherwise check what actions the player is allowed to use element.visible = true - for action_name,buttons in pairs(config.buttons) do - if buttons.auth and not buttons.auth(player,selected_player) then + for action_name, buttons in pairs(config.buttons) do + if buttons.auth and not buttons.auth(player, selected_player) then element[action_name].visible = false - elseif Roles.player_allowed(player,action_name) then + elseif Roles.player_allowed(player, action_name) then element[action_name].visible = true end end @@ -205,36 +206,36 @@ end --- Main player list container for the left flow -- @element player_list_container local player_list_container = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) -- Draw the internal container - local container = Gui.container(parent,event_trigger,200) + local container = Gui.container(parent, event_trigger, 200) -- Draw the scroll table for the players - local scroll_table = Gui.scroll_table(container,184,3) + local scroll_table = Gui.scroll_table(container, 184, 3) -- Change the style of the scroll table local scroll_table_style = scroll_table.style - scroll_table_style.padding = {1,0,1,2} + scroll_table_style.padding = {1, 0,1, 2} -- Add the action bar - local action_bar = Gui.footer(container,nil,nil,false,'action_bar') + local action_bar = Gui.footer(container, nil, nil, false, 'action_bar') -- Change the style of the action bar local action_bar_style = action_bar.style action_bar_style.height = 35 - action_bar_style.padding = {1,3} + action_bar_style.padding = {1, 3} action_bar.visible = false -- Add the buttons to the action bar add_action_bar_buttons(action_bar) -- Add the reason bar - local reason_bar = Gui.footer(container,nil,nil,false,'reason_bar') + local reason_bar = Gui.footer(container, nil, nil, false, 'reason_bar') -- Change the style of the reason bar local reason_bar_style = reason_bar.style reason_bar_style.height = 35 - reason_bar_style.padding = {-1,3} + reason_bar_style.padding = {-1, 3} reason_bar.visible = false -- Add the text entry for the reason bar @@ -263,15 +264,15 @@ end) --- Button on the top flow used to toggle the player list container -- @element toggle_left_element Gui.left_toolbar_button('entity/character', {'player-list.main-tooltip'}, player_list_container, function(player) - return Roles.player_allowed(player,'gui/player-list') + return Roles.player_allowed(player, 'gui/player-list') end) -- Get caption and tooltip format for a player -local function get_time_formats(online_time,afk_time) +local function get_time_formats(online_time, afk_time) local tick = game.tick > 0 and game.tick or 1 - local percent = math.round(online_time/tick,3)*100 + local percent = math.round(online_time/tick, 3)*100 local caption = format_time(online_time) - local tooltip = {'player-list.afk-time', percent, format_time(afk_time,{minutes=true,long=true})} + local tooltip = {'player-list.afk-time', percent, format_time(afk_time, {minutes=true, long=true})} return caption, tooltip end @@ -297,20 +298,20 @@ end local function get_player_list_order() -- Sort all the online players into roles local players = {} - for _,player in pairs(game.connected_players) do + for _, player in pairs(game.connected_players) do local highest_role = Roles.get_player_highest_role(player) if not players[highest_role.name] then players[highest_role.name] = {} end - table.insert(players[highest_role.name],player) + table.insert(players[highest_role.name], player) end -- Sort the players from roles into a set order local ctn = 0 local player_list_order = {} - for _,role_name in pairs(Roles.config.order) do + for _, role_name in pairs(Roles.config.order) do if players[role_name] then - for _,player in pairs(players[role_name]) do + for _, player in pairs(players[role_name]) do ctn = ctn + 1 -- Add the player data to the array local caption, tooltip = get_time_formats(player.online_time, player.afk_time) @@ -329,8 +330,8 @@ local function get_player_list_order() --[[Adds fake players to the player list for i = 1, 10 do - local online_time = math.random(1,tick) - local afk_time = math.random(online_time-(tick/10),tick) + local online_time = math.random(1, tick) + local afk_time = math.random(online_time-(tick/10), tick) local caption, tooltip = get_time_formats(online_time, afk_time) player_list_order[ctn+i] = { name='Player '..i, @@ -347,29 +348,29 @@ local function get_player_list_order() end --- Update the play times every 30 sections -Event.on_nth_tick(1800,function() +Event.on_nth_tick(1800, function() local player_times = get_player_times() - for _,player in pairs(game.connected_players) do - local frame = Gui.get_left_element(player,player_list_container) + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table - for _,player_time in pairs(player_times) do - update_player_base(scroll_table,player_time) + for _, player_time in pairs(player_times) do + update_player_base(scroll_table, player_time) end end end) --- When a player leaves only remove they entry -Event.add(defines.events.on_player_left_game,function(event) +Event.add(defines.events.on_player_left_game, function(event) local remove_player = Game.get_player_by_index(event.player_index) - for _,player in pairs(game.connected_players) do - local frame = Gui.get_left_element(player,player_list_container) + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table - remove_player_base(scroll_table,remove_player) + remove_player_base(scroll_table, remove_player) - local selected_player_name = Store.get(selected_player_store,player) + local selected_player_name = Store.get(selected_player_store, player) if selected_player_name == remove_player.name then - Store.clear(selected_player_store,player) - Store.clear(selected_action_store,player) + Store.clear(selected_player_store, player) + Store.clear(selected_action_store, player) end end end) @@ -377,27 +378,27 @@ end) --- All other events require a full redraw of the table local function redraw_player_list() local player_list_order = get_player_list_order() - for _,player in pairs(game.connected_players) do - local frame = Gui.get_left_element(player,player_list_container) + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table scroll_table.clear() - for _,next_player_data in ipairs(player_list_order) do - add_player_base(scroll_table,next_player_data) + for _, next_player_data in ipairs(player_list_order) do + add_player_base(scroll_table, next_player_data) end end end -Event.add(defines.events.on_player_joined_game,redraw_player_list) -Event.add(Roles.events.on_role_assigned,redraw_player_list) -Event.add(Roles.events.on_role_unassigned,redraw_player_list) +Event.add(defines.events.on_player_joined_game, redraw_player_list) +Event.add(Roles.events.on_role_assigned, redraw_player_list) +Event.add(Roles.events.on_role_unassigned, redraw_player_list) --- When the action player is changed the action bar will update -Store.watch(selected_player_store,function(value,player_name) +Store.watch(selected_player_store, function(value, player_name) local player = Game.get_player_from_any(player_name) - local frame = Gui.get_left_element(player,player_list_container) + local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table update_action_bar(frame.container.action_bar) - for _,next_player in pairs(game.connected_players) do + for _, next_player in pairs(game.connected_players) do local element = scroll_table[next_player.name][open_action_bar.name] local style = 'frame_button' if next_player.name == value then @@ -412,20 +413,20 @@ Store.watch(selected_player_store,function(value,player_name) end) --- When the action name is changed the reason input will update -Store.watch(selected_action_store,function(value,player_name) +Store.watch(selected_action_store, function(value, player_name) local player = Game.get_player_from_any(player_name) - local frame = Gui.get_left_element(player,player_list_container) + local frame = Gui.get_left_element(player, player_list_container) local element = frame.container.reason_bar if value then -- if there is a new value then check the player is still online - local selected_player_name = Store.get(selected_player_store,player_name) + local selected_player_name = Store.get(selected_player_store, player_name) local selected_player = Game.get_player_from_any(selected_player_name) if selected_player.connected then element.visible = true else -- Clear if the player is offline - Store.clear(selected_player_store,player_name) - Store.clear(selected_action_store,player_name) + Store.clear(selected_player_store, player_name) + Store.clear(selected_action_store, player_name) end else diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index 3f841ecd..8c80ec55 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -12,7 +12,7 @@ local Game = require 'utils.game' --- @dep utils.game local format_time = _C.format_time --- @dep expcore.common local tabs = {} -local function Tab(caption,tooltip,element_define) +local function Tab(caption, tooltip, element_define) tabs[#tabs+1] = {caption, tooltip, element_define} end @@ -23,7 +23,7 @@ local scroll_hieght = 275 -- controls the height of the scrolls --- Sub content area used within the content areas -- @element sub_content local sub_content = -Gui.element(function(_,parent) +Gui.element(function(_, parent) return parent.add{ type = 'frame', direction = 'vertical', @@ -38,7 +38,7 @@ end) --- Table which has a title above it above it -- @element title_table local title_table = -Gui.element(function(_,parent,bar_size,caption,column_count) +Gui.element(function(_, parent, bar_size, caption, column_count) Gui.title_label(parent, bar_size, caption) return parent.add{ @@ -65,15 +65,15 @@ Gui.element{ style = 'scroll_pane_under_subheader' } :style{ - padding = {1,3}, + padding = {1, 3}, maximal_height = scroll_hieght, horizontally_stretchable = true, } --- Content area for the welcome tab -- @element welcome_content -Tab({'readme.welcome-tab'},{'readme.welcome-tooltip'}, -Gui.element(function(_,parent) +Tab({'readme.welcome-tab'}, {'readme.welcome-tooltip'}, +Gui.element(function(_, parent) local server_details = global.server_details or { name='ExpGaming S0 - Local', description='Failed to load description: disconnected from sync api.', reset_time='Non Set', branch='Unknown'} local container = parent.add{ type='flow', direction='vertical' } local player = Gui.get_player_from_element(parent) @@ -93,15 +93,15 @@ Gui.element(function(_,parent) -- Get the names of the roles the player has local player_roles = Roles.get_player_roles(player) local role_names = {} - for i,role in ipairs(player_roles) do + for i, role in ipairs(player_roles) do role_names[i] = role.name end -- Add the other information to the gui container.add{ type='flow' }.style.height = 4 - local online_time = format_time(game.tick,{days=true,hours=true,minutes=true,long=true}) + local online_time = format_time(game.tick, {days=true, hours=true, minutes=true, long=true}) Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-general', server_details.reset_time, online_time}) - Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-roles', table.concat(role_names,', ')}) + Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-roles', table.concat(role_names, ', ')}) Gui.centered_label(sub_content(container), frame_width, {'readme.welcome-chat'}) return container @@ -109,8 +109,8 @@ end)) --- Content area for the rules tab -- @element rules_content -Tab({'readme.rules-tab'},{'readme.rules-tooltip'}, -Gui.element(function(_,parent) +Tab({'readme.rules-tab'}, {'readme.rules-tooltip'}, +Gui.element(function(_, parent) local container = parent.add{ type='flow', direction='vertical' } -- Add the title and description to the content @@ -125,7 +125,7 @@ Gui.element(function(_,parent) rules.style.cell_padding = 4 -- Add the rules to the table - for i = 1,15 do + for i = 1, 15 do Gui.centered_label(rules, 565, {'readme.rules-'..i}) end @@ -134,8 +134,8 @@ end)) --- Content area for the commands tab -- @element commands_content -Tab({'readme.commands-tab'},{'readme.commands-tooltip'}, -Gui.element(function(_,parent) +Tab({'readme.commands-tab'}, {'readme.commands-tooltip'}, +Gui.element(function(_, parent) local container = parent.add{ type='flow', direction='vertical' } local player = Gui.get_player_from_element(parent) @@ -151,7 +151,7 @@ Gui.element(function(_,parent) commands.style.cell_padding = 0 -- Add the rules to the table - for name,command in pairs(Commands.get(player)) do + for name, command in pairs(Commands.get(player)) do Gui.centered_label(commands, 120, name) Gui.centered_label(commands, 450, command.help) end @@ -161,8 +161,8 @@ end)) --- Content area for the servers tab -- @element servers_content -Tab({'readme.servers-tab'},{'readme.servers-tooltip'}, -Gui.element(function(_,parent) +Tab({'readme.servers-tab'}, {'readme.servers-tooltip'}, +Gui.element(function(_, parent) local container = parent.add{ type='flow', direction='vertical' } -- Add the title and description to the content @@ -177,14 +177,14 @@ Gui.element(function(_,parent) -- Add the factorio servers local factorio_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2) - for i = 1,8 do + for i = 1, 8 do Gui.centered_label(factorio_servers, 110, {'readme.servers-'..i}) Gui.centered_label(factorio_servers, 460, {'readme.servers-d'..i}) end -- Add the external links local external_links = title_table(scroll_pane, 235, {'readme.servers-external'}, 2) - for _,key in ipairs{'discord','website','patreon','status','github'} do + for _, key in ipairs{'discord', 'website', 'patreon', 'status', 'github'} do Gui.centered_label(external_links, 110, key:gsub("^%l", string.upper)) Gui.centered_label(external_links, 460, {'links.'..key}, {'readme.servers-open-in-browser'}) end @@ -194,8 +194,8 @@ end)) --- Content area for the servers tab -- @element backers_content -Tab({'readme.backers-tab'},{'readme.backers-tooltip'}, -Gui.element(function(_,parent) +Tab({'readme.backers-tab'}, {'readme.backers-tooltip'}, +Gui.element(function(_, parent) local container = parent.add{ type='flow', direction='vertical' } -- Add the title and description to the content @@ -207,10 +207,10 @@ Gui.element(function(_,parent) -- Find which players will go where local done = {} local groups = { - { _roles={'Senior Administrator','Administrator'}, _title={'readme.backers-management'}, _width=230 }, - { _roles={'Board Member','Senior Backer'}, _title={'readme.backers-board'}, _width=145 }, -- change role to board - { _roles={'Sponsor','Supporter'}, _title={'readme.backers-backers'}, _width=196 }, -- change to backer - { _roles={'Moderator','Trainee'}, _title={'readme.backers-staff'}, _width=235 }, + { _roles={'Senior Administrator', 'Administrator'}, _title={'readme.backers-management'}, _width=230 }, + { _roles={'Board Member', 'Senior Backer'}, _title={'readme.backers-board'}, _width=145 }, -- change role to board + { _roles={'Sponsor', 'Supporter'}, _title={'readme.backers-backers'}, _width=196 }, -- change to backer + { _roles={'Moderator', 'Trainee'}, _title={'readme.backers-staff'}, _width=235 }, { _roles={}, _time=3*3600*60, _title={'readme.backers-active'}, _width=235 }, } @@ -242,12 +242,12 @@ Gui.element(function(_,parent) local scroll_pane = title_table_scroll(container) for _, players in ipairs(groups) do local table = title_table(scroll_pane, players._width, players._title, 4) - for _,player_name in ipairs(players) do + for _, player_name in ipairs(players) do Gui.centered_label(table, 140, player_name) end if #players < 4 then - for i = 1,4-#players do + for i = 1, 4-#players do Gui.centered_label(table, 140) end end @@ -260,7 +260,7 @@ end)) -- @element readme local readme_toggle local readme = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) local container = parent.add{ name = event_trigger, type = 'frame', @@ -269,7 +269,7 @@ Gui.element(function(event_trigger,parent) -- Add the left hand side of the frame back, removed because of frame_tabbed_pane style local left_alignment = Gui.alignment(container, nil, nil, 'bottom') - left_alignment.style.padding = {32,0,0,0} + left_alignment.style.padding = {32, 0,0, 0} local left_side = left_alignment.add{ @@ -288,7 +288,7 @@ Gui.element(function(event_trigger,parent) } -- Add the different content areas - for _,tab_details in ipairs(tabs) do + for _, tab_details in ipairs(tabs) do local tab = tab_pane.add{ type = 'tab', style = 'frame_tab', caption = tab_details[1], tooltip = tab_details[2] } tab_pane.add_tab(tab, tab_details[3](tab_pane)) end @@ -299,7 +299,7 @@ end) local toggle_button = Gui.get_top_element(player, readme_toggle) Gui.toolbar_button_style(toggle_button, true) end) -:on_close(function(player,element) +:on_close(function(player, element) local toggle_button = Gui.get_top_element(player, readme_toggle) Gui.toolbar_button_style(toggle_button, false) Gui.destroy_if_valid(element) @@ -308,10 +308,10 @@ end) --- Toggle button for the readme gui -- @element readme_toggle readme_toggle = -Gui.toolbar_button('virtual-signal/signal-info',{'readme.main-tooltip'},function(player) - return Roles.player_allowed(player,'gui/readme') +Gui.toolbar_button('virtual-signal/signal-info', {'readme.main-tooltip'}, function(player) + return Roles.player_allowed(player, 'gui/readme') end) -:on_click(function(player,_) +:on_click(function(player, _) local center = player.gui.center if center[readme.name] then player.opened = nil @@ -321,7 +321,7 @@ end) end) --- When a player joins the game for the first time show this gui -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) local player = Game.get_player_by_index(event.player_index) local element = readme(player.gui.center) element.pane.selected_tab_index = 1 @@ -329,7 +329,7 @@ Event.add(defines.events.on_player_created,function(event) end) --- When a player joins clear center unless the player has something open -Event.add(defines.events.on_player_joined_game,function(event) +Event.add(defines.events.on_player_joined_game, function(event) local player = Game.get_player_by_index(event.player_index) if not player.opened then player.gui.center.clear() @@ -337,7 +337,7 @@ Event.add(defines.events.on_player_joined_game,function(event) end) --- When a player respawns clear center unless the player has something open -Event.add(defines.events.on_player_respawned,function(event) +Event.add(defines.events.on_player_respawned, function(event) local player = Game.get_player_by_index(event.player_index) if not player.opened then player.gui.center.clear() diff --git a/modules/gui/rocket-info.lua b/modules/gui/rocket-info.lua index a024b578..3a19ef21 100644 --- a/modules/gui/rocket-info.lua +++ b/modules/gui/rocket-info.lua @@ -20,7 +20,7 @@ local time_formats = { } --- Check if a player is allowed to use certain interactions -local function check_player_permissions(player,action) +local function check_player_permissions(player, action) if not config.progress['allow_'..action] then return false end @@ -30,7 +30,7 @@ local function check_player_permissions(player,action) end if config.progress[action..'_role_permission'] - and not Roles.player_allowed(player,config.progress[action..'_role_permission']) then + and not Roles.player_allowed(player, config.progress[action..'_role_permission']) then return false end @@ -46,7 +46,7 @@ Gui.element{ tooltip = {'rocket-info.toggle-rocket-tooltip'} } :style(Gui.sprite_style(16)) -:on_click(function(_,element,_) +:on_click(function(_, element, _) local rocket_silo_name = element.parent.name:sub(8) local rocket_silo = Rockets.get_silo_entity(rocket_silo_name) if rocket_silo.auto_launch then @@ -68,21 +68,21 @@ Gui.element{ sprite = 'utility/center', tooltip = {'rocket-info.launch-tooltip'} } -:style(Gui.sprite_style(16,-1)) -:on_click(function(player,element,_) +:style(Gui.sprite_style(16, -1)) +:on_click(function(player, element, _) local rocket_silo_name = element.parent.name:sub(8) local silo_data = Rockets.get_silo_data_by_name(rocket_silo_name) if silo_data.entity.launch_rocket() then element.enabled = false else - player.print({'rocket-info.launch-failed'},Colors.orange_red) + player.print({'rocket-info.launch-failed'}, Colors.orange_red) end end) --- XY cords that allow zoom to map when pressed -- @element silo_cords local silo_cords = -Gui.element(function(event_trigger,parent,silo_data) +Gui.element(function(event_trigger, parent, silo_data) local silo_name = silo_data.silo_name local pos = silo_data.position local name = config.progress.allow_zoom_to_map and event_trigger or nil @@ -94,13 +94,13 @@ Gui.element(function(event_trigger,parent,silo_data) name = 'label-x-'..silo_name, caption = silo_name } - flow_x.style.padding = {0,2,0,1} + flow_x.style.padding = {0, 2,0, 1} -- Add the x cord label flow_x.add{ type = 'label', name = name, - caption = {'rocket-info.progress-x-pos',pos.x}, + caption = {'rocket-info.progress-x-pos', pos.x}, tooltip = tooltip } @@ -110,32 +110,32 @@ Gui.element(function(event_trigger,parent,silo_data) name = 'label-y-'..silo_name, caption = silo_name } - flow_y.style.padding = {0,2,0,1} + flow_y.style.padding = {0, 2,0, 1} -- Add the y cord label flow_y.add{ type = 'label', name = name, - caption = {'rocket-info.progress-y-pos',pos.y}, + caption = {'rocket-info.progress-y-pos', pos.y}, tooltip = tooltip } end) -:on_click(function(player,element,_) +:on_click(function(player, element, _) local rocket_silo_name = element.parent.caption local rocket_silo = Rockets.get_silo_entity(rocket_silo_name) - player.zoom_to_world(rocket_silo.position,2) + player.zoom_to_world(rocket_silo.position, 2) end) --- Base element for each rocket in the progress list -- @element rocket_entry local rocket_entry = -Gui.element(function(_,parent,silo_data) +Gui.element(function(_, parent, silo_data) local silo_name = silo_data.silo_name local player = Gui.get_player_from_element(parent) -- Add the toggle auto launch if the player is allowed it - if check_player_permissions(player,'toggle_active') then + if check_player_permissions(player, 'toggle_active') then local flow = parent.add{ type = 'flow', name = 'toggle-'..silo_name} local button = toggle_launch(flow) button.tooltip = silo_data.toggle_tooltip @@ -143,17 +143,17 @@ Gui.element(function(_,parent,silo_data) end -- Add the remote launch if the player is allowed it - if check_player_permissions(player,'remote_launch') then + if check_player_permissions(player, 'remote_launch') then local flow = parent.add{ type = 'flow', name = 'launch-'..silo_name} local button = launch_rocket(flow) button.enabled = silo_data.allow_launch end -- Draw the silo cords element - silo_cords(parent,silo_data) + silo_cords(parent, silo_data) -- Add a progress label - local alignment = Gui.alignment(parent,silo_name) + local alignment = Gui.alignment(parent, silo_name) local element = alignment.add{ type = 'label', @@ -169,7 +169,7 @@ end) --- Data label which contains a name and a value label pair -- @element data_label local data_label = -Gui.element(function(_,parent,label_data) +Gui.element(function(_, parent, label_data) local data_name = label_data.name local data_subname = label_data.subname local data_fullname = data_subname and data_name..data_subname or data_name @@ -178,13 +178,13 @@ Gui.element(function(_,parent,label_data) local name_label = parent.add{ type = 'label', name = data_fullname..'-label', - caption = {'rocket-info.data-caption-'..data_name,data_subname}, - tooltip = {'rocket-info.data-tooltip-'..data_name,data_subname} + caption = {'rocket-info.data-caption-'..data_name, data_subname}, + tooltip = {'rocket-info.data-tooltip-'..data_name, data_subname} } - name_label.style.padding = {0,2} + name_label.style.padding = {0, 2} --- Right aligned label to store the data - local alignment = Gui.alignment(parent,data_fullname) + local alignment = Gui.alignment(parent, data_fullname) local element = alignment.add{ type = 'label', @@ -192,17 +192,17 @@ Gui.element(function(_,parent,label_data) caption = label_data.value, tooltip = label_data.tooltip } - element.style.padding = {0,2} + element.style.padding = {0, 2} return element end) -- Used to update the captions and tooltips on the data labels -local function update_data_labels(parent,data_label_data) +local function update_data_labels(parent, data_label_data) for _, label_data in ipairs(data_label_data) do local data_name = label_data.subname and label_data.name..label_data.subname or label_data.name if not parent[data_name] then - data_label(parent,label_data) + data_label(parent, label_data) else local data_label_element = parent[data_name].label data_label_element.tooltip = label_data.tooltip @@ -220,7 +220,7 @@ local function get_progress_data(force_name) if not rocket_silo or not rocket_silo.valid then -- Remove from list if not valid force_silos[silo_data.name] = nil - table.insert(progress_data,{ + table.insert(progress_data, { silo_name = silo_data.name, remove = true }) @@ -228,14 +228,14 @@ local function get_progress_data(force_name) else -- Get the progress caption and tooltip local progress_color = Colors.white - local progress_caption = {'rocket-info.progress-caption',rocket_silo.rocket_parts} - local progress_tooltip = {'rocket-info.progress-tooltip',silo_data.launched or 0} + local progress_caption = {'rocket-info.progress-caption', rocket_silo.rocket_parts} + local progress_tooltip = {'rocket-info.progress-tooltip', silo_data.launched or 0} local status = rocket_silo.status == defines.entity_status.waiting_to_launch_rocket if status and silo_data.awaiting_reset then progress_caption = {'rocket-info.progress-launched'} progress_color = Colors.green elseif status then - progress_caption = {'rocket-info.progress-caption',100} + progress_caption = {'rocket-info.progress-caption', 100} progress_color = Colors.cyan else silo_data.awaiting_reset = false @@ -250,7 +250,7 @@ local function get_progress_data(force_name) end -- Insert the gui data - table.insert(progress_data,{ + table.insert(progress_data, { silo_name = silo_data.name, position = rocket_silo.position, allow_launch = not silo_data.awaiting_reset and status or false, @@ -267,7 +267,7 @@ local function get_progress_data(force_name) end --- Update the build progress section -local function update_build_progress(parent,progress_data) +local function update_build_progress(parent, progress_data) local show_message = true for _, silo_data in ipairs(progress_data) do parent.parent.no_silos.visible = false @@ -285,7 +285,7 @@ local function update_build_progress(parent,progress_data) elseif not progress_label then -- Add the rocket to the list show_message = false - rocket_entry(parent,silo_data) + rocket_entry(parent, silo_data) else show_message = false @@ -323,7 +323,7 @@ local function get_stats_data(force_name) -- Format the first launch data if config.stats.show_first_rocket then local value = stats.first_launch or 0 - table.insert(stats_data,{ + table.insert(stats_data, { name = 'first-launch', value = time_formats.caption_hours(value), tooltip = time_formats.tooltip_hours(value) @@ -333,7 +333,7 @@ local function get_stats_data(force_name) -- Format the last launch data if config.stats.show_last_rocket then local value = stats.last_launch or 0 - table.insert(stats_data,{ + table.insert(stats_data, { name = 'last-launch', value = time_formats.caption_hours(value), tooltip = time_formats.tooltip_hours(value) @@ -343,7 +343,7 @@ local function get_stats_data(force_name) -- Format fastest launch data if config.stats.show_fastest_rocket then local value = stats.fastest_launch or 0 - table.insert(stats_data,{ + table.insert(stats_data, { name = 'fastest-launch', value = time_formats.caption_hours(value), tooltip = time_formats.tooltip_hours(value) @@ -354,18 +354,18 @@ local function get_stats_data(force_name) if config.stats.show_total_rockets then local total_rockets = Rockets.get_game_rocket_count() total_rockets = total_rockets == 0 and 1 or total_rockets - local percentage = math.round(force_rockets/total_rockets,3)*100 - table.insert(stats_data,{ + local percentage = math.round(force_rockets/total_rockets, 3)*100 + table.insert(stats_data, { name = 'total-rockets', value = force_rockets, - tooltip = {'rocket-info.value-tooltip-total-rockets',percentage} + tooltip = {'rocket-info.value-tooltip-total-rockets', percentage} }) end -- Format game avg data if config.stats.show_game_avg then local avg = force_rockets > 0 and math.floor(game.tick/force_rockets) or 0 - table.insert(stats_data,{ + table.insert(stats_data, { name = 'avg-launch', value = time_formats.caption(avg), tooltip = time_formats.tooltip(avg) @@ -373,9 +373,9 @@ local function get_stats_data(force_name) end -- Format rolling avg data - for _,avg_over in pairs(config.stats.rolling_avg) do - local avg = Rockets.get_rolling_average(force_name,avg_over) - table.insert(stats_data,{ + for _, avg_over in pairs(config.stats.rolling_avg) do + local avg = Rockets.get_rolling_average(force_name, avg_over) + table.insert(stats_data, { name = 'avg-launch-n', subname = avg_over, value = time_formats.caption(avg), @@ -392,17 +392,17 @@ local function get_milestone_data(force_name) local force_rockets = Rockets.get_rocket_count(force_name) local milestone_data = {} - for _,milestone in ipairs(config.milestones) do + for _, milestone in ipairs(config.milestones) do if milestone <= force_rockets then - local time = Rockets.get_rocket_time(force_name,milestone) - table.insert(milestone_data,{ + local time = Rockets.get_rocket_time(force_name, milestone) + table.insert(milestone_data, { name = 'milestone-n', subname = milestone, value = time_formats.caption_hours(time), tooltip = time_formats.tooltip_hours(time) }) else - table.insert(milestone_data,{ + table.insert(milestone_data, { name = 'milestone-n', subname = milestone, value = {'rocket-info.data-caption-milestone-next'}, @@ -425,7 +425,7 @@ Gui.element{ tooltip = {'rocket-info.toggle-section-tooltip'} } :style(Gui.sprite_style(20)) -:on_click(function(_,element,_) +:on_click(function(_, element, _) local header_flow = element.parent local flow_name = header_flow.caption local flow = header_flow.parent.parent[flow_name] @@ -443,7 +443,7 @@ end) -- Draw a section header and main scroll -- @element rocket_list_container local section = -Gui.element(function(_,parent,section_name,table_size) +Gui.element(function(_, parent, section_name, table_size) -- Draw the header for the section local header = Gui.header( parent, @@ -458,7 +458,7 @@ Gui.element(function(_,parent,section_name,table_size) toggle_section(header) -- Table used to store the data - local scroll_table = Gui.scroll_table(parent,215,table_size,section_name) + local scroll_table = Gui.scroll_table(parent, 215, table_size, section_name) scroll_table.parent.visible = false -- Return the flow table @@ -468,9 +468,9 @@ end) --- Main gui container for the left flow -- @element rocket_list_container local rocket_list_container = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) -- Draw the internal container - local container = Gui.container(parent,event_trigger,200) + local container = Gui.container(parent, event_trigger, 200) -- Set the container style local style = container.style @@ -480,27 +480,27 @@ Gui.element(function(event_trigger,parent) local force_name = player.force.name -- Draw stats section if config.stats.show_stats then - update_data_labels(section(container,'stats',2),get_stats_data(force_name)) + update_data_labels(section(container, 'stats', 2), get_stats_data(force_name)) end -- Draw milestones section if config.milestones.show_milestones then - update_data_labels(section(container,'milestones',2),get_milestone_data(force_name)) + update_data_labels(section(container, 'milestones', 2), get_milestone_data(force_name)) end -- Draw build progress list if config.progress.show_progress then local col_count = 3 - if check_player_permissions(player,'remote_launch') then col_count = col_count+1 end - if check_player_permissions(player,'toggle_active') then col_count = col_count+1 end - local progress = section(container,'progress',col_count) + if check_player_permissions(player, 'remote_launch') then col_count = col_count+1 end + if check_player_permissions(player, 'toggle_active') then col_count = col_count+1 end + local progress = section(container, 'progress', col_count) -- Label used when there are no active silos local no_silos = progress.parent.add{ type = 'label', name = 'no_silos', caption = {'rocket-info.progress-no-silos'} } - no_silos.style.padding = {1,2} + no_silos.style.padding = {1, 2} update_build_progress(progress, get_progress_data(force_name)) end @@ -508,13 +508,13 @@ Gui.element(function(event_trigger,parent) return container.parent end) :add_to_left_flow(function(player) - return player.force.rockets_launched > 0 and Roles.player_allowed(player,'gui/rocket-info') + return player.force.rockets_launched > 0 and Roles.player_allowed(player, 'gui/rocket-info') end) --- Button on the top flow used to toggle the container -- @element toggle_left_element Gui.left_toolbar_button('entity/rocket-silo', {'rocket-info.main-tooltip'}, rocket_list_container, function(player) - return Roles.player_allowed(player,'gui/rocket-info') + return Roles.player_allowed(player, 'gui/rocket-info') end) --- Update the gui for all players on a force @@ -522,21 +522,21 @@ local function update_rocket_gui_all(force_name) local stats = get_stats_data(force_name) local milestones = get_milestone_data(force_name) local progress = get_progress_data(force_name) - for _,player in pairs(game.forces[force_name].players) do - local frame = Gui.get_left_element(player,rocket_list_container) + for _, player in pairs(game.forces[force_name].players) do + local frame = Gui.get_left_element(player, rocket_list_container) local container = frame.container - update_data_labels(container.stats.table,stats) - update_data_labels(container.milestones.table,milestones) - update_build_progress(container.progress.table,progress) + update_data_labels(container.stats.table, stats) + update_data_labels(container.milestones.table, milestones) + update_build_progress(container.progress.table, progress) end end --- Event used to update the stats when a rocket is launched -Event.add(defines.events.on_rocket_launched,function(event) +Event.add(defines.events.on_rocket_launched, function(event) local force = event.rocket_silo.force update_rocket_gui_all(force.name) if force.rockets_launched == 1 then - for _,player in pairs(force.players) do + for _, player in pairs(force.players) do Gui.update_top_flow(player) end end @@ -545,23 +545,23 @@ end) --- Update only the progress gui for a force local function update_rocket_gui_progress(force_name) local progress = get_progress_data(force_name) - for _,player in pairs(game.forces[force_name].players) do - local frame = Gui.get_left_element(player,rocket_list_container) + for _, player in pairs(game.forces[force_name].players) do + local frame = Gui.get_left_element(player, rocket_list_container) local container = frame.container - update_build_progress(container.progress.table,progress) + update_build_progress(container.progress.table, progress) end end --- Event used to set a rocket silo to be awaiting reset -Event.add(defines.events.on_rocket_launch_ordered,function(event) +Event.add(defines.events.on_rocket_launch_ordered, function(event) local silo = event.rocket_silo local silo_data = Rockets.get_silo_data(silo) silo_data.awaiting_reset = true update_rocket_gui_progress(silo.force.name) end) -Event.on_nth_tick(150,function() - for _,force in pairs(game.forces) do +Event.on_nth_tick(150, function() + for _, force in pairs(game.forces) do if #Rockets.get_silos(force.name) > 0 then update_rocket_gui_progress(force.name) end @@ -576,20 +576,20 @@ local function on_built(event) end end -Event.add(defines.events.on_built_entity,on_built) -Event.add(defines.events.on_robot_built_entity,on_built) +Event.add(defines.events.on_built_entity, on_built) +Event.add(defines.events.on_robot_built_entity, on_built) --- Redraw the progress section on role change local function role_update_event(event) if not config.progress.show_progress then return end local player = game.players[event.player_index] - local container = Gui.get_left_element(player,rocket_list_container).container + local container = Gui.get_left_element(player, rocket_list_container).container local progress_scroll = container.progress Gui.destroy_if_valid(progress_scroll.table) local col_count = 3 - if check_player_permissions(player,'remote_launch') then col_count = col_count+1 end - if check_player_permissions(player,'toggle_active') then col_count = col_count+1 end + if check_player_permissions(player, 'remote_launch') then col_count = col_count+1 end + if check_player_permissions(player, 'toggle_active') then col_count = col_count+1 end local progress = progress_scroll.add{ type = 'table', name = 'table', @@ -599,7 +599,7 @@ local function role_update_event(event) update_build_progress(progress, get_progress_data(player.force.name)) end -Event.add(Roles.events.on_role_assigned,role_update_event) -Event.add(Roles.events.on_role_unassigned,role_update_event) +Event.add(Roles.events.on_role_assigned, role_update_event) +Event.add(Roles.events.on_role_unassigned, role_update_event) return rocket_list_container \ No newline at end of file diff --git a/modules/gui/science-info.lua b/modules/gui/science-info.lua index da43c749..b341268e 100644 --- a/modules/gui/science-info.lua +++ b/modules/gui/science-info.lua @@ -11,19 +11,19 @@ local config = require 'config.gui.science' --- @dep config.gui.science local Production = require 'modules.control.production' --- @dep modules.control.production local format_time = _C.format_time --- @dep expcore.common -local null_time_short = {'science-info.eta-time',format_time(0,{hours=true,minutes=true,seconds=true,time=true,null=true})} -local null_time_long = format_time(0,{hours=true,minutes=true,seconds=true,long=true,null=true}) +local null_time_short = {'science-info.eta-time', format_time(0, {hours=true, minutes=true, seconds=true, time=true, null=true})} +local null_time_long = format_time(0, {hours=true, minutes=true, seconds=true, long=true, null=true}) --- Data label that contains the value and the surfix -- @element production_label local production_label = -Gui.element(function(_,parent,production_label_data) +Gui.element(function(_, parent, production_label_data) local name = production_label_data.name local tooltip = production_label_data.tooltip local color = production_label_data.color -- Add an alignment for the number - local alignment = Gui.alignment(parent,name) + local alignment = Gui.alignment(parent, name) -- Add the main value label local element = @@ -42,7 +42,7 @@ Gui.element(function(_,parent,production_label_data) parent.add{ name = 'surfix-'..name, type = 'label', - caption = {'science-info.unit',production_label_data.surfix}, + caption = {'science-info.unit', production_label_data.surfix}, tooltip = tooltip } @@ -56,9 +56,9 @@ Gui.element(function(_,parent,production_label_data) end) -- Get the data that is used with the production label -local function get_production_label_data(name,tooltip,value,secondary) +local function get_production_label_data(name, tooltip, value, secondary) local data_colour = Production.get_color(config.color_clamp, value, secondary) - local surfix,caption = Production.format_number(value) + local surfix, caption = Production.format_number(value) return { name = name, @@ -70,20 +70,20 @@ local function get_production_label_data(name,tooltip,value,secondary) end -- Updates a prodution label to match the current data -local function update_production_label(parent,production_label_data) +local function update_production_label(parent, production_label_data) local name = production_label_data.name local tooltip = production_label_data.tooltip local color = production_label_data.color -- Update the production label - local production_label_element = parent[name] and parent[name].label or production_label(parent,production_label_data) + local production_label_element = parent[name] and parent[name].label or production_label(parent, production_label_data) production_label_element.caption = production_label_data.caption production_label_element.tooltip = production_label_data.tooltip production_label_element.style.font_color = color -- Update the surfix label local surfix_element = parent['surfix-'..name] - surfix_element.caption = {'science-info.unit',production_label_data.surfix} + surfix_element.caption = {'science-info.unit', production_label_data.surfix} surfix_element.tooltip = tooltip surfix_element.style.font_color = color @@ -92,7 +92,7 @@ end --- Adds 4 elements that show the data for a science pack -- @element science_pack_base local science_pack_base = -Gui.element(function(_,parent,science_pack_data) +Gui.element(function(_, parent, science_pack_data) local science_pack = science_pack_data.science_pack -- Draw the icon for the science pack @@ -110,7 +110,7 @@ Gui.element(function(_,parent,science_pack_data) local pack_icon_style = pack_icon.style pack_icon_style.height = 55 if icon_style == 'quick_bar_slot_button' then - pack_icon_style.padding = {0,-2} + pack_icon_style.padding = {0, -2} pack_icon_style.width = 36 end @@ -121,7 +121,7 @@ Gui.element(function(_,parent,science_pack_data) type = 'frame', style = 'bordered_frame' } - delta_flow.style.padding = {0,3} + delta_flow.style.padding = {0, 3} -- Draw the delta flow table local delta_table = @@ -133,15 +133,15 @@ Gui.element(function(_,parent,science_pack_data) delta_table.style.padding = 0 -- Draw the production labels - update_production_label(delta_table,science_pack_data.positive) - update_production_label(delta_table,science_pack_data.negative) - update_production_label(parent,science_pack_data.net) + update_production_label(delta_table, science_pack_data.positive) + update_production_label(delta_table, science_pack_data.negative) + update_production_label(parent, science_pack_data.net) -- Return the pack icon return pack_icon end) -local function get_science_pack_data(player,science_pack) +local function get_science_pack_data(player, science_pack) local force = player.force -- Check that some packs have been made @@ -186,28 +186,28 @@ local function get_science_pack_data(player,science_pack) end -local function update_science_pack(pack_table,science_pack_data) +local function update_science_pack(pack_table, science_pack_data) if not science_pack_data then return end local science_pack = science_pack_data.science_pack pack_table.parent.non_made.visible = false -- Update the icon - local pack_icon = pack_table['icon-'..science_pack] or science_pack_base(pack_table,science_pack_data) + local pack_icon = pack_table['icon-'..science_pack] or science_pack_base(pack_table, science_pack_data) local icon_style = science_pack_data.icon_style pack_icon.style = icon_style local pack_icon_style = pack_icon.style pack_icon_style.height = 55 if icon_style == 'quick_bar_slot_button' then - pack_icon_style.padding = {0,-2} + pack_icon_style.padding = {0, -2} pack_icon_style.width = 36 end -- Update the production labels local delta_table = pack_table['delta-'..science_pack].table - update_production_label(delta_table,science_pack_data.positive) - update_production_label(delta_table,science_pack_data.negative) - update_production_label(pack_table,science_pack_data.net) + update_production_label(delta_table, science_pack_data.positive) + update_production_label(delta_table, science_pack_data.negative) + update_production_label(pack_table, science_pack_data.net) end @@ -226,7 +226,7 @@ local function get_eta_label_data(player) local remaining = research.research_unit_count*(1-progress) -- Check for the limiting science pack - for _,ingredient in pairs(research.research_unit_ingredients) do + for _, ingredient in pairs(research.research_unit_ingredients) do local pack_name = ingredient.name local required = ingredient.amount * remaining local time = Production.get_consumsion_eta(force, pack_name, defines.flow_precision_index.one_minute, required) @@ -238,14 +238,14 @@ local function get_eta_label_data(player) -- Return the caption and tooltip return limit and limit > 0 and { research = true, - caption = format_time(limit,{hours=true,minutes=true,seconds=true,time=true}), - tooltip = format_time(limit,{hours=true,minutes=true,seconds=true,long=true}) + caption = format_time(limit, {hours=true, minutes=true, seconds=true, time=true}), + tooltip = format_time(limit, {hours=true, minutes=true, seconds=true, long=true}) } or { research = false } end -- Updates the eta label -local function update_eta_label(element,eta_label_data) +local function update_eta_label(element, eta_label_data) -- If no research selected show null if not eta_label_data.research then element.caption = null_time_short @@ -254,24 +254,24 @@ local function update_eta_label(element,eta_label_data) end -- Update the element - element.caption = {'science-info.eta-time',eta_label_data.caption} + element.caption = {'science-info.eta-time', eta_label_data.caption} element.tooltip = eta_label_data.tooltip end --- Main task list container for the left flow -- @element task_list_container local science_info_container = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) local player = Gui.get_player_from_element(parent) -- Draw the internal container - local container = Gui.container(parent,event_trigger,200) + local container = Gui.container(parent, event_trigger, 200) -- Draw the header Gui.header(container, {'science-info.main-caption'}, {'science-info.main-tooltip'}) -- Draw the scroll table for the tasks - local scroll_table = Gui.scroll_table(container,178,4) + local scroll_table = Gui.scroll_table(container, 178, 4) -- Draw the no packs label local no_packs_label = @@ -283,7 +283,7 @@ Gui.element(function(event_trigger,parent) -- Change the style of the no packs label local no_packs_style = no_packs_label.style - no_packs_style.padding = {2,4} + no_packs_style.padding = {2, 4} no_packs_style.single_line = false no_packs_style.width = 200 @@ -303,13 +303,13 @@ Gui.element(function(event_trigger,parent) } -- Update the eta - update_eta_label(eta_label,get_eta_label_data(player)) + update_eta_label(eta_label, get_eta_label_data(player)) end -- Add packs which have been made - for _,science_pack in ipairs(config) do - update_science_pack(scroll_table,get_science_pack_data(player,science_pack)) + for _, science_pack in ipairs(config) do + update_science_pack(scroll_table, get_science_pack_data(player, science_pack)) end -- Return the exteral container @@ -320,16 +320,16 @@ end) --- Button on the top flow used to toggle the task list container -- @element toggle_left_element Gui.left_toolbar_button('entity/lab', {'science-info.main-tooltip'}, science_info_container, function(player) - return Roles.player_allowed(player,'gui/science-info') + return Roles.player_allowed(player, 'gui/science-info') end) --- Updates the gui every 1 second -Event.on_nth_tick(60,function() +Event.on_nth_tick(60, function() local force_pack_data = {} local force_eta_data = {} - for _,player in pairs(game.connected_players) do + for _, player in pairs(game.connected_players) do local force_name = player.force.name - local frame = Gui.get_left_element(player,science_info_container) + local frame = Gui.get_left_element(player, science_info_container) local container = frame.container -- Update the science packs @@ -339,16 +339,16 @@ Event.on_nth_tick(60,function() -- No data in chache so it needs to be generated pack_data = {} force_pack_data[force_name] = pack_data - for _,science_pack in ipairs(config) do - local next_data = get_science_pack_data(player,science_pack) + for _, science_pack in ipairs(config) do + local next_data = get_science_pack_data(player, science_pack) pack_data[science_pack] = next_data - update_science_pack(scroll_table,next_data) + update_science_pack(scroll_table, next_data) end else -- Data found in chache is no need to generate it - for _,next_data in ipairs(pack_data) do - update_science_pack(scroll_table,next_data) + for _, next_data in ipairs(pack_data) do + update_science_pack(scroll_table, next_data) end end @@ -361,11 +361,11 @@ Event.on_nth_tick(60,function() -- No data in chache so it needs to be generated eta_data = get_eta_label_data(player) force_eta_data[force_name] = eta_data - update_eta_label(eta_label,eta_data) + update_eta_label(eta_label, eta_data) else -- Data found in chache is no need to generate it - update_eta_label(eta_label,eta_data) + update_eta_label(eta_label, eta_data) end diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index 29ca6542..901c0816 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -21,8 +21,8 @@ Gui.element{ --- Toggles if the server ups is visbile -- @command server-ups -Commands.new_command('server-ups','Toggle the server ups display') -:add_alias('sups','ups') +Commands.new_command('server-ups', 'Toggle the server ups display') +:add_alias('sups', 'ups') :register(function(player) local label = player.gui.screen[server_ups.name] if not global.ext or not global.ext.server_ups then @@ -42,7 +42,7 @@ local function set_location(event) end -- Draw the label when the player joins -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) local player = game.players[event.player_index] local label = server_ups(player.gui.screen) label.visible = false @@ -50,15 +50,15 @@ Event.add(defines.events.on_player_created,function(event) end) -- Update the caption for all online players -Event.on_nth_tick(60,function() +Event.on_nth_tick(60, function() if global.ext and global.ext.server_ups then local caption = 'SUPS = '..global.ext.server_ups - for _,player in pairs(game.connected_players) do + for _, player in pairs(game.connected_players) do player.gui.screen[server_ups.name].caption = caption end end end) -- Update when res or ui scale changes -Event.add(defines.events.on_player_display_resolution_changed,set_location) -Event.add(defines.events.on_player_display_scale_changed,set_location) \ No newline at end of file +Event.add(defines.events.on_player_display_resolution_changed, set_location) +Event.add(defines.events.on_player_display_scale_changed, set_location) \ No newline at end of file diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index a346bfe9..b450a23e 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -18,7 +18,7 @@ local Styles = { } --- If a player is allowed to use the edit buttons -local function check_player_permissions(player,task) +local function check_player_permissions(player, task) if task then -- When a task is given check if the player can edit it local allow_edit_task = config.allow_edit_task @@ -34,7 +34,7 @@ local function check_player_permissions(player,task) elseif allow_edit_task == 'admin' then return player.admin elseif allow_edit_task == 'expcore.roles' then - return Roles.player_allowed(player,config.expcore_roles_allow_edit_task) + return Roles.player_allowed(player, config.expcore_roles_allow_edit_task) end -- Return false as all other condidtions have not been met @@ -49,7 +49,7 @@ local function check_player_permissions(player,task) elseif allow_add_task == 'admin' then return player.admin elseif allow_add_task == 'expcore.roles' then - return Roles.player_allowed(player,config.expcore_roles_allow_add_task) + return Roles.player_allowed(player, config.expcore_roles_allow_add_task) end -- Return false as all other condidtions have not been met @@ -67,8 +67,8 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(player,_,_) - Tasks.add_task(player.force.name,nil,player.name) +:on_click(function(player, _,_) + Tasks.add_task(player.force.name, nil, player.name) end) --- Button displayed next to tasks which the user is can edit, used to start editing a task @@ -81,9 +81,9 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(player,element,_) +:on_click(function(player, element, _) local task_id = element.parent.name:sub(6) - Tasks.set_editing(task_id,player.name,true) + Tasks.set_editing(task_id, player.name, true) end) --- Button displayed next to tasks which the user is can edit, used to delete a task from the list @@ -96,7 +96,7 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(_,element,_) +:on_click(function(_, element, _) local task_id = element.parent.name:sub(6) Tasks.remove_task(task_id) end) @@ -104,7 +104,7 @@ end) --- Set of three elements which make up each row of the task table -- @element add_task_base local add_task_base = -Gui.element(function(_,parent,task_id) +Gui.element(function(_, parent, task_id) -- Add the task number label local task_number = parent.add{ name = 'count-'..task_id, @@ -118,7 +118,7 @@ Gui.element(function(_,parent,task_id) task_flow.style.padding = 0 -- Add the two edit buttons outside the task flow - local edit_flow = Gui.alignment(parent,'edit-'..task_id) + local edit_flow = Gui.alignment(parent, 'edit-'..task_id) edit_task(edit_flow) discard_task(edit_flow) @@ -127,7 +127,7 @@ Gui.element(function(_,parent,task_id) end) -- Removes the three elements that are added as part of the task base -local function remove_task_base(parent,task_id) +local function remove_task_base(parent, task_id) Gui.destroy_if_valid(parent['count-'..task_id]) Gui.destroy_if_valid(parent['edit-'..task_id]) Gui.destroy_if_valid(parent[task_id]) @@ -144,11 +144,11 @@ Gui.element{ style = 'shortcut_bar_button_green' } :style(Styles.sprite22) -:on_click(function(player,element,_) +:on_click(function(player, element, _) local task_id = element.parent.name local new_message = element.parent[task_editing.name].text - Tasks.set_editing(task_id,player.name) - Tasks.update_task(task_id,new_message,player.name) + Tasks.set_editing(task_id, player.name) + Tasks.update_task(task_id, new_message, player.name) end) --- Button displayed next to tasks which the user is currently editing, used to discard changes @@ -161,15 +161,15 @@ Gui.element{ style = 'shortcut_bar_button_red' } :style(Styles.sprite22) -:on_click(function(player,element,_) +:on_click(function(player, element, _) local task_id = element.parent.name - Tasks.set_editing(task_id,player.name) + Tasks.set_editing(task_id, player.name) end) --- Editing state for a task, contrins a text field and the two edit buttons -- @element task_editing task_editing = -Gui.element(function(event_trigger,parent,task) +Gui.element(function(event_trigger, parent, task) local message = task.message -- Draw the element @@ -192,17 +192,17 @@ end) maximal_width = 110, height = 20 } -:on_confirmed(function(player,element,_) +:on_confirmed(function(player, element, _) local task_id = element.parent.name local new_message = element.text - Tasks.set_editing(task_id,player.name) - Tasks.update_task(task_id,new_message,player.name) + Tasks.set_editing(task_id, player.name) + Tasks.update_task(task_id, new_message, player.name) end) --- Default state for a task, contains only a label with the task message -- @element task_label local task_label = -Gui.element(function(_,parent,task) +Gui.element(function(_, parent, task) local message = task.message local last_edit_name = task.last_edit_name local last_edit_time = task.last_edit_time @@ -220,7 +220,7 @@ end) } --- Updates a task for a player -local function update_task(player,task_table,task_id) +local function update_task(player, task_table, task_id) local task = Tasks.get_task(task_id) local task_ids = Tasks.get_force_task_ids(player.force.name) local task_number = table.get_index(task_ids, task_id) @@ -228,18 +228,18 @@ local function update_task(player,task_table,task_id) -- Task no longer exists so should be removed from the list if not task then task_table.parent.no_tasks.visible = #task_ids == 0 - remove_task_base(task_table,task_id) + remove_task_base(task_table, task_id) return end -- Get the task flow for this task - local task_flow = task_table[task_id] or add_task_base(task_table,task_id) + local task_flow = task_table[task_id] or add_task_base(task_table, task_id) task_table.parent.no_tasks.visible = false task_table['count-'..task_id].caption = task_number..')' -- Update the edit flow local edit_flow = task_table['edit-'..task_id] - local player_allowed_edit = check_player_permissions(player,task) + local player_allowed_edit = check_player_permissions(player, task) local players_editing = table.get_keys(task.curently_editing) local edit_task_element = edit_flow[edit_task.name] local discard_task_element = edit_flow[discard_task.name] @@ -248,14 +248,14 @@ local function update_task(player,task_table,task_id) discard_task_element.visible = player_allowed_edit if #players_editing > 0 then edit_task_element.hovered_sprite = 'utility/warning_icon' - edit_task_element.tooltip = {'task-list.edit-tooltip',table.concat(players_editing,', ')} + edit_task_element.tooltip = {'task-list.edit-tooltip', table.concat(players_editing, ', ')} else edit_task_element.hovered_sprite = edit_task_element.sprite edit_task_element.tooltip = {'task-list.edit-tooltip-none'} end -- Check if the player is was editing and/or currently editing - local task_entry = task_flow[task_editing.name] or task_label(task_flow,task) + local task_entry = task_flow[task_editing.name] or task_label(task_flow, task) local player_was_editing = task_entry.type == 'textfield' local player_is_editing = task.curently_editing[player.name] @@ -272,24 +272,24 @@ local function update_task(player,task_table,task_id) -- Player was editing but is no longer, remove text field and add label edit_task_element.enabled = true task_flow.clear() - task_label(task_flow,task) + task_label(task_flow, task) elseif not player_was_editing and player_is_editing then -- Player was not editing but now is, remove label and add text field edit_task_element.enabled = false task_flow.clear() - task_editing(task_flow,task).focus() - task_table.parent.scroll_to_element(task_flow,'top-third') + task_editing(task_flow, task).focus() + task_table.parent.scroll_to_element(task_flow, 'top-third') end end -- Update all the tasks for a player -local function update_all_tasks(player,scroll_table) +local function update_all_tasks(player, scroll_table) local task_ids = Tasks.get_force_task_ids(player.force.name) if #task_ids > 0 then - for _,task_id in ipairs(task_ids) do - update_task(player,scroll_table,task_id) + for _, task_id in ipairs(task_ids) do + update_task(player, scroll_table, task_id) end end end @@ -297,9 +297,9 @@ end --- Main task list container for the left flow -- @element task_list_container local task_list_container = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) -- Draw the internal container - local container = Gui.container(parent,event_trigger,200) + local container = Gui.container(parent, event_trigger, 200) -- Draw the header local header = Gui.header( @@ -315,7 +315,7 @@ Gui.element(function(event_trigger,parent) add_new_task_element.visible = check_player_permissions(player) -- Draw the scroll table for the tasks - local scroll_table = Gui.scroll_table(container,190,3) + local scroll_table = Gui.scroll_table(container, 190, 3) scroll_table.draw_horizontal_lines = true scroll_table.vertical_centering = false @@ -334,7 +334,7 @@ Gui.element(function(event_trigger,parent) -- Change the style of the no tasks label local no_tasks_style = no_tasks_label.style - no_tasks_style.padding = {2,4} + no_tasks_style.padding = {2, 4} no_tasks_style.single_line = false no_tasks_style.width = 200 @@ -342,8 +342,8 @@ Gui.element(function(event_trigger,parent) local task_ids = Tasks.get_force_task_ids(player.force.name) if #task_ids > 0 then no_tasks_label.visible = false - for _,task_id in ipairs(task_ids) do - update_task(player,scroll_table,task_id) + for _, task_id in ipairs(task_ids) do + update_task(player, scroll_table, task_id) end end @@ -358,11 +358,11 @@ end) --- Button on the top flow used to toggle the task list container -- @element toggle_left_element Gui.left_toolbar_button('utility/not_enough_repair_packs_icon', {'task-list.main-tooltip'}, task_list_container, function(player) - return Roles.player_allowed(player,'gui/task-list') + return Roles.player_allowed(player, 'gui/task-list') end) --- When a new task is added it will udpate the task list for everyone on that force -Tasks.on_update(function(task,task_id,removed_task) +Tasks.on_update(function(task, task_id, removed_task) -- Get the force to update, task is nil when removed local force if task then @@ -373,12 +373,12 @@ Tasks.on_update(function(task,task_id,removed_task) -- Update the task for all the players on the force local task_ids = Tasks.get_force_task_ids(force.name) - for _,player in pairs(force.connected_players) do - local frame = Gui.get_left_element(player,task_list_container) + for _, player in pairs(force.connected_players) do + local frame = Gui.get_left_element(player, task_list_container) local scroll_table = frame.container.scroll.table -- Update the task that was changed - update_task(player,scroll_table,task_id) + update_task(player, scroll_table, task_id) -- Update the numbering of the other tasks if the task was removed if not task then @@ -391,26 +391,26 @@ Tasks.on_update(function(task,task_id,removed_task) end) --- Update the tasks when the player joins -Event.add(defines.events.on_player_joined_game,function(event) +Event.add(defines.events.on_player_joined_game, function(event) local player = game.players[event.player_index] - local frame = Gui.get_left_element(player,task_list_container) + local frame = Gui.get_left_element(player, task_list_container) local scroll_table = frame.container.scroll.table - update_all_tasks(player,scroll_table) + update_all_tasks(player, scroll_table) end) --- Makes sure the right buttons are present when roles change local function role_update_event(event) local player = game.players[event.player_index] - local container = Gui.get_left_element(player,task_list_container).container + local container = Gui.get_left_element(player, task_list_container).container -- Update the tasks, incase the user can now edit them local scroll_table = container.scroll.table - update_all_tasks(player,scroll_table) + update_all_tasks(player, scroll_table) -- Update the new task button incase the user can now add them local add_new_task_element = container.header.alignment[add_new_task.name] add_new_task_element.visible = check_player_permissions(player) end -Event.add(Roles.events.on_role_assigned,role_update_event) -Event.add(Roles.events.on_role_unassigned,role_update_event) \ No newline at end of file +Event.add(Roles.events.on_role_assigned, role_update_event) +Event.add(Roles.events.on_role_unassigned, role_update_event) \ No newline at end of file diff --git a/modules/gui/warp-list.lua b/modules/gui/warp-list.lua index 6f25fac1..3f7aa51a 100644 --- a/modules/gui/warp-list.lua +++ b/modules/gui/warp-list.lua @@ -27,7 +27,7 @@ end) -- Table that stores a boolean value of weather to keep the warp gui open local keep_gui_open = {} -Global.register(keep_gui_open,function(tbl) +Global.register(keep_gui_open, function(tbl) keep_gui_open = tbl end) @@ -40,7 +40,7 @@ local Styles = { --- Returns if a player is allowed to edit the given warp --- If a player is allowed to use the edit buttons -local function check_player_permissions(player,action,warp) +local function check_player_permissions(player, action, warp) -- Check if the action is allow edit and then check bypass settings if action == 'allow_edit_warp' then -- Check if the warp is the spawn then it cant be edited @@ -62,7 +62,7 @@ local function check_player_permissions(player,action,warp) elseif action_config == 'admin' then return player.admin elseif action_config == 'expcore.roles' then - return Roles.player_allowed(player,config['expcore_roles_'..action]) + return Roles.player_allowed(player, config['expcore_roles_'..action]) end -- Return false as all other condidtions have not been met @@ -79,12 +79,12 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(player,_) +:on_click(function(player, _) -- Add the new warp local force_name = player.force.name local surface = player.surface local position = player.position - local warp_id = Warps.add_warp(force_name,surface,position,player.name) + local warp_id = Warps.add_warp(force_name, surface, position, player.name) Warps.make_warp_tag(warp_id) Warps.make_warp_area(warp_id) end) @@ -99,7 +99,7 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(_,element) +:on_click(function(_, element) local warp_id = element.parent.name:sub(6) Warps.remove_warp(warp_id) end) @@ -114,15 +114,15 @@ Gui.element{ style = 'tool_button' } :style(Styles.sprite20) -:on_click(function(player,element) +:on_click(function(player, element) local warp_id = element.parent.name:sub(6) - Warps.set_editing(warp_id,player.name,true) + Warps.set_editing(warp_id, player.name, true) end) --- Set of three elements which make up each row of the warp table -- @element add_warp_base local add_warp_base = -Gui.element(function(_,parent,warp_id) +Gui.element(function(_, parent, warp_id) -- Add the icon flow local icon_flow = parent.add{ @@ -137,7 +137,7 @@ Gui.element(function(_,parent,warp_id) warp_flow.style.padding = 0 -- Add the two edit buttons outside the warp flow - local edit_flow = Gui.alignment(parent,'edit-'..warp_id) + local edit_flow = Gui.alignment(parent, 'edit-'..warp_id) edit_warp(edit_flow) discard_warp(edit_flow) @@ -146,7 +146,7 @@ Gui.element(function(_,parent,warp_id) end) -- Removes the three elements that are added as part of the warp base -local function remove_warp_base(parent,warp_id) +local function remove_warp_base(parent, warp_id) Gui.destroy_if_valid(parent['icon-'..warp_id]) Gui.destroy_if_valid(parent['edit-'..warp_id]) Gui.destroy_if_valid(parent[warp_id]) @@ -164,12 +164,12 @@ Gui.element{ style = 'shortcut_bar_button_green' } :style(Styles.sprite22) -:on_click(function(player,element) +:on_click(function(player, element) local warp_id = element.parent.name local warp_name = element.parent[warp_editing.name].text local warp_icon = element.parent.parent['icon-'..warp_id][warp_icon_button.name].elem_value - Warps.set_editing(warp_id,player.name) - Warps.update_warp(warp_id,warp_name,warp_icon,player.name) + Warps.set_editing(warp_id, player.name) + Warps.update_warp(warp_id, warp_name, warp_icon, player.name) end) --- Cancels the editing changes of the selected warp name or icon @@ -182,15 +182,15 @@ Gui.element{ style = 'shortcut_bar_button_red' } :style(Styles.sprite22) -:on_click(function(player,element) +:on_click(function(player, element) local warp_id = element.parent.name - Warps.set_editing(warp_id,player.name) + Warps.set_editing(warp_id, player.name) end) --- Editing state for a warp, contrins a text field and the two edit buttons -- @element warp_editing warp_editing = -Gui.element(function(event_trigger,parent,warp) +Gui.element(function(event_trigger, parent, warp) local name = warp.name -- Draw the element @@ -213,18 +213,18 @@ end) maximal_width = 110, height = 20 } -:on_confirmed(function(player,element,_) +:on_confirmed(function(player, element, _) local warp_id = element.parent.name local warp_name = element.text local warp_icon = element.parent.parent['icon-'..warp_id][warp_icon_button.name].elem_value - Warps.set_editing(warp_id,player.name) - Warps.update_warp(warp_id,warp_name,warp_icon,player.name) + Warps.set_editing(warp_id, player.name) + Warps.update_warp(warp_id, warp_name, warp_icon, player.name) end) --- Default state for a warp, contains only a label with the warp name -- @element warp_label local warp_label = -Gui.element(function(event_trigger,parent,warp) +Gui.element(function(event_trigger, parent, warp) local last_edit_name = warp.last_edit_name local last_edit_time = warp.last_edit_time -- Draw the element @@ -232,52 +232,52 @@ Gui.element(function(event_trigger,parent,warp) name = event_trigger, type = 'label', caption = warp.name, - tooltip = {'warp-list.last-edit',last_edit_name,format_time(last_edit_time)} + tooltip = {'warp-list.last-edit', last_edit_name, format_time(last_edit_time)} } end) :style{ single_line = false, maximal_width = 150 } -:on_click(function(player,element,_) +:on_click(function(player, element, _) local warp_id = element.parent.name local warp = Warps.get_warp(warp_id) local position = warp.position - player.zoom_to_world(position,1.5) + player.zoom_to_world(position, 1.5) end) --- Default state for the warp icon, when pressed teleports the player -- @element warp_icon_button warp_icon_button = -Gui.element(function(event_trigger,parent,warp) +Gui.element(function(event_trigger, parent, warp) local warp_position = warp.position -- Draw the element return parent.add{ name = event_trigger, type = 'sprite-button', sprite = 'item/'..warp.icon, - tooltip = {'warp-list.goto-tooltip',warp_position.x,warp_position.y}, + tooltip = {'warp-list.goto-tooltip', warp_position.x, warp_position.y}, style = 'quick_bar_slot_button' } end) :style(Styles.sprite32) -:on_click(function(player,element,_) +:on_click(function(player, element, _) if element.type == 'choose-elem-button' then return end local warp_id = element.parent.caption - Warps.teleport_player(warp_id,player) + Warps.teleport_player(warp_id, player) -- Reset the warp cooldown if the player does not have unlimited warps - if not check_player_permissions(player,'bypass_warp_cooldown') then - Store.set(player_warp_cooldown_store,player,config.cooldown_duraction) - Store.trigger(player_in_range_store,player) + if not check_player_permissions(player, 'bypass_warp_cooldown') then + Store.set(player_warp_cooldown_store, player, config.cooldown_duraction) + Store.trigger(player_in_range_store, player) end end) --- Editing state for the warp icon, chose elem used to chosse icon -- @element warp_icon_editing local warp_icon_editing = -Gui.element(function(_,parent,warp) +Gui.element(function(_, parent, warp) return parent.add{ name = warp_icon_button.name, type = 'choose-elem-button', @@ -293,7 +293,7 @@ end) local warp_timer = Gui.element{ type = 'progressbar', - tooltip = {'warp-list.timer-tooltip',config.cooldown_duraction}, + tooltip = {'warp-list.timer-tooltip', config.cooldown_duraction}, minimum_value = 0, maximum_value = config.cooldown_duraction*config.update_smoothing } @@ -303,22 +303,22 @@ Gui.element{ } --- Updates a warp for a player -local function update_warp(player,warp_table,warp_id) +local function update_warp(player, warp_table, warp_id) local warp = Warps.get_warp(warp_id) -- Warp no longer exists so should be removed from the list if not warp then - remove_warp_base(warp_table,warp_id) + remove_warp_base(warp_table, warp_id) return end -- Get the warp flow for this warp - local warp_flow = warp_table[warp_id] or add_warp_base(warp_table,warp_id) + local warp_flow = warp_table[warp_id] or add_warp_base(warp_table, warp_id) local icon_flow = warp_table['icon-'..warp_id] -- Update the edit flow local edit_flow = warp_table['edit-'..warp_id] - local player_allowed_edit = check_player_permissions(player,'allow_edit_warp',warp) + local player_allowed_edit = check_player_permissions(player, 'allow_edit_warp', warp) local players_editing = table.get_keys(warp.currently_editing) local edit_warp_element = edit_flow[edit_warp.name] local discard_warp_element = edit_flow[discard_warp.name] @@ -327,15 +327,15 @@ local function update_warp(player,warp_table,warp_id) discard_warp_element.visible = player_allowed_edit if #players_editing > 0 then edit_warp_element.hovered_sprite = 'utility/warning_icon' - edit_warp_element.tooltip = {'warp-list.edit-tooltip',table.concat(players_editing,', ')} + edit_warp_element.tooltip = {'warp-list.edit-tooltip', table.concat(players_editing, ', ')} else edit_warp_element.hovered_sprite = edit_warp_element.sprite edit_warp_element.tooltip = {'warp-list.edit-tooltip-none'} end -- Check if the player is was editing and/or currently editing - local warp_label_element = warp_flow[warp_label.name] or warp_label(warp_flow,warp) - local icon_entry = icon_flow[warp_icon_button.name] or warp_icon_button(icon_flow,warp) + local warp_label_element = warp_flow[warp_label.name] or warp_label(warp_flow, warp) + local icon_entry = icon_flow[warp_icon_button.name] or warp_icon_button(icon_flow, warp) local player_was_editing = icon_entry.type == 'choose-elem-button' local player_is_editing = warp.currently_editing[player.name] @@ -347,20 +347,20 @@ local function update_warp(player,warp_table,warp_id) local last_edit_name = warp.last_edit_name local last_edit_time = warp.last_edit_time warp_label_element.caption = warp_name - warp_label_element.tooltip = {'warp-list.last-edit',last_edit_name,format_time(last_edit_time)} + warp_label_element.tooltip = {'warp-list.last-edit', last_edit_name, format_time(last_edit_time)} icon_entry.sprite = 'item/'..warp_icon elseif player_was_editing and not player_is_editing then -- Player was editing but is no longer, remove text field and add label edit_warp_element.enabled = true warp_flow.clear() - warp_label(warp_flow,warp) + warp_label(warp_flow, warp) icon_flow.clear() - local warp_icon_element = warp_icon_button(icon_flow,warp) - local timer = Store.get(player_warp_cooldown_store,player) - local in_range = Store.get(player_in_range_store,player) - local apply_proximity = not check_player_permissions(player,'bypass_warp_proximity') + local warp_icon_element = warp_icon_button(icon_flow, warp) + local timer = Store.get(player_warp_cooldown_store, player) + local in_range = Store.get(player_in_range_store, player) + local apply_proximity = not check_player_permissions(player, 'bypass_warp_proximity') if (timer and timer > 0) or (apply_proximity and not in_range) then warp_icon_element.enabled = false warp_icon_element.tooltip = {'warp-list.goto-disabled'} @@ -370,20 +370,20 @@ local function update_warp(player,warp_table,warp_id) -- Player was not editing but now is, remove label and add text field edit_warp_element.enabled = false warp_flow.clear() - warp_editing(warp_flow,warp).focus() - warp_table.parent.scroll_to_element(warp_flow,'top-third') + warp_editing(warp_flow, warp).focus() + warp_table.parent.scroll_to_element(warp_flow, 'top-third') icon_flow.clear() - warp_icon_editing(icon_flow,warp) + warp_icon_editing(icon_flow, warp) end end -- Update all the warps for a player -local function update_all_warps(player,warp_table) +local function update_all_warps(player, warp_table) local warp_ids = Warps.get_force_warp_ids(player.force.name) if #warp_ids > 0 then - for _,warp_id in ipairs(warp_ids) do - update_warp(player,warp_table,warp_id) + for _, warp_id in ipairs(warp_ids) do + update_warp(player, warp_table, warp_id) end end end @@ -391,9 +391,9 @@ end --- Main warp list container for the left flow -- @element warp_list_container local warp_list_container = -Gui.element(function(event_trigger,parent) +Gui.element(function(event_trigger, parent) -- Draw the internal container - local container = Gui.container(parent,event_trigger,200) + local container = Gui.container(parent, event_trigger, 200) -- Draw the header local header = Gui.header( @@ -406,10 +406,10 @@ Gui.element(function(event_trigger,parent) -- Draw the new warp button local player = Gui.get_player_from_element(parent) local add_new_warp_element = add_new_warp(header) - add_new_warp_element.visible = check_player_permissions(player,'allow_add_warp') + add_new_warp_element.visible = check_player_permissions(player, 'allow_add_warp') -- Draw the scroll table for the warps - local scroll_table = Gui.scroll_table(container,250,3) + local scroll_table = Gui.scroll_table(container, 250, 3) -- Change the style of the scroll table local scroll_table_style = scroll_table.style @@ -421,14 +421,14 @@ Gui.element(function(event_trigger,parent) -- Change the progress of the warp timer local progress = 1 - local timer = Store.get(player_warp_cooldown_store,player) + local timer = Store.get(player_warp_cooldown_store, player) if timer and timer > 0 then progress = 1 - (timer/config.cooldown_duraction) end warp_timer_element.value = progress -- Add any existing warps - update_all_warps(player,scroll_table) + update_all_warps(player, scroll_table) -- Return the exteral container return container.parent @@ -437,16 +437,16 @@ end) --- Button on the top flow used to toggle the warp list container -- @element warp_list_toggle -Gui.left_toolbar_button('item/'..config.default_icon,{'warp-list.main-tooltip',config.standard_proximity_radius},warp_list_container, function(player) - return Roles.player_allowed(player,'gui/warp-list') +Gui.left_toolbar_button('item/'..config.default_icon, {'warp-list.main-tooltip', config.standard_proximity_radius}, warp_list_container, function(player) + return Roles.player_allowed(player, 'gui/warp-list') end) -:on_custom_event(Gui.events.on_visibility_changed_by_click, function(player,_,event) +:on_custom_event(Gui.events.on_visibility_changed_by_click, function(player, _,event) -- Set gui keep open state for player that clicked the button: true if visible, false if invisible keep_gui_open[player.name] = event.state end) --- When the name of a warp is updated this is triggered -Warps.on_update(function(warp,_,removed_warp) +Warps.on_update(function(warp, _,removed_warp) -- Get the force to update, warp is nil when removed local force if warp then @@ -457,69 +457,69 @@ Warps.on_update(function(warp,_,removed_warp) -- Update the gui for selected players local warp_ids = Warps.get_force_warp_ids(force.name) - for _,player in pairs(force.connected_players) do - local frame = Gui.get_left_element(player,warp_list_container) + for _, player in pairs(force.connected_players) do + local frame = Gui.get_left_element(player, warp_list_container) local scroll_table = frame.container.scroll.table -- Update the gui scroll_table.clear() - for _,next_warp_id in ipairs(warp_ids) do - update_warp(player,scroll_table,next_warp_id) + for _, next_warp_id in ipairs(warp_ids) do + update_warp(player, scroll_table, next_warp_id) end end end) --- Update the warps when the player joins -Event.add(defines.events.on_player_joined_game,function(event) +Event.add(defines.events.on_player_joined_game, function(event) local player = game.players[event.player_index] - local frame = Gui.get_left_element(player,warp_list_container) + local frame = Gui.get_left_element(player, warp_list_container) local scroll_table = frame.container.scroll.table - update_all_warps(player,scroll_table) + update_all_warps(player, scroll_table) end) --- Makes sure the right buttons are present when roles change local function role_update_event(event) local player = game.players[event.player_index] - local container = Gui.get_left_element(player,warp_list_container).container + local container = Gui.get_left_element(player, warp_list_container).container -- Update the warps, incase the user can now edit them local scroll_table = container.scroll.table - update_all_warps(player,scroll_table) + update_all_warps(player, scroll_table) -- Update the new warp button incase the user can now add them local add_new_warp_element = container.header.alignment[add_new_warp.name] - add_new_warp_element.visible = check_player_permissions(player,'allow_add_warp') + add_new_warp_element.visible = check_player_permissions(player, 'allow_add_warp') end -Event.add(Roles.events.on_role_assigned,role_update_event) -Event.add(Roles.events.on_role_unassigned,role_update_event) +Event.add(Roles.events.on_role_assigned, role_update_event) +Event.add(Roles.events.on_role_unassigned, role_update_event) --- When the player leaves or enters range of a warp this is triggered -Store.watch(player_in_range_store,function(value,player_name) +Store.watch(player_in_range_store, function(value, player_name) local player = game.players[player_name] local force = player.force -- Change if the frame is visible based on if the player is in range if not keep_gui_open[player.name] then - Gui.toggle_left_element(player,warp_list_container,value) + Gui.toggle_left_element(player, warp_list_container, value) end -- Check if the player requires proximity - if check_player_permissions(player,'bypass_warp_proximity') then + if check_player_permissions(player, 'bypass_warp_proximity') then return end -- Get the warp table - local frame = Gui.get_left_element(player,warp_list_container) + local frame = Gui.get_left_element(player, warp_list_container) local scroll_table = frame.container.scroll.table -- Check if the buttons should be active - local timer = Store.get(player_warp_cooldown_store,player) + local timer = Store.get(player_warp_cooldown_store, player) local button_disabled = timer and timer > 0 or not value -- Change the enabled state of the warp buttons local warp_ids = Warps.get_force_warp_ids(force.name) - for _,warp_id in pairs(warp_ids) do + for _, warp_id in pairs(warp_ids) do local element = scroll_table['icon-'..warp_id][warp_icon_button.name] if element and element.valid then element.enabled = not button_disabled @@ -527,23 +527,23 @@ Store.watch(player_in_range_store,function(value,player_name) element.tooltip = {'warp-list.goto-disabled'} else local position = Warps.get_warp(warp_id).position - element.tooltip = {'warp-list.goto-tooltip',position.x,position.y} + element.tooltip = {'warp-list.goto-tooltip', position.x, position.y} end end end end) --- Update the warp cooldown progress bars to match the store -Store.watch(player_warp_cooldown_store,function(value,player_name,old_value) +Store.watch(player_warp_cooldown_store, function(value, player_name, old_value) if value == old_value then return end -- Get the progress bar element local player = game.players[player_name] - local frame = Gui.get_left_element(player,warp_list_container) + local frame = Gui.get_left_element(player, warp_list_container) local warp_timer_element = frame.container[warp_timer.name] -- Set the progress local progress = 1 - local timer = Store.get(player_warp_cooldown_store,player) + local timer = Store.get(player_warp_cooldown_store, player) if timer and timer > 0 then progress = 1 - (timer/config.cooldown_duraction) end @@ -551,7 +551,7 @@ Store.watch(player_warp_cooldown_store,function(value,player_name,old_value) -- Trigger update of buttons if cooldown is now 0 if value == 0 then - Store.trigger(player_in_range_store,player_name) + Store.trigger(player_in_range_store, player_name) end end) @@ -559,8 +559,8 @@ end) local r2 = config.standard_proximity_radius^2 local rs2 = config.spawn_proximity_radius^2 local mr2 = config.minimum_distance^2 -Event.on_nth_tick(math.floor(60/config.update_smoothing),function() - Store.map(player_warp_cooldown_store,function(value) +Event.on_nth_tick(math.floor(60/config.update_smoothing), function() + Store.map(player_warp_cooldown_store, function(value) if value > 0 then return value - 1 end @@ -568,8 +568,8 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function() local force_warps = {} local warps = {} - for _,player in pairs(game.connected_players) do - local was_in_range = Store.get(player_in_range_store,player) + for _, player in pairs(game.connected_players) do + local was_in_range = Store.get(player_in_range_store, player) -- Get the ids of all the warps on the players force local force_name = player.force.name @@ -585,10 +585,10 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function() if #warp_ids > 0 then local surface = player.surface local pos = player.position - local px,py = pos.x,pos.y + local px, py = pos.x, pos.y -- Loop over each warp - for _,warp_id in ipairs(warp_ids) do + for _, warp_id in ipairs(warp_ids) do -- Check if warp id is chached local warp = warps[warp_id] if not warp then @@ -612,13 +612,13 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function() -- Check the dist to the closest warp local in_range = closest_warp.warp_id == warp_ids.spawn and closest_distance < rs2 or closest_distance < r2 if was_in_range and not in_range then - Store.set(player_in_range_store,player,false) + Store.set(player_in_range_store, player, false) elseif not was_in_range and in_range then - Store.set(player_in_range_store,player,true) + Store.set(player_in_range_store, player, true) end -- Change the enabled state of the add warp button - local frame = Gui.get_left_element(player,warp_list_container) + local frame = Gui.get_left_element(player, warp_list_container) local add_warp_element = frame.container.header.alignment[add_new_warp.name] local was_able_to_make_warp = add_warp_element.enabled local can_make_warp = closest_distance > mr2 @@ -627,7 +627,7 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function() add_warp_element.tooltip = {'warp-list.add-tooltip'} elseif not can_make_warp and was_able_to_make_warp then add_warp_element.enabled = false - add_warp_element.tooltip = {'warp-list.too-close',closest_warp.name} + add_warp_element.tooltip = {'warp-list.too-close', closest_warp.name} end end @@ -637,16 +637,16 @@ Event.on_nth_tick(math.floor(60/config.update_smoothing),function() end) --- When a player is created make sure that there is a spawn warp created -Event.add(defines.events.on_player_created,function(event) +Event.add(defines.events.on_player_created, function(event) -- If the force has no spawn then make a spawn warp local player = Game.get_player_by_index(event.player_index) local force = player.force local spawn_id = Warps.get_spawn_warp_id(force.name) if not spawn_id then local spawn_position = force.get_spawn_position(player.surface) - spawn_id = Warps.add_warp(force.name,player.surface,spawn_position,nil,'Spawn') - Warps.set_spawn_warp(spawn_id,force) - Store.trigger(Warps.store,spawn_id) + spawn_id = Warps.add_warp(force.name, player.surface, spawn_position, nil, 'Spawn') + Warps.set_spawn_warp(spawn_id, force) + Store.trigger(Warps.store, spawn_id) Warps.make_warp_tag(spawn_id) end end) @@ -657,7 +657,7 @@ local function maintain_tag(event) local tag = event.tag local force_name = event.force.name local warp_ids = Warps.get_force_warp_ids(force_name) - for _,warp_id in pairs(warp_ids) do + for _, warp_id in pairs(warp_ids) do local warp = Warps.get_warp(warp_id) local wtag = warp.tag if not wtag or not wtag.valid or wtag == tag then @@ -669,5 +669,5 @@ local function maintain_tag(event) end end -Event.add(defines.events.on_chart_tag_modified,maintain_tag) -Event.add(defines.events.on_chart_tag_removed,maintain_tag) \ No newline at end of file +Event.add(defines.events.on_chart_tag_modified, maintain_tag) +Event.add(defines.events.on_chart_tag_removed, maintain_tag) \ No newline at end of file diff --git a/overrides/inspect.lua b/overrides/inspect.lua index 76605169..6cf7296f 100644 --- a/overrides/inspect.lua +++ b/overrides/inspect.lua @@ -99,10 +99,10 @@ end -- tables aren't pure sequences. So we implement our own # operator. local function getSequenceLength(t) local len = 1 - local v = rawget(t,len) + local v = rawget(t, len) while v ~= nil do len = len + 1 - v = rawget(t,len) + v = rawget(t, len) end return len - 1 end @@ -110,7 +110,7 @@ end local function getNonSequentialKeys(t) local keys = {} local sequenceLength = getSequenceLength(t) - for k,_ in pairs(t) do + for k, _ in pairs(t) do if not isSequenceKey(k, sequenceLength) then table.insert(keys, k) end end table.sort(keys, sortKeys) @@ -133,7 +133,7 @@ local function countTableAppearances(t, tableAppearances) if type(t) == 'table' then if not tableAppearances[t] then tableAppearances[t] = 1 - for k,v in pairs(t) do + for k, v in pairs(t) do countTableAppearances(k, tableAppearances) countTableAppearances(v, tableAppearances) end @@ -172,7 +172,7 @@ local function processRecursive(process, item, path, visited) visited[item] = processedCopy local processedKey - for k,v in pairs(processed) do + for k, v in pairs(processed) do processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited) if processedKey ~= nil then processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited) @@ -258,14 +258,14 @@ function Inspector:putTable(t) local count = 0 for i=1, sequenceLength do - if count > 0 then self:puts(',') end + if count > 0 then self:puts(', ') end self:puts(' ') self:putValue(t[i]) count = count + 1 end - for _,k in ipairs(nonSequentialKeys) do - if count > 0 then self:puts(',') end + for _, k in ipairs(nonSequentialKeys) do + if count > 0 then self:puts(', ') end self:tabify() self:putKey(k) self:puts(' = ') @@ -274,7 +274,7 @@ function Inspector:putTable(t) end if mt then - if count > 0 then self:puts(',') end + if count > 0 then self:puts(', ') end self:tabify() self:puts(' = ') self:putValue(mt) @@ -302,7 +302,7 @@ function Inspector:putValue(v) elseif tv == 'table' then self:putTable(v) else - self:puts('<',tv,' ',self:getId(v),'>') + self:puts('<', tv, ' ', self:getId(v), '>') end end diff --git a/overrides/require.lua b/overrides/require.lua index 36430248..4436e5d8 100644 --- a/overrides/require.lua +++ b/overrides/require.lua @@ -1,4 +1,3 @@ ---luacheck:ignore global require local loaded = package.loaded local raw_require = require diff --git a/overrides/table.lua b/overrides/table.lua index e3823302..3d0233d7 100644 --- a/overrides/table.lua +++ b/overrides/table.lua @@ -54,10 +54,10 @@ end @usage-- Adding 1000 values into the middle of the array local tbl = {} local values = {} -for i = 1,1000 do tbl[i] = i values[i] = i end -table.array_insert(tbl,500,values) -- around 0.4ms +for i = 1, 1000 do tbl[i] = i values[i] = i end +table.array_insert(tbl, 500, values) -- around 0.4ms ]] -function table.array_insert(tbl,start_index,values) +function table.array_insert(tbl, start_index, values) if not values then values = start_index start_index = nil @@ -90,16 +90,16 @@ end @usage-- Merging two tables local tbl = {} local tbl2 = {} -for i = 1,100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end -table.table_insert(tbl,50,tbl2) +for i = 1, 100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end +table.table_insert(tbl, 50, tbl2) ]] -function table.table_insert(tbl,start_index,tbl2) +function table.table_insert(tbl, start_index, tbl2) if not tbl2 then tbl2 = start_index start_index = nil end - table.array_insert(tbl,start_index,tbl2) + table.array_insert(tbl, start_index, tbl2) for key, value in pairs(tbl2) do if not tonumber(key) then tbl[key] = value @@ -152,14 +152,14 @@ function table.array_contains(t, e) 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') +-- @usage local key_three, key_one = extract({key_one='foo', key_two='bar', key_three=true}, 'key_three', 'key_one') -- @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 table.extract_keys(tbl,...) +function table.extract_keys(tbl, ...) local values = {} - for _,key in pairs({...}) do - table.insert(values,tbl[key]) + for _, key in pairs({...}) do + table.insert(values, tbl[key]) end return unpack(values) end @@ -302,7 +302,7 @@ function table.get_values(tbl, sorted, as_string) end end if sorted then - table.sort(valueset,sortFunc) + table.sort(valueset, sortFunc) end return valueset end @@ -328,7 +328,7 @@ function table.get_keys(tbl, sorted, as_string) end end if sorted then - table.sort(keyset,sortFunc) + table.sort(keyset, sortFunc) end return keyset end @@ -340,11 +340,11 @@ function table.alphanumsort(tbl) local o = table.get_keys(tbl) local function padnum(d) local dec, n = string.match(d, "(%.?)0*(.+)") return #dec > 0 and ("%.12f"):format(d) or ("%s%03d%s"):format(dec, #n, n) end - table.sort(o, function(a,b) - return tostring(a):gsub("%.?%d+",padnum)..("%3d"):format(#b) - < tostring(b):gsub("%.?%d+",padnum)..("%3d"):format(#a) end) + table.sort(o, function(a, b) + return tostring(a):gsub("%.?%d+", padnum)..("%3d"):format(#b) + < tostring(b):gsub("%.?%d+", padnum)..("%3d"):format(#a) end) local _tbl = {} - for _,k in pairs(o) do _tbl[k] = tbl[k] end + for _, k in pairs(o) do _tbl[k] = tbl[k] end return _tbl end @@ -352,9 +352,9 @@ end -- @tparam table tbl the table to be sorted -- @treturn table the sorted table function table.keysort(tbl) - local o = table.get_keys(tbl,true) + local o = table.get_keys(tbl, true) local _tbl = {} - for _,k in pairs(o) do _tbl[k] = tbl[k] end + for _, k in pairs(o) do _tbl[k] = tbl[k] end return _tbl end @@ -365,7 +365,7 @@ end t must be a list in ascending order for the return value to be valid. Usage example: - local t = {1,3,5,7,9} + local t = {1, 3,5, 7,9} local x = 5 local index = table.binary_search(t, x) if index < 0 then diff --git a/utils/gui.lua b/utils/gui.lua index 36fc1d61..12bb4806 100644 --- a/utils/gui.lua +++ b/utils/gui.lua @@ -72,7 +72,7 @@ local function handler_factory(event_name) return function(element_name, handler) local element = ExpGui.defines[element_name] if not element then return end - element[event_name](element,function(_,_,event) + element[event_name](element, function(_, _,event) handler(event) end) end From a9751c6cc5920709b851193f8f39f8a788a7674c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:31:27 +0100 Subject: [PATCH 025/106] Removed Topic Docs --- docs/topics/license.html | 796 ------------------------------------- docs/topics/readme.md.html | 345 ---------------- 2 files changed, 1141 deletions(-) delete mode 100644 docs/topics/license.html delete mode 100644 docs/topics/readme.md.html diff --git a/docs/topics/license.html b/docs/topics/license.html deleted file mode 100644 index 293edf6c..00000000 --- a/docs/topics/license.html +++ /dev/null @@ -1,796 +0,0 @@ - - - - - - - - license topic - - - - - - - -
-
- - - - - - - -
- - - - - - - - -

license topic

-

-

- - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 -

Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. -

Preamble -

The GNU General Public License is a free, copyleft license for -software and other kinds of works. -

The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. -

When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. -

To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. -

For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. -

Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. -

For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. -

Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. -

Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. -

The precise terms and conditions for copying, distribution and -modification follow. -

TERMS AND CONDITIONS -

0. Definitions. -

"This License" refers to version 3 of the GNU General Public License. -

"Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. -

"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. -

To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. -

A "covered work" means either the unmodified Program or a work based -on the Program. -

To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. -

To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. -

An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. -

1. Source Code. -

The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. -

A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. -

The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. -

The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. -

The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. -

The Corresponding Source for a work in source code form is that -same work. -

2. Basic Permissions. -

All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. -

You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. -

Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. -

3. Protecting Users' Legal Rights From Anti-Circumvention Law. -

No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. -

When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. -

4. Conveying Verbatim Copies. -

You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. -

You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. -

5. Conveying Modified Source Versions. -

You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: -

a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. -

b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". -

c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. -

d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. -

A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. -

6. Conveying Non-Source Forms. -

You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: -

a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. -

b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. -

c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. -

d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. -

e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. -

A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. -

A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. -

"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. -

If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). -

The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. -

Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. -

7. Additional Terms. -

"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. -

When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. -

Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: -

a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or -

b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or -

c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or -

d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or -

e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or -

f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. -

All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. -

If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. -

Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. -

8. Termination. -

You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). -

However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. -

Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. -

Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. -

9. Acceptance Not Required for Having Copies. -

You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. -

10. Automatic Licensing of Downstream Recipients. -

Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. -

An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. -

You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. -

11. Patents. -

A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". -

A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. -

Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. -

In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. -

If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. -

If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. -

A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. -

Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. -

12. No Surrender of Others' Freedom. -

If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. -

13. Use with the GNU Affero General Public License. -

Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. -

14. Revised Versions of this License. -

The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. -

Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. -

If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. -

Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. -

15. Disclaimer of Warranty. -

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -

16. Limitation of Liability. -

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. -

17. Interpretation of Sections 15 and 16. -

If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. -

END OF TERMS AND CONDITIONS -

How to Apply These Terms to Your New Programs -

If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. -

To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. -

Scenario for Facotorio multiplayer. - Copyright (C) 2018 badgamernl -

This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -

This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -

You should have received a copy of the GNU General Public License - along with this program. If not, see . -

Also add information on how to contact you by electronic and paper mail. -

If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: -

explosivegaming.nl Copyright (C) 2018 badgamernl - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. -

The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". -

You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. -

The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - - - - - - - - - - - - - -
- - - -

- - - -
-
- - - - - diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html deleted file mode 100644 index d9e08d04..00000000 --- a/docs/topics/readme.md.html +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - readme.md topic - - - - - - - -
-
- - - - - - - -
- - - - - - - - -

readme.md topic

-

-

- -

- logo -
- - Release - - - Downloads - - - Star - - - Fork - - - CodeFactor - - - Discord - -

-

ExpGaming Scenario Repository

-

## Explosive Gaming -

Explosive Gaming (often ExpGaming) is a server hosting community with a strong focus on Factorio and games that follow similar ideas. Our Factorio server are known for hosting large maps with the main goal of being a "mega base" which can produce as much as possible within our reset schedule. Although these servers tend to attract the more experienced players, our servers are open to everyone. You can find us through our [website], [discord], [wiki], or in the public games tab in Factorio (ExpGaming S1, ExpGaming S2, etc.). -

## Use and Installation -

1) Download this [git repository](https://github.com/explosivegaming/scenario/archive/master.zip) for the stable release. The dev branch can be found [here](https://github.com/explosivegaming/scenario/archive/dev.zip) for those who want the latest features. See [releases](#releases) for other release branches. -

2) Extract the downloaded zip file from the branch you downloaded into Factorio's scenario directory: - * Windows: `%appdata%\Factorio\scenarios` - * Linux: `~/.factorio/scenarios` -

3) Within the scenario you can find `./config/_file_loader.lua` which contains a list of all the modules that will be loaded by the scenario; simply comment out (or remove) features you do not want but note that some modules may load other modules as dependencies even when removed from the list. -

4) More advanced users may want to play with the other configs files within `./config` but please be aware that some of the config files will require a basic understanding of lua while others may just be a list of values. -

5) Once you have made any config changes that you wish to make open Factorio, select play, then start scenario (or host scenario from within multiplayer tab), and select the scenario which will be called `scenario-master` if you have downloaded the latest stable release and have not changed the folder name. -

6) The scenario will now load all the selected modules and start the map, any errors or exceptions raised in the scenario should not cause a game/server crash, so if any features do not work as expected then it may be returning an error in the log. -Please report these errors to [the issues page](issues). -

## Contributing -

All are welcome to make pull requests and issues for this scenario, if you are in any doubt, please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. To find out what we already have please read our [docs]. Please keep in mind while making code changes: -

* New features should have the branch names: `feature/feature-name` -* New features are merged into `dev` after it has been completed, this can be done through a pull request. -* After a number of features have been added a release branch is made: `release/X.Y.0` -* Bug fixes and localization can be made to the release branch with a pull request rather than into dev. -* A release is merged into `master` on the following friday after it is considered stable. -* Patches may be named `patch/X.Y.Z` and will be merged into `dev` and then `master` when appropriate. -

## Releases -

| Scenario Version* | Version Name | Factorio Version** | -|---|---|---| -| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] | -| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | -| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] | -| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] | -| [v5.6][s5.6] | Information Guis | [v0.17.44][f0.17.44] | -| [v5.5][s5.5] | Gui System | [v0.17.43][f0.17.43] | -| [v5.4][s5.4] | Admin Controls | [v0.17.32][f0.17.32] | -| [v5.3][s5.3] | Custom Roles | [v0.17.28][f0.17.28] | -| [v5.2][s5.2] | Quality of life | [v0.17.22][f0.17.22] | -| [v5.1][s5.1] | Permission Groups | [v0.17.13][f0.17.13] | -| [v5.0][s5.0] | 0.17 Overhaul| [v0.17][f0.17.9] | -| [v4.0][s4.0] | Softmod Manager | [v0.16.51][f0.16.51] | -| [v3.0][s3.0] | 0.16 Overhaul | [v0.16][f0.16] | -| [v2.0][s2.0] | Localization and clean up | [v0.15][f0.15] | -| [v1.0][s1.0] | Modulation | [v0.15][f0.15] | -| [v0.1][s0.1] | First Tracked Version | [v0.14][f0.14] | -

\* Scenario patch versions have been omitted. -

\*\* Factorio versions show the version they were made for, often the minimum requirement. -

[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0 -[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 -[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0 -[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0 -[s5.6]: https://github.com/explosivegaming/scenario/releases/tag/5.6.0 -[s5.5]: https://github.com/explosivegaming/scenario/releases/tag/5.5.0 -[s5.4]: https://github.com/explosivegaming/scenario/releases/tag/5.4.0 -[s5.3]: https://github.com/explosivegaming/scenario/releases/tag/5.3.0 -[s5.2]: https://github.com/explosivegaming/scenario/releases/tag/5.2.0 -[s5.1]: https://github.com/explosivegaming/scenario/releases/tag/5.1.0 -[s5.0]: https://github.com/explosivegaming/scenario/releases/tag/5.0.0 -[s4.0]: https://github.com/explosivegaming/scenario/releases/tag/v4.0 -[s3.0]: https://github.com/explosivegaming/scenario/releases/tag/v3.0 -[s2.0]: https://github.com/explosivegaming/scenario/releases/tag/v2.0 -[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 -[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 -

[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71 -[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 -[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49 -[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47 -[f0.17.44]: https://wiki.factorio.com/Version_history/0.17.0#0.17.44 -[f0.17.43]: https://wiki.factorio.com/Version_history/0.17.0#0.17.43 -[f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 -[f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 -[f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 -[f0.17.13]: https://wiki.factorio.com/Version_history/0.17.0#0.17.13 -[f0.17.9]: https://wiki.factorio.com/Version_history/0.17.0#0.17.9 -[f0.16.51]: https://wiki.factorio.com/Version_history/0.16.0#0.16.51 -[f0.16]: https://wiki.factorio.com/Version_history/0.16.0 -[f0.15]: https://wiki.factorio.com/Version_history/0.15.0 -[f0.14]: https://wiki.factorio.com/Version_history/0.14.0 -

## License -

The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE) -

[docs]: https://explosivegaming.github.io/scenario/ -[issues]: https://github.com/explosivegaming/scenario/issues/new/choose -[website]: https://explosivegaming.nl -[discord]: https://discord.explosivegaming.nl -[wiki]: https://wiki.explosivegaming.nl - - - - - - - - - - - - - -
- - - -

- - - -
-
- - - - - From b17d74fff7c97da4ade239cb37c79118ae82f822 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:33:15 +0100 Subject: [PATCH 026/106] Removed unused variable --- modules/gui/debug/expcore_datastore_view.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/gui/debug/expcore_datastore_view.lua b/modules/gui/debug/expcore_datastore_view.lua index f7a9912f..cecd92c6 100644 --- a/modules/gui/debug/expcore_datastore_view.lua +++ b/modules/gui/debug/expcore_datastore_view.lua @@ -4,7 +4,6 @@ local Color = require 'utils.color_presets' --- @dep utils.color_presets local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model local dump = Model.dump -local dump_text = Model.dump_text local concat = table.concat local Public = {} From e0c7084cdefded92c7d246ca4aafe8253efa90e4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:38:49 +0100 Subject: [PATCH 027/106] Renamed to pr checker --- .github/workflows/{luacheck.yml => pr-checker.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{luacheck.yml => pr-checker.yml} (98%) diff --git a/.github/workflows/luacheck.yml b/.github/workflows/pr-checker.yml similarity index 98% rename from .github/workflows/luacheck.yml rename to .github/workflows/pr-checker.yml index abf770ab..4f442fa1 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/pr-checker.yml @@ -1,4 +1,4 @@ -name: CI Luacheck +name: CI PR Checker on: pull_request From c0cbe16fe3ceb3a11f4ecff6493bdd76ffe53c73 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:47:10 +0100 Subject: [PATCH 028/106] Fixed Code Factor Checks --- .github/workflows/dev-deploy.yml | 4 ++-- .github/workflows/pr-checker.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index fc0f9fa8..37efb8d6 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -19,10 +19,10 @@ jobs: - name: Install Lua uses: leafo/gh-actions-lua@v5 - + - name: Install LuaRocks uses: leafo/gh-actions-luarocks@v2 - + - name: Install LDoc run: luarocks install ldoc 1.4.4-1 diff --git a/.github/workflows/pr-checker.yml b/.github/workflows/pr-checker.yml index 4f442fa1..77e50408 100644 --- a/.github/workflows/pr-checker.yml +++ b/.github/workflows/pr-checker.yml @@ -18,7 +18,7 @@ jobs: uses: Roang-zero1/factorio-mod-luacheck@master with: luacheckrc_url: https://raw.githubusercontent.com/explosivegaming/scenario/${{ steps.extract_branch.outputs.branch }}/.luacheckrc - + docs: runs-on: ubuntu-latest steps: @@ -29,10 +29,10 @@ jobs: - name: Install Lua uses: leafo/gh-actions-lua@v5 - + - name: Install LuaRocks uses: leafo/gh-actions-luarocks@v2 - + - name: Install LDoc run: luarocks install ldoc 1.4.4-1 From 5c647a4d8e1b2c89f95c4315a580f347ba462921 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 17:59:24 +0000 Subject: [PATCH 029/106] Automattic Doc Update --- docs/addons/Advanced-Start.html | 10 +- docs/addons/Chat-Popups.html | 10 +- docs/addons/Chat-Reply.html | 10 +- docs/addons/Compilatron.html | 12 +- docs/addons/Damage-Popups.html | 10 +- docs/addons/Death-Logger.html | 10 +- docs/addons/Discord-Alerts.html | 10 +- docs/addons/Inventory-Clear.html | 359 ++++++++ docs/addons/Player-Colours.html | 10 +- docs/addons/Pollution-Grading.html | 10 +- docs/addons/Scorched-Earth.html | 10 +- docs/addons/Spawn-Area.html | 10 +- docs/addons/Tree-Decon.html | 10 +- docs/addons/greetings.html | 10 +- docs/commands/Admin-Chat.html | 10 +- docs/commands/Bonus.html | 10 +- docs/commands/Cheat-Mode.html | 10 +- docs/commands/Clear-Inventory.html | 10 +- docs/commands/Debug.html | 10 +- docs/commands/Find.html | 10 +- docs/commands/Help.html | 10 +- docs/commands/Home.html | 10 +- docs/commands/Interface.html | 10 +- docs/commands/Jail.html | 10 +- docs/commands/Kill.html | 10 +- docs/commands/Me.html | 10 +- docs/commands/Quickbar.html | 407 +++++++++ docs/commands/Rainbow.html | 10 +- docs/commands/Repair.html | 10 +- docs/commands/Reports.html | 10 +- docs/commands/Roles.html | 10 +- docs/commands/Spawn.html | 10 +- docs/commands/Tag.html | 10 +- docs/commands/Teleport.html | 10 +- docs/commands/Warnings.html | 10 +- docs/configs/Advanced-Start.html | 14 +- docs/configs/Bonuses.html | 10 +- docs/configs/Chat-Reply.html | 10 +- docs/configs/Commands-Auth-Admin.html | 12 +- docs/configs/Commands-Auth-Roles.html | 10 +- .../Commands-Auth-Runtime-Disable.html | 10 +- docs/configs/Commands-Parse-Roles.html | 10 +- docs/configs/Commands-Parse.html | 12 +- docs/configs/Compilatron.html | 10 +- docs/configs/Death-Logger.html | 10 +- docs/configs/Discord-Alerts.html | 10 +- docs/configs/File-Loader.html | 10 +- docs/configs/Permission-Groups.html | 10 +- docs/configs/Player-List.html | 10 +- docs/configs/Pollution-Grading.html | 10 +- docs/configs/Popup-Messages.html | 10 +- docs/configs/Preset-Player-Colours.html | 10 +- docs/configs/Preset-Player-Quickbar.html | 248 ++++++ docs/configs/Repair.html | 10 +- docs/configs/Rockets.html | 10 +- docs/configs/Roles.html | 10 +- docs/configs/Science.html | 10 +- docs/configs/Scorched-Earth.html | 10 +- docs/configs/Spawn-Area.html | 10 +- docs/configs/Tasks.html | 10 +- docs/configs/Warnings.html | 10 +- docs/configs/Warps.html | 10 +- docs/configs/inventory_clear.html | 248 ++++++ docs/control/Jail.html | 16 +- docs/control/Production.html | 364 ++++---- docs/control/Reports.html | 16 +- docs/control/Rockets.html | 14 +- docs/control/Tasks.html | 22 +- docs/control/Warnings.html | 18 +- docs/control/Warps.html | 26 +- docs/core/Async.html | 14 +- docs/core/Commands.html | 22 +- docs/core/Common.html | 36 +- docs/core/Groups.html | 10 +- docs/core/Gui.html | 38 +- docs/core/Roles.html | 52 +- docs/core/Store.html | 58 +- docs/guis/Player-List.html | 10 +- docs/guis/Readme.html | 38 +- docs/guis/Rocket-Info.html | 10 +- docs/guis/Science-Info.html | 10 +- docs/guis/Task-List.html | 10 +- docs/guis/Warps-List.html | 10 +- docs/guis/server-ups.html | 10 +- docs/index.html | 27 +- docs/modules/control.html | 10 +- .../modules.addons.station-auto-name.html | 10 +- docs/modules/overrides.debug.html | 10 +- docs/modules/overrides.math.html | 10 +- docs/modules/overrides.table.html | 20 +- docs/modules/utils.event.html | 10 +- docs/modules/utils.event_core.html | 10 +- docs/modules/utils.task.html | 10 +- docs/topics/LICENSE.html | 800 ++++++++++++++++++ docs/topics/README.md.html | 352 ++++++++ 95 files changed, 3373 insertions(+), 562 deletions(-) create mode 100644 docs/addons/Inventory-Clear.html create mode 100644 docs/commands/Quickbar.html create mode 100644 docs/configs/Preset-Player-Quickbar.html create mode 100644 docs/configs/inventory_clear.html create mode 100644 docs/topics/LICENSE.html create mode 100644 docs/topics/README.md.html diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 1d717318..e81eb23f 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -347,7 +351,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 7f17c3a9..9f183435 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -348,7 +352,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index d7927bc8..42c26a8f 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -375,7 +379,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 5b569aae..45cc871e 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -58,6 +58,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -483,7 +487,7 @@ (string) - the name of the location that the complitron is at + the name of the location that the compilatron is at @@ -584,7 +588,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 48df3a68..3d5d84bc 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -348,7 +352,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index a7b1b937..fbf61296 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -403,7 +407,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 78f0bcd6..0159d227 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -459,7 +463,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html new file mode 100644 index 00000000..60ef06b4 --- /dev/null +++ b/docs/addons/Inventory-Clear.html @@ -0,0 +1,359 @@ + + + + + + + + Inventory-Clear addon + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Inventory-Clear addon

+

Will move players items to spawn when they are banned or kicked, option to clear on leave

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + + + + +
utils.event
config.inventory_clear
expcore.common
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.inventory_clear +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index a9b88d40..e1a2be59 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -403,7 +407,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index d7166cc9..de0f214a 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -319,7 +323,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 464c0bf3..bf3e8303 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -403,7 +407,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 27174f1c..d95d6d7a 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -375,7 +379,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 1ae7cd94..457ca4fc 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -375,7 +379,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index 88bcabfb..f2f31ac7 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -57,6 +57,7 @@ + @@ -123,6 +124,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -375,7 +379,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index e2928b14..d62c7a8c 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -387,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index b4acd3f8..4ab594b6 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -499,7 +503,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index bd44f024..b665d15c 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -360,7 +364,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 8c73ddea..891ac5c8 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -387,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index dc8bd630..53b98cea 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -364,7 +368,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index fa39eb7d..29033cc5 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -359,7 +363,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 8d75f6db..c0c4e54e 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -403,7 +407,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 512a2ee6..338791be 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -457,7 +461,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 2f43cbd6..b0021e91 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -415,7 +419,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index f7cdeb46..621a9aec 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -610,7 +614,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 085d3e43..ca61daca 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -388,7 +392,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index c8286186..cccd2fc5 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -359,7 +363,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html new file mode 100644 index 00000000..186a774e --- /dev/null +++ b/docs/commands/Quickbar.html @@ -0,0 +1,407 @@ + + + + + + + + Quickbar commands + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Quickbar commands

+

Commands Module - Quickbar + - Adds a command that allows players to load Quickbar presets

+

+ + + + + + + + + + + + + +

Dependencies

+ + + + + + + + + + +
expcore.commands
config.preset_player_quickbar
+ + +

Commands

+ + + + + + + + + + + + +
load-quickbarLoads your quickbar preset
save-quickbarSaves your quickbar preset to the script-output folder
+ + +
+ + +

Dependencies

+
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.preset_player_quickbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + load-quickbar +
+
+
+
+ +

Loads your quickbar preset

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + save-quickbar +
+
+
+
+ +

Saves your quickbar preset to the script-output folder

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 38c038a6..05233854 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -387,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 0a156f7b..fcf3f0d7 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -61,6 +61,7 @@ + @@ -112,6 +113,7 @@ + @@ -157,9 +159,11 @@ + + @@ -186,8 +190,8 @@ @@ -320,7 +324,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 88e9d0d0..0d83676a 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -584,7 +588,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 9ca693d6..1b746a51 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -556,7 +560,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 479f2750..af7524a0 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -388,7 +392,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index c21383cd..77dbadf0 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -442,7 +446,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index b343424b..108e22a2 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -483,7 +487,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index ab2e9aed..2c4e808a 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -62,6 +62,7 @@ + @@ -113,6 +114,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -568,7 +572,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index bb433438..e7e40e07 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -364,7 +368,7 @@

-

when true the research queue is useible from the start

+

when true the research queue is useable from the start

@@ -473,7 +477,7 @@

items and there condition for being given - ['item-name'] = function(amount_made,production_stats,player) return end -- 0 means no items given + ['item-name'] = function(amount_made, production_stats, player) return end -- 0 means no items given Plates

@@ -505,7 +509,7 @@ generated by LDoc
diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index ed9c3bd1..74e7c9f0 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -60,9 +60,11 @@ + + @@ -110,6 +112,7 @@ + @@ -148,6 +151,7 @@ + @@ -178,8 +182,8 @@ @@ -236,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index f7c4bca2..6b56dad1 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -69,9 +69,11 @@ + + @@ -119,6 +121,7 @@ + @@ -157,6 +160,7 @@ + @@ -187,8 +191,8 @@ @@ -484,7 +488,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 9da0f411..1b2832eb 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -220,7 +224,7 @@

Commands-Auth-Admin config

-

This is a very simple config file which adds a admin only auth functio; +

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

@@ -293,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 477cb804..b4884896 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -319,7 +323,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 1636ab35..08a59675 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -69,9 +69,11 @@ + + @@ -119,6 +121,7 @@ + @@ -157,6 +160,7 @@ + @@ -187,8 +191,8 @@ @@ -441,7 +445,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 9d4292ca..bbec55e1 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -353,7 +357,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 234392ad..897c2281 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -223,7 +227,7 @@

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; +use Commands.add_parse('name',function(input, player, reject) end) to add a parse; see ./expcore/commands.lua for more details

@@ -337,7 +341,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index dec0e529..c5ae25df 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -353,7 +357,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 67857dec..f7eeef91 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -415,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 5ea02120..ed9373e9 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -60,9 +60,11 @@ + + @@ -110,6 +112,7 @@ + @@ -148,6 +151,7 @@ + @@ -178,8 +182,8 @@ @@ -236,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 3a9716cf..41ff18a2 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -60,9 +60,11 @@ + + @@ -110,6 +112,7 @@ + @@ -148,6 +151,7 @@ + @@ -178,8 +182,8 @@ @@ -239,7 +243,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 3abffdaa..0a7b5d6c 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -294,7 +298,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index cfda4261..f1c5fe11 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -69,9 +69,11 @@ + + @@ -119,6 +121,7 @@ + @@ -157,6 +160,7 @@ + @@ -187,8 +191,8 @@ @@ -811,7 +815,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 6be165c4..8f6800a8 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -383,7 +387,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 4f9f85b0..3148caa2 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -413,7 +417,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 723391f4..41594ef5 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -323,7 +327,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html new file mode 100644 index 00000000..81ac064b --- /dev/null +++ b/docs/configs/Preset-Player-Quickbar.html @@ -0,0 +1,248 @@ + + + + + + + + Preset-Player-Quickbar config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Preset-Player-Quickbar config

+

Preset quickbar items that players can load

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index e8582c36..ba7df4b5 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -413,7 +417,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 0db5696a..89fa28f2 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -833,7 +837,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index a6816311..5ec16347 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -291,7 +295,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 332659e6..056d6ddd 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -353,7 +357,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index a55e5c6b..a95626c1 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -387,7 +391,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 66357213..8b1fad7f 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -743,7 +747,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index f3bf9416..c010dd30 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -383,7 +387,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 77d8481e..25e9f049 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -354,7 +358,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 81f0ffec..93b734a5 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -68,9 +68,11 @@ + + @@ -118,6 +120,7 @@ + @@ -156,6 +159,7 @@ + @@ -186,8 +190,8 @@ @@ -773,7 +777,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html new file mode 100644 index 00000000..735bcfeb --- /dev/null +++ b/docs/configs/inventory_clear.html @@ -0,0 +1,248 @@ + + + + + + + + inventory_clear config + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

inventory_clear config

+

Config to control when players items are removed, this is a list of event names that will trigger inventory clear

+

+ + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + diff --git a/docs/control/Jail.html b/docs/control/Jail.html index f66c2789..1d1dc63e 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -88,6 +88,7 @@ + @@ -126,6 +127,7 @@ + @@ -160,9 +162,11 @@ + + @@ -189,8 +193,8 @@ @@ -242,15 +246,15 @@ -- This will move 'MrBiter' to the jail role and remove all other roles from them -- the player name and reason are only so they can be included in the event for user feedback - Jail.jail_player('MrBiter','Cooldude2606','Likes biters too much') + Jail.jail_player('MrBiter', 'Cooldude2606', 'Likes biters too much') -- This will give 'MrBiter' all his roles back and remove him from jail -- again as above the player name is only used in the event for user feedback - Jail.unjail_player('MrBiter','Cooldude2606') + Jail.unjail_player('MrBiter', 'Cooldude2606') -- Temp ban works the same as jail but will store the reason and move the players items to spawn -- this is meant to be used as a more permiment jail but not as strong as a ban - Jail.temp_ban_player('MrBiter','Cooldude2606','Likes biters too much') + Jail.temp_ban_player('MrBiter', 'Cooldude2606', 'Likes biters too much') @@ -1207,7 +1211,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 66ab08bb..e446944c 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -42,9 +42,9 @@

Sections

@@ -88,6 +88,7 @@ + @@ -126,6 +127,7 @@ + @@ -160,9 +162,11 @@ + + @@ -189,8 +193,8 @@ @@ -204,9 +208,9 @@

Jump to Section

@@ -247,21 +251,21 @@ -- The get production function is used to get production, consumion and net -- it may be used for any item and with any precision level, use total for total - Production.get_production(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + Production.get_production(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute) -- The fluctuations works by compearing recent production with the average over time -- again any precision may be used, apart from one_thousand_hours as there would be no valid average - Production.get_fluctuations(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute) + Production.get_fluctuations(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute) -- ETA is calculated based on what function you use but all share a similar method -- for production eta it will take current production average given by the precision -- and work out how many ticks it will require to make the required amount (1000 by default) - Production.get_production_eta(game.forces.player,'iron-plate',defines.flow_precision_index.one_minute,250000) + Production.get_production_eta(game.forces.player, 'iron-plate', defines.flow_precision_index.one_minute, 250000) -- Both get_color and format_number are helper functions to help format production stats - -- get_color will return green,orange,red,or grey based on the active_value - -- the passive_value is used when active_value is 0 and can only return orange,red,or grey - Production.get_color(clamp,active_value,passive_value) + -- get_color will return green, orange, red, or grey based on the active_value + -- the passive_value is used when active_value is 0 and can only return orange, red, or grey + Production.get_color(clamp, active_value, passive_value) @@ -283,22 +287,6 @@ -

Formating

- - - - - - - - - - - - -
get_color(clamp, active_value, passive_value)Returns a color value bassed on the value that was given
format_number(value)Returns three parts used to format a number
- -

Precision

@@ -349,6 +337,22 @@
+ + +

Formating

+ + + + + + + + + + + + +
get_color(clamp, active_value, passive_value)Returns a color value bassed on the value that was given
format_number(value)Returns three parts used to format a number

@@ -399,159 +403,6 @@ - - - - - - - - -

Formating

-
-
-
-
- # - get_color(clamp, active_value, passive_value) -
-
-
-
- -

Returns a color value bassed on the value that was given

-

- - - Parameters: - -
    - - - - - -
  • - - clamp - - : - - (number) - - value which seperates the different colours - -
  • - - - - - -
  • - - active_value - - : - - (number) - - first value tested, tested against clamp - -
  • - - - - - -
  • - - passive_value - - : - - (number) - - second value tested, tested against 0 - -
  • - - -
- - - - - Returns: -
    -
  • - (table) - contains r,g,b keys -
  • -
- - - - - - - - - -
-
-
-
- # - format_number(value) -
-
-
-
- -

Returns three parts used to format a number

-

- - - Parameters: - -
    - - - - - -
  • - - value - - : - - (number) - - the value to format - -
  • - - -
- - - - - Returns: -
    -
  • - (string) - the sign for the number -
  • -
  • - (string) - the surfix for any unit used -
  • -
- - - @@ -1306,6 +1157,159 @@ + + + + + + +
+
+

Formating

+
+
+
+
+ # + get_color(clamp, active_value, passive_value) +
+
+
+
+ +

Returns a color value bassed on the value that was given

+

+ + + Parameters: + +
    + + + + + +
  • + + clamp + + : + + (number) + + value which seperates the different colours + +
  • + + + + + +
  • + + active_value + + : + + (number) + + first value tested, tested against clamp + +
  • + + + + + +
  • + + passive_value + + : + + (number) + + second value tested, tested against 0 + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + contains r, g,b keys +
  • +
+ + + + + + + + + +
+
+
+
+ # + format_number(value) +
+
+
+
+ +

Returns three parts used to format a number

+

+ + + Parameters: + +
    + + + + + +
  • + + value + + : + + (number) + + the value to format + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + the sign for the number +
  • +
  • + (string) + the surfix for any unit used +
  • +
+ + + @@ -1328,7 +1332,7 @@ generated by LDoc
diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 09e64549..26b3f059 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -88,6 +88,7 @@ + @@ -126,6 +127,7 @@ + @@ -160,9 +162,11 @@ + + @@ -189,8 +193,8 @@ @@ -243,13 +247,13 @@ -- This will place a report on "MrBiter" (must be a valid player) the report will have been made -- by "Cooldude2606" (must be the player name) with the reason 'Liking biters too much' this can be -- seen by using Reports.get_report. - Reports.report_player('MrBiter','Cooldude2606','Liking biters too much') -- true + Reports.report_player('MrBiter', 'Cooldude2606', 'Liking biters too much') -- true -- The other get methods can be used to get all the reports on a player or to test if a player is reported. - Reports.get_report('MrBiter','Cooldude2606') -- 'Liking biters too much' + Reports.get_report('MrBiter', 'Cooldude2606') -- 'Liking biters too much' -- This will remove the warning on 'MrBiter' (must be a valid player) which was made by 'Cooldude2606'. - Reports.remove_report('MrBiter','Cooldude2606') -- true + Reports.remove_report('MrBiter', 'Cooldude2606') -- true -- This will remove all the report that have been made against 'MrBiter'. Note that the remove event will -- be triggered once per report issused. @@ -1109,7 +1113,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index d1bcf823..0841f8fc 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -87,6 +87,7 @@ + @@ -125,6 +126,7 @@ + @@ -159,9 +161,11 @@ + + @@ -188,8 +192,8 @@ @@ -249,10 +253,10 @@ Rockets.get_silos('player') -- You can get the launch time for a rocket, meaning what game tick the 50th rocket was launched - Rockets.get_rocket_time('player',50) + Rockets.get_rocket_time('player', 50) -- The rolling average will work out the time to launch one rocket based on the last X rockets - Rockets.get_rolling_average('player',10) + Rockets.get_rolling_average('player', 10) @@ -983,7 +987,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index d8fe98bf..9c1656ae 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -87,6 +87,7 @@ + @@ -125,6 +126,7 @@ + @@ -159,9 +161,11 @@ + + @@ -188,8 +192,8 @@ @@ -235,9 +239,9 @@

Usage

-- Making and then editing a new task
-local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name)
+local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name)
 
-Tasks.update_task(task_id,'We need more iron!',game.player.name)
+Tasks.update_task(task_id, 'We need more iron!', game.player.name) @@ -585,7 +589,7 @@ Tasks.update_task(task_id,'We need more iron!',game. Usage:
-- Check if a player is editing a task or not
-local editing = Tasks.get_editing(task_id,game.player.name)
+local editing = Tasks.get_editing(task_id, game.player.name)
@@ -699,7 +703,7 @@ Tasks.update_task(task_id,'We need more iron!',game. Usage:
-- Adding a new task for your force
-local task_id = Tasks.add_task(game.player.force.name,nil,game.player.name)
+local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name) @@ -838,7 +842,7 @@ Tasks.update_task(task_id,'We need more iron!',game. Usage:
-- Updating the message for on a task
-Task.update_task(task_id,'We need more iron!',game.player.name)
+Task.update_task(task_id, 'We need more iron!', game.player.name) @@ -923,7 +927,7 @@ Tasks.update_task(task_id,'We need more iron!',game. Usage:
-- Setting your editing state to true
-Tasks.set_editing(task_id,game.player.name,true)
+Tasks.set_editing(task_id, game.player.name, true) @@ -997,7 +1001,7 @@ Tasks.update_task(task_id,'We need more iron!',game. generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 7465e015..4e950b38 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -87,6 +87,7 @@ + @@ -125,6 +126,7 @@ + @@ -159,9 +161,11 @@ + + @@ -188,8 +192,8 @@ @@ -239,17 +243,17 @@ local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings -- This will add a warning to the player - Warnings.add_warning('MrBiter','Cooldude2606','Killed too many biters') + Warnings.add_warning('MrBiter', 'Cooldude2606', 'Killed too many biters') -- This will remove a warning from a player, second name is just who is doing the action - Warnings.remove_warning('MrBiter','Cooldude2606') + Warnings.remove_warning('MrBiter', 'Cooldude2606') -- Script warning as similar to normal warning but are designed to have no effect for a short amount of time -- this is so it can be used for greifer protection without being too agressive - Warnings.add_script_warning('MrBiter','Killed too many biters') + Warnings.add_script_warning('MrBiter', 'Killed too many biters') -- Both normal and script warnings can also be cleared, this will remove all warnings - Warnings.clear_warnings('MrBiter','Cooldude2606') + Warnings.clear_warnings('MrBiter', 'Cooldude2606') @@ -1464,7 +1468,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index f3a3b9f2..5ebcaf6a 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -88,6 +88,7 @@ + @@ -126,6 +127,7 @@ + @@ -160,9 +162,11 @@ + + @@ -189,8 +193,8 @@ @@ -239,14 +243,14 @@
-- Making a new spawn warp
 local player = game.player
 local force = player.force
-local spawn_id = Warps.add_warp(force.name,player.surface,player.position,player.name,'Spawn')
+local spawn_id = Warps.add_warp(force.name, player.surface, player.position, player.name, 'Spawn')
 
 Warps.set_spawn_warp(spawn_id, force)
 Warps.make_warp_tag(spawn_id)
-- Making a new warp with a warp area
 local player = game.player
 local force = player.force
-local warp_id = Warps.add_warp(force.name,player.surface,player.position,player.name)
+local warp_id = Warps.add_warp(force.name, player.surface, player.position, player.name)
 
 Warps.make_warp_area(warp_id)
 Warps.make_warp_tag(warp_id)
@@ -721,7 +725,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Check if a player is editing a warp or not
-local editing = Warps.get_editing(warp_id,game.player.name)
+local editing = Warps.get_editing(warp_id, game.player.name) @@ -851,7 +855,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Adding a new warp for your force at your position
 local player = game.player
-local warp_id = Warps.add_warp(player.force.name,player.surface,player.position,player.name)
+local warp_id = Warps.add_warp(player.force.name, player.surface, player.position, player.name) @@ -1008,7 +1012,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Changing the name and icon for a warp
-Warps.update_warp(warp_id,'My Warp','iron-plate',game.player.name)
+Warps.update_warp(warp_id, 'My Warp', 'iron-plate', game.player.name) @@ -1093,7 +1097,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Setting your editing state to true
-Warps.set_editing(warp_id,game.player.name,true)
+Warps.set_editing(warp_id, game.player.name, true) @@ -1446,7 +1450,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Set your forces spawn to a warp
-Warps.set_spawn_warp(warp_id,game.player.force)
+Warps.set_spawn_warp(warp_id, game.player.force) @@ -1515,7 +1519,7 @@ Warps.make_warp_tag(warp_id) Usage:
-- Teleport yourself to a warp point
-Warps.teleport_player(warp_id,game.player)
+Warps.teleport_player(warp_id, game.player) @@ -1534,7 +1538,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 6a6a6a2d..4bea00c1 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -86,6 +86,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -245,11 +249,11 @@ Async.register(function(player) end) -- This will allow us to bypass the error by running one tick later outside of any player scope -Async(promote_player,game.player) +Async(promote_player, game.player) -- Here we make an sync function that we want to have a delay, note the delay is not defined here local print_message = -Async.register(function(player,message) +Async.register(function(player, message) player.print(message) end) @@ -597,7 +601,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 512c965a..924e5c7a 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -92,6 +92,7 @@ + @@ -130,6 +131,7 @@ + @@ -164,9 +166,11 @@ + + @@ -193,8 +197,8 @@ @@ -266,7 +270,7 @@ msg = ':'..msg end - for 1 = 1,repeat_count do + for 1 = 1, repeat_count do Command.print(1..msg) end end) @@ -331,7 +335,7 @@ -- this is where that smiley param is used msg = ':'..msg end - for 1 = 1,repeat_count do + 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 @@ -339,7 +343,7 @@ end) -- Other values that can be returned from register -Commands.print(any,colour[opt]) -- this will return any value value to the user including if it is ran through rcon console +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 @@ -417,7 +421,7 @@ if not input then return end -- nil check -- Example Code: -Commands.add_parse('number-range-int',function(input, player, reject, range_min, range_max) +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 @@ -1997,7 +2001,7 @@ nb: this must be the last function ran on the command and must be done for the c local msg = ') '..player.name if smiley then msg = ':'..msg end - for 1 = 1,repeat_count do + for 1 = 1, repeat_count do Command.print(1..msg) end end) @@ -2175,7 +2179,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire Usage:
-- Used in the command system to log handler errors
-local success, err = pcall(command_data.callback, player, unpack(params))
+local success, err = pcall(command_data.callback, player, unpack(params))
 if Commands.internal_error(success, command_data.name, err) then
     return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err)
 end
@@ -2382,7 +2386,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 2adc2dbf..9a0d4cdf 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -44,7 +44,7 @@ - + @@ -89,6 +89,7 @@ + @@ -127,6 +128,7 @@ + @@ -161,9 +163,11 @@ + + @@ -190,8 +194,8 @@ @@ -207,7 +211,7 @@ - + @@ -353,7 +357,7 @@ -

Formating

+

Formatting

@@ -747,7 +751,7 @@ Usage:
-- Check for a string or table
-local is_string_or_table = multi_type_check(value, {'string','table'})
+local is_string_or_table = multi_type_check(value, {'string', 'table'}) @@ -855,7 +859,7 @@ Usage:
-- Raise error if value is not a string or table
-multi_type_error('foo', {'string','table'}, 'Value must be a string or table')
+multi_type_error('foo', {'string', 'table'}, 'Value must be a string or table') @@ -1075,9 +1079,9 @@ Usage:
-- Output: "Bad argument #2 to "<anon>"; argument is of type number expected string or table"
-validate_argument_type(value, {'string','table'}, 2)
+validate_argument_type(value, {'string', 'table'}, 2)
-- Output: "Bad argument #2 to "<anon>"; "player" is of type number expected string or table"
-validate_argument_type(value, {'string','table'}, 2, 'player')
+validate_argument_type(value, {'string', 'table'}, 2, 'player') @@ -1948,7 +1952,7 @@ -

Formating

+

Formatting

@@ -2056,7 +2060,7 @@ (table) - a color which contains r,g,b as its keys + a color which contains r, g, b as its keys @@ -2132,7 +2136,7 @@ (table) - a color which contains r,g,b as its keys + a color which contains r, g, b as its keys @@ -2480,7 +2484,7 @@ (table) - the position that the items will be moved to {x=100,y=100} + the position that the items will be moved to {x=100, y=100} (default: {0) @@ -2540,7 +2544,7 @@ Usage: -
-- Copy all the items in a players inventory and place them in chests at {0,0}
+    
-- Copy all the items in a players inventory and place them in chests at {0, 0}
 move_items(game.player.get_main_inventory().get_contents())
@@ -2678,7 +2682,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 Usage: -
-- Place a 0 at {0,0}
+    
-- Place a 0 at {0, 0}
 print_grid_value(0, game.player.surface, { x=0, y=0 })
@@ -2751,7 +2755,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index fcf6fcc9..4c28e6fe 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -89,6 +89,7 @@ + @@ -127,6 +128,7 @@ + @@ -161,9 +163,11 @@ + + @@ -190,8 +194,8 @@ @@ -1427,7 +1431,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index e9480d3c..3390f92f 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -94,6 +94,7 @@ + @@ -132,6 +133,7 @@ + @@ -166,9 +168,11 @@ + + @@ -195,8 +199,8 @@ @@ -261,7 +265,7 @@ Gui.element{
-- Making a factory function for a button which is contained within a flow
 -- This method is for when you still want to register event handlers but cant use the table method
 local example_flow_with_button =
-Gui.element(function(event_trigger,parent,...)
+Gui.element(function(event_trigger, parent, ...)
     -- ... shows that all other arguments from the factory call are passed to this function
     -- Here we are adding a flow which we will then later add a button to
     local flow =
@@ -301,7 +305,7 @@ Gui.element{
     caption = 'Example Button',
     style = 'forward_button' -- factorio styles can be applied here
 }
-:style(function(style,element,...)
+:style(function(style, element, ...)
     -- style is the current style object for the elemenent
     -- element is the element that is being changed
     -- ... shows that all other arguments from the factory call are passed to this function
@@ -316,7 +320,7 @@ Gui.element{
     type = 'button',
     caption = 'Example Button'
 }
-:on_click(function(player,element,event)
+:on_click(function(player, element, event)
     -- player is the player who interacted with the element to cause the event
     -- element is a refrence to the element which caused the event
     -- event is a raw refrence to the event data if player and element are not enough
@@ -337,20 +341,20 @@ Gui.element{
     width = 18,
     height = 20
 }
-:on_click(function(player,_,_)
+:on_click(function(player, _,_)
     Gui.hide_left_flow(player)
 end)
-- Eample from defines, Gui.alignment, called like: Gui.alignment(parent, name, horizontal_align, vertical_align)
 -- Notice how _ are used to blank arguments that are not needed in that context and how they line up with above
 Gui.alignment =
-Gui.element(function(_,parent,name,_,_)
+Gui.element(function(_, parent, name, _,_)
     return parent.add{
         name = name or 'alignment',
         type = 'flow',
     }
 end)
-:style(function(style,_,_,horizontal_align,vertical_align)
-    style.padding = {1,2}
+:style(function(style, _,_, horizontal_align, vertical_align)
+    style.padding = {1, 2}
     style.vertical_align = vertical_align or 'center'
     style.horizontal_align = horizontal_align or 'right'
     style.vertically_stretchable  = style.vertical_align ~= 'center'
@@ -1170,9 +1174,9 @@ Gui.element(function(_,parent,name,_,_)
     
     Usage:
     
-- Adding a right align flow
-local alignment = Gui.alignment(element,'example_right_alignment')
+local alignment = Gui.alignment(element, 'example_right_alignment')
-- Adding a horizontal center and top align flow
-local alignment = Gui.alignment(element,'example_center_top_alignment','center','top')
+
local alignment = Gui.alignment(element, 'example_center_top_alignment', 'center', 'top')
@@ -1274,7 +1278,7 @@ Gui.element(function(_,parent,name,_,_) Usage:
-- Adding a scroll table with max height of 200 and column count of 3
-local scroll_table = Gui.scroll_table(element,200,3)
+
local scroll_table = Gui.scroll_table(element, 200, 3)
@@ -1607,7 +1611,7 @@ Gui.element(function(_,parent,name,_,_) Usage:
-- Adding a container as a base
-local container = Gui.container(parent,'my_container',200)
+local container = Gui.container(parent, 'my_container', 200) @@ -2921,7 +2925,7 @@ Gui.element{
-- Using element defines with a custom factory function
 -- This method can be used if you still want to be able register event handlers but it is too complex to be compatible with LuaGuiElement.add
 local example_flow_with_button =
-Gui.element(function(event_trigger,parent,...)
+Gui.element(function(event_trigger, parent, ...)
     -- ... shows that all other arguments from the factory call are passed to this function
     -- parent is the element which was passed to the factory function where you should add your new element
     -- here we are adding a flow which we will then later add a button to
@@ -3021,7 +3025,7 @@ Gui.element{
     caption = 'Example Button',
     style = 'forward_button' -- factorio styles can be applied here
 }
-:style(function(style,element,...)
+:style(function(style, element, ...)
     -- style is the current style object for the elemenent
     -- element is the element that is being changed
     -- ... shows that all other arguments from the factory call are passed to this function
@@ -4150,7 +4154,7 @@ element_define:raise_custom_event{
     
-- Toggle your flow
 Gui.toggle_top_flow(game.player)
-- Open your top flow
-Gui.toggle_top_flow(game.player,true)
+
Gui.toggle_top_flow(game.player, true)
@@ -4405,7 +4409,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 5a2def19..f703718c 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -93,6 +93,7 @@ + @@ -131,6 +132,7 @@ + @@ -165,9 +167,11 @@ + + @@ -194,8 +198,8 @@ @@ -249,13 +253,13 @@
--- Using Role System (assignment):
 --When a map first starts you will want to define on mass all the players you expect to join and the roles to give them:
 Roles.override_player_roles{
-    Cooldude2606 = {'Owner','Admin','Member'},
+    Cooldude2606 = {'Owner', 'Admin', 'Member'},
     NotCooldude2606 = {'Member'}
 }
 
 --Once the game is running you still want to be able to give role and remove them which is when you would use:
-Roles.assign_player(player,'Admin',by_player_name) -- this will give the "Admin" role to the player
-Roles.unassign_player(player,{'Admin','Moderator'},by_player_name) -- this will remove "Admin" and "Moderator" role in one go
+Roles.assign_player(player, 'Admin', by_player_name) -- this will give the "Admin" role to the player
+Roles.unassign_player(player, {'Admin', 'Moderator'}, by_player_name) -- this will remove "Admin" and "Moderator" role in one go
 
--- Using Role System (role testing):
 --To comparer two players you can comparer the index of they highest roles, can be used when you want to allow a "write" down type system:
@@ -265,9 +269,9 @@
 Roles.get_player_roles(player) -- the return is an array that can be looped over however this is not in particular order
 
 --Finally you may want to test if a player has a certain role, flag or action allowed which is when you would use:
-Roles.player_has_role(player,'Admin') -- you can provide a role name if you only want a name based system
-Roles.player_has_flag(player,'is_donator') -- your roles can be grouped together with flags such as is_donator
-Roles.player_allowed(player,'game modifiers') -- or you can have an action based system where each action is something the player can do
+Roles.player_has_role(player, 'Admin') -- you can provide a role name if you only want a name based system
+Roles.player_has_flag(player, 'is_donator') -- your roles can be grouped together with flags such as is_donator
+Roles.player_allowed(player, 'game modifiers') -- or you can have an action based system where each action is something the player can do
 
--- Example Flag Define:
 --Flags can be used to group multiple roles and actions under one catch all, for example if you want a piece of code to only
@@ -275,7 +279,7 @@
 --a player has that tag present:
 
 -- give you donators a speed boost when they join; these functions aren't required but can be useful
-Roles.define_flag_trigger('is_donator',function(player,state)
+Roles.define_flag_trigger('is_donator', function(player, state)
     if state then
         player.character_running_speed_modifier = 1.5
     else
@@ -288,29 +292,29 @@
 :set_flag('is_donator')
 
 -- and in your code you would test for
-if Roles.player_has_flag(player,'is_donator') then
+if Roles.player_has_flag(player, 'is_donator') then
     -- some donator only code
 end
--- Example Role Define:
 --You can't use a role system without any roles so first you must define your roles; each role has a minimum of a name with
 --the option for a shorthand:
-Roles.new_role('Administrator','Admin')
+Roles.new_role('Administrator', 'Admin')
 
 --Next you will want to add any extras you want to have, such as a tag, colour, permission group or any custom flags:
-Roles.new_role('Administrator','Admin')
+Roles.new_role('Administrator', 'Admin')
 :set_custom_tag('[Admin]')
-:set_custom_color('red') -- this can be {r=0,g=0,b=0} or a predefined value
+:set_custom_color('red') -- this can be {r=0, g=0, b=0} or a predefined value
 :set_permission_group('Staff') -- a second argument can be added if you have not used the custom permission group config
 :set_flag('is_admin')
 
 --You will then want to decide if you want to allow all actions, this should of course be used sparely:
-Roles.new_role('Administrator','Admin')
+Roles.new_role('Administrator', 'Admin')
 ...extras...
 :set_allow_all()
 
 --If you don't do this want this as i would advise you do then you will want to define what the role can do; this comes with
 --an optional inheritance system if you like those sort of things in which case disallow may also be of some use to you:
-Roles.new_role('Administrator','Admin')
+Roles.new_role('Administrator', 'Admin')
 ...extras...
 :set_parent('Moderator') -- the admin can do anything that a moderator can do
 :allow{ -- these actions can be anything just try to keep them without conflicts
@@ -319,7 +323,7 @@
 }
 
 --Here is what the finished admin role would look like:
-Roles.new_role('Administrator','Admin')
+Roles.new_role('Administrator', 'Admin')
 :set_custom_tag('[Admin]')
 :set_custom_color('red')
 :set_permission_group('Staff')
@@ -413,7 +417,7 @@ Roles.define_role_order{
     
     
- @@ -531,7 +535,7 @@ nb: this function is used for the input for most outward facing functions - + @@ -884,7 +888,7 @@ nb: this is one way, failing false after already gaining the role will not revok Usage:
-- Print a message to the given roles
-Roles.print_to_roles({'Administrator','Moderator'}, 'Hello, World!')
+Roles.print_to_roles({'Administrator', 'Moderator'}, 'Hello, World!')
@@ -1156,7 +1160,7 @@ nb: this is one way, failing false after already gaining the role will not revok
-

Gets a role from a name,index or role object (where it is just returned) +

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

@@ -1643,8 +1647,8 @@ nb: this function is used for the input for most outward facing functions

Roles.override_player_roles('Cooldude2606', {'Moderator'})
-- Override all existing roles, effects all users not just ones listed
 Roles.override_player_roles{
-    ['Cooldude2606'] = {'Administrator','Moderator'},
-    ['arty714'] = {'Administrator','Moderator'},
+    ['Cooldude2606'] = {'Administrator', 'Moderator'},
+    ['arty714'] = {'Administrator', 'Moderator'},
 }
@@ -2537,7 +2541,7 @@ nb: this function is used for the input for most outward facing functions

-

Clears all flags from this role, individual flags can be removed with set_flag(name,false)

+

Clears all flags from this role, individual flags can be removed with set_flag(name, false)

@@ -3334,7 +3338,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc
diff --git a/docs/core/Store.html b/docs/core/Store.html index 51907502..4cf097cc 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -89,6 +89,7 @@ + @@ -127,6 +128,7 @@ + @@ -161,9 +163,11 @@ + + @@ -190,8 +194,8 @@ @@ -244,13 +248,13 @@ local scenario_diffculty = Store.register() -- When the store is changed this function will trigger -Store.watch(scenario_diffculty,function(value) +Store.watch(scenario_diffculty, function(value) game.print('The scenario diffculty has been set to '..value) end) -Store.set(scenario_diffculty,'hard') -- Set the value stored to 'hard' +Store.set(scenario_diffculty, 'hard') -- Set the value stored to 'hard' Store.get(scenario_diffculty) -- Returns 'hard' -Store.update(scenario_diffculty,function(value) -- Will set value to 'normal' if no value is present +Store.update(scenario_diffculty, function(value) -- Will set value to 'normal' if no value is present return not value and 'normal' end)
-- Require the module and add a store with keys
@@ -261,13 +265,13 @@ Store.set(scenario_diffculty,'hard') end)
 
 -- When any key in the store is changed this function will trigger
-Store.watch(player_scores,function(value,key,old_value)
+Store.watch(player_scores, function(value, key, old_value)
     game.print(key..' now has a score of '..value)
 end)
 
-Store.set(player_scores,game.player,10) -- Set your score to 10
-Store.get(scenario_diffculty,game.player) -- Returns 10
-Store.update(scenario_diffculty,game.player,function(value) -- Add 1 to your score
+Store.set(player_scores, game.player, 10) -- Set your score to 10
+Store.get(scenario_diffculty, game.player) -- Returns 10
+Store.update(scenario_diffculty, game.player, function(value) -- Add 1 to your score
     return value + 1
 end)
@@ -639,7 +643,7 @@ Store.set(player_scores,game.player,10) end) -- player_scores is a valid store and key will be your player name -local key = Store.validate(player_scores,game.player) +
local key = Store.validate(player_scores, game.player)
@@ -777,12 +781,12 @@ Store.set(player_scores,game.player,10) local scenario_diffculty = Store.register() -- Register the watcher so that when we change the value the message is printed -Store.watch(scenario_diffculty,function(value) +Store.watch(scenario_diffculty, function(value) game.print('The scenario diffculty has been set to '..value) end) -- Set a new value for the diffculty and see that it has printed to the game -Store.set(scenario_diffculty,'hard') +Store.set(scenario_diffculty, 'hard')
-- Printing the changed value to all players, with keys
 -- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
 local player_scores = Store.register(function(player)
@@ -790,12 +794,12 @@ Store.set(player_scores,game.player,10) end)
 
 -- Register the watcher so that when we change the value the message is printed
-Store.watch(player_scores,function(value,key,old_value)
+Store.watch(player_scores, function(value, key, old_value)
     game.print(key..' now has a score of '..value)
 end)
 
 -- Set a new value for your score and see that it has printed to the game
-Store.set(player_scores,game.player,10)
+Store.set(player_scores, game.player, 10) @@ -887,7 +891,7 @@ Store.set(player_scores,game.player,10) end) -- Get your current score -local my_score = Store.get(player_scores,game.player) +local my_score = Store.get(player_scores, game.player) -- Get all scores lcoal scores = Store.get(player_scores) @@ -972,7 +976,7 @@ Store.set(player_scores,game.player,10) end) -- Clear your score -Store.clear(player_scores,game.player) +Store.clear(player_scores, game.player) -- Clear all scores Store.clear(player_scores) @@ -1065,7 +1069,7 @@ Store.set(player_scores,game.player,10) local scenario_diffculty = Store.register() -- Set the new scenario diffculty -Store.set(scenario_diffculty,'hard') +Store.set(scenario_diffculty, 'hard')
-- Set data in a store with keys
 -- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects
 local player_scores = Store.register(function(player)
@@ -1073,10 +1077,10 @@ Store.set(player_scores,game.player,10) end)
 
 -- Set your current score
-Store.set(player_scores,game.player,10)
+Store.set(player_scores, game.player, 10)
 
 -- Set all scores, note this might not have much use
-Store.set(player_scores,{
+Store.set(player_scores, {
     [game.player.name] = 10,
     ['SomeOtherPlayer'] = 0
 })
@@ -1169,10 +1173,10 @@ Store.set(player_scores,game.player,10) local game_score = Store.register() -- Setting a default value -Store.set(game_score,0) +Store.set(game_score, 0) -- We now will update the game score by one, we return the value so that it is set as the new value in the store -Store.update(game_score,function(value) +Store.update(game_score, function(value) return value + 1end)
-- Updating keys in a table of data
@@ -1182,7 +1186,7 @@ Store.set(player_scores,game.player,10) end)
 
 -- Setting a default value for your player, used to show the table structure
-Store.set(player_data,game.player,{
+Store.set(player_data, game.player, {
     group = 'Admin',
     role = 'Owner',
     show_group_config = false
@@ -1190,7 +1194,7 @@ Store.set(player_scores,game.player,10) -- Updating the show_group_config key in your player data, note that it would be harder to call set every time
 -- We do not need to return anything in this case as we are not replacing all the data
-Store.update(player_data,game.player,function(data)
+Store.update(player_data, game.player, function(data)
     data.show_group_config = not data.show_group_config
 end)
@@ -1267,7 +1271,7 @@ Store.set(player_scores,game.player,10) end) -- Setting a default value for your player, used to show the table structure -Store.set(player_data,game.player,{ +Store.set(player_data, game.player, { group = 'Admin', role = 'Owner', show_group_config = false @@ -1276,7 +1280,7 @@ Store.set(player_scores,game.player,10) -- Updating the show_group_config key for all players, note that it would be harder to call set every time -- We do not need to return anything in this case as we are not replacing all the data -- We also have access to the current key being updated if needed -Store.map(player_data,function(data,key) +Store.map(player_data, function(data, key) data.show_group_config = not data.show_group_config end) @@ -1461,7 +1465,7 @@ Store.set(player_scores,game.player,10) -- Trigger the watchers with a fake change of diffculty -- This is mostly used internally but it can be useful in other cases -Store.raw_trigger(scenario_diffculty,nil,'normal','normal') +Store.raw_trigger(scenario_diffculty, nil, 'normal', 'normal') @@ -1480,7 +1484,7 @@ Store.set(player_scores,game.player,10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index f6a07252..8ffe6e6e 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -718,7 +722,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index beecc8d1..38ac0062 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -257,6 +261,9 @@ + + +
get_role_from_any(any)Gets a role from a name,index or role object (where it is just returned) + 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._prototype:clear_flags()Clears all flags from this role, individual flags can be removed with set_flag(name,false)Clears all flags from this role, individual flags can be removed with set_flag(name, false)
Roles._prototype:has_flag(name)
utils.game
expcore.common
@@ -432,6 +439,31 @@ + + + + + + + +
+
+
+ # + expcore.common +
+
+
+
+ + + + + + + + + @@ -727,7 +759,7 @@ generated by LDoc
diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index b112fb6a..c1c5383e 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -690,7 +694,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 3b409eb2..1397bf4f 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -569,7 +573,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index c9d42c26..27a5fad8 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -755,7 +759,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 0eaf7808..7206002a 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -100,6 +100,7 @@ + @@ -124,6 +125,7 @@ + @@ -158,9 +160,11 @@ + + @@ -187,8 +191,8 @@ @@ -960,7 +964,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 3acdff7b..8b3b3b8e 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -101,6 +101,7 @@ + @@ -125,6 +126,7 @@ + @@ -159,9 +161,11 @@ + + @@ -188,8 +192,8 @@ @@ -436,7 +440,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 266d509e..746fcd7d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -155,6 +155,10 @@
+ + + + @@ -276,6 +280,11 @@ - Adds a command that adds * around your message in the chat + + + + @@ -353,7 +362,7 @@ - @@ -366,7 +375,7 @@ @@ -414,6 +423,10 @@ see ./expcore/commands.lua for more details + + + + @@ -426,6 +439,10 @@ see ./expcore/commands.lua for more details + + + + @@ -484,10 +501,10 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name

Topics

Greets players on join
Inventory-ClearWill move players items to spawn when they are banned or kicked, option to clear on leave
Pollution-Grading Makes polution look much nice of the map, ie not one big red mess
QuickbarCommands Module - Quickbar + - Adds a command that allows players to load Quickbar presets
Rainbow Commands Module - Rainbow - Adds a command that prints your message in rainbow font
Commands-Auth-AdminThis is a very simple config file which adds a admin only auth functio; + 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
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; +use Commands.add_parse('name',function(input, player, reject) end) to add a parse; see ./expcore/commands.lua for more details
This file contains all the different settings for the warp system and gui
inventory_clearConfig to control when players items are removed, this is a list of event names that will trigger inventory clear
Pollution-Grading This controls how pollution is viewed on the map
Preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed)
Preset-Player-QuickbarPreset quickbar items that players can load
Repair Config file for the repair command
- + - +
readme.mdREADME.md
licenseLICENSE
@@ -507,7 +524,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 3542b831..bf094544 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -100,6 +100,7 @@ + @@ -138,6 +139,7 @@ + @@ -172,9 +174,11 @@ + + @@ -186,8 +190,8 @@ @@ -294,7 +298,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index e5d0e142..8babe37f 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -100,6 +100,7 @@ + @@ -138,6 +139,7 @@ + @@ -172,9 +174,11 @@ + + @@ -186,8 +190,8 @@ @@ -292,7 +296,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 3e5221fc..fbc3074a 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -100,6 +100,7 @@ + @@ -138,6 +139,7 @@ + @@ -172,9 +174,11 @@ + + @@ -186,8 +190,8 @@ @@ -653,7 +657,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index f1734c97..d631c6f6 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -100,6 +100,7 @@ + @@ -138,6 +139,7 @@ + @@ -172,9 +174,11 @@ + + @@ -186,8 +190,8 @@ @@ -352,7 +356,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 20f2ea68..dcc8f576 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -102,6 +102,7 @@ + @@ -140,6 +141,7 @@ + @@ -174,9 +176,11 @@ + + @@ -188,8 +192,8 @@ @@ -615,8 +619,8 @@
-- Adding 1000 values into the middle of the array
 local tbl = {}
 local values = {}
-for i = 1,1000 do tbl[i] = i values[i] = i end
-table.array_insert(tbl,500,values) -- around 0.4ms
+for i = 1, 1000 do tbl[i] = i values[i] = i end +table.array_insert(tbl, 500, values) -- around 0.4ms @@ -711,8 +715,8 @@
-- Merging two tables
 local tbl = {}
 local tbl2 = {}
-for i = 1,100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end
-table.table_insert(tbl,50,tbl2)
+for i = 1, 100 do tbl[i] = i tbl['_'..i] = i tbl2[i] = i tbl2['__'..i] = i end +table.table_insert(tbl, 50, tbl2) @@ -1066,7 +1070,7 @@ Usage: -
local key_three, key_one = extract({key_one='foo',key_two='bar',key_three=true},'key_three','key_one')
+
local key_three, key_one = extract({key_one='foo', key_two='bar', key_three=true}, 'key_three', 'key_one')
@@ -2007,7 +2011,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index beaa2b20..686d99d2 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -101,6 +101,7 @@ + @@ -139,6 +140,7 @@ + @@ -173,9 +175,11 @@ + + @@ -187,8 +191,8 @@ @@ -1291,7 +1295,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index c270c6ce..7d3a4b74 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -100,6 +100,7 @@ + @@ -138,6 +139,7 @@ + @@ -172,9 +174,11 @@ + + @@ -186,8 +190,8 @@ @@ -433,7 +437,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 43b62a10..33e87913 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -101,6 +101,7 @@ + @@ -139,6 +140,7 @@ + @@ -173,9 +175,11 @@ + + @@ -187,8 +191,8 @@ @@ -650,7 +654,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html new file mode 100644 index 00000000..5153e753 --- /dev/null +++ b/docs/topics/LICENSE.html @@ -0,0 +1,800 @@ + + + + + + + + LICENSE topic + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

LICENSE topic

+

+

+ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 +

Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +

Preamble +

The GNU General Public License is a free, copyleft license for +software and other kinds of works. +

The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. +

When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. +

To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. +

For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. +

Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. +

For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. +

Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. +

Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. +

The precise terms and conditions for copying, distribution and +modification follow. +

TERMS AND CONDITIONS +

0. Definitions. +

"This License" refers to version 3 of the GNU General Public License. +

"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. +

"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. +

To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. +

A "covered work" means either the unmodified Program or a work based +on the Program. +

To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. +

To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. +

An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. +

1. Source Code. +

The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. +

A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. +

The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. +

The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. +

The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. +

The Corresponding Source for a work in source code form is that +same work. +

2. Basic Permissions. +

All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. +

You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. +

Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. +

3. Protecting Users' Legal Rights From Anti-Circumvention Law. +

No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. +

When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. +

4. Conveying Verbatim Copies. +

You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. +

You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. +

5. Conveying Modified Source Versions. +

You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: +

a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +

b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". +

c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +

d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. +

A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. +

6. Conveying Non-Source Forms. +

You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: +

a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +

b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. +

c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +

d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +

e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. +

A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. +

A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. +

"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. +

If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). +

The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. +

Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. +

7. Additional Terms. +

"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. +

When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. +

Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: +

a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +

b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +

c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +

d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or +

e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +

f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. +

All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. +

If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. +

Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. +

8. Termination. +

You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). +

However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. +

Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. +

Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. +

9. Acceptance Not Required for Having Copies. +

You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. +

10. Automatic Licensing of Downstream Recipients. +

Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. +

An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. +

You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. +

11. Patents. +

A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". +

A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. +

Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. +

In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. +

If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. +

If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. +

A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. +

Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. +

12. No Surrender of Others' Freedom. +

If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. +

13. Use with the GNU Affero General Public License. +

Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. +

14. Revised Versions of this License. +

The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. +

Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. +

If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. +

Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. +

15. Disclaimer of Warranty. +

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +

16. Limitation of Liability. +

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. +

17. Interpretation of Sections 15 and 16. +

If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. +

END OF TERMS AND CONDITIONS +

How to Apply These Terms to Your New Programs +

If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. +

To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. +

Scenario for Facotorio multiplayer. + Copyright (C) 2018 badgamernl +

This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. +

This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +

You should have received a copy of the GNU General Public License + along with this program. If not, see . +

Also add information on how to contact you by electronic and paper mail. +

If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: +

explosivegaming.nl Copyright (C) 2018 badgamernl + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. +

The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". +

You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. +

The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + + + + + + + + + + + + + +
+ + + +

+ + + +
+
+ + + + + diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html new file mode 100644 index 00000000..4a614dc5 --- /dev/null +++ b/docs/topics/README.md.html @@ -0,0 +1,352 @@ + + + + + + + + README.md topic + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

README.md topic

+

+

+ +

+ logo +
+ + Release + + + Downloads + + + Star + + + Fork + + + CodeFactor + + + Discord + +

+

ExpGaming Scenario Repository

+

## Explosive Gaming +

Explosive Gaming (often ExpGaming) is a server hosting community with a strong focus on Factorio and games that follow similar ideas. Our Factorio server are known for hosting large maps with the main goal of being a "mega base" which can produce as much as possible within our reset schedule. Although these servers tend to attract the more experienced players, our servers are open to everyone. You can find us through our [website], [discord], [wiki], or in the public games tab in Factorio (ExpGaming S1, ExpGaming S2, etc.). +

## Use and Installation +

1) Download this [git repository](https://github.com/explosivegaming/scenario/archive/master.zip) for the stable release. The dev branch can be found [here](https://github.com/explosivegaming/scenario/archive/dev.zip) for those who want the latest features. See [releases](#releases) for other release branches. +

2) Extract the downloaded zip file from the branch you downloaded into Factorio's scenario directory: + * Windows: `%appdata%\Factorio\scenarios` + * Linux: `~/.factorio/scenarios` +

3) Within the scenario you can find `./config/_file_loader.lua` which contains a list of all the modules that will be loaded by the scenario; simply comment out (or remove) features you do not want but note that some modules may load other modules as dependencies even when removed from the list. +

4) More advanced users may want to play with the other configs files within `./config` but please be aware that some of the config files will require a basic understanding of lua while others may just be a list of values. +

5) Once you have made any config changes that you wish to make open Factorio, select play, then start scenario (or host scenario from within multiplayer tab), and select the scenario which will be called `scenario-master` if you have downloaded the latest stable release and have not changed the folder name. +

6) The scenario will now load all the selected modules and start the map, any errors or exceptions raised in the scenario should not cause a game/server crash, so if any features do not work as expected then it may be returning an error in the log. +Please report these errors to [the issues page](issues). +

## Contributing +

All are welcome to make pull requests and issues for this scenario, if you are in any doubt, please ask someone in our [discord]. If you do not know lua and don't feel like learning you can always make a [feature request]. To find out what we already have please read our [docs]. Please keep in mind while making code changes: +

* New features should have the branch names: `feature/feature-name` +* New features are merged into `dev` after it has been completed, this can be done through a pull request. +* After a number of features have been added a release branch is made: `release/X.Y.0` +* Bug fixes and localization can be made to the release branch with a pull request rather than into dev. +* A release is merged into `master` on the following friday after it is considered stable. +* Patches may be named `patch/X.Y.Z` and will be merged into `dev` and then `master` when appropriate. +

## Releases +

| Scenario Version* | Version Name | Factorio Version** | +|---|---|---| +| [v6.0][s6.0] | Gui / 0.18 Overhaul | [v0.18.17][f0.18.17] | +| [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] | +| [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | +| [v5.8][s5.8] | Home and Chat Bot | [v0.17.47][f0.17.49] | +| [v5.7][s5.7] | Warp System | [v0.17.47][f0.17.47] | +| [v5.6][s5.6] | Information Guis | [v0.17.44][f0.17.44] | +| [v5.5][s5.5] | Gui System | [v0.17.43][f0.17.43] | +| [v5.4][s5.4] | Admin Controls | [v0.17.32][f0.17.32] | +| [v5.3][s5.3] | Custom Roles | [v0.17.28][f0.17.28] | +| [v5.2][s5.2] | Quality of life | [v0.17.22][f0.17.22] | +| [v5.1][s5.1] | Permission Groups | [v0.17.13][f0.17.13] | +| [v5.0][s5.0] | 0.17 Overhaul| [v0.17][f0.17.9] | +| [v4.0][s4.0] | Softmod Manager | [v0.16.51][f0.16.51] | +| [v3.0][s3.0] | 0.16 Overhaul | [v0.16][f0.16] | +| [v2.0][s2.0] | Localization and clean up | [v0.15][f0.15] | +| [v1.0][s1.0] | Modulation | [v0.15][f0.15] | +| [v0.1][s0.1] | First Tracked Version | [v0.14][f0.14] | +

\* Scenario patch versions have been omitted. +

\*\* Factorio versions show the version they were made for, often the minimum requirement. +

[s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0 +[s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0 +[s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 +[s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0 +[s5.7]: https://github.com/explosivegaming/scenario/releases/tag/5.7.0 +[s5.6]: https://github.com/explosivegaming/scenario/releases/tag/5.6.0 +[s5.5]: https://github.com/explosivegaming/scenario/releases/tag/5.5.0 +[s5.4]: https://github.com/explosivegaming/scenario/releases/tag/5.4.0 +[s5.3]: https://github.com/explosivegaming/scenario/releases/tag/5.3.0 +[s5.2]: https://github.com/explosivegaming/scenario/releases/tag/5.2.0 +[s5.1]: https://github.com/explosivegaming/scenario/releases/tag/5.1.0 +[s5.0]: https://github.com/explosivegaming/scenario/releases/tag/5.0.0 +[s4.0]: https://github.com/explosivegaming/scenario/releases/tag/v4.0 +[s3.0]: https://github.com/explosivegaming/scenario/releases/tag/v3.0 +[s2.0]: https://github.com/explosivegaming/scenario/releases/tag/v2.0 +[s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 +[s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 +

[f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17 +[f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71 +[f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 +[f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49 +[f0.17.47]: https://wiki.factorio.com/Version_history/0.17.0#0.17.47 +[f0.17.44]: https://wiki.factorio.com/Version_history/0.17.0#0.17.44 +[f0.17.43]: https://wiki.factorio.com/Version_history/0.17.0#0.17.43 +[f0.17.32]: https://wiki.factorio.com/Version_history/0.17.0#0.17.32 +[f0.17.28]: https://wiki.factorio.com/Version_history/0.17.0#0.17.28 +[f0.17.22]: https://wiki.factorio.com/Version_history/0.17.0#0.17.22 +[f0.17.13]: https://wiki.factorio.com/Version_history/0.17.0#0.17.13 +[f0.17.9]: https://wiki.factorio.com/Version_history/0.17.0#0.17.9 +[f0.16.51]: https://wiki.factorio.com/Version_history/0.16.0#0.16.51 +[f0.16]: https://wiki.factorio.com/Version_history/0.16.0 +[f0.15]: https://wiki.factorio.com/Version_history/0.15.0 +[f0.14]: https://wiki.factorio.com/Version_history/0.14.0 +

## License +

The Explosive Gaming codebase is licensed under the [GNU General Public License v3.0](LICENSE) +

[docs]: https://explosivegaming.github.io/scenario/ +[issues]: https://github.com/explosivegaming/scenario/issues/new/choose +[website]: https://explosivegaming.nl +[discord]: https://discord.explosivegaming.nl +[wiki]: https://wiki.explosivegaming.nl + + + + + + + + + + + + + +
+ + + +

+ + + +
+
+ + + + + From ddcda05ab9b868a3e64c8636c8ddfd20c158791e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 19:06:48 +0100 Subject: [PATCH 030/106] Fixed Datastore Docs --- expcore/datastore.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 4189aaef..f2f526ad 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -163,7 +163,7 @@ Event.on_load(function() end end) ------ Datastore Manager ----- +----- Datastore Manager -- @section datastoreManager --- Metatable used on datastores @@ -224,6 +224,7 @@ function DatastoreManager.combine(datastoreName, subDatastoreName) return datastore:combine(subDatastoreName) end +local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end --[[-- Ingest the result from a request, this is used through a rcon interface to sync data @tparam string action The action that should be done, can be: remove, message, propagate, or request @tparam string datastoreName The name of the datastore that should have the action done to it @@ -234,7 +235,6 @@ end Datastore.ingest('request', 'ExampleData', 'TestKey', 'Foo') ]] -local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end function DatastoreManager.ingest(action, datastoreName, key, valueJson) local datastore = assert(Datastores[datastoreName], 'Datastore ingest error, Datastore not found '..tostring(datastoreName)) assert(type(action) == 'string', 'Datastore ingest error, Action is not a string got: '..type(action)) @@ -289,7 +289,7 @@ function DatastoreManager.name_serializer(rawKey) return rawKey.name end ------ Datastore Internal ----- +----- Datastore Internal -- @section datastore-internal --[[-- Debug, Get the debug info for this datastore @@ -398,8 +398,8 @@ function Datastore:write_action(action, key, value) game.write_file('datastore.pipe', table.concat(data, ' ')..'\n', true, 0) end ------ Datastore ----- --- @section datastore +----- Datastore Local +-- @section datastore-local --[[-- Create a new datastore which is stores its data inside of this datastore @tparam string subDatastoreName The name of the datastore that will have its data stored in this datastore @@ -615,7 +615,7 @@ function Datastore:update_all(callback) end end ------ Datastore External ----- +----- Datastore External -- @section datastore-external --[[-- Request a value from an external source, will trigger on_load when data is received @@ -717,7 +717,7 @@ function Datastore:unload_all(callback) for key in pairs(data) do self:unload(key) end end ------ Events ----- +----- Events -- @section events local function event_error(err) print('An error ocurred in a datastore event handler:', err) end @@ -826,5 +826,5 @@ end) ]] Datastore.on_update = event_factory('on_update') ------ Module Return ----- +----- Module Return return DatastoreManager \ No newline at end of file From 933f32e5e37275b357f0826a3f4b79776519d6db Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:12:20 +0000 Subject: [PATCH 031/106] Automattic Doc Update --- docs/addons/Advanced-Start.html | 4 +- docs/addons/Chat-Popups.html | 4 +- docs/addons/Chat-Reply.html | 4 +- docs/addons/Compilatron.html | 4 +- docs/addons/Damage-Popups.html | 4 +- docs/addons/Death-Logger.html | 4 +- docs/addons/Discord-Alerts.html | 4 +- docs/addons/Inventory-Clear.html | 4 +- docs/addons/Player-Colours.html | 4 +- docs/addons/Pollution-Grading.html | 4 +- docs/addons/Scorched-Earth.html | 4 +- docs/addons/Spawn-Area.html | 4 +- docs/addons/Tree-Decon.html | 4 +- docs/addons/greetings.html | 4 +- docs/commands/Admin-Chat.html | 4 +- docs/commands/Bonus.html | 4 +- docs/commands/Cheat-Mode.html | 4 +- docs/commands/Clear-Inventory.html | 4 +- docs/commands/Debug.html | 4 +- docs/commands/Find.html | 4 +- docs/commands/Help.html | 4 +- docs/commands/Home.html | 4 +- docs/commands/Interface.html | 4 +- docs/commands/Jail.html | 4 +- docs/commands/Kill.html | 4 +- docs/commands/Me.html | 4 +- docs/commands/Quickbar.html | 4 +- docs/commands/Rainbow.html | 4 +- docs/commands/Repair.html | 4 +- docs/commands/Reports.html | 4 +- docs/commands/Roles.html | 4 +- docs/commands/Spawn.html | 4 +- docs/commands/Tag.html | 4 +- docs/commands/Teleport.html | 4 +- docs/commands/Warnings.html | 4 +- docs/configs/Advanced-Start.html | 4 +- docs/configs/Bonuses.html | 4 +- docs/configs/Chat-Reply.html | 4 +- docs/configs/Commands-Auth-Admin.html | 4 +- docs/configs/Commands-Auth-Roles.html | 4 +- .../Commands-Auth-Runtime-Disable.html | 4 +- docs/configs/Commands-Parse-Roles.html | 4 +- docs/configs/Commands-Parse.html | 4 +- docs/configs/Compilatron.html | 4 +- docs/configs/Death-Logger.html | 4 +- docs/configs/Discord-Alerts.html | 4 +- docs/configs/File-Loader.html | 4 +- docs/configs/Permission-Groups.html | 4 +- docs/configs/Player-List.html | 4 +- docs/configs/Pollution-Grading.html | 4 +- docs/configs/Popup-Messages.html | 4 +- docs/configs/Preset-Player-Colours.html | 4 +- docs/configs/Preset-Player-Quickbar.html | 4 +- docs/configs/Repair.html | 4 +- docs/configs/Rockets.html | 4 +- docs/configs/Roles.html | 4 +- docs/configs/Science.html | 4 +- docs/configs/Scorched-Earth.html | 4 +- docs/configs/Spawn-Area.html | 4 +- docs/configs/Tasks.html | 4 +- docs/configs/Warnings.html | 4 +- docs/configs/Warps.html | 4 +- docs/configs/inventory_clear.html | 4 +- docs/control/Jail.html | 4 +- docs/control/Production.html | 4 +- docs/control/Reports.html | 4 +- docs/control/Rockets.html | 4 +- docs/control/Tasks.html | 4 +- docs/control/Warnings.html | 4 +- docs/control/Warps.html | 4 +- docs/core/Async.html | 4 +- docs/core/Commands.html | 4 +- docs/core/Common.html | 4 +- docs/core/Datastore.html | 2871 +++++++++++++++++ docs/core/Groups.html | 4 +- docs/core/Gui.html | 4 +- docs/core/PlayerData.html | 501 +++ docs/core/Roles.html | 4 +- docs/core/Store.html | 4 +- docs/guis/Player-List.html | 4 +- docs/guis/Readme.html | 4 +- docs/guis/Rocket-Info.html | 4 +- docs/guis/Science-Info.html | 4 +- docs/guis/Task-List.html | 4 +- docs/guis/Warps-List.html | 4 +- docs/guis/server-ups.html | 4 +- docs/index.html | 12 +- docs/modules/control.html | 4 +- .../modules.addons.station-auto-name.html | 4 +- docs/modules/overrides.debug.html | 4 +- docs/modules/overrides.math.html | 4 +- docs/modules/overrides.table.html | 4 +- docs/modules/utils.event.html | 4 +- docs/modules/utils.event_core.html | 4 +- docs/modules/utils.task.html | 4 +- docs/topics/LICENSE.html | 4 +- docs/topics/README.md.html | 4 +- 97 files changed, 3665 insertions(+), 95 deletions(-) create mode 100644 docs/core/Datastore.html create mode 100644 docs/core/PlayerData.html diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index e81eb23f..9982cb3f 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -73,8 +73,10 @@ + + @@ -351,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 9f183435..c9dbff7f 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -73,8 +73,10 @@ + + @@ -352,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 42c26a8f..4e9b6377 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -73,8 +73,10 @@ + + @@ -379,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 45cc871e..fc1716fd 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -74,8 +74,10 @@ + + @@ -588,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 3d5d84bc..68b6d7fc 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -73,8 +73,10 @@ + + @@ -352,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index fbf61296..a8967ecd 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -73,8 +73,10 @@ + + @@ -407,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 0159d227..45ab0cb9 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -73,8 +73,10 @@ + + @@ -463,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 60ef06b4..ce87dc0e 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -73,8 +73,10 @@ + + @@ -351,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index e1a2be59..4756d480 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -73,8 +73,10 @@ + + @@ -407,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index de0f214a..0f7111f3 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -73,8 +73,10 @@ + + @@ -323,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index bf3e8303..561ae5b3 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -73,8 +73,10 @@ + + @@ -407,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index d95d6d7a..ea566dda 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -73,8 +73,10 @@ + + @@ -379,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 457ca4fc..a2b049bd 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -73,8 +73,10 @@ + + @@ -379,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index f2f31ac7..36515fa4 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -73,8 +73,10 @@ + + @@ -379,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index d62c7a8c..41426961 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -81,8 +81,10 @@ + + @@ -391,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 4ab594b6..f3217c1f 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -81,8 +81,10 @@ + + @@ -503,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index b665d15c..5869f710 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -81,8 +81,10 @@ + + @@ -364,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 891ac5c8..af432523 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -81,8 +81,10 @@ + + @@ -391,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 53b98cea..819392f3 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -81,8 +81,10 @@ + + @@ -368,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 29033cc5..ce42ad18 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -81,8 +81,10 @@ + + @@ -363,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index c0c4e54e..38834890 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -81,8 +81,10 @@ + + @@ -407,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 338791be..18dda653 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -81,8 +81,10 @@ + + @@ -461,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index b0021e91..09786909 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -81,8 +81,10 @@ + + @@ -419,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 621a9aec..a6c12d10 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -81,8 +81,10 @@ + + @@ -614,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index ca61daca..9e1bf8e8 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -81,8 +81,10 @@ + + @@ -392,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index cccd2fc5..f2d7330f 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -81,8 +81,10 @@ + + @@ -363,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index 186a774e..dcd166ea 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -81,8 +81,10 @@ + + @@ -399,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 05233854..97ca2540 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -81,8 +81,10 @@ + + @@ -391,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index fcf3f0d7..bc5c3c49 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -80,8 +80,10 @@ + + @@ -324,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 0d83676a..770dc9e7 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -81,8 +81,10 @@ + + @@ -588,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 1b746a51..d1676712 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -81,8 +81,10 @@ + + @@ -560,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index af7524a0..2923f033 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -81,8 +81,10 @@ + + @@ -392,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 77dbadf0..412c0d34 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -81,8 +81,10 @@ + + @@ -446,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 108e22a2..9bf1c238 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -81,8 +81,10 @@ + + @@ -487,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 2c4e808a..fb304bad 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -81,8 +81,10 @@ + + @@ -572,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index e7e40e07..1a77b8ab 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -87,8 +87,10 @@ + + @@ -509,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 74e7c9f0..46a2357e 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -79,8 +79,10 @@ + + @@ -240,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 6b56dad1..a244e41b 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -88,8 +88,10 @@ + + @@ -488,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 1b2832eb..7c44f74a 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -87,8 +87,10 @@ + + @@ -297,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index b4884896..a65c596e 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -87,8 +87,10 @@ + + @@ -323,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 08a59675..085de457 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -88,8 +88,10 @@ + + @@ -445,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index bbec55e1..c9f4ec18 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -87,8 +87,10 @@ + + @@ -357,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 897c2281..0339092d 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -87,8 +87,10 @@ + + @@ -341,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index c5ae25df..d2e99dc2 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -87,8 +87,10 @@ + + @@ -357,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index f7eeef91..f2a86deb 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -87,8 +87,10 @@ + + @@ -419,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index ed9373e9..51a7423d 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -79,8 +79,10 @@ + + @@ -240,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 41ff18a2..d09624a4 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -79,8 +79,10 @@ + + @@ -243,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 0a7b5d6c..e1f58384 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -87,8 +87,10 @@ + + @@ -298,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index f1c5fe11..b7c4b928 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -88,8 +88,10 @@ + + @@ -815,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 8f6800a8..2f6d8514 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -87,8 +87,10 @@ + + @@ -387,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 3148caa2..dc478298 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -87,8 +87,10 @@ + + @@ -417,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 41594ef5..79e279ad 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -87,8 +87,10 @@ + + @@ -327,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 81ac064b..127715e0 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -79,8 +79,10 @@ + + @@ -240,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index ba7df4b5..c9aea8e7 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -87,8 +87,10 @@ + + @@ -417,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 89fa28f2..c349fcd6 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -87,8 +87,10 @@ + + @@ -837,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 5ec16347..0126bc4a 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -87,8 +87,10 @@ + + @@ -295,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 056d6ddd..184f0085 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -87,8 +87,10 @@ + + @@ -357,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index a95626c1..505eb968 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -87,8 +87,10 @@ + + @@ -391,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 8b1fad7f..d46308ac 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -87,8 +87,10 @@ + + @@ -747,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index c010dd30..cad9627f 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -87,8 +87,10 @@ + + @@ -387,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 25e9f049..bde17b16 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -87,8 +87,10 @@ + + @@ -358,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 93b734a5..b1976aea 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -87,8 +87,10 @@ + + @@ -777,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 735bcfeb..bedc32c6 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -79,8 +79,10 @@ + + @@ -240,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 1d1dc63e..75303250 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -69,8 +69,10 @@ + + @@ -1211,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index e446944c..5e9f256e 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -69,8 +69,10 @@ + + @@ -1332,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 26b3f059..ccfd5a8b 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -69,8 +69,10 @@ + + @@ -1113,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 0841f8fc..e48c254c 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -68,8 +68,10 @@ + + @@ -987,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 9c1656ae..5856ec42 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -68,8 +68,10 @@ + + @@ -1001,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 4e950b38..78146b3c 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -68,8 +68,10 @@ + + @@ -1468,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 5ebcaf6a..40c9c942 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -69,8 +69,10 @@ + + @@ -1538,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 4bea00c1..17551cde 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -53,8 +53,10 @@ + + @@ -601,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 924e5c7a..91eac693 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -59,8 +59,10 @@ + + @@ -2386,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 9a0d4cdf..7b122edb 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -56,8 +56,10 @@ + + @@ -2755,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html new file mode 100644 index 00000000..3a878064 --- /dev/null +++ b/docs/core/Datastore.html @@ -0,0 +1,2871 @@ + + + + + + + + Datastore core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

Datastore core

+

Core Module - Datastore +- A module used to store data in the global table with the option to have it sync to an external source.

+

+ + + + + + +

Usage

+
-- Types of Datastore
+-- This datastore will not save data externally and can be used to watch for updates on values within it
+-- A common use might be to store data for a gui and only update the gui when a value changes
+local LocalDatastore = Datastore.connect('LocalDatastore')
+
+-- This datastore will allow you to use the save and request method, this allows you to have persistent data
+-- Should be used over auto save as it creates less save requests, but this means you need to tell the data to be saved
+-- We use this type for player data as we know the data only needs to be saved when the player leaves
+local PersistentDatastore = Datastore.connect('PersistentDatastore', true) -- save_to_disk
+
+-- This datastore is the same as above but the save method will be called automatically when ever you change a value
+-- An auto save datastore should be used if the data does not change often, this can be global settings and things of that sort
+-- If it is at all possible to setup events to unload and/or save the data then this is preferable
+local AutosaveDatastore = Datastore.connect('AutosaveDatastore', true, true) -- save_to_disk, auto_save
+
+-- Finally you can have a datastore that propagates its changes to all other connected servers, this means request does not need to be used
+-- This should be used when you might have data conflicts while saving, this is done by pushing the saved value to all active servers
+-- The request method has little use after server start as any external changes to the value will be pushed automatically
+-- Auto save can also be used with this type and you should follow the same guidelines above for when this should be avoided
+local PropagateDatastore = Datastore.connect('PropagateDatastore', true, false, true) -- save_to_disk, propagate_changes
+
+
-- Using Datastores Locally
+-- Once you have your datastore connection setup, any further requests with connect will return the same datastore
+-- This is important to know because the settings passed as parameters you have an effect when it is first created
+
+-- One useful thing that you might want to set up before runtime is a serializer, this will convert non string keys into strings
+-- This serializer will allow use to pass a player object and still have it serialized to the players name
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set_serializer(function(rawKey)
+    return rawKey.name
+end)
+
+-- If we want to get data from the datastore we can use get or get_all
+local value = ExampleData:get(player, defaultValue)
+local values = ExampleData:get_all()
+
+-- If we want to set data then we can use set, increment, update, or update_all
+ExampleData:set(player, 10)
+ExampleData:increment(player)
+ExampleData:update(player, function(player_name, value)
+    return value * 2
+end)
+ExampleData:update_all(function(player_name, value)
+    return value * 2
+end)
+
+-- If we want to remove data then we use remove
+ExampleData:remove(player)
+
+-- We can also listen for updates to a value done by any of the above methods with on_update
+ExampleData:on_update(function(player_name, value)
+    game.print(player_name..' has had their example data updated to '..tostring(value))
+end)
+
-- Using Datastore Externally
+-- If save_to_disk is used then this opens up the option for persistent data which you can request, save, and remove
+-- All of the local methods are still usable put now there is the option for extra events
+-- In order for this to work there must be an external script to read datastore.pipe and inject with Datastore.ingest
+
+-- To request data you would use request and the on_load event, this event can be used to modify data before it is used
+ExampleData:request(player)
+ExampleData:on_load(function(player_name, value)
+    game.print('Loaded example data for '..player_name)
+    -- A value can be returned here to overwrite the received value
+end)
+
+-- To save data you would use save and the on_save event, this event can be used to modify data before it is saved
+ExampleData:save(player)
+ExampleData:on_save(function(player_name, value)
+    game.print('Saved example data for '..player_name)
+    -- A value can be returned here to overwrite the value which is saved
+end)
+
+-- To remove data locally but not externally, like if a player logs off, you would use unload and on_unload
+ExampleData:unload(player)
+ExampleData:on_unload(function(player_name, value)
+    game.print('Unloaded example data for '..player_name)
+    -- Any return is ignored, this is event is for cleaning up other data
+end)
+
-- Using Datastore Messaging
+-- The message action can be used regardless of save_to_disk being set as no data is saved, but an external script is still required
+-- These messages can be used to send data to other servers which doesnt need to be saved such as shouts or commands
+-- Using messages is quite simple only using message and on_message
+ExampleData:message(key, message)
+ExampleData:on_message(function(key, message)
+    game.print('Received message '..message)
+end)
+
-- Combined Datastores
+-- A combined datastore is a datastore which stores its data inside of another datastore
+-- This means that the data is stored more efficiently in the external database and less requests need to be made
+-- To understand how combined datastores work think of each key in the parent as a table where the sub datastore is a key in that table
+-- Player data is the most used version of the combined datastore, below is how the player data module is setup
+local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk
+PlayerData:set_serializer(Datastore.name_serializer) -- use player name as key
+PlayerData:combine('Statistics')
+PlayerData:combine('Settings')
+PlayerData:combine('Required')
+
+-- You can then further combine datastores to any depth, below we add some possible settings and statistics that we might use
+-- Although we dont in this example, each of these functions returns the datastore object which you should use as a local value
+PlayerData.Settings:combine('Color')
+PlayerData.Settings:combine('Quickbar')
+PlayerData.Settings:combine('JoinMessage')
+PlayerData.Statistics:combine('Playtime')
+PlayerData.Statistics:combine('JoinCount')
+
+-- Because sub datastore work just like a normal datastore you dont need any special code, using get and set will still return as if it wasnt a sub datastore
+-- Things like the serializer and the datastore settings are always the same as the parent so you dont need to worry about setting up the serializer each time
+-- And because save, request, and unload methods all point to the root datastore you are able to request and save your data as normal
+
+-- If you used get_all on PlayerData this is what you would get:
+{
+    Cooldude2606 = {
+        Settings = {
+            Color = 'ColorValue',
+            Quickbar = 'QuickbarValue',
+            JoinMessage = 'JoinMessageValue'
+        },
+        Statistics = {
+            Playtime = 'PlaytimeValue',
+            JoinCount = 'JoinCountValue'
+        }
+    }
+}
+
+-- If you used get_all on PlayerData.Settings this is what you would get:
+{
+    Cooldude2606 = {
+        Color = 'ColorValue',
+        Quickbar = 'QuickbarValue',
+        JoinMessage = 'JoinMessageValue'
+    }
+}
+
+-- If you used get_all on PlayerData.Settings.Color this is what you would get:
+{
+    Cooldude2606 = 'ColorValue'
+}
+ + + + + + + +

Dependencies

+ + + + + + + +
utils.event
+ + +

Fields

+ + + + + + + + +
global.datastoresSave datastores in the global table
+ + +

Datastore Manager

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
metatableMetatable used on datastores
connect(datastoreName[, saveToDisk=false][, autoSave=false][, propagateChanges=false])Make a new datastore connection, if a connection already exists then it is returned
combine(datastoreName, subDatastoreName)Make a new datastore that stores its data inside of another one
ingest(action, datastoreName, key, valueJson)Ingest the result from a request, this is used through a rcon interface to sync data
debug([datastoreName])Debug, Use to get all datastores, or return debug info on a datastore
name_serializer(rawKey)Commonly used serializer, returns the name of the object
+ + +

Datastore Internal

+ + + + + + + + + + + + + + + + + + + + + + + + +
debug()Debug, Get the debug info for this datastore
raw_get(key[, fromChild=false])Internal, Get data following combine logic
raw_set(key, value)Internal, Set data following combine logic
serialize(rawKey)Internal, Return the serialized key
write_action(action, key, value)Internal, Writes an event to the output file to be saved and/or propagated
+ + +

Datastore Local

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
combine(subDatastoreName)Create a new datastore which is stores its data inside of this datastore
set_serializer(callback)Set a callback that will be used to serialize keys which aren't strings
set_metadata(tags)Set metadata tags on this datastore which can be accessed by other scripts
get(key[, default])Get a value from local storage, option to have a default value
set(key, value)Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save
increment(key[, delta=1])Increment the value in local storage, only works for number values, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save
update(key, callback)Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save
remove(key)Remove a value locally and on the external source, works regardless of propagateChanges
get_all([callback])Get all keys in this datastore, optional filter callback
update_all(callback)Update all keys in this datastore using the same update function
+ + +

Datastore External

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
request(key)Request a value from an external source, will trigger on_load when data is received
save(key)Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true
unload(key)Save a value to an external source and remove locally, will trigger on_unload then on_save, save_to_disk is not required for on_unload
message(key, message)Use to send a message over the connection, works regardless of saveToDisk and propagateChanges
save_all([callback])Save all the keys in the datastore, optional filter callback
unload_all([callback])Unload all the keys in the datastore, optional filter callback
+ + +

Events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
raise_event(event_name, key[, value][, source])Internal, Raise an event on this datastore
on_loadRegister a callback that triggers when data is loaded from an external source, returned value is saved locally
on_saveRegister a callback that triggers before data is saved, returned value is saved externally
on_unloadRegister a callback that triggers before data is unloaded, returned value is ignored
on_messageRegister a callback that triggers when a message is received, returned value is ignored
on_updateRegister a callback that triggers any time a value is changed, returned value is ignored
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Fields

+
+
+
+
+ # + global.datastores +
+
+
+
+ +

Save datastores in the global table

+

+ + + + + + + + + + + + + + +
+
+

Datastore Manager

+
+
+
+
+ # + metatable +
+
+
+
+ +

Metatable used on datastores

+

+ + + Fields: + +
    + + + + + +
  • + + __index + + + + + +
  • + + + + + +
  • + + __newidnex + + + + + +
  • + + + + + +
  • + + __call + + + + + +
  • + + +
+ + + + + + + + + + + + + +
+
+
+
+ # + connect(datastoreName[, saveToDisk=false][, autoSave=false][, propagateChanges=false]) +
+
+
+
+ +

Make a new datastore connection, if a connection already exists then it is returned

+

+ + + Parameters: + +
    + + + + + +
  • + + datastoreName + + : + + (string) + + The name that you want the new datastore to have, this can not have any whitespace + +
  • + + + + + +
  • + + saveToDisk + + : + + (boolean) + + When set to true, using the save method with write the data to datastore.pipe + + (default: false) +
  • + + + + + +
  • + + autoSave + + : + + (boolean) + + When set to true, using any method which modifies data will cause the data to be saved + + (default: false) +
  • + + + + + +
  • + + propagateChanges + + : + + (boolean) + + When set to true, using the save method will send the data to all other connected servers + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + The new datastore connection that can be used to access and modify data in the datastore +
  • +
+ + + + + + + + Usage: +
-- Connecting to the test datastore which will allow saving to disk
+local ExampleData = Datastore.connect('ExampleData', true) -- saveToDisk
+
+ + +
+
+
+
+ # + combine(datastoreName, subDatastoreName) +
+
+
+
+ +

Make a new datastore that stores its data inside of another one

+

+ + + Parameters: + +
    + + + + + +
  • + + datastoreName + + : + + (string) + + The name of the datastore that will contain the data for the new datastore + +
  • + + + + + +
  • + + subDatastoreName + + : + + (string) + + The name of the new datastore, this name will also be used as the key inside the parent datastore + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + The new datastore connection that can be used to access and modify data in the datastore +
  • +
+ + + + + + + + Usage: +
-- Setting up a datastore which stores its data inside of another datastore
+local BarData = Datastore.combine('ExampleData', 'Bar')
+ + +
+
+
+
+ # + ingest(action, datastoreName, key, valueJson) +
+
+
+
+ +

Ingest the result from a request, this is used through a rcon interface to sync data

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + The action that should be done, can be: remove, message, propagate, or request + +
  • + + + + + +
  • + + datastoreName + + : + + (string) + + The name of the datastore that should have the action done to it + +
  • + + + + + +
  • + + key + + : + + (string) + + The key of that datastore that is having the action done to it + +
  • + + + + + +
  • + + valueJson + + : + + (string) + + The json string for the value being ingested, remove does not require a value + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Replying to a data request
+Datastore.ingest('request', 'ExampleData', 'TestKey', 'Foo')
+ + +
+
+
+
+ # + debug([datastoreName]) +
+
+
+
+ +

Debug, Use to get all datastores, or return debug info on a datastore

+

+ + + Parameters: + +
    + + + + + +
  • + + datastoreName + + : + + (string) + + The name of the datastore to get the debug info of + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Get all the datastores
+local datastores = Datastore.debug()
+
-- Getting the debug info for a datastore
+local debug_info = Datastore.debug('ExampleData')
+ + +
+
+
+
+ # + name_serializer(rawKey) +
+
+
+
+ +

Commonly used serializer, returns the name of the object

+

+ + + Parameters: + +
    + + + + + +
  • + + rawKey + + : + + (any) + + The raw key that will be serialized, this can be things like player, force, surface, etc + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + The name of the object that was passed +
  • +
+ + + + + + + + Usage: +
-- Using the name serializer for your datastore
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set_serializer(Datastore.name_serializer)
+ + +
+
+

Datastore Internal

+
+
+
+
+ # + debug() +
+
+
+
+ +

Debug, Get the debug info for this datastore

+

+ + + + + + Returns: +
    +
  • + (table) + The debug info for this datastore, contains stuff like parent, settings, children, etc +
  • +
+ + + + + + + + Usage: +
-- Get the debug info for a datastore
+local ExampleData = Datastore.connect('ExampleData')
+local debug_info = ExampleData:debug()
+ + +
+
+
+
+ # + raw_get(key[, fromChild=false]) +
+
+
+
+ +

Internal, Get data following combine logic

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (string) + + The key to get the value of from this datastore + +
  • + + + + + +
  • + + fromChild + + : + + (boolean) + + If the get request came from a child of this datastore + + (default: false) +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + The value that was stored at this key in this datastore +
  • +
+ + + + + + + + Usage: +
-- Internal, Get the data from a datastore
+local value = self:raw_get('TestKey')
+ + +
+
+
+
+ # + raw_set(key, value) +
+
+
+
+ +

Internal, Set data following combine logic

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (string) + + The key to set the value of in this datastore + +
  • + + + + + +
  • + + value + + : + + (any) + + The value that will be set at this key + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Internal, Set the value in a datastore
+self:raw_set('TestKey', 'Foo')
+ + +
+
+
+
+ # + serialize(rawKey) +
+
+
+
+ +

Internal, Return the serialized key

+

+ + + Parameters: + +
    + + + + + +
  • + + rawKey + + : + + (any) + + The key that needs to be serialized, if it is already a string then it is returned + +
  • + + +
+ + + + + Returns: +
    +
  • + (string) + The key after it has been serialized +
  • +
+ + + + + + + + Usage: +
-- Internal, Ensure that the key is a string
+key = self:serialize(key)
+ + +
+
+
+
+ # + write_action(action, key, value) +
+
+
+
+ +

Internal, Writes an event to the output file to be saved and/or propagated

+

+ + + Parameters: + +
    + + + + + +
  • + + action + + : + + (string) + + The action that should be wrote to datastore.pipe, can be request, remove, message, save, propagate + +
  • + + + + + +
  • + + key + + : + + (string) + + The key that the action is being preformed on + +
  • + + + + + +
  • + + value + + : + + (any) + + The value that should be used with the action + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Write a data request to datastore.pipe
+self:write_action('request', 'TestKey')
+
-- Write a data save to datastore.pipe
+self:write_action('save', 'TestKey', 'Foo')
+ + +
+
+

Datastore Local

+
+
+
+
+ # + combine(subDatastoreName) +
+
+
+
+ +

Create a new datastore which is stores its data inside of this datastore

+

+ + + Parameters: + +
    + + + + + +
  • + + subDatastoreName + + : + + (string) + + The name of the datastore that will have its data stored in this datastore + +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + The new datastore that was created inside of this datastore +
  • +
+ + + + + + + + Usage: +
-- Add a new sub datastore
+local ExampleData = Datastore.connect('ExampleData')
+local BarData = ExampleData:combine('Bar')
+ + +
+
+
+
+ # + set_serializer(callback) +
+
+
+
+ +

Set a callback that will be used to serialize keys which aren't strings

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + The function that will be used to serialize non string keys passed as an argument + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Set a custom serializer, this would be the same as Datastore.name_serializer
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set_serializer(function(rawKey)
+    return rawKey.name
+end)
+ + +
+
+
+
+ # + set_metadata(tags) +
+
+
+
+ +

Set metadata tags on this datastore which can be accessed by other scripts

+

+ + + Parameters: + +
    + + + + + +
  • + + tags + + : + + (table) + + A table of tags that you want to set in the metadata for this datastore + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding metadata that could be used by a gui to help understand the stored data
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set_metadata{
+    caption = 'Test Data',
+    tooltip = 'Data used for testing datastores',
+    type = 'table'
+}
+ + +
+
+
+
+ # + get(key[, default]) +
+
+
+
+ +

Get a value from local storage, option to have a default value

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to get the value of, must be a string unless a serializer is set + +
  • + + + + + +
  • + + default + + : + + (any) + + The default value that will be returned if no value is found in the datastore + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Get a key from the datastore, the default will be deep copied if no value exists in the datastore
+local ExampleData = Datastore.connect('ExampleData')
+local value = ExampleData:get('TestKey')
+ + +
+
+
+
+ # + set(key, value) +
+
+
+
+ +

Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to set the value of, must be a string unless a serializer is set + +
  • + + + + + +
  • + + value + + : + + (any) + + The value that you want to set for this key + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Set a value in the datastore, this will trigger on_update, if auto_save is true then will trigger save
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set('TestKey', 'Foo')
+ + +
+
+
+
+ # + increment(key[, delta=1]) +
+
+
+
+ +

Increment the value in local storage, only works for number values, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to increment the value of, must be a string unless a serializer is set + +
  • + + + + + +
  • + + delta + + : + + (number) + + The amount that you want to increment the value by, can be negative or a decimal + + (default: 1) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Increment a value in a datastore, the value must be a number or nil, if nil 0 is used as the start value
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:increment('TestNumber')
+ + +
+
+
+
+ # + update(key, callback) +
+
+
+
+ +

Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to apply the update to, must be a string unless a serializer is set + +
  • + + + + + +
  • + + callback + + : + + (function) + + The function that will be used to update the value at this key + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Using a function to update a value, if a value is returned then this will be the new value
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:increment('TestKey', function(key, value)
+    return value..value
+end)
+ + +
+
+
+
+ # + remove(key) +
+
+
+
+ +

Remove a value locally and on the external source, works regardless of propagateChanges

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to remove locally and externally, must be a string unless a serializer is set + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Remove a key locally and externally
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:remove('TestKey')
+ + +
+
+
+
+ # + get_all([callback]) +
+
+
+
+ +

Get all keys in this datastore, optional filter callback

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + The filter function that can be used to filter the results returned + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (table) + All the data that is in this datastore, filtered if a filter was provided +
  • +
+ + + + + + + + Usage: +
-- Get all the data in this datastore
+local ExampleData = Datastore.connect('ExampleData')
+local data = ExampleData:get_all()
+
-- Get all the data in this datastore, with a filter
+local ExampleData = Datastore.connect('ExampleData')
+local data = ExampleData:get_all(function(key, value)
+    return type(value) == 'string'
+end)
+ + +
+
+
+
+ # + update_all(callback) +
+
+
+
+ +

Update all keys in this datastore using the same update function

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + The update function that will be applied to each key + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Get all the data in this datastore, with a filter
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:update_all(function(key, value)
+    return value..value
+end)
+ + +
+
+

Datastore External

+
+
+
+
+ # + request(key) +
+
+
+
+ +

Request a value from an external source, will trigger on_load when data is received

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to request from an external source, must be a string unless a serializer is set + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Request a key from an external source, on_load is triggered when data is received
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:request('TestKey')
+ + +
+
+
+
+ # + save(key) +
+
+
+
+ +

Save a value to an external source, will trigger on_save before data is saved, save_to_disk must be set to true

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to save to an external source, must be a string unless a serializer is set + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Save a key to an external source, save_to_disk must be set to true for there to be any effect
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:save('TestKey')
+ + +
+
+
+
+ # + unload(key) +
+
+
+
+ +

Save a value to an external source and remove locally, will trigger on_unload then on_save, save_to_disk is not required for on_unload

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to unload from the datastore, must be a string unless a serializer is set + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Unload a key from the datastore, get will now return nil and value will be saved externally if save_to_disk is set to true
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:unload('TestKey')
+ + +
+
+
+
+ # + message(key, message) +
+
+
+
+ +

Use to send a message over the connection, works regardless of saveToDisk and propagateChanges

+

+ + + Parameters: + +
    + + + + + +
  • + + key + + : + + (any) + + The key that you want to send a message over, must be a string unless a serializer is set + +
  • + + + + + +
  • + + message + + : + + (any) + + The message that you want to send to other connected servers, or external source + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Send a message to other servers on this key, can listen for messages with on_message
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:message('TestKey', 'Foo')
+ + +
+
+
+
+ # + save_all([callback]) +
+
+
+
+ +

Save all the keys in the datastore, optional filter callback

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + The filter function that can be used to filter the keys saved + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Save all the data in this datastore
+local ExampleData = Datastore.connect('ExampleData')
+local data = ExampleData:save_all()
+
-- Save all the data in this datastore, with a filter
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:save_all(function(key, value)
+    return type(value) == 'string'
+end)
+ + +
+
+
+
+ # + unload_all([callback]) +
+
+
+
+ +

Unload all the keys in the datastore, optional filter callback

+

+ + + Parameters: + +
    + + + + + +
  • + + callback + + : + + (function) + + The filter function that can be used to filter the keys unloaded + + (optional) +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Unload all the data in this datastore
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:unload_all()
+
-- Unload all the data in this datastore, with a filter
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:unload_all(function(key, value)
+    return type(value) == 'string'
+end)
+ + +
+
+

Events

+
+
+
+
+ # + raise_event(event_name, key[, value][, source]) +
+
+
+
+ +

Internal, Raise an event on this datastore

+

+ + + Parameters: + +
    + + + + + +
  • + + event_name + + : + + (string) + + The name of the event to raise for this datastore + +
  • + + + + + +
  • + + key + + : + + (string) + + The key that this event is being raised for + +
  • + + + + + +
  • + + value + + : + + (any) + + The current value that this key has, might be a deep copy of the value + + (optional) +
  • + + + + + +
  • + + source + + : + + (string) + + Where this call came from, used to do event recursion so can be parent or child + + (optional) +
  • + + +
+ + + + + Returns: +
    +
  • + (any) + The value that is left after being passed through all the event handlers +
  • +
+ + + + + + + + Usage: +
-- Internal, Getting the value that should be saved
+value = self:raise_event('on_save', key, value)
+ + +
+
+
+
+ # + on_load +
+
+
+
+ +

Register a callback that triggers when data is loaded from an external source, returned value is saved locally

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + The handler that will be registered to the on_load event + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a handler to on_load, returned value will be saved locally, can be used to deserialize the value beyond a normal json
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:on_load(function(key, value)
+    game.print('Test data loaded for: '..key)
+end)
+ + +
+
+
+
+ # + on_save +
+
+
+
+ +

Register a callback that triggers before data is saved, returned value is saved externally

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + The handler that will be registered to the on_load event + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a handler to on_save, returned value will be saved externally, can be used to serialize the value beyond a normal json
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:on_save(function(key, value)
+    game.print('Test data saved for: '..key)
+end)
+ + +
+
+
+
+ # + on_unload +
+
+
+
+ +

Register a callback that triggers before data is unloaded, returned value is ignored

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + The handler that will be registered to the on_load event + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a handler to on_unload, returned value is ignored, can be used to clean up guis or local values related to this data
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:on_load(function(key, value)
+    game.print('Test data unloaded for: '..key)
+end)
+ + +
+
+
+
+ # + on_message +
+
+
+
+ +

Register a callback that triggers when a message is received, returned value is ignored

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + The handler that will be registered to the on_load event + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a handler to on_message, returned value is ignored, can be used to receive messages from other connected servers without saving data
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:on_message(function(key, value)
+    game.print('Test data message for: '..key)
+end)
+ + +
+
+
+
+ # + on_update +
+
+
+
+ +

Register a callback that triggers any time a value is changed, returned value is ignored

+

+ + + +
    + + + + + +
  • + + callback + + : + + (function) + + The handler that will be registered to the on_load event + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Adding a handler to on_update, returned value is ignored, can be used to update guis or send messages when data is changed
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:on_update(function(key, value)
+    game.print('Test data updated for: '..key)
+end)
+ + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 4c28e6fe..390576d0 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -56,8 +56,10 @@ + + @@ -1431,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 3390f92f..67da6d5e 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -61,8 +61,10 @@ + + @@ -4409,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html new file mode 100644 index 00000000..aebb516b --- /dev/null +++ b/docs/core/PlayerData.html @@ -0,0 +1,501 @@ + + + + + + + + PlayerData core + + + + + + + +
+
+ + + + + + + +
+ + + + + + + + +

PlayerData core

+

Core Module - PlayerData +- A module used to store player data in a central datastore to minimize data requests and saves.

+

+ + + + + + +

Usage

+
-- Adding a colour setting for players
+local PlayerData = require 'expcore.player_data'
+local PlayerColors = PlayerData.Settings:combine('Color')
+
+-- Set the players color when their data is loaded
+PlayerColors:on_load(function(player_name, color)
+    local player = game.players[player_name]
+    player.color = color
+end)
+
+-- Overwrite the saved color with the players current color
+PlayerColors:on_save(function(player_name, _)
+    local player = game.players[player_name]
+    return player.color -- overwrite existing data with the current color
+end)
+
-- Add a playtime statistic for players
+local Event = require 'utils.event'
+local PlayerData = require 'expcore.player_data'
+local Playtime = PlayerData.Statistics:combine('Playtime')
+
+-- When playtime reaches an hour interval tell the player and say thanks
+Playtime:on_update(function(player_name, playtime)
+    if playtime % 60 == 0 then
+        local hours = playtime / 60
+        local player = game.players[player_name]
+        player.print('Thanks for playing on our servers, you have played for '..hours..' hours!')
+    end
+end)
+
+-- Update playtime for players, data is only loaded for online players so update_all can be used
+Event.add_on_nth_tick(3600, function()
+    Playtime:update_all(function(player_name, playtime)
+        return playtime + 1
+    end)
+end)
+ + + + + + + +

Dependencies

+ + + + + + + + + + + + + + + + +
utils.event
expcore.datastore
expcore.commands
config.expcore.command_general_parse
+ + +

Commands

+ + + + + + + + + + + + +
set-data-preferenceSets your data saving preference
data-preferenceGets your data saving preference
+ + +
+ + +

Dependencies

+
+
+
+
+ # + utils.event +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.datastore +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.commands +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + config.expcore.command_general_parse +
+
+
+
+ + + + + + + + + + + + + + + +
+
+

Commands

+
+
+
+
+ # + set-data-preference +
+
+
+
+ +

Sets your data saving preference

+

+ + + + + + + + + + + + + + +
+
+
+
+ # + data-preference +
+
+
+
+ +

Gets your data saving preference

+

+ + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + + + diff --git a/docs/core/Roles.html b/docs/core/Roles.html index f703718c..a2f9b5f5 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -60,8 +60,10 @@ + + @@ -3338,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 4cf097cc..865d2a0b 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -56,8 +56,10 @@ + + @@ -1484,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 8ffe6e6e..3741113e 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -67,8 +67,10 @@ + + @@ -722,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 38ac0062..56f34949 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -67,8 +67,10 @@ + + @@ -759,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index c1c5383e..77d8f10f 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -67,8 +67,10 @@ + + @@ -694,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 1397bf4f..d3d73439 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -67,8 +67,10 @@ + + @@ -573,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 27a5fad8..0c48a4ef 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -67,8 +67,10 @@ + + @@ -759,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 7206002a..9f458d5d 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -67,8 +67,10 @@ + + @@ -964,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 8b3b3b8e..ff0d47a2 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -68,8 +68,10 @@ + + @@ -440,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 746fcd7d..554eb376 100644 --- a/docs/index.html +++ b/docs/index.html @@ -58,6 +58,11 @@ Common Core Module - Common - Adds some commonly used functions used in many modules + + + Datastore + Core Module - Datastore +- A module used to store data in the global table with the option to have it sync to an external source. Gui @@ -68,6 +73,11 @@ Groups Core Module - Permission Groups - Permission group making for factorio so you never have to make one by hand again + + + PlayerData + Core Module - PlayerData +- A module used to store player data in a central datastore to minimize data requests and saves. Roles @@ -524,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index bf094544..1f630e60 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -67,8 +67,10 @@ + + @@ -298,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 8babe37f..860b6709 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -67,8 +67,10 @@ + + @@ -296,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index fbc3074a..d9ab8c54 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -67,8 +67,10 @@ + + @@ -657,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index d631c6f6..f2a6bb08 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -67,8 +67,10 @@ + + @@ -356,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index dcc8f576..c14dd012 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -69,8 +69,10 @@ + + @@ -2011,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 686d99d2..e01c5afa 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -68,8 +68,10 @@ + + @@ -1295,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 7d3a4b74..87d6676f 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -67,8 +67,10 @@ + + @@ -437,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 33e87913..1c1421d8 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -68,8 +68,10 @@ + + @@ -654,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 5153e753..aea96aa4 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -53,8 +53,10 @@ + + @@ -792,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 4a614dc5..b6a028b8 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -53,8 +53,10 @@ + + @@ -344,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 26f054750a907a91ea8dff23118900f6bb75853c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 26 May 2020 18:41:36 +0000 Subject: [PATCH 032/106] Automattic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 9982cb3f..cc6129c8 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index c9dbff7f..bc385a8a 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 4e9b6377..1f89abbc 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index fc1716fd..3b42c2a5 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 68b6d7fc..a8191108 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index a8967ecd..ca5a9bb4 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 45ab0cb9..6a5089fa 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index ce87dc0e..8a5b9b04 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 4756d480..8216e112 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 0f7111f3..5de21ce5 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 561ae5b3..6840b813 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index ea566dda..da905ace 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index a2b049bd..6d5ae397 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index 36515fa4..580b9565 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 41426961..b6515bda 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index f3217c1f..e0f2c5e2 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 5869f710..481ce6da 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index af432523..2923b427 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 819392f3..db56ab3b 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index ce42ad18..c27e6985 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 38834890..ac6fde55 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 18dda653..a62051e4 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 09786909..62937967 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index a6c12d10..0007a248 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 9e1bf8e8..f2771918 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index f2d7330f..270f977a 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index dcd166ea..807c030f 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 97ca2540..7466efa9 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index bc5c3c49..437e6d31 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 770dc9e7..e18ce8b1 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index d1676712..6b5be68f 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 2923f033..1e90e23a 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 412c0d34..8a55b38a 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 9bf1c238..f7254201 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index fb304bad..bc962822 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 1a77b8ab..abb0ae03 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 46a2357e..783af50b 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index a244e41b..e7c33601 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 7c44f74a..a97ecd9b 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index a65c596e..ac978ac0 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 085de457..94cd9d04 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index c9f4ec18..f796a95a 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 0339092d..0f523096 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index d2e99dc2..c9828e49 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index f2a86deb..91f3c657 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 51a7423d..16f5e304 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index d09624a4..ccd03ff7 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index e1f58384..ea4e217d 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index b7c4b928..ed4f59cf 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 2f6d8514..4ca12c26 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index dc478298..2e3cdea7 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 79e279ad..3436a2a8 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 127715e0..bef57272 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index c9aea8e7..9ace2130 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index c349fcd6..446b466e 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 0126bc4a..93fb8a67 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 184f0085..cdb96845 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 505eb968..080a9d1b 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index d46308ac..ced0ea43 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index cad9627f..7e60001c 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index bde17b16..7dea56ba 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index b1976aea..9a8501af 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index bedc32c6..d5f96823 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 75303250..cb4d7253 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 5e9f256e..00f8378e 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index ccfd5a8b..db2c4cc2 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index e48c254c..5c688ff9 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 5856ec42..dfdb1590 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 78146b3c..037d21dc 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 40c9c942..2b9c97fd 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 17551cde..9b24a4fa 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 91eac693..5684cd9a 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 7b122edb..ead26694 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 3a878064..e2ecce0a 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2863,7 +2863,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 390576d0..3895f74e 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 67da6d5e..3328f24b 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index aebb516b..a413ca06 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index a2f9b5f5..78985356 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 865d2a0b..f32d2a1d 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 3741113e..006e999a 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 56f34949..d7bf81bc 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 77d8f10f..fb536754 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index d3d73439..0dc047c3 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 0c48a4ef..a804e94c 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 9f458d5d..6d01070b 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index ff0d47a2..4dc8640b 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 554eb376..e97ed4cf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 1f630e60..0c3ca408 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 860b6709..d4f1b982 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index d9ab8c54..32f4ab29 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index f2a6bb08..67a1bd22 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index c14dd012..99d613c1 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index e01c5afa..08ad3136 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 87d6676f..a7bab96d 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 1c1421d8..84d31433 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index aea96aa4..e5636e58 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index b6a028b8..f255135b 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 8128ec9aef666ec13828287453a3f19b23d7fc7d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 18:30:18 +0100 Subject: [PATCH 033/106] Changed Datastore Output For Mark --- expcore/datastore.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index f2f526ad..ad433f3d 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -395,7 +395,7 @@ function Datastore:write_action(action, key, value) if value ~= nil then data[4] = type(value) == 'table' and '"'..game.table_to_json(value)..'"' or '"'..tostring(value)..'"' end - game.write_file('datastore.pipe', table.concat(data, ' ')..'\n', true, 0) + game.write_file('datastore.out', table.concat(data, ' ')..'\n', true, 0) end ----- Datastore Local @@ -827,4 +827,4 @@ end) Datastore.on_update = event_factory('on_update') ----- Module Return -return DatastoreManager \ No newline at end of file +return DatastoreManager From 27cb7c6c5517b879a7ad771ec55d787ea73db596 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 17:31:26 +0000 Subject: [PATCH 034/106] Automattic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index cc6129c8..de40ffd2 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index bc385a8a..9dee9a4c 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 1f89abbc..9fd8fe3e 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 3b42c2a5..004af1ff 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index a8191108..c426721e 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index ca5a9bb4..b3af5fa3 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 6a5089fa..7f631158 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 8a5b9b04..d1ca6747 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 8216e112..64f37fda 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 5de21ce5..fbe8fc71 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 6840b813..cee0143f 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index da905ace..f6058123 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 6d5ae397..415565c0 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index 580b9565..d45cbf08 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index b6515bda..554c8cc2 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index e0f2c5e2..bd7ed2ea 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 481ce6da..5322cd80 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 2923b427..c33fc375 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index db56ab3b..96695e71 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index c27e6985..6146c6a2 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index ac6fde55..fa39ddf6 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index a62051e4..97fc53b1 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 62937967..a9a04075 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 0007a248..856f169f 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index f2771918..9cb40198 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 270f977a..e6bbf606 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index 807c030f..b49b42db 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 7466efa9..00a44deb 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 437e6d31..86194d72 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index e18ce8b1..5922ab2d 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 6b5be68f..b712f17b 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 1e90e23a..182bf5f9 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 8a55b38a..9b8ffc6f 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index f7254201..b45591d8 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index bc962822..9f44a5d9 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index abb0ae03..15f82513 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 783af50b..ec261fc7 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index e7c33601..31f5aca1 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index a97ecd9b..aecb7917 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index ac978ac0..37ed22cd 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 94cd9d04..0113f2a3 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index f796a95a..3ec4cc44 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 0f523096..0b86c999 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index c9828e49..8eda6d1a 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 91f3c657..a40b2a7e 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 16f5e304..25247211 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index ccd03ff7..9d2bdc20 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index ea4e217d..386d1071 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index ed4f59cf..4dcad5ad 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 4ca12c26..06e80037 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 2e3cdea7..6d51ac1c 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 3436a2a8..e69831e5 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index bef57272..990da2ef 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 9ace2130..ded21556 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 446b466e..80e56657 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 93fb8a67..17377426 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index cdb96845..a4426d1b 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 080a9d1b..9629234b 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index ced0ea43..17a0d237 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 7e60001c..64f7e301 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 7dea56ba..9cd10480 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 9a8501af..10ea25ad 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index d5f96823..2585327d 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index cb4d7253..af409f8b 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 00f8378e..21d55c8b 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index db2c4cc2..004e0b8f 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 5c688ff9..ebda3498 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index dfdb1590..a6374cf7 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 037d21dc..ac3a24d0 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 2b9c97fd..cfc43749 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 9b24a4fa..15b12353 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 5684cd9a..7ddaf2d2 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index ead26694..22579644 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index e2ecce0a..4f2e0e13 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2863,7 +2863,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 3895f74e..71e16ffe 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 3328f24b..c5528dfb 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index a413ca06..414c04eb 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 78985356..831e0ed4 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index f32d2a1d..ec73448a 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 006e999a..84a1151e 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index d7bf81bc..07a816f0 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index fb536754..b4d155f5 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 0dc047c3..1649f2b2 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index a804e94c..693ace2f 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 6d01070b..eef98505 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 4dc8640b..f3a845b1 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index e97ed4cf..0c510479 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 0c3ca408..c26f8334 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index d4f1b982..9cfaef5c 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 32f4ab29..20003b39 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 67a1bd22..c62a7efe 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 99d613c1..52c5df1e 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 08ad3136..659d6c80 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index a7bab96d..eb510317 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 84d31433..4653341c 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index e5636e58..6fc8916b 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index f255135b..3a5e588e 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 3b58365bf5787652799116c2c141239e8703dcc0 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 20:45:39 +0100 Subject: [PATCH 035/106] Fixed small edge cases for datastore --- expcore/datastore.lua | 47 +++++++++++++++++++++++++++++------------ expcore/player_data.lua | 7 +++--- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index ad433f3d..be6848e4 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -224,7 +224,6 @@ function DatastoreManager.combine(datastoreName, subDatastoreName) return datastore:combine(subDatastoreName) end -local function ingest_error(err) print('Datastore ingest error, Unable to parse json:', err) end --[[-- Ingest the result from a request, this is used through a rcon interface to sync data @tparam string action The action that should be done, can be: remove, message, propagate, or request @tparam string datastoreName The name of the datastore that should have the action done to it @@ -244,15 +243,14 @@ function DatastoreManager.ingest(action, datastoreName, key, valueJson) datastore:raw_set(key) elseif action == 'message' then - local success, value = xpcall(game.json_to_table, ingest_error, valueJson) - if not success then return end - if value == nil then value = valueJson end + local success, value = pcall(game.json_to_table, valueJson) + if not success or value == nil then value = tonumber(valueJson) or valueJson end datastore:raise_event('on_message', key, value) elseif action == 'propagate' or action == 'request' then - local success, value = xpcall(game.json_to_table, ingest_error, valueJson) - if not success then return end - if value == nil then value = valueJson end + local success, value = pcall(game.json_to_table, valueJson) + if not success or value == nil then value = tonumber(valueJson) or valueJson end + datastore:raw_set(key) -- clear any existing data value = datastore:raise_event('on_load', key, value) datastore:set(key, value) @@ -437,6 +435,20 @@ function Datastore:set_serializer(callback) self.serializer = callback end +--[[-- Set a default value to be returned by get if no other default is given, using will mean get will never return nil, set using the default will set to nil to save space +@tparam any default The value that will be deep copied by get if the value is nil and no other default is given +@tparam boolean allowSet When true if the default is passed as the value for set it will be set rather than setting nil + +@usage-- Set a default value to be returned by get +local ExampleData = Datastore.connect('ExampleData') +ExampleData:set_default('Foo') + +]] +function Datastore:set_default(value, allowSet) + self.default = value + self.allow_set_to_default = allowSet +end + --[[-- Set metadata tags on this datastore which can be accessed by other scripts @tparam table tags A table of tags that you want to set in the metadata for this datastore @@ -456,7 +468,7 @@ function Datastore:set_metadata(tags) end end ---[[-- Get a value from local storage, option to have a default value +--[[-- Get a value from local storage, option to have a default value, do not edit the data returned as changes may not save, use update if you want to make changes @tparam any key The key that you want to get the value of, must be a string unless a serializer is set @tparam[opt] any default The default value that will be returned if no value is found in the datastore @@ -469,7 +481,7 @@ function Datastore:get(key, default) key = self:serialize(key) local value = self:raw_get(key) if value ~= nil then return value end - return copy(default) + return copy(default or self.default) end --[[-- Set a value in local storage, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save @@ -483,7 +495,11 @@ ExampleData:set('TestKey', 'Foo') ]] function Datastore:set(key, value) key = self:serialize(key) - self:raw_set(key, value) + if value == self.default and not self.allow_set_to_default then + self:raw_set(key) + else + self:raw_set(key, value) + end self:raise_event('on_update', key, value) if self.auto_save then self:save(key) end return value @@ -528,7 +544,7 @@ function Datastore:update(key, callback) end end ---[[-- Remove a value locally and on the external source, works regardless of propagateChanges +--[[-- Remove a value locally and on the external source, works regardless of propagateChanges, requires save_to_disk for external changes @tparam any key The key that you want to remove locally and externally, must be a string unless a serializer is set @usage-- Remove a key locally and externally @@ -539,7 +555,8 @@ ExampleData:remove('TestKey') function Datastore:remove(key) key = self:serialize(key) self:raw_set(key) - self:write_action('remove', key) + self:raise_event('on_update', key) + if self.save_to_disk then self:write_action('remove', key) end if self.parent and self.parent.auto_save then return self.parent:save(key) end end @@ -734,7 +751,8 @@ value = self:raise_event('on_save', key, value) ]] function Datastore:raise_event(event_name, key, value, source) -- Raise the event for the children of this datastore - if source ~= 'child' then + if source ~= 'child' and next(self.children) then + if type(value) ~= 'table' then value = self:raw_get(key, true) end for value_name, child in pairs(self.children) do value[value_name] = child:raise_event(event_name, key, value[value_name], 'parent') end @@ -753,6 +771,9 @@ function Datastore:raise_event(event_name, key, value, source) if source ~= 'parent' and self.parent then self.parent:raise_event(event_name, key, self.parent:raw_get(key), 'child') end + + -- If this is the save event and the table is empty then return nil + if event_name == 'on_save' and next(self.children) and not next(value) then return end return value end diff --git a/expcore/player_data.lua b/expcore/player_data.lua index 268cdaca..057ae404 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -54,6 +54,7 @@ PlayerData:set_serializer(Datastore.name_serializer) -- use player name local DataSavingPreference = PlayerData:combine('DataSavingPreference') local PreferenceEnum = { 'All', 'Statistics', 'Settings', 'Required' } for k,v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end +DataSavingPreference:set_default('All') --- Sets your data saving preference -- @command set-data-preference @@ -68,12 +69,12 @@ end) -- @command data-preference Commands.new_command('data-preference', 'Shows you what your current data saving preference is') :register(function(player) - return {'expcore-data.get-preference', DataSavingPreference:get(player, 'All')} + return {'expcore-data.get-preference', DataSavingPreference:get(player)} end) --- Remove data that the player doesnt want to have stored PlayerData:on_save(function(player_name, player_data) - local dataPreference = DataSavingPreference:get(player_name, 'All') + local dataPreference = DataSavingPreference:get(player_name) dataPreference = PreferenceEnum[dataPreference] if dataPreference == PreferenceEnum.All then return player_data end @@ -86,7 +87,7 @@ end) --- Display your data preference when your data loads DataSavingPreference:on_load(function(player_name, dataPreference) - game.players[player_name].print{'expcore-data.get-preference', dataPreference or 'All'} + game.players[player_name].print{'expcore-data.get-preference', dataPreference or DataSavingPreference.default} end) --- Load player data when they join From 11a0e9418352b2d4180b9576918acdf38a0a0abb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 19:47:14 +0000 Subject: [PATCH 036/106] Automattic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 84 +++++++++++++++++-- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 175 insertions(+), 101 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index de40ffd2..b905f84b 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 9dee9a4c..20b6d9d3 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 9fd8fe3e..b1350559 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 004af1ff..4eb0fa49 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index c426721e..07beb8d0 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index b3af5fa3..fc0d475c 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 7f631158..6abc8699 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index d1ca6747..8f867ccd 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 64f37fda..b2c325e6 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index fbe8fc71..7da24a94 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index cee0143f..797be5fc 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index f6058123..521f0c68 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 415565c0..8ef08e69 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index d45cbf08..aba7c737 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 554c8cc2..e2b7a92a 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index bd7ed2ea..a4477c25 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 5322cd80..420acf19 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index c33fc375..b6ed751d 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 96695e71..b5d1723b 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 6146c6a2..ad63ea53 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index fa39ddf6..748073cc 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 97fc53b1..8d83e298 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index a9a04075..d4131d76 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 856f169f..7d08ae74 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 9cb40198..49090c8c 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index e6bbf606..1f94ca8c 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index b49b42db..eced6076 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 00a44deb..29116bf1 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 86194d72..5dd6baa3 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 5922ab2d..6e2fa67e 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index b712f17b..0eb6bc54 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 182bf5f9..1410e891 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 9b8ffc6f..b5eade1e 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index b45591d8..506437b1 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 9f44a5d9..09d94fe0 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 15f82513..6fa00a5c 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index ec261fc7..3deff1c3 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 31f5aca1..efd2d01a 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index aecb7917..3e673093 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 37ed22cd..22b511f7 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 0113f2a3..0f51c6be 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 3ec4cc44..18fc8af0 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 0b86c999..9d9e9773 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 8eda6d1a..aba19541 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index a40b2a7e..8f420fd1 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 25247211..1417a7df 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 9d2bdc20..6f7b43cb 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 386d1071..21fc3b34 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 4dcad5ad..e8102d39 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 06e80037..44bc9350 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 6d51ac1c..767eb6ad 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index e69831e5..d7c88f71 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 990da2ef..a5663f89 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index ded21556..caca32f1 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 80e56657..9284d9de 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 17377426..41f10f2d 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index a4426d1b..63beb302 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 9629234b..17d60cfa 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 17a0d237..c3aa7574 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 64f7e301..665ba1d6 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 9cd10480..a29df164 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 10ea25ad..a22a2fca 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 2585327d..c7aa0279 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index af409f8b..bb010655 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 21d55c8b..0d1526a3 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 004e0b8f..c8e8872e 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index ebda3498..a0f25f20 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index a6374cf7..caf6c305 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index ac3a24d0..273b898a 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index cfc43749..94f1cae7 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 15b12353..7468f76b 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 7ddaf2d2..b58c500f 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 22579644..256a9c3f 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 4f2e0e13..b8391000 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -488,12 +488,16 @@ PlayerData.Statistics:combine('JoinCount') Set a callback that will be used to serialize keys which aren't strings + set_default(default, allowSet) + Set a default value to be returned by get if no other default is given, using will mean get will never return nil, set using the default will set to nil to save space + + set_metadata(tags) Set metadata tags on this datastore which can be accessed by other scripts get(key[, default]) - Get a value from local storage, option to have a default value + Get a value from local storage, option to have a default value, do not edit the data returned as changes may not save, use update if you want to make changes set(key, value) @@ -509,7 +513,7 @@ PlayerData.Statistics:combine('JoinCount') remove(key) - Remove a value locally and on the external source, works regardless of propagateChanges + Remove a value locally and on the external source, works regardless of propagateChanges, requires save_to_disk for external changes get_all([callback]) @@ -1585,6 +1589,76 @@ ExampleData:set_serializer(function(rawKey) end) + +
+
+
+ # + set_default(default, allowSet) +
+
+
+
+ +

Set a default value to be returned by get if no other default is given, using will mean get will never return nil, set using the default will set to nil to save space

+

+ + + Parameters: + +
    + + + + + +
  • + + default + + : + + (any) + + The value that will be deep copied by get if the value is nil and no other default is given + +
  • + + + + + +
  • + + allowSet + + : + + (boolean) + + When true if the default is passed as the value for set it will be set rather than setting nil + +
  • + + +
+ + + + + + + + + + + + Usage: +
-- Set a default value to be returned by get
+local ExampleData = Datastore.connect('ExampleData')
+ExampleData:set_default('Foo')
+ +
@@ -1654,7 +1728,7 @@ ExampleData:set_metadata{
-

Get a value from local storage, option to have a default value

+

Get a value from local storage, option to have a default value, do not edit the data returned as changes may not save, use update if you want to make changes

@@ -1938,7 +2012,7 @@ ExampleData:increment('TestKey', -

Remove a value locally and on the external source, works regardless of propagateChanges

+

Remove a value locally and on the external source, works regardless of propagateChanges, requires save_to_disk for external changes

@@ -2863,7 +2937,7 @@ ExampleData:on_update(function(key, value) generated by LDoc
diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 71e16ffe..3404fcfa 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index c5528dfb..602243cc 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 414c04eb..287e602c 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 831e0ed4..e392213d 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index ec73448a..5a04a6f2 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 84a1151e..609a2c80 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 07a816f0..69341b29 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index b4d155f5..c941d3a3 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 1649f2b2..a714805f 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 693ace2f..463f300f 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index eef98505..fbdddf7d 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index f3a845b1..1b8e3cc9 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 0c510479..46aeecd8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index c26f8334..cb760a00 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 9cfaef5c..573a44da 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 20003b39..adb35cb5 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index c62a7efe..f0c1dc05 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 52c5df1e..b94d657f 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 659d6c80..c65f7959 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index eb510317..e37f37b0 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 4653341c..2e25f027 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 6fc8916b..6454f2b4 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 3a5e588e..cfdb426c 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 729a9bb2f6f4f2b4cecefce368c92d64a73c3885 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 20:56:17 +0100 Subject: [PATCH 037/106] Fixed Spelling Error In Dev Deploy --- .github/workflows/dev-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-deploy.yml b/.github/workflows/dev-deploy.yml index 37efb8d6..418d1360 100644 --- a/.github/workflows/dev-deploy.yml +++ b/.github/workflows/dev-deploy.yml @@ -33,7 +33,7 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v4 with: - message: "Automattic Doc Update" + message: "Automatic Doc Update" add: "./docs/** .luacheckrc" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2464ce7db2548b74aca3569d38c2d5e3f6b8c76d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 27 May 2020 19:56:52 +0000 Subject: [PATCH 038/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index b905f84b..755811ab 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 20b6d9d3..7347b974 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index b1350559..a28cc85f 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 4eb0fa49..385c6da8 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 07beb8d0..fb75ba3c 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index fc0d475c..ae40ede0 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 6abc8699..462826c4 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 8f867ccd..0b65b662 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index b2c325e6..7292395a 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 7da24a94..f8b64382 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 797be5fc..e1e7834b 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 521f0c68..92824ebe 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 8ef08e69..44dc4f57 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index aba7c737..b40f9ba0 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index e2b7a92a..02d70be4 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index a4477c25..5b197c1e 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 420acf19..16c13abf 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index b6ed751d..c8726049 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index b5d1723b..de12eae5 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index ad63ea53..be8eadb2 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 748073cc..b385875c 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 8d83e298..22973d10 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index d4131d76..d6409faf 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 7d08ae74..5be520c4 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 49090c8c..22821c74 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 1f94ca8c..67e61f45 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index eced6076..5a81f67b 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 29116bf1..298eefa7 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 5dd6baa3..0941e6eb 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 6e2fa67e..8ef6e582 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 0eb6bc54..ebbf7cb2 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 1410e891..6e08c81f 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index b5eade1e..77a2c044 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 506437b1..db84bd57 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 09d94fe0..74954cf8 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 6fa00a5c..7baf7005 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 3deff1c3..10c2ebb5 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index efd2d01a..e36c572f 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 3e673093..2acc192a 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 22b511f7..ecbf40c3 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 0f51c6be..6288cd7d 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 18fc8af0..6650e7f2 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 9d9e9773..fcb7a418 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index aba19541..519f6c78 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 8f420fd1..a4c65b9d 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 1417a7df..79d64014 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 6f7b43cb..2c97636e 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 21fc3b34..27468629 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index e8102d39..ceeb6509 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 44bc9350..0fe59b61 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 767eb6ad..3d7c7bd5 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index d7c88f71..5ec442cd 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index a5663f89..094b42d4 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index caca32f1..18e65638 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 9284d9de..94b96cfe 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 41f10f2d..eca0f60c 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 63beb302..f999ceee 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 17d60cfa..7c402543 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index c3aa7574..84d6ff61 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 665ba1d6..cb64336e 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index a29df164..9520725f 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index a22a2fca..3617281f 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index c7aa0279..15e80415 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index bb010655..ecc493f5 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 0d1526a3..5fd86871 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index c8e8872e..cf04f952 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index a0f25f20..2a788d11 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index caf6c305..66fb32e7 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 273b898a..acfed8cc 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 94f1cae7..86cfa243 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 7468f76b..fa6b3448 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index b58c500f..a0bc7428 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 256a9c3f..6ac4df01 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index b8391000..a182b25e 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2937,7 +2937,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 3404fcfa..35579c41 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 602243cc..ab12ced0 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 287e602c..291a41a8 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index e392213d..c1052119 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 5a04a6f2..88e01d4c 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 609a2c80..0bf09166 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 69341b29..f653191a 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index c941d3a3..d3fd39a6 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index a714805f..e40081ec 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 463f300f..9f1d2bca 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index fbdddf7d..d63e4de4 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 1b8e3cc9..81b28a30 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 46aeecd8..3b293f21 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index cb760a00..cfd10002 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 573a44da..f438166a 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index adb35cb5..a3e9ee3d 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index f0c1dc05..66583be9 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index b94d657f..027253e0 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index c65f7959..3b1963a8 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index e37f37b0..d22d596d 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 2e25f027..8310de69 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 6454f2b4..84e20a06 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index cfdb426c..ebde3d59 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 8b7bec2dbc39cab2ccf51cdd3a1ce73c16c5d138 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 16:09:35 +0000 Subject: [PATCH 039/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 755811ab..b6ac93ac 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 7347b974..33101a86 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index a28cc85f..3864784a 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 385c6da8..0fcd4fe9 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index fb75ba3c..e85398f5 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index ae40ede0..b13de4d2 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 462826c4..0cfc564a 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 0b65b662..6bc2dc61 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 7292395a..3ece776f 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index f8b64382..26fd0df5 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index e1e7834b..73a785bf 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 92824ebe..b6b9aeb6 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 44dc4f57..ca6c2cc2 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index b40f9ba0..91e04a32 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 02d70be4..331a560e 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 5b197c1e..7ba84844 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 16c13abf..6fc83113 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index c8726049..35496407 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index de12eae5..7f7abfdc 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index be8eadb2..86c6a97f 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index b385875c..601bbb69 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 22973d10..01b58d9f 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index d6409faf..f99753c7 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 5be520c4..2eb37330 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 22821c74..dcc2c097 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 67e61f45..b037d31f 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index 5a81f67b..c2115937 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 298eefa7..6671f8ba 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 0941e6eb..1b9455d5 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 8ef6e582..d49820be 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index ebbf7cb2..6f995ff0 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 6e08c81f..3f6b6dd7 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 77a2c044..726883b5 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index db84bd57..5a9d45dd 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 74954cf8..57f4d9b3 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 7baf7005..86299acf 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 10c2ebb5..d9281fad 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index e36c572f..a78296da 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 2acc192a..36b40503 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index ecbf40c3..73072b8f 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 6288cd7d..76754576 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 6650e7f2..e39ed5d8 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index fcb7a418..c1f1bea6 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 519f6c78..c45eeb7d 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index a4c65b9d..bc0d5bd2 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 79d64014..48f834a6 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 2c97636e..41f7dbfb 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 27468629..e27977e5 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index ceeb6509..042da02d 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 0fe59b61..6743f536 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 3d7c7bd5..710a8eff 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 5ec442cd..b5bed51b 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 094b42d4..ab7b25fe 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 18e65638..89facf72 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 94b96cfe..25a43bb4 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index eca0f60c..cd39a863 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index f999ceee..91ef0b4e 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 7c402543..7446a08d 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 84d6ff61..c4c152eb 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index cb64336e..1e2f97c0 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 9520725f..4f8e2ecc 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 3617281f..47263e6c 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 15e80415..d0e6dcf3 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index ecc493f5..1fb8a0e9 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 5fd86871..108212a9 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index cf04f952..85a2600f 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 2a788d11..e643e992 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 66fb32e7..a3f3141e 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index acfed8cc..9148d70d 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 86cfa243..272ece0c 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index fa6b3448..f327afd8 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index a0bc7428..691326e3 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 6ac4df01..24f660f7 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index a182b25e..07f8a472 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2937,7 +2937,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 35579c41..4932fd5d 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index ab12ced0..e495d1ee 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 291a41a8..d2a47991 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index c1052119..fd6ea916 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 88e01d4c..f95ab508 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 0bf09166..457d801e 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index f653191a..b3b49c6f 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index d3fd39a6..4148f540 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index e40081ec..b6305287 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 9f1d2bca..8909da90 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index d63e4de4..2027aa0d 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 81b28a30..305bd2ad 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 3b293f21..5497df50 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index cfd10002..d337544a 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index f438166a..918cb2bf 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index a3e9ee3d..2ce8916c 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 66583be9..8017ccf6 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 027253e0..7978ea9a 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 3b1963a8..7bbeaa32 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index d22d596d..9422e97c 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 8310de69..d683c95e 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 84e20a06..6e5949d6 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index ebde3d59..ef778fc1 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 695e54a332f425abf8f1a6dfd76572b4a15d63ea Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 16:57:51 +0000 Subject: [PATCH 040/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index b6ac93ac..cc739011 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 33101a86..61b5ce66 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 3864784a..f265300c 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 0fcd4fe9..35e5a905 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index e85398f5..32c542e1 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index b13de4d2..f06cdcbc 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 0cfc564a..ebb72372 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 6bc2dc61..7bd43fe0 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 3ece776f..8ca410a8 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 26fd0df5..8f2e7e26 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 73a785bf..4f63b4aa 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index b6b9aeb6..8f5429a4 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index ca6c2cc2..929011ae 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index 91e04a32..bc350b25 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 331a560e..b1342e13 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 7ba84844..0dfaf416 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 6fc83113..976c6d9d 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 35496407..43163079 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 7f7abfdc..2ebe0133 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 86c6a97f..ad6b5621 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 601bbb69..b733a9f8 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 01b58d9f..5e9c0d26 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index f99753c7..0335e9eb 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 2eb37330..a61ebfd1 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index dcc2c097..1ec5dca0 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index b037d31f..e6a4fc53 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index c2115937..3d64271c 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 6671f8ba..ac821181 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 1b9455d5..2026943b 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index d49820be..f4088abb 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 6f995ff0..5e5005e1 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 3f6b6dd7..9606f48f 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 726883b5..3eb9b8df 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 5a9d45dd..f5ff823d 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 57f4d9b3..5435e56d 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 86299acf..87406477 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index d9281fad..603006c7 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index a78296da..907370e3 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 36b40503..ee12fd99 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 73072b8f..e6e20866 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 76754576..684be81c 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index e39ed5d8..d8ffaf6a 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index c1f1bea6..47fa1c0b 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index c45eeb7d..cde94699 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index bc0d5bd2..1da89090 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 48f834a6..cb16bfec 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 41f7dbfb..1e8c3f74 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index e27977e5..38617bd0 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 042da02d..44b9ee5b 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 6743f536..68d7704a 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 710a8eff..c6d99fda 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index b5bed51b..3a9f81f7 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index ab7b25fe..9dc338cd 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 89facf72..f8640084 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 25a43bb4..6a5d46f3 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index cd39a863..a6f14e26 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 91ef0b4e..58a75989 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 7446a08d..80b96946 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index c4c152eb..93ad97d1 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 1e2f97c0..f2591f6b 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 4f8e2ecc..21e80537 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 47263e6c..8d27997e 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index d0e6dcf3..1f40c750 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 1fb8a0e9..31031246 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 108212a9..3ebbcafd 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1334,7 +1334,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 85a2600f..ddf4d340 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index e643e992..355fff87 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index a3f3141e..fa82cf36 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 9148d70d..188c6397 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 272ece0c..78f73ecf 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index f327afd8..814d13c3 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 691326e3..d67d141b 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 24f660f7..4b447777 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 07f8a472..a49a3b4a 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2937,7 +2937,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 4932fd5d..bc8241ce 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index e495d1ee..80b93963 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index d2a47991..fabbd1b6 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index fd6ea916..9fb09323 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index f95ab508..493b7bbd 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 457d801e..379a1470 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index b3b49c6f..36af85a3 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 4148f540..f9865025 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index b6305287..70de7162 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 8909da90..9a7ac1cb 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 2027aa0d..f67fafb1 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 305bd2ad..a6617fe6 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 5497df50..44148718 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index d337544a..0aea52b5 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 918cb2bf..cf19c2be 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 2ce8916c..d16e0982 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 8017ccf6..295939c3 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 7978ea9a..a0533903 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 7bbeaa32..bcb961b7 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 9422e97c..b6101e70 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index d683c95e..b34e692b 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 6e5949d6..9d8a109e 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index ef778fc1..5088ecd5 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From e630912ef06b594809d7df9c02876aa934e0cfb8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 19:28:09 +0000 Subject: [PATCH 041/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Player-Colours.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/addons/greetings.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Bonus.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Quickbar.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Tag.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 12 +++++------ docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 20 +++++++++---------- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/core/Store.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 97 files changed, 111 insertions(+), 111 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index cc739011..d8d445bf 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 61b5ce66..500a420b 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index f265300c..2b30ff69 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 35e5a905..55978afb 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 32c542e1..f8735da3 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -354,7 +354,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index f06cdcbc..a010b4b6 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index ebb72372..c77011f1 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -465,7 +465,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 7bd43fe0..cd3e909f 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -353,7 +353,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index 8ca410a8..1e0d5afc 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 8f2e7e26..6b014639 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 4f63b4aa..a633ac44 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 8f5429a4..832fdc48 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 929011ae..b8cbb8ea 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/addons/greetings.html b/docs/addons/greetings.html index bc350b25..9ff8d6d7 100644 --- a/docs/addons/greetings.html +++ b/docs/addons/greetings.html @@ -381,7 +381,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index b1342e13..005a017f 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index 0dfaf416..ce7bd2f0 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -505,7 +505,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 976c6d9d..655f69de 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 43163079..0fad87ec 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 2ebe0133..d67c8dcb 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index ad6b5621..4d229f9e 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index b733a9f8..57ff6971 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -409,7 +409,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 5e9c0d26..62cd4012 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -463,7 +463,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 0335e9eb..aa9b66d4 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index a61ebfd1..5b920bb0 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -616,7 +616,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 1ec5dca0..68fa5273 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index e6a4fc53..7740ea93 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -365,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Quickbar.html b/docs/commands/Quickbar.html index 3d64271c..46575536 100644 --- a/docs/commands/Quickbar.html +++ b/docs/commands/Quickbar.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index ac821181..c109a771 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 2026943b..3562acff 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -326,7 +326,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index f4088abb..9d2fa6cf 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -590,7 +590,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 5e5005e1..db5dc2dc 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -562,7 +562,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 9606f48f..bb7bda69 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -394,7 +394,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index 3eb9b8df..976e9558 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -448,7 +448,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index f5ff823d..dc781afc 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -489,7 +489,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 5435e56d..7d6f33c5 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -574,7 +574,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 87406477..77a3f47e 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -511,7 +511,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 603006c7..83c69c04 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 907370e3..79dd8641 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -490,7 +490,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index ee12fd99..02e73901 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -299,7 +299,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index e6e20866..3c272b09 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -325,7 +325,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 684be81c..2089a199 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index d8ffaf6a..9b1d7bb6 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 47fa1c0b..2e6baba3 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -343,7 +343,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index cde94699..03b102ff 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -359,7 +359,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 1da89090..9fd6aaa1 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -421,7 +421,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index cb16bfec..0650cbdf 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 1e8c3f74..ad036391 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -245,7 +245,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 38617bd0..47f0f5fd 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 44b9ee5b..9b7467fc 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -817,7 +817,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 68d7704a..5f41b748 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index c6d99fda..58f6ff3b 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 3a9f81f7..2fc545ac 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -329,7 +329,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 9dc338cd..73ae12d4 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index f8640084..50139018 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 6a5d46f3..45f10079 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -839,7 +839,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index a6f14e26..17a67d0d 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -297,7 +297,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 58a75989..ad70c88d 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -249,7 +249,7 @@ show_eta - color_clamp + color_cutoff color_flux @@ -293,15 +293,15 @@
- # - color_clamp + # + color_cutoff

-

the amount required for the text to show as green or red

+

the amount that production can fall before the text changes color

@@ -328,7 +328,7 @@

-

the ammount of flucuation allowed in production before icon change

+

the amount of fluctuation allowed in production before the icon changes color

@@ -359,7 +359,7 @@ generated by LDoc
diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 80b96946..cab64486 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -393,7 +393,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 93ad97d1..026ac644 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -749,7 +749,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index f2591f6b..f668a386 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 21e80537..43f8ce40 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -360,7 +360,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 8d27997e..f3a3a03a 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -779,7 +779,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 1f40c750..625909f7 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -242,7 +242,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 31031246..b4793d65 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1213,7 +1213,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 3ebbcafd..c8b13c4c 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -346,8 +346,8 @@ - get_color(clamp, active_value, passive_value) - Returns a color value bassed on the value that was given + get_color(cutoff, active_value, passive_value) + Returns a color value based on the value that was given format_number(value) @@ -1173,13 +1173,13 @@
# - get_color(clamp, active_value, passive_value) + get_color(cutoff, active_value, passive_value)
-

Returns a color value bassed on the value that was given

+

Returns a color value based on the value that was given

@@ -1193,13 +1193,13 @@
  • - clamp + cutoff : (number) - value which seperates the different colours + value which separates the different colours
  • @@ -1215,7 +1215,7 @@ (number) - first value tested, tested against clamp + first value tested, tested against cutoff @@ -1231,7 +1231,7 @@ (number) - second value tested, tested against 0 + second value tested, tested against 0 when active is 0 @@ -1245,7 +1245,7 @@
    • (table) - contains r, g,b keys + contains r,g,b keys
    @@ -1334,7 +1334,7 @@ generated by LDoc
    diff --git a/docs/control/Reports.html b/docs/control/Reports.html index ddf4d340..4c22e2e4 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1115,7 +1115,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 355fff87..90c3334b 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -989,7 +989,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index fa82cf36..1803c657 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -1003,7 +1003,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 188c6397..136c8750 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1470,7 +1470,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 78f73ecf..e3ccd5bb 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1540,7 +1540,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 814d13c3..f833a3ed 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -603,7 +603,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index d67d141b..0d0ce7f5 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2388,7 +2388,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 4b447777..688bd414 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2757,7 +2757,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index a49a3b4a..41e45037 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2937,7 +2937,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index bc8241ce..af3d7113 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1433,7 +1433,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 80b93963..9f0fd3fa 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4411,7 +4411,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index fabbd1b6..660803ea 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -493,7 +493,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 9fb09323..67c68389 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3340,7 +3340,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 493b7bbd..001d7b55 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -1486,7 +1486,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 379a1470..cff143f6 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -724,7 +724,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 36af85a3..49745f81 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index f9865025..500ed985 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -696,7 +696,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 70de7162..80576f9d 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -575,7 +575,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 9a7ac1cb..d59677ba 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -761,7 +761,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index f67fafb1..266a80d1 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -966,7 +966,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index a6617fe6..fd658607 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -442,7 +442,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 44148718..7552eb92 100644 --- a/docs/index.html +++ b/docs/index.html @@ -534,7 +534,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 0aea52b5..671e4d07 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -300,7 +300,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index cf19c2be..a8bec605 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -298,7 +298,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index d16e0982..8d31670b 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -659,7 +659,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 295939c3..aa2b7079 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -358,7 +358,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index a0533903..9d80986b 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2013,7 +2013,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index bcb961b7..e2864dd5 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1297,7 +1297,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index b6101e70..9845d50f 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -439,7 +439,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index b34e692b..416d8f74 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -656,7 +656,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 9d8a109e..0ec20a36 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -794,7 +794,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 5088ecd5..6a9404bb 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -346,7 +346,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From e37e846ea103fd7994c6dc0fc5c201c47d493f47 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 21:27:18 +0100 Subject: [PATCH 042/106] Updated Player Data Core --- config/expcore/roles.lua | 5 ++-- expcore/player_data.lua | 49 ++++++++++++++++++++++++++++++++++++---- locale/en/expcore.cfg | 5 +++- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 4d9f9dad..383569a4 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -220,8 +220,9 @@ local default = Roles.new_role('Guest','') 'command/report', 'command/ratio', 'command/server-ups', - 'command/data-preference', - 'command/set-data-preference', + 'command/save-data', + 'command/preference', + 'command/set-preference', 'gui/player-list', 'gui/rocket-info', 'gui/science-info', diff --git a/expcore/player_data.lua b/expcore/player_data.lua index 057ae404..d6157f5c 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -42,10 +42,18 @@ end) ]] local Event = require 'utils.event' --- @dep utils.event +local Async = require 'expcore.async' --- @dep expcore.async local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore.command_general_parse' --- @dep config.expcore.command_general_parse +--- Stores all the players whos data failed to load +local FailedLoad = {} +global.failed_player_data = FailedLoad +Event.on_load(function() + FailedLoad = global.failed_player_data +end) + --- Common player data that acts as the root store for player data local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk PlayerData:set_serializer(Datastore.name_serializer) -- use player name @@ -58,7 +66,7 @@ DataSavingPreference:set_default('All') --- Sets your data saving preference -- @command set-data-preference -Commands.new_command('set-data-preference', 'Allows you to set your data saving preference') +Commands.new_command('set-preference', 'Allows you to set your data saving preference') :add_param('option', false, 'string-options', PreferenceEnum) :register(function(player, option) DataSavingPreference:set(player, option) @@ -67,11 +75,37 @@ end) --- Gets your data saving preference -- @command data-preference -Commands.new_command('data-preference', 'Shows you what your current data saving preference is') +Commands.new_command('preference', 'Shows you what your current data saving preference is') :register(function(player) return {'expcore-data.get-preference', DataSavingPreference:get(player)} end) +--- Gets your data and writes it to a file +Commands.new_command('save-data', 'Writes all your player data to a file on your computer') +:register(function(player) + player.print{'expcore-data.get-data'} + game.write_file('expgaming_player_data.json', game.table_to_json(PlayerData:get(player, {})), false, player.index) +end) + +--- Async function called after 10 seconds with no player data loaded +local check_data_loaded = Async.register(function(player) + local player_data = PlayerData:get(player) + if not player_data then + FailedLoad[player.name] = true + player.print{'expcore-data.data-failed'} + Datastore.ingest('request', 'PlayerData', player.name, '{"failed_load":true}') + end +end) + +--- When player data loads tell the player if the load had failed previously +PlayerData:on_load(function(player_name, player_data) + if not player_data or player_data.failed_load then return end + if FailedLoad[player_name] then + FailedLoad[player_name] = nil + game.players[player_name].print{'expcore-data.data-restore'} + end +end) + --- Remove data that the player doesnt want to have stored PlayerData:on_save(function(player_name, player_data) local dataPreference = DataSavingPreference:get(player_name) @@ -92,12 +126,19 @@ end) --- Load player data when they join Event.add(defines.events.on_player_joined_game, function(event) - PlayerData:request(game.players[event.player_index]) + local player = game.players[event.player_index] + PlayerData:request(player) + Async.wait(600, check_data_loaded, player) end) --- Unload player data when they leave Event.add(defines.events.on_player_left_game, function(event) - PlayerData:unload(game.players[event.player_index]) + local player = game.players[event.player_index] + local player_data = PlayerData:get(player) + if player_data.failed_load then + FailedLoad[player.name] = nil + PlayerData:raw_set(player) + else PlayerData:unload(player) end end) ----- Module Return ----- diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index 5fd4fefe..7d50cd29 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -39,4 +39,7 @@ left-button-tooltip=Hide all open windows. [expcore-data] set-preference=You data saving preference has been set to __1__. Existing data will not be effected until you rejoin. -get-preference=You data saving preference is __1__. Use /set-data-preference to change this. \ No newline at end of file +get-preference=You data saving preference is __1__. Use /set-preference to change this. Use /save-data to get a local copy of your data. +get-data=Your player data has been writen to file, location: factorio/script_output/expgaming_player_data.json +data-failed=Your player data has failed to load. Any changes to your data will not be saved. +data-restore=Your player data has been restored and changes will now save when you leave. \ No newline at end of file From c26b54f2772739ebda2c54491ef84ab24e16dc7e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 22:08:21 +0100 Subject: [PATCH 043/106] Added player colours to player data --- config/_file_loader.lua | 2 +- modules/addons/player-colours.lua | 50 ++++++++++++++++++++++++ modules/addons/random-player-colours.lua | 29 -------------- 3 files changed, 51 insertions(+), 30 deletions(-) create mode 100644 modules/addons/player-colours.lua delete mode 100644 modules/addons/random-player-colours.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index ce035ac0..c2a79ccf 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -42,7 +42,7 @@ return { 'modules.addons.compilatron', 'modules.addons.scorched-earth', 'modules.addons.pollution-grading', - 'modules.addons.random-player-colours', + 'modules.addons.player-colours', 'modules.addons.discord-alerts', 'modules.addons.chat-reply', 'modules.addons.tree-decon', diff --git a/modules/addons/player-colours.lua b/modules/addons/player-colours.lua new file mode 100644 index 00000000..74732d67 --- /dev/null +++ b/modules/addons/player-colours.lua @@ -0,0 +1,50 @@ +--- Gives players random colours when they join, also applies preset colours to those who have them +-- @addon Player-Colours + +local Event = require 'utils.event' --- @dep utils.event +local Colours = require 'utils.color_presets' --- @dep utils.color_presets +local config = require 'config.preset_player_colours' --- @dep config.preset_player_colours + +--- Stores the colour that the player wants +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local PlayerColours = PlayerData.Settings:combine('Colour') + +--- Used to compact player colours to take less space +local floor = math.floor +local function compact(colour) + return { + floor(colour.r * 255), + floor(colour.g * 255), + floor(colour.b * 255) + } +end + +--- When your data loads apply the players colour, or a random on if none is saved +PlayerColours:on_load(function(player_name, player_colour) + if not player_colour then + local preset = config.players[player_name] + if preset then + player_colour = {preset, preset} + else + local colour_name = 'white' + while config.disallow[colour_name] do + colour_name = table.get_random_dictionary_entry(Colours, true) + end + player_colour = {Colours[colour_name], Colours[colour_name]} + end + end + + local player = game.players[player_name] + player.color = player_colour[1] + player.chat_color = player_colour[2] +end) + +--- Save the players color when they use the color command +Event.add(defines.events.on_console_command, function(event) + if event.command ~= 'color' then return end + if event.parameters == '' then return end + if not event.player_index then return end + local player = game.players[event.player_index] + if not player or not player.valid then return end + PlayerColours:set(player, {compact(player.color), compact(player.chat_color)}) +end) \ No newline at end of file diff --git a/modules/addons/random-player-colours.lua b/modules/addons/random-player-colours.lua deleted file mode 100644 index 17b95ddb..00000000 --- a/modules/addons/random-player-colours.lua +++ /dev/null @@ -1,29 +0,0 @@ ---- Gives players random colours when they join, also applies preset colours to those who have them --- @addon Player-Colours - -local Colours = require 'utils.color_presets' --- @dep utils.color_presets -local Game = require 'utils.game' --- @dep utils.game -local Event = require 'utils.event' --- @dep utils.event -local config = require 'config.preset_player_colours' --- @dep config.preset_player_colours -local Global = require 'utils.global' --- @dep utils.global -require 'overrides.table' - -Global.register(config, function(tbl) - config = tbl -end) - -Event.add(defines.events.on_player_created, function(event) - local player = Game.get_player_by_index(event.player_index) - local color = 'white' - if config.players[player.name] then - color = config.players[player.name] - else - while config.disallow[color] do - color = table.get_random_dictionary_entry(Colours, true) - end - color = Colours[color] - end - color = {r=color.r/255, g=color.g/255, b=color.b/255, a=0.5} - player.color = color - player.chat_color = color -end) \ No newline at end of file From c75c123b35e11b9eeb5384998288aef1a8c5d604 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 22:19:18 +0100 Subject: [PATCH 044/106] Added Custom Join Message --- config/_file_loader.lua | 8 ++++-- locale/en/addons.cfg | 5 +--- locale/en/commands.cfg | 6 +++- modules/addons/greetings.lua | 26 ----------------- modules/data/greetings.lua | 32 +++++++++++++++++++++ modules/{addons => data}/player-colours.lua | 0 6 files changed, 43 insertions(+), 34 deletions(-) delete mode 100644 modules/addons/greetings.lua create mode 100644 modules/data/greetings.lua rename modules/{addons => data}/player-colours.lua (100%) diff --git a/config/_file_loader.lua b/config/_file_loader.lua index c2a79ccf..8e9de264 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -32,8 +32,6 @@ return { 'modules.commands.quickbar', --- Addons - 'modules.addons.station-auto-name', - 'modules.addons.greetings', 'modules.addons.chat-popups', 'modules.addons.damage-popups', 'modules.addons.death-logger', @@ -42,11 +40,15 @@ return { 'modules.addons.compilatron', 'modules.addons.scorched-earth', 'modules.addons.pollution-grading', - 'modules.addons.player-colours', + 'modules.addons.station-auto-name', 'modules.addons.discord-alerts', 'modules.addons.chat-reply', 'modules.addons.tree-decon', + --- Data + 'modules.data.player-colours', + 'modules.data.greetings', + --- GUI 'modules.gui.readme', 'modules.gui.rocket-info', diff --git a/locale/en/addons.cfg b/locale/en/addons.cfg index 4cb4c837..ed0d9123 100644 --- a/locale/en/addons.cfg +++ b/locale/en/addons.cfg @@ -77,7 +77,4 @@ get-mead-1= Filling the drinking horn get-mead-2= Skål! get-beer-1= 🍺 Pouring A Glass 🍺 get-beer-2= 🍻 Chears Mate 🍻 -verify=Please return to our discord and type r!verify __1__ - -[greetings] -greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] \ No newline at end of file +verify=Please return to our discord and type r!verify __1__ \ No newline at end of file diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 081b8f36..f4555dec 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -75,4 +75,8 @@ return-set=Your return point has been set to x: __1__ y: __2__ home-get=Your home point is at x: __1__ y: __2__ [expcom-server-ups] -no-ext=No external source was found, cannot display server ups. \ No newline at end of file +no-ext=No external source was found, cannot display server ups. + +[expcom-join-message] +greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] +message-set=Your join message has been updated. \ No newline at end of file diff --git a/modules/addons/greetings.lua b/modules/addons/greetings.lua deleted file mode 100644 index 093cf1b5..00000000 --- a/modules/addons/greetings.lua +++ /dev/null @@ -1,26 +0,0 @@ ---- Greets players on join --- @addon greetings - -local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.event -local config = require 'config.join_messages' --- @dep config.join_messages -local Global = require 'utils.global' --- @dep utils.global -require 'overrides.table' - -Global.register(config, function(tbl) - config = tbl -end) - -local greet = -function(event) - local player = Game.get_player_by_index(event.player_index) - local custom_message = config[player.name] - if custom_message then - game.print(custom_message, player.color) - else - player.print{'greetings.greet', {'links.discord'}} - end - -end - -Event.add(defines.events.on_player_joined_game, greet) \ No newline at end of file diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua new file mode 100644 index 00000000..45d487f7 --- /dev/null +++ b/modules/data/greetings.lua @@ -0,0 +1,32 @@ +--- Greets players on join +-- @addon greetings + +local Commands = require 'expcore.commands' ---@dep expcore.commands +local config = require 'config.join_messages' --- @dep config.join_messages + +--- Stores the join message that the player have +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local CustomMessages = PlayerData.Settings:combine('JoinMessage') + +--- When a players data loads show their message +CustomMessages:on_load(function(player_name, player_message) + local player = game.players[player_name] + local custom_message = player_message or config[player_name] + if custom_message then + game.print(custom_message, player.color) + else + player.print{'expcom-join-message.greet', {'links.discord'}} + end +end) + +--- Set your custom join message +-- @command join-message +-- @tparam string message The custom join message that will be used +Commands.new_command('join-message', 'Sets your custom join message') +:add_param('message', false) +:enable_auto_concat() +:register(function(player, message) + if not player then return end + CustomMessages:set(player, message) + return {'expcom-join-message.message-set'} +end) \ No newline at end of file diff --git a/modules/addons/player-colours.lua b/modules/data/player-colours.lua similarity index 100% rename from modules/addons/player-colours.lua rename to modules/data/player-colours.lua From d65a1fe0fefec17dd372860d192ac3300fbe72d8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 22:31:24 +0100 Subject: [PATCH 045/106] Added Quickbar filters --- config/_file_loader.lua | 2 +- config/expcore/roles.lua | 8 +++---- locale/en/commands.cfg | 6 +---- locale/en/data.cfg | 6 +++++ modules/commands/quickbar.lua | 40 ------------------------------- modules/data/greetings.lua | 4 ++-- modules/data/quickbar.lua | 45 +++++++++++++++++++++++++++++++++++ 7 files changed, 59 insertions(+), 52 deletions(-) create mode 100644 locale/en/data.cfg delete mode 100644 modules/commands/quickbar.lua create mode 100644 modules/data/quickbar.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 8e9de264..65d8f093 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -29,7 +29,6 @@ return { 'modules.commands.find', 'modules.commands.bonus', 'modules.commands.home', - 'modules.commands.quickbar', --- Addons 'modules.addons.chat-popups', @@ -48,6 +47,7 @@ return { --- Data 'modules.data.player-colours', 'modules.data.greetings', + 'modules.data.quickbar', --- GUI 'modules.gui.readme', diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 383569a4..3b4b225d 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -140,9 +140,7 @@ Roles.new_role('Sponsor','Spon') 'command/home-set', 'command/home-get', 'command/return', - 'fast-tree-decon', - 'command/load-quickbar', - 'command/save-quickbar' + 'fast-tree-decon' } Roles.new_role('Supporter','Sup') @@ -152,7 +150,9 @@ Roles.new_role('Supporter','Sup') :set_parent('Veteran') :allow{ 'command/jail', - 'command/unjail' + 'command/unjail', + 'command/join-message', + 'command/save-quickbar' } Roles.new_role('Partner','Part') diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index f4555dec..081b8f36 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -75,8 +75,4 @@ return-set=Your return point has been set to x: __1__ y: __2__ home-get=Your home point is at x: __1__ y: __2__ [expcom-server-ups] -no-ext=No external source was found, cannot display server ups. - -[expcom-join-message] -greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] -message-set=Your join message has been updated. \ No newline at end of file +no-ext=No external source was found, cannot display server ups. \ No newline at end of file diff --git a/locale/en/data.cfg b/locale/en/data.cfg new file mode 100644 index 00000000..6816c16b --- /dev/null +++ b/locale/en/data.cfg @@ -0,0 +1,6 @@ +[join-message] +greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] +message-set=Your join message has been updated. + +[quickbar] +saved=Your quickbar filters have been saved. \ No newline at end of file diff --git a/modules/commands/quickbar.lua b/modules/commands/quickbar.lua deleted file mode 100644 index c297ddfe..00000000 --- a/modules/commands/quickbar.lua +++ /dev/null @@ -1,40 +0,0 @@ ---[[-- Commands Module - Quickbar - - Adds a command that allows players to load Quickbar presets - @commands Quickbar -]] - -local Commands = require 'expcore.commands' --- @dep expcore.commands -local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar - ---- Loads your quickbar preset --- @command load-quickbar -Commands.new_command('load-quickbar', 'Loads your preset Quickbar items') -:add_alias('load-toolbar') -:register(function(player) - if config[player.name] then - local custom_quickbar = config[player.name] - for i, item_name in pairs(custom_quickbar) do - if item_name ~= nil and item_name ~= '' then - player.set_quick_bar_slot(i, item_name) - end - end - else - Commands.error('Quickbar preset not found') - end -end) - ---- Saves your quickbar preset to the script-output folder --- @command save-quickbar -Commands.new_command('save-quickbar', 'Saves your Quickbar preset items to file') -:add_alias('save-toolbar') -:register(function(player) - local quickbar_names = {} - for i=1, 100 do - local slot = player.get_quick_bar_slot(i) - if slot ~= nil then - quickbar_names[i] = slot.name - end - end - game.write_file("quickbar_preset.txt", player.name .. " = " .. serpent.line(quickbar_names) .. "\n", true) - Commands.print("Quickbar saved") -end) diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 45d487f7..6816d0cc 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -15,7 +15,7 @@ CustomMessages:on_load(function(player_name, player_message) if custom_message then game.print(custom_message, player.color) else - player.print{'expcom-join-message.greet', {'links.discord'}} + player.print{'join-message.greet', {'links.discord'}} end end) @@ -28,5 +28,5 @@ Commands.new_command('join-message', 'Sets your custom join message') :register(function(player, message) if not player then return end CustomMessages:set(player, message) - return {'expcom-join-message.message-set'} + return {'join-message.message-set'} end) \ No newline at end of file diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua new file mode 100644 index 00000000..5c53f183 --- /dev/null +++ b/modules/data/quickbar.lua @@ -0,0 +1,45 @@ +--[[-- Commands Module - Quickbar + - Adds a command that allows players to load Quickbar presets + @commands Quickbar +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar + +--- Stores the quickbar filters for a player +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local PlayerFilters = PlayerData.Settings:combine('QuickbarFilters') + +--- Loads your quickbar preset +PlayerFilters:on_load(function(player_name, filters) + if not filters then filters = config[player_name] end + if not filters then return end + local player = game.players[player_name] + for i, item_name in pairs(filters) do + if item_name ~= nil and item_name ~= '' then + player.set_quick_bar_slot(i, item_name) + end + end +end) + +--- Saves your quickbar preset to the script-output folder +-- @command save-quickbar +Commands.new_command('save-quickbar', 'Saves your Quickbar preset items to file') +:add_alias('save-toolbar') +:register(function(player) + local filters = {} + for i = 1, 100 do + local slot = player.get_quick_bar_slot(i) + if slot ~= nil then + filters[i] = slot.name + end + end + + if next(filters) then + PlayerFilters:set(player, filters) + else + PlayerFilters:remove(player) + end + + return {'quickbar.saved'} +end) \ No newline at end of file From 6a5d5f02d9a35c648ab2be59688faadea534f6ad Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 22:43:58 +0100 Subject: [PATCH 046/106] Added player tags --- modules/{commands => data}/tag.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) rename modules/{commands => data}/tag.lua (72%) diff --git a/modules/commands/tag.lua b/modules/data/tag.lua similarity index 72% rename from modules/commands/tag.lua rename to modules/data/tag.lua index 7b256f9c..693d5346 100644 --- a/modules/commands/tag.lua +++ b/modules/data/tag.lua @@ -8,6 +8,20 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles require 'config.expcore.command_general_parse' require 'config.expcore.command_role_parse' +--- Stores the tag for a player +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local PlayerTags = PlayerData.Settings:combine('Tag') + +--- When your tag is updated then apply the changes +PlayerTags:on_update(function(player_name, player_tag) + local player = game.players[player_name] + if player_tag == nil or player_tag == '' then + player_tag.tag = '' + else + player.tag = '- '..player_tag + end +end) + --- Sets your player tag. -- @command tag -- @tparam string tag the tag that will be after the name, there is a max length @@ -15,7 +29,7 @@ Commands.new_command('tag', 'Sets your player tag.') :add_param('tag', false, 'string-max-length', 20) :enable_auto_concat() :register(function(player, tag) - player.tag = '- '..tag + PlayerTags:set(player, tag) end) --- Clears your tag. Or another player if you are admin. @@ -29,10 +43,10 @@ end} :register(function(player, action_player) if action_player.index == player.index then -- no player given so removes your tag - action_player.tag = '' + PlayerTags:remove(action_player) elseif Roles.player_allowed(player, 'command/clear-tag/always') then -- player given and user is admin so clears that player's tag - action_player.tag = '' + PlayerTags:remove(action_player) else -- user is not admin and tried to clear another users tag return Commands.error{'expcore-commands.unauthorized'} From bfcb22918590d1fafd7ef9408119b532a77e0491 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 22:52:15 +0100 Subject: [PATCH 047/106] Added player bonus --- modules/{commands => data}/bonus.lua | 43 ++++++++++++---------------- modules/data/greetings.lua | 5 ++-- 2 files changed, 22 insertions(+), 26 deletions(-) rename modules/{commands => data}/bonus.lua (62%) diff --git a/modules/commands/bonus.lua b/modules/data/bonus.lua similarity index 62% rename from modules/commands/bonus.lua rename to modules/data/bonus.lua index 28327eaa..7bf686c5 100644 --- a/modules/commands/bonus.lua +++ b/modules/data/bonus.lua @@ -11,12 +11,11 @@ local Store = require 'expcore.store' --- @dep expcore.store local config = require 'config.bonuses' --- @dep config.bonuses require 'config.expcore.command_general_parse' --- Store bonus percentages keyed by player name -local bonus_store = Store.register(function(player) - return player.name -end) +--- Stores the bonus for the player +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local PlayerBonus = PlayerData.Settings:combine('Bonus') --- Apply a bonus amount to a player +--- Apply a bonus amount to a player local function apply_bonus(player, amount) if not amount then return end for bonus, min_max in pairs(config) do @@ -25,6 +24,11 @@ local function apply_bonus(player, amount) end end +--- When store is updated apply new bonus to the player +PlayerBonus.on_update(function(player_name, player_bonus) + apply_bonus(game.player[player_name], player_bonus or 0) +end) + --- Changes the amount of bonus you receive -- @command bonus -- @tparam number amount range 0-50 the percent increase for your bonus @@ -32,41 +36,32 @@ Commands.new_command('bonus', 'Changes the amount of bonus you receive') :add_param('amount', 'integer-range', 0,50) :register(function(player, amount) local percent = amount/100 - Store.set(bonus_store, player, percent) + PlayerBonus:set(player, percent) Commands.print{'expcom-bonus.set', amount} Commands.print({'expcom-bonus.wip'}, 'orange') end) --- When store is updated apply new bonus to the player -Store.watch(bonus_store, function(value, category) - local player = Game.get_player_from_any(category) - apply_bonus(player, value) -end) - --- When a player respawns re-apply bonus +--- When a player respawns re-apply bonus Event.add(defines.events.on_player_respawned, function(event) - local player = Game.get_player_by_index(event.player_index) - local value = Store.get(bonus_store, player) - apply_bonus(player, value) + local player = game.players[event.player_index] + apply_bonus(player, PlayerBonus:get(player)) end) --- When a player dies allow them to have instant respawn +--- When a player dies allow them to have instant respawn Event.add(defines.events.on_player_died, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] if Roles.player_has_flag(player, 'instance-respawn') then player.ticks_to_respawn = 120 end end) --- Remove bonus if a player no longer has access to the command +--- Remove bonus if a player no longer has access to the command local function role_update(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] if not Roles.player_allowed(player, 'command/bonus') then - Store.clear(bonus_store, player) + PlayerBonus:remove(player) end end Event.add(Roles.events.on_role_assigned, role_update) -Event.add(Roles.events.on_role_unassigned, role_update) - -return bonus_store \ No newline at end of file +Event.add(Roles.events.on_role_unassigned, role_update) \ No newline at end of file diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 6816d0cc..04a736cd 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -1,8 +1,9 @@ --- Greets players on join -- @addon greetings -local Commands = require 'expcore.commands' ---@dep expcore.commands local config = require 'config.join_messages' --- @dep config.join_messages +local Commands = require 'expcore.commands' ---@dep expcore.commands +require 'config.expcore.command_general_parse' --- Stores the join message that the player have local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data @@ -23,7 +24,7 @@ end) -- @command join-message -- @tparam string message The custom join message that will be used Commands.new_command('join-message', 'Sets your custom join message') -:add_param('message', false) +:add_param('message', false, 'string-max-length', 255) :enable_auto_concat() :register(function(player, message) if not player then return end From 0836375e0251a6ae1f249b7b822a15fa2a2f8dbe Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 28 May 2020 23:08:08 +0100 Subject: [PATCH 048/106] Added Alt View --- docs/config.ld | 1 + modules/data/alt-view.lua | 21 +++++++++++++++++++++ modules/data/bonus.lua | 6 ++---- modules/data/greetings.lua | 2 +- modules/data/player-colours.lua | 2 +- modules/data/quickbar.lua | 2 +- modules/data/tag.lua | 2 +- 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 modules/data/alt-view.lua diff --git a/docs/config.ld b/docs/config.ld index 30e23b4b..68c0c7a5 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -19,6 +19,7 @@ new_type("core", "Core", true) new_type("control", "Control", true) new_type("addon", "Addons", true) new_type("gui", "Guis", true) +new_type("data", "Data", true) new_type("commands", "Commands", true) new_type("config", "Configs", true, "Settings") diff --git a/modules/data/alt-view.lua b/modules/data/alt-view.lua new file mode 100644 index 00000000..83aca25a --- /dev/null +++ b/modules/data/alt-view.lua @@ -0,0 +1,21 @@ +--- Stores if you use alt mode or not and auto applies it +-- @data Alt-View + +local Event = require 'utils.event' ---@dep utils.event + +--- Stores the join message that the player have +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local UsesAlt = PlayerData.Settings:combine('UsesAlt') +UsesAlt:set_default(false) + +--- When your data loads apply alt view if you have it enabled +UsesAlt:on_load(function(player_name, uses_alt) + local player = game.players[player_name] + player.game_view_settings.show_entity_info = uses_alt or false +end) + +--- When alt view is toggled update this +Event.add(defines.events.on_player_toggled_alt_mode, function(event) + local player = game.players[event.player_index] + UsesAlt:set(player, player.game_view_settings.show_entity_info) +end) \ No newline at end of file diff --git a/modules/data/bonus.lua b/modules/data/bonus.lua index 7bf686c5..6cf1752f 100644 --- a/modules/data/bonus.lua +++ b/modules/data/bonus.lua @@ -1,14 +1,12 @@ --[[-- Commands Module - Bonus - Adds a command that allows players to have increased stats - @commands Bonus + @data Bonus ]] -local Commands = require 'expcore.commands' --- @dep expcore.commands local Roles = require 'expcore.roles' --- @dep expcore.roles local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game -local Store = require 'expcore.store' --- @dep expcore.store local config = require 'config.bonuses' --- @dep config.bonuses +local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore.command_general_parse' --- Stores the bonus for the player diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 04a736cd..84def7e3 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -1,5 +1,5 @@ --- Greets players on join --- @addon greetings +-- @data Greetings local config = require 'config.join_messages' --- @dep config.join_messages local Commands = require 'expcore.commands' ---@dep expcore.commands diff --git a/modules/data/player-colours.lua b/modules/data/player-colours.lua index 74732d67..bed8012f 100644 --- a/modules/data/player-colours.lua +++ b/modules/data/player-colours.lua @@ -1,5 +1,5 @@ --- Gives players random colours when they join, also applies preset colours to those who have them --- @addon Player-Colours +-- @data Player-Colours local Event = require 'utils.event' --- @dep utils.event local Colours = require 'utils.color_presets' --- @dep utils.color_presets diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua index 5c53f183..d2352a7f 100644 --- a/modules/data/quickbar.lua +++ b/modules/data/quickbar.lua @@ -1,6 +1,6 @@ --[[-- Commands Module - Quickbar - Adds a command that allows players to load Quickbar presets - @commands Quickbar + @data Quickbar ]] local Commands = require 'expcore.commands' --- @dep expcore.commands diff --git a/modules/data/tag.lua b/modules/data/tag.lua index 693d5346..644fc0f3 100644 --- a/modules/data/tag.lua +++ b/modules/data/tag.lua @@ -1,6 +1,6 @@ --[[-- Commands Module - Tag - Adds a command that allows players to have a custom tag after their name - @commands Tag + @data Tag ]] local Commands = require 'expcore.commands' --- @dep expcore.commands From 4286e25803f84d1aa8c417aba877d80d9836df52 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 29 May 2020 22:57:06 +0100 Subject: [PATCH 049/106] Fixed some bugs --- config/_file_loader.lua | 5 +++-- config/expcore/roles.lua | 6 +++--- expcore/datastore.lua | 20 ++++++++++---------- expcore/player_data.lua | 17 ++++------------- modules/data/bonus.lua | 4 ++-- modules/data/tag.lua | 2 +- 6 files changed, 23 insertions(+), 31 deletions(-) diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 65d8f093..28d4ebde 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -12,7 +12,6 @@ return { 'modules.commands.me', 'modules.commands.kill', 'modules.commands.admin-chat', - 'modules.commands.tag', 'modules.commands.teleport', 'modules.commands.cheat-mode', 'modules.commands.ratio', @@ -27,7 +26,6 @@ return { 'modules.commands.spawn', 'modules.commands.warnings', 'modules.commands.find', - 'modules.commands.bonus', 'modules.commands.home', --- Addons @@ -48,6 +46,9 @@ return { 'modules.data.player-colours', 'modules.data.greetings', 'modules.data.quickbar', + 'modules.data.alt-view', + 'modules.data.tag', + 'modules.data.bonus', --- GUI 'modules.gui.readme', diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 3b4b225d..c1904ada 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -151,8 +151,7 @@ Roles.new_role('Supporter','Sup') :allow{ 'command/jail', 'command/unjail', - 'command/join-message', - 'command/save-quickbar' + 'command/join-message' } Roles.new_role('Partner','Part') @@ -187,7 +186,8 @@ Roles.new_role('Member','Mem') 'gui/task-list/add', 'gui/task-list/edit', 'gui/warp-list/add', - 'gui/warp-list/edit' + 'gui/warp-list/edit', + 'command/save-quickbar' } Roles.new_role('Regular','Reg') diff --git a/expcore/datastore.lua b/expcore/datastore.lua index be6848e4..f13a4c50 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -153,6 +153,7 @@ local Datastores = {} local Datastore = {} local Data = {} local copy = table.deep_copy +local trace = debug.traceback --- Save datastores in the global table global.datastores = Data @@ -250,7 +251,6 @@ function DatastoreManager.ingest(action, datastoreName, key, valueJson) elseif action == 'propagate' or action == 'request' then local success, value = pcall(game.json_to_table, valueJson) if not success or value == nil then value = tonumber(valueJson) or valueJson end - datastore:raw_set(key) -- clear any existing data value = datastore:raise_event('on_load', key, value) datastore:set(key, value) @@ -360,7 +360,7 @@ function Datastore:raw_set(key, value) end end -local function serialize_error(err) error('An error ocurred in a datastore serializer: '..err) end +local function serialize_error(err) error('An error ocurred in a datastore serializer: '..trace(err)) end --[[-- Internal, Return the serialized key @tparam any rawKey The key that needs to be serialized, if it is already a string then it is returned @treturn string The key after it has been serialized @@ -389,11 +389,11 @@ self:write_action('save', 'TestKey', 'Foo') ]] function Datastore:write_action(action, key, value) - local data = {action, self.name, '"'..key..'"'} + local data = {action, self.name, key} if value ~= nil then - data[4] = type(value) == 'table' and '"'..game.table_to_json(value)..'"' or '"'..tostring(value)..'"' + data[4] = type(value) == 'table' and game.table_to_json(value) or tostring(value) end - game.write_file('datastore.out', table.concat(data, ' ')..'\n', true, 0) + game.write_file('ext/datastore.out', table.concat(data, ' ')..'\n', true, 0) end ----- Datastore Local @@ -520,7 +520,7 @@ function Datastore:increment(key, delta) return Datastore:set(key, value + (delta or 1)) end -local function update_error(err) error('An error ocurred in datastore update: '..err, 2) end +local function update_error(err) error('An error ocurred in datastore update: '..trace(err), 2) end --[[-- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save @tparam any key The key that you want to apply the update to, must be a string unless a serializer is set @tparam function callback The function that will be used to update the value at this key @@ -560,7 +560,7 @@ function Datastore:remove(key) if self.parent and self.parent.auto_save then return self.parent:save(key) end end -local function filter_error(err) print('An error ocurred in a datastore filter:', err) end +local function filter_error(err) print('An error ocurred in a datastore filter:'..trace(err)) end --[[-- Internal, Used to filter elements from a table @tparam table tbl The table that will have the filter applied to it @tparam[opt] function callback The function that will be used as a filter, if none giving then the provided table is returned @@ -737,7 +737,7 @@ end ----- Events -- @section events -local function event_error(err) print('An error ocurred in a datastore event handler:', err) end +local function event_error(err) print('An error ocurred in a datastore event handler: '..trace(err)) end --[[-- Internal, Raise an event on this datastore @tparam string event_name The name of the event to raise for this datastore @tparam string key The key that this event is being raised for @@ -752,7 +752,7 @@ value = self:raise_event('on_save', key, value) function Datastore:raise_event(event_name, key, value, source) -- Raise the event for the children of this datastore if source ~= 'child' and next(self.children) then - if type(value) ~= 'table' then value = self:raw_get(key, true) end + if type(value) ~= 'table' then value = {} end for value_name, child in pairs(self.children) do value[value_name] = child:raise_event(event_name, key, value[value_name], 'parent') end @@ -769,7 +769,7 @@ function Datastore:raise_event(event_name, key, value, source) -- Raise the event for the parent of this datastore if source ~= 'parent' and self.parent then - self.parent:raise_event(event_name, key, self.parent:raw_get(key), 'child') + self.parent:raise_event(event_name, key, self.parent:raw_get(key, true), 'child') end -- If this is the save event and the table is empty then return nil diff --git a/expcore/player_data.lua b/expcore/player_data.lua index d6157f5c..576674f6 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -47,13 +47,6 @@ local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore.command_general_parse' --- @dep config.expcore.command_general_parse ---- Stores all the players whos data failed to load -local FailedLoad = {} -global.failed_player_data = FailedLoad -Event.on_load(function() - FailedLoad = global.failed_player_data -end) - --- Common player data that acts as the root store for player data local PlayerData = Datastore.connect('PlayerData', true) -- saveToDisk PlayerData:set_serializer(Datastore.name_serializer) -- use player name @@ -87,11 +80,10 @@ Commands.new_command('save-data', 'Writes all your player data to a file on your game.write_file('expgaming_player_data.json', game.table_to_json(PlayerData:get(player, {})), false, player.index) end) ---- Async function called after 10 seconds with no player data loaded +--- Async function called after 5 seconds with no player data loaded local check_data_loaded = Async.register(function(player) local player_data = PlayerData:get(player) if not player_data then - FailedLoad[player.name] = true player.print{'expcore-data.data-failed'} Datastore.ingest('request', 'PlayerData', player.name, '{"failed_load":true}') end @@ -100,8 +92,8 @@ end) --- When player data loads tell the player if the load had failed previously PlayerData:on_load(function(player_name, player_data) if not player_data or player_data.failed_load then return end - if FailedLoad[player_name] then - FailedLoad[player_name] = nil + local existing_data = PlayerData:get(player_name) + if existing_data and existing_data.failed_load then game.players[player_name].print{'expcore-data.data-restore'} end end) @@ -128,7 +120,7 @@ end) Event.add(defines.events.on_player_joined_game, function(event) local player = game.players[event.player_index] PlayerData:request(player) - Async.wait(600, check_data_loaded, player) + Async.wait(300, check_data_loaded, player) end) --- Unload player data when they leave @@ -136,7 +128,6 @@ Event.add(defines.events.on_player_left_game, function(event) local player = game.players[event.player_index] local player_data = PlayerData:get(player) if player_data.failed_load then - FailedLoad[player.name] = nil PlayerData:raw_set(player) else PlayerData:unload(player) end end) diff --git a/modules/data/bonus.lua b/modules/data/bonus.lua index 6cf1752f..2275d543 100644 --- a/modules/data/bonus.lua +++ b/modules/data/bonus.lua @@ -23,8 +23,8 @@ local function apply_bonus(player, amount) end --- When store is updated apply new bonus to the player -PlayerBonus.on_update(function(player_name, player_bonus) - apply_bonus(game.player[player_name], player_bonus or 0) +PlayerBonus:on_update(function(player_name, player_bonus) + apply_bonus(game.players[player_name], player_bonus or 0) end) --- Changes the amount of bonus you receive diff --git a/modules/data/tag.lua b/modules/data/tag.lua index 644fc0f3..d01b6918 100644 --- a/modules/data/tag.lua +++ b/modules/data/tag.lua @@ -16,7 +16,7 @@ local PlayerTags = PlayerData.Settings:combine('Tag') PlayerTags:on_update(function(player_name, player_tag) local player = game.players[player_name] if player_tag == nil or player_tag == '' then - player_tag.tag = '' + player.tag = '' else player.tag = '- '..player_tag end From 2dacbe9edd3e2e57cc2aba3f3b86887630010f86 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 01:45:02 +0100 Subject: [PATCH 050/106] Added Statistics --- config/_file_loader.lua | 1 + config/statistics.lua | 29 +++++++++ expcore/datastore.lua | 8 +-- expcore/player_data.lua | 22 ++++--- modules/data/statistics.lua | 123 ++++++++++++++++++++++++++++++++++++ utils/event_core.lua | 13 ++-- 6 files changed, 177 insertions(+), 19 deletions(-) create mode 100644 config/statistics.lua create mode 100644 modules/data/statistics.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 28d4ebde..5fd71d8d 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -43,6 +43,7 @@ return { 'modules.addons.tree-decon', --- Data + 'modules.data.statistics', 'modules.data.player-colours', 'modules.data.greetings', 'modules.data.quickbar', diff --git a/config/statistics.lua b/config/statistics.lua new file mode 100644 index 00000000..d26fa2f8 --- /dev/null +++ b/config/statistics.lua @@ -0,0 +1,29 @@ +--- A list of all tracked statistics and the events which trigger them +-- @config Statistics + +local e = defines.events -- order as per lua api as it was easier just to go down the list +return { + Playtime = true, --- @setting Playtime If playtime is tracked for a player, play time measured in minutes + AfkTime = true, --- @setting AfkTime If afk time is tracked for a player, play time measured in minutes, afk is once a player does nothing for 5 minutes + DistanceTraveled = true, --- @settings DistanceTraveled If distance traveled is checked, only counts if not afk + MachinesRemoved = true, --- @setting MachinesRemoved If removed machines are tracked, includes marked for decon and player mined entity + OreMined = true, --- @settings OreMined If ore mined is tracked for a player, includes player mined entity but only ore, + DamageDealt = true, --- @settings DamageDealt If damage dealt is tracked for a player, includes any damage to entities not on the same force or neutral + Kills = true, --- @settings Kills If kills are tracked for a player, includes all kills not on same force or neutral + counters = { --- @setting counters Simple statistics that just go up by one each time an event happens + MachinesBuilt = e.on_built_entity, + MapTagsMade = e.on_chart_tag_added, + ChatMessages = e.on_console_chat, + CommandsUsed = e.on_console_command, + ItemsPickedUp = e.on_picked_up_item, + TilesBuilt = e.on_player_built_tile, + ItemsCrafted = e.on_player_crafted_item, + MapsPlayed = e.on_player_created, + DeconstructionPlanerUsed = e.on_player_deconstructed_area, + Deaths = e.on_player_died, + JoinCount = e.on_player_joined_game, + TilesRemoved = e.on_player_mined_tile, + CapsulesUsed = e.on_player_used_capsule, + RocketsLaunched = e.on_rocket_launched + } +} \ No newline at end of file diff --git a/expcore/datastore.lua b/expcore/datastore.lua index f13a4c50..ffa23f99 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -391,7 +391,7 @@ self:write_action('save', 'TestKey', 'Foo') function Datastore:write_action(action, key, value) local data = {action, self.name, key} if value ~= nil then - data[4] = type(value) == 'table' and game.table_to_json(value) or tostring(value) + data[4] = type(value) == 'table' and game.table_to_json(value) or value end game.write_file('ext/datastore.out', table.concat(data, ' ')..'\n', true, 0) end @@ -517,7 +517,7 @@ ExampleData:increment('TestNumber') function Datastore:increment(key, delta) key = self:serialize(key) local value = self:raw_get(key) or 0 - return Datastore:set(key, value + (delta or 1)) + return self:set(key, value + (delta or 1)) end local function update_error(err) error('An error ocurred in datastore update: '..trace(err), 2) end @@ -560,7 +560,7 @@ function Datastore:remove(key) if self.parent and self.parent.auto_save then return self.parent:save(key) end end -local function filter_error(err) print('An error ocurred in a datastore filter:'..trace(err)) end +local function filter_error(err) log('An error ocurred in a datastore filter:'..trace(err)) end --[[-- Internal, Used to filter elements from a table @tparam table tbl The table that will have the filter applied to it @tparam[opt] function callback The function that will be used as a filter, if none giving then the provided table is returned @@ -737,7 +737,7 @@ end ----- Events -- @section events -local function event_error(err) print('An error ocurred in a datastore event handler: '..trace(err)) end +local function event_error(err) log('An error ocurred in a datastore event handler: '..trace(err)) end --[[-- Internal, Raise an event on this datastore @tparam string event_name The name of the event to raise for this datastore @tparam string key The key that this event is being raised for diff --git a/expcore/player_data.lua b/expcore/player_data.lua index 576674f6..c3861a3c 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -83,26 +83,30 @@ end) --- Async function called after 5 seconds with no player data loaded local check_data_loaded = Async.register(function(player) local player_data = PlayerData:get(player) - if not player_data then + if not player_data or not player_data.valid then player.print{'expcore-data.data-failed'} - Datastore.ingest('request', 'PlayerData', player.name, '{"failed_load":true}') + Datastore.ingest('request', 'PlayerData', player.name, '{"valid":false}') end end) --- When player data loads tell the player if the load had failed previously PlayerData:on_load(function(player_name, player_data) - if not player_data or player_data.failed_load then return end + if not player_data or not player_data.valid then return end local existing_data = PlayerData:get(player_name) - if existing_data and existing_data.failed_load then + if existing_data and existing_data.valid == false then game.players[player_name].print{'expcore-data.data-restore'} end + player_data.valid = true end) --- Remove data that the player doesnt want to have stored PlayerData:on_save(function(player_name, player_data) local dataPreference = DataSavingPreference:get(player_name) dataPreference = PreferenceEnum[dataPreference] - if dataPreference == PreferenceEnum.All then return player_data end + if dataPreference == PreferenceEnum.All then + player_data.valid = nil + return player_data + end local saved_player_data = { PlayerRequired = player_data.PlayerRequired, DataSavingPreference = PreferenceEnum[dataPreference] } if dataPreference <= PreferenceEnum.Settings then saved_player_data.PlayerSettings = player_data.PlayerSettings end @@ -119,17 +123,17 @@ end) --- Load player data when they join Event.add(defines.events.on_player_joined_game, function(event) local player = game.players[event.player_index] - PlayerData:request(player) Async.wait(300, check_data_loaded, player) + PlayerData:request(player) end) --- Unload player data when they leave Event.add(defines.events.on_player_left_game, function(event) local player = game.players[event.player_index] local player_data = PlayerData:get(player) - if player_data.failed_load then - PlayerData:raw_set(player) - else PlayerData:unload(player) end + if player_data.valid == true then + PlayerData:unload(player) + else PlayerData:raw_set(player) end end) ----- Module Return ----- diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua new file mode 100644 index 00000000..65d30fcb --- /dev/null +++ b/modules/data/statistics.lua @@ -0,0 +1,123 @@ + +local Event = require 'utils.event' ---@dep utils.event +local config = require 'config.statistics' ---@dep config.statistics +local floor = math.floor +local afk_required = 5*3600 -- 5 minutes + +--- Stores the statistics on a player +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local AllPlayerData = PlayerData.All +local Statistics = PlayerData.Statistics + +--- Update your statistics with any which happened before the data was valid +Statistics:on_load(function(player_name, player_statistics) + local existing_data = AllPlayerData:get(player_name) + if existing_data and existing_data.valid then return end + local counters = config.counters + for key, value in pairs(Statistics:get(player_name, {})) do + if config[key] or counters[key] then + if not player_statistics[key] then + player_statistics[key] = value + else + player_statistics[key] = player_statistics[key] + value + end + end + end + return player_statistics +end) + +--- Add Playtime and AfkTime if it is enabled +if config.Playtime or config.AfkTime then + local playtime, afk_time + if config.Playtime then playtime = Statistics:combine('Playtime') end + if config.AfkTime then afk_time = Statistics:combine('AfkTime') end + Event.on_nth_tick(3600, function() + if game.tick == 0 then return end + for _, player in pairs(game.connected_players) do + if playtime then playtime:increment(player) end + if afk_time and player.afk_time > afk_required then afk_time:increment(player) end + end + end) +end + +--- Add DistanceTraveled if it is enabled +if config.DistanceTraveled then + local stat = Statistics:combine('DistanceTraveled') + Event.add(defines.events.on_player_changed_position, function(event) + local player = game.players[event.player_index] + if not player.valid or not player.connected or player.afk_time > afk_required then return end + stat:increment(player) + end) +end + +--- Add MachinesRemoved if it is enabled +if config.MachinesRemoved then + local stat = Statistics:combine('MachinesRemoved') + local function on_event(event) + if not event.player_index then return end -- Check player is valid + local player = game.players[event.player_index] + if not player.valid or not player.connected then return end + local entity = event.entity -- Check entity is valid + if not entity.valid or entity.force ~= player.force then return end + stat:increment(player) + end + Event.add(defines.events.on_marked_for_deconstruction, on_event) + Event.add(defines.events.on_player_mined_entity, on_event) +end + +--- Add OreMined if it is enabled +if config.OreMined then + local stat = Statistics:combine('OreMined') + Event.add(defines.events.on_player_mined_entity, function(event) + if not event.player_index then return end -- Check player is valid + local player = game.players[event.player_index] + if not player.valid or not player.connected then return end + local entity = event.entity -- Check entity is valid + if not entity.valid or entity.type ~= 'resource' then return end + stat:increment(player) + end) +end + +--- Add DamageDealt if it is enabled +if config.DamageDealt then + local stat = Statistics:combine('DamageDealt') + Event.add(defines.events.on_entity_damaged, function(event) + local character = event.cause -- Check character is valid + if not character.valid or character.type ~= 'character' then return end + local player = character.player -- Check player is valid + if not player.valid or not player.connected then return end + local entity = event.entity -- Check entity is valid + if not entity.valid or entity.force == player.force or entity.force.name == 'neutral' then return end + stat:increment(player, floor(event.final_damage_amount)) + end) +end + +--- Add Kills if it is enabled +if config.DamageDealt then + local stat = Statistics:combine('Kills') + Event.add(defines.events.on_entity_died, function(event) + local character = event.cause -- Check character is valid + if not character.valid or character.type ~= 'character' then return end + local player = character.player -- Check player is valid + if not player.valid or not player.connected then return end + local entity = event.entity -- Check entity is valid + if not entity.valid or entity.force == player.force or entity.force.name == 'neutral' then return end + stat:increment(player) + end) +end + +--- Add all the remaining statistics from the config +for statistic, event_name in pairs(config.counters) do + local stat = Statistics:combine(statistic) + Event.add(event_name, function(event) + if event.player_index then + local player = game.players[event.player_index] + if not player.valid or not player.connected then return end + stat:increment(player) + else + for _, player in pairs(game.connected_players) do + stat:increment(player) + end + end + end) +end \ No newline at end of file diff --git a/utils/event_core.lua b/utils/event_core.lua index b34715e1..9525167a 100644 --- a/utils/event_core.lua +++ b/utils/event_core.lua @@ -11,11 +11,16 @@ local event_handlers = {} -- map of nth_tick to handlers[] local on_nth_tick_event_handlers = {} -local pcall = pcall +local trace = debug.traceback +local xpcall = xpcall local log = log local script_on_event = script.on_event local script_on_nth_tick = script.on_nth_tick +local function handler_error(err) + log('\n\t'..trace(err)) +end + local function call_handlers(handlers, event) if _DEBUG then for i = 1, #handlers do @@ -24,11 +29,7 @@ local function call_handlers(handlers, event) end else for i = 1, #handlers do - local handler = handlers[i] - local success, error = pcall(handler, event) - if not success then - log('\n\t'..error) - end + xpcall(handlers[i], handler_error, event) end end end From 0af93b9bb5365b678d75b422584be6a4b38cc400 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 01:55:15 +0100 Subject: [PATCH 051/106] Fixed Doc Issues --- config/statistics.lua | 8 ++++---- expcore/player_data.lua | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/statistics.lua b/config/statistics.lua index d26fa2f8..b7058b47 100644 --- a/config/statistics.lua +++ b/config/statistics.lua @@ -5,11 +5,11 @@ local e = defines.events -- order as per lua api as it was easier just to go dow return { Playtime = true, --- @setting Playtime If playtime is tracked for a player, play time measured in minutes AfkTime = true, --- @setting AfkTime If afk time is tracked for a player, play time measured in minutes, afk is once a player does nothing for 5 minutes - DistanceTraveled = true, --- @settings DistanceTraveled If distance traveled is checked, only counts if not afk + DistanceTraveled = true, --- @setting DistanceTraveled If distance traveled is checked, only counts if not afk MachinesRemoved = true, --- @setting MachinesRemoved If removed machines are tracked, includes marked for decon and player mined entity - OreMined = true, --- @settings OreMined If ore mined is tracked for a player, includes player mined entity but only ore, - DamageDealt = true, --- @settings DamageDealt If damage dealt is tracked for a player, includes any damage to entities not on the same force or neutral - Kills = true, --- @settings Kills If kills are tracked for a player, includes all kills not on same force or neutral + OreMined = true, --- @setting OreMined If ore mined is tracked for a player, includes player mined entity but only ore, + DamageDealt = true, --- @setting DamageDealt If damage dealt is tracked for a player, includes any damage to entities not on the same force or neutral + Kills = true, --- @setting Kills If kills are tracked for a player, includes all kills not on same force or neutral counters = { --- @setting counters Simple statistics that just go up by one each time an event happens MachinesBuilt = e.on_built_entity, MapTagsMade = e.on_chart_tag_added, diff --git a/expcore/player_data.lua b/expcore/player_data.lua index c3861a3c..9d8ea963 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -91,7 +91,7 @@ end) --- When player data loads tell the player if the load had failed previously PlayerData:on_load(function(player_name, player_data) - if not player_data or not player_data.valid then return end + if not player_data or player_data.valid == false then return end local existing_data = PlayerData:get(player_name) if existing_data and existing_data.valid == false then game.players[player_name].print{'expcore-data.data-restore'} From cd56cbe281fa910030131c951ce0fc30c3b64e21 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 16:23:42 +0100 Subject: [PATCH 052/106] Added trees and reseach to stats --- config/statistics.lua | 8 +++-- modules/data/statistics.lua | 69 ++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/config/statistics.lua b/config/statistics.lua index b7058b47..36c60da3 100644 --- a/config/statistics.lua +++ b/config/statistics.lua @@ -7,9 +7,12 @@ return { AfkTime = true, --- @setting AfkTime If afk time is tracked for a player, play time measured in minutes, afk is once a player does nothing for 5 minutes DistanceTraveled = true, --- @setting DistanceTraveled If distance traveled is checked, only counts if not afk MachinesRemoved = true, --- @setting MachinesRemoved If removed machines are tracked, includes marked for decon and player mined entity - OreMined = true, --- @setting OreMined If ore mined is tracked for a player, includes player mined entity but only ore, + TreesDestroyed = true, --- @setting OreMined If ore mined is tracked for a player, includes marked for decon and player mined entity but only trees + OreMined = true, --- @setting OreMined If ore mined is tracked for a player, includes player mined entity but only ore DamageDealt = true, --- @setting DamageDealt If damage dealt is tracked for a player, includes any damage to entities not on the same force or neutral Kills = true, --- @setting Kills If kills are tracked for a player, includes all kills not on same force or neutral + RocketsLaunched = true, --- @setting RocketsLaunched If the number of rockets launched should be tracked, done for all players on the force + ResearchCompleted = true, --- @setting ResearchCompleted If the number of researches completed should be tracked, done for all players on the force counters = { --- @setting counters Simple statistics that just go up by one each time an event happens MachinesBuilt = e.on_built_entity, MapTagsMade = e.on_chart_tag_added, @@ -23,7 +26,6 @@ return { Deaths = e.on_player_died, JoinCount = e.on_player_joined_game, TilesRemoved = e.on_player_mined_tile, - CapsulesUsed = e.on_player_used_capsule, - RocketsLaunched = e.on_rocket_launched + CapsulesUsed = e.on_player_used_capsule } } \ No newline at end of file diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index 65d30fcb..fd554b8b 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -50,34 +50,26 @@ if config.DistanceTraveled then end) end ---- Add MachinesRemoved if it is enabled -if config.MachinesRemoved then - local stat = Statistics:combine('MachinesRemoved') +--- Add MachinesRemoved and TreesDestroyed and config.OreMined if it is enabled +if config.MachinesRemoved or config.TreesDestroyed or config.OreMined then + local machines, trees, ore + if config.MachinesRemoved then machines = Statistics:combine('MachinesRemoved') end + if config.TreesDestroyed then trees = Statistics:combine('TreesDestroyed') end + if config.OreMined then ore = Statistics:combine('OreMined') end local function on_event(event) if not event.player_index then return end -- Check player is valid local player = game.players[event.player_index] if not player.valid or not player.connected then return end local entity = event.entity -- Check entity is valid - if not entity.valid or entity.force ~= player.force then return end - stat:increment(player) + if not entity.valid then return end + if entity.type == 'resource' then ore:increment(player) + elseif entity.type == 'tree' then trees:increment(player) + elseif entity.force == player.force then machines:increment(player) end end Event.add(defines.events.on_marked_for_deconstruction, on_event) Event.add(defines.events.on_player_mined_entity, on_event) end ---- Add OreMined if it is enabled -if config.OreMined then - local stat = Statistics:combine('OreMined') - Event.add(defines.events.on_player_mined_entity, function(event) - if not event.player_index then return end -- Check player is valid - local player = game.players[event.player_index] - if not player.valid or not player.connected then return end - local entity = event.entity -- Check entity is valid - if not entity.valid or entity.type ~= 'resource' then return end - stat:increment(player) - end) -end - --- Add DamageDealt if it is enabled if config.DamageDealt then local stat = Statistics:combine('DamageDealt') @@ -106,18 +98,41 @@ if config.DamageDealt then end) end +--- Add RocketsLaunched if it is enabled +if config.RocketsLaunched then + local stat = Statistics:combine('RocketsLaunched') + Event.add(defines.events.on_rocket_launched, function(event) + local silo = event.rocket_silo -- Check silo is valid + if not silo or not silo.valid then return end + local force = silo.force -- Check force is valid + if not force or not force.valid then return end + for _, player in pairs(force.connected_players) do + stat:increment(player) + end + end) +end + +--- Add RocketsLaunched if it is enabled +if config.ResearchCompleted then + local stat = Statistics:combine('ResearchCompleted') + Event.add(defines.events.on_research_finished, function(event) + local research = event.research -- Check research is valid + if event.by_script or not research or not research.valid then return end + local force = research.force -- Check force is valid + if not force or not force.valid then return end + for _, player in pairs(force.connected_players) do + stat:increment(player) + end + end) +end + --- Add all the remaining statistics from the config for statistic, event_name in pairs(config.counters) do local stat = Statistics:combine(statistic) Event.add(event_name, function(event) - if event.player_index then - local player = game.players[event.player_index] - if not player.valid or not player.connected then return end - stat:increment(player) - else - for _, player in pairs(game.connected_players) do - stat:increment(player) - end - end + if not event.player_index then return end + local player = game.players[event.player_index] + if not player.valid or not player.connected then return end + stat:increment(player) end) end \ No newline at end of file From f23f76494c90080df989644ce0ad4d74da20a3cd Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 15:28:03 +0000 Subject: [PATCH 053/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 21 +- docs/addons/Chat-Popups.html | 21 +- docs/addons/Chat-Reply.html | 21 +- docs/addons/Compilatron.html | 21 +- docs/addons/Damage-Popups.html | 21 +- docs/addons/Death-Logger.html | 21 +- docs/addons/Discord-Alerts.html | 21 +- docs/addons/Inventory-Clear.html | 21 +- docs/addons/Pollution-Grading.html | 21 +- docs/addons/Scorched-Earth.html | 21 +- docs/addons/Spawn-Area.html | 21 +- docs/addons/Tree-Decon.html | 21 +- docs/commands/Admin-Chat.html | 21 +- docs/commands/Cheat-Mode.html | 21 +- docs/commands/Clear-Inventory.html | 21 +- docs/commands/Debug.html | 21 +- docs/commands/Find.html | 21 +- docs/commands/Help.html | 21 +- docs/commands/Home.html | 21 +- docs/commands/Interface.html | 21 +- docs/commands/Jail.html | 21 +- docs/commands/Kill.html | 21 +- docs/commands/Me.html | 21 +- docs/commands/Rainbow.html | 21 +- docs/commands/Repair.html | 21 +- docs/commands/Reports.html | 21 +- docs/commands/Roles.html | 21 +- docs/commands/Spawn.html | 21 +- docs/commands/Teleport.html | 21 +- docs/commands/Warnings.html | 21 +- docs/configs/Advanced-Start.html | 21 +- docs/configs/Bonuses.html | 21 +- docs/configs/Chat-Reply.html | 21 +- docs/configs/Commands-Auth-Admin.html | 21 +- docs/configs/Commands-Auth-Roles.html | 21 +- .../Commands-Auth-Runtime-Disable.html | 21 +- docs/configs/Commands-Parse-Roles.html | 21 +- docs/configs/Commands-Parse.html | 21 +- docs/configs/Compilatron.html | 21 +- docs/configs/Death-Logger.html | 21 +- docs/configs/Discord-Alerts.html | 21 +- docs/configs/File-Loader.html | 21 +- docs/configs/Permission-Groups.html | 21 +- docs/configs/Player-List.html | 21 +- docs/configs/Pollution-Grading.html | 21 +- docs/configs/Popup-Messages.html | 21 +- docs/configs/Preset-Player-Colours.html | 21 +- docs/configs/Preset-Player-Quickbar.html | 21 +- docs/configs/Repair.html | 21 +- docs/configs/Rockets.html | 21 +- docs/configs/Roles.html | 21 +- docs/configs/Science.html | 21 +- docs/configs/Scorched-Earth.html | 21 +- docs/configs/Spawn-Area.html | 21 +- docs/configs/Statistics.html | 616 ++++++++++++++++++ docs/configs/Tasks.html | 21 +- docs/configs/Warnings.html | 21 +- docs/configs/Warps.html | 21 +- docs/configs/inventory_clear.html | 21 +- docs/control/Jail.html | 21 +- docs/control/Production.html | 21 +- docs/control/Reports.html | 21 +- docs/control/Rockets.html | 21 +- docs/control/Tasks.html | 21 +- docs/control/Warnings.html | 21 +- docs/control/Warps.html | 21 +- docs/core/Async.html | 21 +- docs/core/Commands.html | 21 +- docs/core/Common.html | 21 +- docs/core/Datastore.html | 21 +- docs/core/Groups.html | 21 +- docs/core/Gui.html | 21 +- docs/core/PlayerData.html | 49 +- docs/core/Roles.html | 21 +- docs/core/Store.html | 21 +- docs/data/Alt-View.html | 342 ++++++++++ docs/data/Bonus.html | 494 ++++++++++++++ docs/data/Greetings.html | 437 +++++++++++++ docs/data/Player-Colours.html | 398 +++++++++++ docs/data/Quickbar.html | 415 ++++++++++++ docs/data/Tag.html | 493 ++++++++++++++ docs/guis/Player-List.html | 21 +- docs/guis/Readme.html | 21 +- docs/guis/Rocket-Info.html | 21 +- docs/guis/Science-Info.html | 21 +- docs/guis/Task-List.html | 21 +- docs/guis/Warps-List.html | 21 +- docs/guis/server-ups.html | 21 +- docs/index.html | 59 +- docs/modules/control.html | 21 +- .../modules.addons.station-auto-name.html | 21 +- docs/modules/overrides.debug.html | 21 +- docs/modules/overrides.math.html | 21 +- docs/modules/overrides.table.html | 21 +- docs/modules/utils.event.html | 21 +- docs/modules/utils.event_core.html | 21 +- docs/modules/utils.task.html | 21 +- docs/topics/LICENSE.html | 21 +- docs/topics/README.md.html | 21 +- 99 files changed, 4623 insertions(+), 570 deletions(-) create mode 100644 docs/configs/Statistics.html create mode 100644 docs/data/Alt-View.html create mode 100644 docs/data/Bonus.html create mode 100644 docs/data/Greetings.html create mode 100644 docs/data/Player-Colours.html create mode 100644 docs/data/Quickbar.html create mode 100644 docs/data/Tag.html diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index d8d445bf..9fdecd6e 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -353,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 500a420b..eb355e9b 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -354,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 2b30ff69..31abe5c8 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -381,7 +390,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 55978afb..ecfb09b5 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -57,10 +57,8 @@ - - @@ -113,10 +111,22 @@ + @@ -590,7 +599,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index f8735da3..4536430f 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -354,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index a010b4b6..94412bc5 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -409,7 +418,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index c77011f1..df4b1a82 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -465,7 +474,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index cd3e909f..db651249 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -353,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 6b014639..5f925633 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -325,7 +334,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index a633ac44..676c8260 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -409,7 +418,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 832fdc48..2869e2a1 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -381,7 +390,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index b8cbb8ea..638e8af6 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -56,10 +56,8 @@ - - @@ -112,10 +110,22 @@ + @@ -381,7 +390,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 005a017f..1ff9064b 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -51,7 +51,6 @@

    Commands

    @@ -115,10 +112,8 @@ - - @@ -141,6 +136,19 @@ + + + + + + + + + + + + + + + + + + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -113,10 +114,8 @@ - - @@ -139,10 +138,22 @@ + @@ -122,10 +123,8 @@ - - @@ -148,10 +147,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -122,10 +123,8 @@ - - @@ -148,10 +147,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -113,10 +114,8 @@ - - @@ -139,10 +138,22 @@ + @@ -113,10 +114,8 @@ - - @@ -139,10 +138,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -122,10 +123,8 @@ - - @@ -148,10 +147,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -113,10 +114,8 @@ - - @@ -139,10 +138,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -121,10 +122,8 @@ - - @@ -147,10 +146,22 @@ + @@ -113,10 +114,8 @@ - - @@ -139,10 +138,22 @@ + + @@ -1213,7 +1222,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index c8b13c4c..6742ff29 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -89,10 +89,8 @@ - - @@ -115,10 +113,22 @@ + @@ -1334,7 +1343,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 4c22e2e4..1065af7d 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -89,10 +89,8 @@ - - @@ -115,10 +113,22 @@ + @@ -1115,7 +1124,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 90c3334b..3db8b3a6 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -88,10 +88,8 @@ - - @@ -114,10 +112,22 @@ + @@ -989,7 +998,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 1803c657..b7399b8d 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -88,10 +88,8 @@ - - @@ -114,10 +112,22 @@ + @@ -1003,7 +1012,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 136c8750..347bcbbd 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -88,10 +88,8 @@ - - @@ -114,10 +112,22 @@ + @@ -1470,7 +1479,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index e3ccd5bb..abac232c 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -89,10 +89,8 @@ - - @@ -115,10 +113,22 @@ + @@ -1540,7 +1549,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index f833a3ed..2dfa34d8 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -87,10 +87,8 @@ - - @@ -113,10 +111,22 @@ + @@ -603,7 +612,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 0d0ce7f5..074380a5 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -93,10 +93,8 @@ - - @@ -119,10 +117,22 @@ + @@ -2388,7 +2397,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 688bd414..684e8861 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -90,10 +90,8 @@ - - @@ -116,10 +114,22 @@ + @@ -2757,7 +2766,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 41e45037..833bc23a 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -92,10 +92,8 @@ - - @@ -118,10 +116,22 @@ + @@ -2937,7 +2946,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index af3d7113..2bc7a866 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -90,10 +90,8 @@ - - @@ -116,10 +114,22 @@ + @@ -1433,7 +1442,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 9f0fd3fa..c701bfa0 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -95,10 +95,8 @@ - - @@ -121,10 +119,22 @@ + @@ -4411,7 +4420,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 660803ea..2348e69f 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -87,10 +87,8 @@ - - @@ -113,10 +111,22 @@ + @@ -288,6 +297,9 @@ utils.event + expcore.async + + expcore.datastore @@ -339,6 +351,31 @@ + + + + + + +
    +
    +
    +
    + # + expcore.async +
    +
    +
    +
    + + + + + + + + + @@ -493,7 +530,7 @@ generated by LDoc
    diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 67c68389..1fc9a1a2 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -94,10 +94,8 @@ - - @@ -120,10 +118,22 @@ + @@ -3340,7 +3349,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 001d7b55..1290cd54 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -90,10 +90,8 @@ - - @@ -116,10 +114,22 @@ + @@ -1486,7 +1495,7 @@ Store.set(player_scores, game.player, 10) generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html new file mode 100644 index 00000000..6800954f --- /dev/null +++ b/docs/data/Alt-View.html @@ -0,0 +1,342 @@ + + + + + + + + Alt-View data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Alt-View data

    +

    Stores if you use alt mode or not and auto applies it

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + +
    utils.event
    expcore.player_data
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html new file mode 100644 index 00000000..b7c64d7f --- /dev/null +++ b/docs/data/Bonus.html @@ -0,0 +1,494 @@ + + + + + + + + Bonus data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Bonus data

    +

    Commands Module - Bonus + - Adds a command that allows players to have increased stats

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + + + + + + + +
    expcore.roles
    utils.event
    config.bonuses
    expcore.commands
    expcore.player_data
    + + +

    Commands

    + + + + + + + + +
    bonusChanges the amount of bonus you receive
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.roles +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + config.bonuses +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.commands +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Commands

    +
    +
    +
    +
    + # + bonus +
    +
    +
    +
    + +

    Changes the amount of bonus you receive

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + range 0-50 the percent increase for your bonus + +
    • + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html new file mode 100644 index 00000000..2dc49cb4 --- /dev/null +++ b/docs/data/Greetings.html @@ -0,0 +1,437 @@ + + + + + + + + Greetings data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Greetings data

    +

    Greets players on join

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + +
    config.join_messages
    expcore.commands
    expcore.player_data
    + + +

    Commands

    + + + + + + + + +
    join-messageSet your custom join message
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + config.join_messages +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.commands +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Commands

    +
    +
    +
    +
    + # + join-message +
    +
    +
    +
    + +

    Set your custom join message

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + message + + : + + (string) + + The custom join message that will be used + +
    • + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html new file mode 100644 index 00000000..16bde4bd --- /dev/null +++ b/docs/data/Player-Colours.html @@ -0,0 +1,398 @@ + + + + + + + + Player-Colours data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Player-Colours data

    +

    Gives players random colours when they join, also applies preset colours to those who have them

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + + + + +
    utils.event
    utils.color_presets
    config.preset_player_colours
    expcore.player_data
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.color_presets +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + config.preset_player_colours +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html new file mode 100644 index 00000000..3a344472 --- /dev/null +++ b/docs/data/Quickbar.html @@ -0,0 +1,415 @@ + + + + + + + + Quickbar data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Quickbar data

    +

    Commands Module - Quickbar + - Adds a command that allows players to load Quickbar presets

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + +
    expcore.commands
    config.preset_player_quickbar
    expcore.player_data
    + + +

    Commands

    + + + + + + + + +
    save-quickbarSaves your quickbar preset to the script-output folder
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.commands +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + config.preset_player_quickbar +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Commands

    +
    +
    +
    +
    + # + save-quickbar +
    +
    +
    +
    + +

    Saves your quickbar preset to the script-output folder

    +

    + + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/data/Tag.html b/docs/data/Tag.html new file mode 100644 index 00000000..0411e368 --- /dev/null +++ b/docs/data/Tag.html @@ -0,0 +1,493 @@ + + + + + + + + Tag data + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Tag data

    +

    Commands Module - Tag + - Adds a command that allows players to have a custom tag after their name

    +

    + + + + + + + + + + + + + +

    Dependencies

    + + + + + + + + + + + + + +
    expcore.commands
    expcore.roles
    expcore.player_data
    + + +

    Commands

    + + + + + + + + + + + + +
    tagSets your player tag.
    tag-clearClears your tag.
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.commands +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.roles +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Commands

    +
    +
    +
    +
    + # + tag +
    +
    +
    +
    + +

    Sets your player tag.

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + tag + + : + + (string) + + the tag that will be after the name, there is a max length + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + tag-clear +
    +
    +
    +
    + +

    Clears your tag.

    +

    Or another player if you are admin.

    + + + Command Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to remove the tag from, nil will apply to self + + (default: self) +
    • + + +
    + + + + + + + + + + + + + +
    +
    + + + +
    +
    +
    + + + + diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index cff143f6..9d54971a 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -724,7 +733,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 49745f81..b16a7df7 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -761,7 +770,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 500ed985..bcec0e6e 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -696,7 +705,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 80576f9d..2f76523d 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -575,7 +584,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index d59677ba..c5fe849c 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -761,7 +770,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 266a80d1..a0e07525 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -101,10 +101,8 @@ - - @@ -113,10 +111,22 @@ + @@ -966,7 +975,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index fd658607..d51a9362 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -102,10 +102,8 @@ - - @@ -114,10 +112,22 @@ + @@ -442,7 +451,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 7552eb92..44c76ee0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -161,10 +161,6 @@ Sends alert messages to our discord server when certain events are triggered - greetings - Greets players on join - - Inventory-Clear Will move players items to spawn when they are banned or kicked, option to clear on leave @@ -173,10 +169,6 @@ Makes polution look much nice of the map, ie not one big red mess - Player-Colours - Gives players random colours when they join, also applies preset colours to those who have them - - Scorched-Earth When a player walks around the tiles under them will degrade over time, the same is true when entites are built @@ -227,6 +219,36 @@ - Adds a warp list gui which allows players to add and remove warp points
    +

    Data

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Alt-ViewStores if you use alt mode or not and auto applies it
    BonusCommands Module - Bonus + - Adds a command that allows players to have increased stats
    GreetingsGreets players on join
    Player-ColoursGives players random colours when they join, also applies preset colours to those who have them
    QuickbarCommands Module - Quickbar + - Adds a command that allows players to load Quickbar presets
    TagCommands Module - Tag + - Adds a command that allows players to have a custom tag after their name

    Commands

    @@ -235,11 +257,6 @@ - Adds a command that allows admins to talk in a private chat - - - - @@ -290,11 +307,6 @@ - Adds a command that adds * around your message in the chat - - - - @@ -320,11 +332,6 @@ - Adds a command that allows players to teleport to their spawn point - - - - @@ -465,6 +472,10 @@ see ./expcore/commands.lua for more details + + + + @@ -534,7 +545,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 671e4d07..4954312b 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -101,10 +101,8 @@ - - @@ -127,10 +125,22 @@ + @@ -300,7 +309,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index a8bec605..05cb9c3f 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -101,10 +101,8 @@ - - @@ -127,10 +125,22 @@ + @@ -298,7 +307,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 8d31670b..09707d61 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -101,10 +101,8 @@ - - @@ -127,10 +125,22 @@ + @@ -659,7 +668,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index aa2b7079..caa8894a 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -101,10 +101,8 @@ - - @@ -127,10 +125,22 @@ + @@ -358,7 +367,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 9d80986b..cb9dc2a8 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -103,10 +103,8 @@ - - @@ -129,10 +127,22 @@ + @@ -2013,7 +2022,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index e2864dd5..dbfed0fb 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -102,10 +102,8 @@ - - @@ -128,10 +126,22 @@ + @@ -1297,7 +1306,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 9845d50f..31413255 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -101,10 +101,8 @@ - - @@ -127,10 +125,22 @@ + @@ -439,7 +448,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 416d8f74..ce25a89e 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -102,10 +102,8 @@ - - @@ -128,10 +126,22 @@ + @@ -656,7 +665,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 0ec20a36..3670121a 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -87,10 +87,8 @@ - - @@ -113,10 +111,22 @@ + @@ -794,7 +803,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 6a9404bb..9d2aab2e 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -87,10 +87,8 @@ - - @@ -113,10 +111,22 @@ + @@ -346,7 +355,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 88176f44a342bc8759064732c952259206b062a2 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 21:06:07 +0100 Subject: [PATCH 054/106] Fixed player data issue --- expcore/player_data.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/player_data.lua b/expcore/player_data.lua index 9d8ea963..b49331e6 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -133,7 +133,7 @@ Event.add(defines.events.on_player_left_game, function(event) local player_data = PlayerData:get(player) if player_data.valid == true then PlayerData:unload(player) - else PlayerData:raw_set(player) end + else PlayerData:raw_set(player.name) end end) ----- Module Return ----- From c7f2eb604756070202646b7f0b5d12f1a87ed935 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 22:47:01 +0100 Subject: [PATCH 055/106] Converted Warps --- config/gui/warps.lua | 2 +- expcore/datastore.lua | 25 ++- expcore/player_data.lua | 3 +- modules/control/warps.lua | 59 +++--- modules/gui/warp-list.lua | 401 +++++++++++++++++++------------------- 5 files changed, 245 insertions(+), 245 deletions(-) diff --git a/config/gui/warps.lua b/config/gui/warps.lua index d1710ba8..3e8b272b 100644 --- a/config/gui/warps.lua +++ b/config/gui/warps.lua @@ -10,7 +10,7 @@ return { -- Warp cooldowns bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none expcore_roles_bypass_warp_cooldown = 'gui/warp-list/bypass-cooldown', --- @setting expcore_roles_bypass_warp_cooldown if expcore.roles is used then this is the required permission - cooldown_duraction = 60, --- @setting cooldown_duraction the duration of the warp cooldown in seconds + cooldown_duration = 60, --- @setting cooldown_duration the duration of the warp cooldown in seconds -- Warp proximity bypass_warp_proximity = 'expcore.roles', --- @setting bypass_warp_proximity dictates who the warp proximity is applied to; values: all, admin, expcore.roles, none diff --git a/expcore/datastore.lua b/expcore/datastore.lua index ffa23f99..0a471b07 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -251,7 +251,8 @@ function DatastoreManager.ingest(action, datastoreName, key, valueJson) elseif action == 'propagate' or action == 'request' then local success, value = pcall(game.json_to_table, valueJson) if not success or value == nil then value = tonumber(valueJson) or valueJson end - value = datastore:raise_event('on_load', key, value) + local old_value = datastore:raw_get(key) + value = datastore:raise_event('on_load', key, value, old_value) datastore:set(key, value) end @@ -495,12 +496,13 @@ ExampleData:set('TestKey', 'Foo') ]] function Datastore:set(key, value) key = self:serialize(key) + local old_value = self:raw_get(key) if value == self.default and not self.allow_set_to_default then self:raw_set(key) else self:raw_set(key, value) end - self:raise_event('on_update', key, value) + self:raise_event('on_update', key, value, old_value) if self.auto_save then self:save(key) end return value end @@ -535,11 +537,12 @@ end) function Datastore:update(key, callback) key = self:serialize(key) local value = self:raw_get(key) + local old_value = copy(self:raw_get(key)) local success, new_value = xpcall(callback, update_error, key, value) if success and new_value ~= nil then self:set(key, new_value) else - self:raise_event('on_update', key, value) + self:raise_event('on_update', key, value, old_value) if self.auto_save then self:save(key) end end end @@ -554,8 +557,9 @@ ExampleData:remove('TestKey') ]] function Datastore:remove(key) key = self:serialize(key) + local old_value = self:raw_get(key) self:raw_set(key) - self:raise_event('on_update', key) + self:raise_event('on_update', key, old_value) if self.save_to_disk then self:write_action('remove', key) end if self.parent and self.parent.auto_save then return self.parent:save(key) end end @@ -622,11 +626,12 @@ end) function Datastore:update_all(callback) local data = self:get_all() for key, value in pairs(data) do + local old_value = copy(value) local success, new_value = xpcall(callback, update_error, key, value) if success and new_value ~= nil then self:set(key, new_value) else - self:raise_event('on_update', key, value) + self:raise_event('on_update', key, value, old_value) if self.auto_save then self:save(key) end end end @@ -749,12 +754,13 @@ local function event_error(err) log('An error ocurred in a datastore event handl value = self:raise_event('on_save', key, value) ]] -function Datastore:raise_event(event_name, key, value, source) +function Datastore:raise_event(event_name, key, value, old_value, source) -- Raise the event for the children of this datastore if source ~= 'child' and next(self.children) then if type(value) ~= 'table' then value = {} end for value_name, child in pairs(self.children) do - value[value_name] = child:raise_event(event_name, key, value[value_name], 'parent') + local old_child_value = old_value and old_value[value_name] or nil + value[value_name] = child:raise_event(event_name, key, value[value_name], old_child_value, 'parent') end end @@ -762,14 +768,15 @@ function Datastore:raise_event(event_name, key, value, source) local handlers = self.events[event_name] if handlers then for _, handler in ipairs(handlers) do - local success, new_value = xpcall(handler, event_error, key, value) + local success, new_value = xpcall(handler, event_error, key, value, old_value) if success and new_value ~= nil then value = new_value end end end -- Raise the event for the parent of this datastore if source ~= 'parent' and self.parent then - self.parent:raise_event(event_name, key, self.parent:raw_get(key, true), 'child') + local parent_value = self.parent:raw_get(key, true) + self.parent:raise_event(event_name, key, parent_value, parent_value, 'child') end -- If this is the save event and the table is empty then return nil diff --git a/expcore/player_data.lua b/expcore/player_data.lua index b49331e6..ba9a127c 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -90,9 +90,8 @@ local check_data_loaded = Async.register(function(player) end) --- When player data loads tell the player if the load had failed previously -PlayerData:on_load(function(player_name, player_data) +PlayerData:on_load(function(player_name, player_data, existing_data) if not player_data or player_data.valid == false then return end - local existing_data = PlayerData:get(player_name) if existing_data and existing_data.valid == false then game.players[player_name].print{'expcore-data.data-restore'} end diff --git a/modules/control/warps.lua b/modules/control/warps.lua index 7e7a12e6..a61e80d4 100644 --- a/modules/control/warps.lua +++ b/modules/control/warps.lua @@ -21,25 +21,24 @@ Warps.make_warp_tag(warp_id) ]] -local Store = require 'expcore.store' --- @dep expcore.store +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Global = require 'utils.global' --- @dep utils.global -local Token = require 'utils.token' --- @dep utils.token local config = require 'config.gui.warps' --- @dep config.warps +--- Stores all data for the warp gui +local WrapData = Datastore.connect('WrapData') +WrapData:set_serializer(function(raw_key) return raw_key.warp_id end) + local Warps = {} -- Global lookup table for force name to task ids -local force_warps = {} +local force_warps = {_uid=1} Global.register(force_warps, function(tbl) force_warps = tbl end) --- Warp store is keyed by warp id, value is a table -local warp_store = Store.register() -Warps.store = warp_store - -- When a warp is updated change its chat tag and resort the warp order -Store.watch(warp_store, function(warp, warp_id) +WrapData:on_update(function(warp_id, warp, old_warp) if warp then -- Update the map chart tag if there is one if warp.tag then @@ -47,7 +46,7 @@ Store.watch(warp_store, function(warp, warp_id) end -- Check that the name of the warp has been changed - if warp.name == warp.old_name then return end + if not old_warp or warp.name == old_warp.name then return end -- Get the names of all the warp points for this force local force_name = warp.force_name @@ -56,7 +55,7 @@ Store.watch(warp_store, function(warp, warp_id) local warp_names = {} for _, next_warp_id in pairs(warp_ids) do - local next_warp = Store.get(warp_store, next_warp_id) + local next_warp = WrapData:get(next_warp_id) if next_warp_id ~= spawn_id then warp_names[next_warp.name..next_warp_id] = next_warp_id end @@ -70,9 +69,9 @@ Store.watch(warp_store, function(warp, warp_id) end end) ---- Map Intergration. +--- Map Integration. -- functions used to create and alter warps with in the map --- @section mapIntergration +-- @section mapIntegration --[[-- Add or update the chat tag for this warp @tparam string warp_id the uid of the warp you want the chart tag for @@ -83,7 +82,7 @@ local tag_added = Warps.make_warp_tag(warp_id) ]] function Warps.make_warp_tag(warp_id) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) local name = warp.name local icon = warp.icon @@ -120,7 +119,7 @@ local removed = Warps.remove_warp_tag(warp_id) ]] function Warps.remove_warp_tag(warp_id) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) -- Check there is a tag to remove local tag = warp.tag @@ -144,7 +143,7 @@ Warps.make_warp_area(warp_id) ]] function Warps.make_warp_area(warp_id) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) local surface = warp.surface local position = warp.position local posx = position.x @@ -170,7 +169,7 @@ function Warps.make_warp_area(warp_id) end surface.set_tiles(base_tiles) - -- Add a tile patern ontop of the base + -- Add a tile pattern on top of the base local tiles = {} for _, pos in pairs(config.tiles) do table.insert(tiles, {name=base_tile, position={pos[1]+posx, pos[2]+posy}}) @@ -199,7 +198,7 @@ Warps.remove_warp_area(warp_id) ]] function Warps.remove_warp_area(warp_id) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) local position = warp.position local surface = warp.surface local radius = config.standard_proximity_radius @@ -222,7 +221,7 @@ function Warps.remove_warp_area(warp_id) end surface.set_tiles(tiles) - -- Remove all the entites that are in the area + -- Remove all the entities that are in the area local entities = surface.find_entities_filtered{ force='neutral', area={ @@ -243,7 +242,7 @@ Warps.set_spawn_warp(warp_id, game.player.force) ]] function Warps.set_spawn_warp(warp_id, force) -- Check the force owns this warp - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) if warp.force_name ~= force.name then return end -- Set this warp as the spawn @@ -267,7 +266,7 @@ Warps.teleport_player(warp_id, game.player) ]] function Warps.teleport_player(warp_id, player) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) local surface = warp.surface local position = { x=warp.position.x+0.5, @@ -299,7 +298,8 @@ local warp_id = Warps.add_warp(player.force.name, player.surface, player.positio ]] function Warps.add_warp(force_name, surface, position, player_name, warp_name) -- Get new warp id - local warp_id = tostring(Token.uid()) + local warp_id = tostring(force_warps._uid) + force_warps._uid = force_warps._uid + 1 warp_name = warp_name or 'New warp' -- Get the existing warps for this force @@ -319,7 +319,7 @@ function Warps.add_warp(force_name, surface, position, player_name, warp_name) end -- Add the new warp to the store - Store.set(warp_store, warp_id, { + WrapData:set(warp_id, { warp_id = warp_id, force_name = force_name, name = warp_name, @@ -345,11 +345,11 @@ Warps.remove_warp(warp_id) ]] function Warps.remove_warp(warp_id) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) local force_name = warp.force_name Warps.remove_warp_tag(warp_id) Warps.remove_warp_area(warp_id) - Store.clear(warp_store, warp_id) + WrapData:remove(warp_id) table.remove_element(force_warps[force_name], warp_id) end @@ -364,10 +364,9 @@ Warps.update_warp(warp_id, 'My Warp', 'iron-plate', game.player.name) ]] function Warps.update_warp(warp_id, new_name, new_icon, player_name) - Store.update(warp_store, warp_id, function(warp) + WrapData:update(warp_id, function(_, warp) warp.last_edit_name = player_name or '' warp.last_edit_time = game.tick - warp.old_name = warp.name warp.name = new_name or warp.name warp.icon = new_icon or warp.icon end) @@ -383,7 +382,7 @@ Warps.set_editing(warp_id, game.player.name, true) ]] function Warps.set_editing(warp_id, player_name, state) - Store.update(warp_store, warp_id, function(warp) + WrapData:update(warp_id, function(_, warp) warp.currently_editing[player_name] = state end) end @@ -398,7 +397,7 @@ end) ]] function Warps.on_update(handler) - Store.watch(warp_store, handler) + WrapData:on_update(handler) end --- Getters. @@ -414,7 +413,7 @@ local warp = Warps.get_warp(warp_id) ]] function Warps.get_warp(warp_id) - return Store.get(warp_store, warp_id) + return WrapData:get(warp_id) end --[[-- Gets all the warp ids that a force has @@ -452,7 +451,7 @@ local editing = Warps.get_editing(warp_id, game.player.name) ]] function Warps.get_editing(warp_id, player_name) - local warp = Store.get(warp_store, warp_id) + local warp = WrapData:get(warp_id) return warp.currently_editing[player_name] end diff --git a/modules/gui/warp-list.lua b/modules/gui/warp-list.lua index 4736679e..50f98d7e 100644 --- a/modules/gui/warp-list.lua +++ b/modules/gui/warp-list.lua @@ -5,33 +5,30 @@ ]] local Gui = require 'expcore.gui' --- @dep expcore.gui -local Store = require 'expcore.store' --- @dep expcore.store +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Global = require 'utils.global' --- @dep utils.global local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Roles = require 'expcore.roles' --- @dep expcore.roles local Colors = require 'utils.color_presets' --- @dep utils.color_presets local config = require 'config.gui.warps' --- @dep config.gui.warps local Warps = require 'modules.control.warps' --- @dep modules.control.warps local format_time = _C.format_time --- @dep expcore.common --- Stores a boolean value indexed by player name -local player_in_range_store = Store.register(function(player) - return player.name -end) +--- Stores all data for the warp gui +local WrapGuiData = Datastore.connect('WrapGuiData') +WrapGuiData:set_serializer(Datastore.name_serializer) +local PlayerInRange = WrapGuiData:combine('PlayerInRange') +PlayerInRange:set_default(false) +local PlayerCooldown = WrapGuiData:combine('PlayerCooldown') +PlayerCooldown:set_default(0) --- Stores the time remaing for a players warp cooldown -local player_warp_cooldown_store = Store.register(function(player) - return player.name -end) - --- Table that stores a boolean value of weather to keep the warp gui open +--- Table that stores a boolean value of weather to keep the warp gui open local keep_gui_open = {} Global.register(keep_gui_open, function(tbl) keep_gui_open = tbl end) --- Styles used for sprite buttons +--- Styles used for sprite buttons local Styles = { sprite20 = Gui.sprite_style(20), sprite22 = Gui.sprite_style(20, nil, { right_margin = -3 }), @@ -55,7 +52,7 @@ local function check_player_permissions(player, action, warp) end end - -- Check player has permisison based on value in the config + -- Check player has permission based on value in the config local action_config = config[action] if action_config == 'all' then return true @@ -65,7 +62,7 @@ local function check_player_permissions(player, action, warp) return Roles.player_allowed(player, config['expcore_roles_'..action]) end - -- Return false as all other condidtions have not been met + -- Return false as all other conditions have not been met return false end @@ -187,7 +184,7 @@ Gui.element{ Warps.set_editing(warp_id, player.name) end) ---- Editing state for a warp, contrins a text field and the two edit buttons +--- Editing state for a warp, contains a text field and the two edit buttons -- @element warp_editing warp_editing = Gui.element(function(event_trigger, parent, warp) @@ -246,7 +243,7 @@ end) player.zoom_to_world(position, 1.5) end) - +local update_wrap_buttons --- Default state for the warp icon, when pressed teleports the player -- @element warp_icon_button warp_icon_button = @@ -269,8 +266,8 @@ end) -- Reset the warp cooldown if the player does not have unlimited warps if not check_player_permissions(player, 'bypass_warp_cooldown') then - Store.set(player_warp_cooldown_store, player, config.cooldown_duraction) - Store.trigger(player_in_range_store, player) + PlayerCooldown:set(player, config.cooldown_duration) + update_wrap_buttons(player) end end) @@ -293,15 +290,43 @@ end) local warp_timer = Gui.element{ type = 'progressbar', - tooltip = {'warp-list.timer-tooltip', config.cooldown_duraction}, + tooltip = {'warp-list.timer-tooltip', config.cooldown_duration}, minimum_value = 0, - maximum_value = config.cooldown_duraction*config.update_smoothing + maximum_value = config.cooldown_duration*config.update_smoothing } :style{ horizontally_stretchable = true, color = Colors.light_blue } +local warp_list_container +--- Update the warp buttons for a player +function update_wrap_buttons(player, timer, in_range) + -- Get the warp table + local frame = Gui.get_left_element(player, warp_list_container) + local scroll_table = frame.container.scroll.table + + -- Check if the buttons should be active + timer = timer or PlayerCooldown:get(player) + in_range = in_range or PlayerInRange:get(player) + local button_disabled = timer > 0 or not in_range + + -- Change the enabled state of the warp buttons + local warp_ids = Warps.get_force_warp_ids(player.force.name) + for _, warp_id in pairs(warp_ids) do + local element = scroll_table['icon-'..warp_id][warp_icon_button.name] + if element and element.valid then + element.enabled = not button_disabled + if button_disabled then + element.tooltip = {'warp-list.goto-disabled'} + else + local position = Warps.get_warp(warp_id).position + element.tooltip = {'warp-list.goto-tooltip', position.x, position.y} + end + end + end +end + --- Updates a warp for a player local function update_warp(player, warp_table, warp_id) local warp = Warps.get_warp(warp_id) @@ -358,10 +383,10 @@ local function update_warp(player, warp_table, warp_id) icon_flow.clear() local warp_icon_element = warp_icon_button(icon_flow, warp) - local timer = Store.get(player_warp_cooldown_store, player) - local in_range = Store.get(player_in_range_store, player) + local timer = PlayerCooldown:get(player) + local in_range = PlayerInRange:get(player) local apply_proximity = not check_player_permissions(player, 'bypass_warp_proximity') - if (timer and timer > 0) or (apply_proximity and not in_range) then + if timer > 0 or (apply_proximity and not in_range) then warp_icon_element.enabled = false warp_icon_element.tooltip = {'warp-list.goto-disabled'} end @@ -381,7 +406,20 @@ end -- Update all the warps for a player local function update_all_warps(player, warp_table) local warp_ids = Warps.get_force_warp_ids(player.force.name) - if #warp_ids > 0 then + warp_table.clear() + for _, warp_id in ipairs(warp_ids) do + update_warp(player, warp_table, warp_id) + end +end + +-- Update all warps for all players on a force +local function update_all_wrap_force(force) + local warp_ids = Warps.get_force_warp_ids(force.name) + for _, player in pairs(force.connected_players) do + local frame = Gui.get_left_element(player, warp_list_container) + local warp_table = frame.container.scroll.table + + warp_table.clear() for _, warp_id in ipairs(warp_ids) do update_warp(player, warp_table, warp_id) end @@ -390,7 +428,7 @@ end --- Main warp list container for the left flow -- @element warp_list_container -local warp_list_container = +warp_list_container = Gui.element(function(event_trigger, parent) -- Draw the internal container local container = Gui.container(parent, event_trigger, 200) @@ -399,7 +437,7 @@ Gui.element(function(event_trigger, parent) local header = Gui.header( container, {'warp-list.main-caption'}, - {'warp-list.sub-tooltip', config.cooldown_duraction, config.standard_proximity_radius}, + {'warp-list.sub-tooltip', config.cooldown_duration, config.standard_proximity_radius}, true ) @@ -421,16 +459,16 @@ Gui.element(function(event_trigger, parent) -- Change the progress of the warp timer local progress = 1 - local timer = Store.get(player_warp_cooldown_store, player) - if timer and timer > 0 then - progress = 1 - (timer/config.cooldown_duraction) + local timer = PlayerCooldown:get(player) + if timer > 0 then + progress = 1 - (timer/config.cooldown_duration) end warp_timer_element.value = progress -- Add any existing warps update_all_warps(player, scroll_table) - -- Return the exteral container + -- Return the external container return container.parent end) :add_to_left_flow() @@ -446,26 +484,140 @@ end) end) --- When the name of a warp is updated this is triggered -Warps.on_update(function(warp, _,removed_warp) +Warps.on_update(function(_, warp, old_warp) -- Get the force to update, warp is nil when removed - local force if warp then - force = game.forces[warp.force_name] + update_all_wrap_force(game.forces[warp.force_name]) else - force = game.forces[removed_warp.force_name] + update_all_wrap_force(game.forces[old_warp.force_name]) + end +end) + +--- When the player leaves or enters range of a warp this is triggered +PlayerInRange:on_update(function(player_name, player_in_range) + local player = game.players[player_name] + + -- Change if the frame is visible based on if the player is in range + if not keep_gui_open[player.name] then + Gui.toggle_left_element(player, warp_list_container, player_in_range) end - -- Update the gui for selected players - local warp_ids = Warps.get_force_warp_ids(force.name) - for _, player in pairs(force.connected_players) do - local frame = Gui.get_left_element(player, warp_list_container) - local scroll_table = frame.container.scroll.table + -- Check if the player requires proximity + if not check_player_permissions(player, 'bypass_warp_proximity') then + update_wrap_buttons(player, nil, player_in_range) + end +end) - -- Update the gui - scroll_table.clear() - for _, next_warp_id in ipairs(warp_ids) do - update_warp(player, scroll_table, next_warp_id) +--- Update the warp cooldown progress bars to match the current cooldown +PlayerCooldown:on_update(function(player_name, player_cooldown) + -- Get the progress bar element + local player = game.players[player_name] + local frame = Gui.get_left_element(player, warp_list_container) + local warp_timer_element = frame.container[warp_timer.name] + + -- Set the progress + local progress = 1 + if player_cooldown and player_cooldown > 0 then + progress = 1 - (player_cooldown/config.cooldown_duration) + end + warp_timer_element.value = progress + + -- Trigger update of buttons if cooldown is now 0 + if player_cooldown == 0 then + update_wrap_buttons(player, player_cooldown, nil) + end +end) + +--- Handles updating the timer and checking distance from a warp +local r2 = config.standard_proximity_radius^2 +local rs2 = config.spawn_proximity_radius^2 +local mr2 = config.minimum_distance^2 +Event.on_nth_tick(math.floor(60/config.update_smoothing), function() + PlayerCooldown:update_all(function(_, player_cooldown) + if player_cooldown > 0 then return player_cooldown - 1 end + end) + + local force_warps = {} + local warps = {} + for _, player in pairs(game.connected_players) do + local was_in_range = PlayerInRange:get(player) + + -- Get the ids of all the warps on the players force + local force_name = player.force.name + local warp_ids = force_warps[force_name] + if not warp_ids then + warp_ids = Warps.get_force_warp_ids(force_name) + force_warps[force_name] = warp_ids end + + -- Check if the force has any warps + local closest_warp + local closest_distance + if #warp_ids > 0 then + local surface = player.surface + local pos = player.position + local px, py = pos.x, pos.y + + -- Loop over each warp + for _, warp_id in ipairs(warp_ids) do + -- Check if warp id is cached + local warp = warps[warp_id] + if not warp then + warp = Warps.get_warp(warp_id) + warps[warp_id] = warp + end + + -- Check if the player is within range + local warp_pos = warp.position + if warp.surface == surface then + local dx, dy = px-warp_pos.x, py-warp_pos.y + local dist = (dx*dx)+(dy*dy) + if closest_distance == nil or dist < closest_distance then + closest_warp = warp + closest_distance = dist + if dist < r2 then break end + end + end + end + + -- Check the dist to the closest warp + local in_range = closest_warp.warp_id == warp_ids.spawn and closest_distance < rs2 or closest_distance < r2 + if was_in_range and not in_range then + PlayerInRange:set(player, false) + elseif not was_in_range and in_range then + PlayerInRange:set(player, true) + end + + -- Change the enabled state of the add warp button + local frame = Gui.get_left_element(player, warp_list_container) + local add_warp_element = frame.container.header.alignment[add_new_warp.name] + local was_able_to_make_warp = add_warp_element.enabled + local can_make_warp = closest_distance > mr2 + if can_make_warp and not was_able_to_make_warp then + add_warp_element.enabled = true + add_warp_element.tooltip = {'warp-list.add-tooltip'} + elseif not can_make_warp and was_able_to_make_warp then + add_warp_element.enabled = false + add_warp_element.tooltip = {'warp-list.too-close', closest_warp.name} + end + + end + + end + +end) + +--- When a player is created make sure that there is a spawn warp created +Event.add(defines.events.on_player_created, function(event) + -- If the force has no spawn then make a spawn warp + local player = game.players[event.player_index] + local force = player.force + local spawn_id = Warps.get_spawn_warp_id(force.name) + if not spawn_id then + local spawn_position = force.get_spawn_position(player.surface) + spawn_id = Warps.add_warp(force.name, player.surface, spawn_position, nil, 'Spawn') + Warps.set_spawn_warp(spawn_id, force) + Warps.make_warp_tag(spawn_id) end end) @@ -494,163 +646,6 @@ end Event.add(Roles.events.on_role_assigned, role_update_event) Event.add(Roles.events.on_role_unassigned, role_update_event) ---- When the player leaves or enters range of a warp this is triggered -Store.watch(player_in_range_store, function(value, player_name) - local player = game.players[player_name] - local force = player.force - - -- Change if the frame is visible based on if the player is in range - if not keep_gui_open[player.name] then - Gui.toggle_left_element(player, warp_list_container, value) - end - - -- Check if the player requires proximity - if check_player_permissions(player, 'bypass_warp_proximity') then - return - end - - -- Get the warp table - local frame = Gui.get_left_element(player, warp_list_container) - local scroll_table = frame.container.scroll.table - - -- Check if the buttons should be active - local timer = Store.get(player_warp_cooldown_store, player) - local button_disabled = timer and timer > 0 or not value - - -- Change the enabled state of the warp buttons - local warp_ids = Warps.get_force_warp_ids(force.name) - for _, warp_id in pairs(warp_ids) do - local element = scroll_table['icon-'..warp_id][warp_icon_button.name] - if element and element.valid then - element.enabled = not button_disabled - if button_disabled then - element.tooltip = {'warp-list.goto-disabled'} - else - local position = Warps.get_warp(warp_id).position - element.tooltip = {'warp-list.goto-tooltip', position.x, position.y} - end - end - end -end) - ---- Update the warp cooldown progress bars to match the store -Store.watch(player_warp_cooldown_store, function(value, player_name, old_value) - if value == old_value then return end - -- Get the progress bar element - local player = game.players[player_name] - local frame = Gui.get_left_element(player, warp_list_container) - local warp_timer_element = frame.container[warp_timer.name] - - -- Set the progress - local progress = 1 - local timer = Store.get(player_warp_cooldown_store, player) - if timer and timer > 0 then - progress = 1 - (timer/config.cooldown_duraction) - end - warp_timer_element.value = progress - - -- Trigger update of buttons if cooldown is now 0 - if value == 0 then - Store.trigger(player_in_range_store, player_name) - end -end) - ---- Handles updating the timer and checking distance from a warp -local r2 = config.standard_proximity_radius^2 -local rs2 = config.spawn_proximity_radius^2 -local mr2 = config.minimum_distance^2 -Event.on_nth_tick(math.floor(60/config.update_smoothing), function() - Store.map(player_warp_cooldown_store, function(value) - if value > 0 then - return value - 1 - end - end) - - local force_warps = {} - local warps = {} - for _, player in pairs(game.connected_players) do - local was_in_range = Store.get(player_in_range_store, player) - - -- Get the ids of all the warps on the players force - local force_name = player.force.name - local warp_ids = force_warps[force_name] - if not warp_ids then - warp_ids = Warps.get_force_warp_ids(force_name) - force_warps[force_name] = warp_ids - end - - -- Check if the force has any warps - local closest_warp - local closest_distance - if #warp_ids > 0 then - local surface = player.surface - local pos = player.position - local px, py = pos.x, pos.y - - -- Loop over each warp - for _, warp_id in ipairs(warp_ids) do - -- Check if warp id is chached - local warp = warps[warp_id] - if not warp then - warp = Warps.get_warp(warp_id) - warps[warp_id] = warp - end - - -- Check if the player is within range - local warp_pos = warp.position - if warp.surface == surface then - local dx, dy = px-warp_pos.x, py-warp_pos.y - local dist = (dx*dx)+(dy*dy) - if closest_distance == nil or dist < closest_distance then - closest_warp = warp - closest_distance = dist - if dist < r2 then break end - end - end - end - - -- Check the dist to the closest warp - local in_range = closest_warp.warp_id == warp_ids.spawn and closest_distance < rs2 or closest_distance < r2 - if was_in_range and not in_range then - Store.set(player_in_range_store, player, false) - elseif not was_in_range and in_range then - Store.set(player_in_range_store, player, true) - end - - -- Change the enabled state of the add warp button - local frame = Gui.get_left_element(player, warp_list_container) - local add_warp_element = frame.container.header.alignment[add_new_warp.name] - local was_able_to_make_warp = add_warp_element.enabled - local can_make_warp = closest_distance > mr2 - if can_make_warp and not was_able_to_make_warp then - add_warp_element.enabled = true - add_warp_element.tooltip = {'warp-list.add-tooltip'} - elseif not can_make_warp and was_able_to_make_warp then - add_warp_element.enabled = false - add_warp_element.tooltip = {'warp-list.too-close', closest_warp.name} - end - - end - - end - -end) - ---- When a player is created make sure that there is a spawn warp created -Event.add(defines.events.on_player_created, function(event) - -- If the force has no spawn then make a spawn warp - local player = Game.get_player_by_index(event.player_index) - local force = player.force - local spawn_id = Warps.get_spawn_warp_id(force.name) - if not spawn_id then - local spawn_position = force.get_spawn_position(player.surface) - spawn_id = Warps.add_warp(force.name, player.surface, spawn_position, nil, 'Spawn') - Warps.set_spawn_warp(spawn_id, force) - Store.trigger(Warps.store, spawn_id) - Warps.make_warp_tag(spawn_id) - end -end) - --- When a chart tag is removed or edited make sure it is not one that belongs to a warp local function maintain_tag(event) if not event.player_index then return end @@ -659,8 +654,8 @@ local function maintain_tag(event) local warp_ids = Warps.get_force_warp_ids(force_name) for _, warp_id in pairs(warp_ids) do local warp = Warps.get_warp(warp_id) - local wtag = warp.tag - if not wtag or not wtag.valid or wtag == tag then + local warp_tag = warp.tag + if not warp_tag or not warp_tag.valid or warp_tag == tag then if event.name == defines.events.on_chart_tag_removed then warp.tag = nil end From 4a31011a2649b57530fc45f5b45e2a9937023724 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 23:02:59 +0100 Subject: [PATCH 056/106] Updated Tasks --- expcore/datastore.lua | 2 +- modules/control/tasks.lua | 38 +++++++++++++++++++------------------- modules/control/warps.lua | 2 +- modules/gui/task-list.lua | 10 +++++----- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/expcore/datastore.lua b/expcore/datastore.lua index 0a471b07..f0d5baa9 100644 --- a/expcore/datastore.lua +++ b/expcore/datastore.lua @@ -559,7 +559,7 @@ function Datastore:remove(key) key = self:serialize(key) local old_value = self:raw_get(key) self:raw_set(key) - self:raise_event('on_update', key, old_value) + self:raise_event('on_update', key, nil, old_value) if self.save_to_disk then self:write_action('remove', key) end if self.parent and self.parent.auto_save then return self.parent:save(key) end end diff --git a/modules/control/tasks.lua b/modules/control/tasks.lua index 0e8fb941..ec0f8c38 100644 --- a/modules/control/tasks.lua +++ b/modules/control/tasks.lua @@ -10,22 +10,21 @@ Tasks.update_task(task_id, 'We need more iron!', game.player.name) ]] -local Store = require 'expcore.store' --- @dep expcore.store +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Global = require 'utils.global' --- @dep utils.global -local Token = require 'utils.token' --- @dep utils.token + +--- Stores all data for the warp gui +local TaskData = Datastore.connect('TaskData') +TaskData:set_serializer(function(raw_key) return raw_key.task_id end) local Tasks = {} -- Global lookup table for force name to task ids -local force_tasks = {} +local force_tasks = {_uid=1} Global.register(force_tasks, function(tbl) force_tasks = tbl end) --- Task store is keyed by task id, value is a table -local task_store = Store.register() -Tasks.store = task_store - --- Setters. -- functions used to created and alter tasks -- @section setters @@ -43,8 +42,9 @@ local task_id = Tasks.add_task(game.player.force.name, nil, game.player.name) ]] function Tasks.add_task(force_name, task_number, player_name, task_message) -- Get a new task id - local task_id = tostring(Token.uid()) + local task_id = tostring(force_tasks._uid) task_message = task_message or 'New Task' + force_tasks._uid = force_tasks._uid + 1 -- Get the existing tasks for this force local tasks = force_tasks[force_name] @@ -67,13 +67,13 @@ function Tasks.add_task(force_name, task_number, player_name, task_message) end -- Add the new task to the store - Store.set(task_store, task_id, { + TaskData:set(task_id, { task_id = task_id, force_name = force_name, message = task_message, last_edit_name = player_name or '', last_edit_time = game.tick, - curently_editing = editing + currently_editing = editing }) return task_id @@ -87,10 +87,10 @@ Tasks.remove_task(task_id) ]] function Tasks.remove_task(task_id) - local task = Store.get(task_store, task_id) + local task = TaskData:get(task_id) local force_name = task.force_name table.remove_element(force_tasks[force_name], task_id) - Store.clear(task_store, task_id) + TaskData:remove(task_id) end --[[-- Update the message and last edited information for a task @@ -103,7 +103,7 @@ Task.update_task(task_id, 'We need more iron!', game.player.name) ]] function Tasks.update_task(task_id, new_message, player_name) - Store.update(task_store, task_id, function(task) + TaskData:update(task_id, function(_, task) task.last_edit_name = player_name or '' task.last_edit_time = game.tick task.message = new_message @@ -120,8 +120,8 @@ Tasks.set_editing(task_id, game.player.name, true) ]] function Tasks.set_editing(task_id, player_name, state) - Store.update(task_store, task_id, function(task) - task.curently_editing[player_name] = state + TaskData:update(task_id, function(_, task) + task.currently_editing[player_name] = state end) end @@ -135,7 +135,7 @@ end) ]] function Tasks.on_update(handler) - Store.watch(task_store, handler) + TaskData:on_update(handler) end --- Getters. @@ -151,7 +151,7 @@ local task = Tasks.get_task(task_id) ]] function Tasks.get_task(task_id) - return Store.get(task_store, task_id) + return TaskData:get(task_id) end --[[-- Gets all the task ids that a force has @@ -176,8 +176,8 @@ local editing = Tasks.get_editing(task_id, game.player.name) ]] function Tasks.get_editing(task_id, player_name) - local task = Store.get(task_store, task_id) - return task.curently_editing[player_name] + local task = TaskData:get(task_id) + return task.currently_editing[player_name] end -- Module Return diff --git a/modules/control/warps.lua b/modules/control/warps.lua index a61e80d4..07be1b0f 100644 --- a/modules/control/warps.lua +++ b/modules/control/warps.lua @@ -25,7 +25,7 @@ local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Global = require 'utils.global' --- @dep utils.global local config = require 'config.gui.warps' --- @dep config.warps ---- Stores all data for the warp gui +--- Stores all data for the warp system local WrapData = Datastore.connect('WrapData') WrapData:set_serializer(function(raw_key) return raw_key.warp_id end) diff --git a/modules/gui/task-list.lua b/modules/gui/task-list.lua index bdc57818..a83b3aa5 100644 --- a/modules/gui/task-list.lua +++ b/modules/gui/task-list.lua @@ -240,7 +240,7 @@ local function update_task(player, task_table, task_id) -- Update the edit flow local edit_flow = task_table['edit-'..task_id] local player_allowed_edit = check_player_permissions(player, task) - local players_editing = table.get_keys(task.curently_editing) + local players_editing = table.get_keys(task.currently_editing) local edit_task_element = edit_flow[edit_task.name] local discard_task_element = edit_flow[discard_task.name] @@ -257,7 +257,7 @@ local function update_task(player, task_table, task_id) -- Check if the player is was editing and/or currently editing local task_entry = task_flow[task_editing.name] or task_label(task_flow, task) local player_was_editing = task_entry.type == 'textfield' - local player_is_editing = task.curently_editing[player.name] + local player_is_editing = task.currently_editing[player.name] -- Update the task flow if not player_was_editing and not player_is_editing then @@ -361,14 +361,14 @@ Gui.left_toolbar_button('utility/not_enough_repair_packs_icon', {'task-list.main return Roles.player_allowed(player, 'gui/task-list') end) ---- When a new task is added it will udpate the task list for everyone on that force -Tasks.on_update(function(task, task_id, removed_task) +--- When a new task is added it will update the task list for everyone on that force +Tasks.on_update(function(task_id, task, old_task) -- Get the force to update, task is nil when removed local force if task then force = game.forces[task.force_name] else - force = game.forces[removed_task.force_name] + force = game.forces[old_task.force_name] end -- Update the task for all the players on the force From 54987bd8f1e12df17ecdd622b17627ac80703036 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 23:12:00 +0100 Subject: [PATCH 057/106] Updated Player List --- config/gui/player_list_actions.lua | 27 +++-- modules/commands/interface.lua | 1 - modules/gui/debug/expcore_store_view.lua | 128 ----------------------- modules/gui/debug/main_view.lua | 1 - modules/gui/player-list.lua | 68 ++++++------ 5 files changed, 44 insertions(+), 181 deletions(-) delete mode 100644 modules/gui/debug/expcore_store_view.lua diff --git a/config/gui/player_list_actions.lua b/config/gui/player_list_actions.lua index 1bd19bbf..611cd0f0 100644 --- a/config/gui/player_list_actions.lua +++ b/config/gui/player_list_actions.lua @@ -7,7 +7,6 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles -local Store = require 'expcore.store' --- @dep expcore.store local Game = require 'utils.game' --- @dep utils.game local Reports = require 'modules.control.reports' --- @dep modules.control.reports local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings @@ -15,11 +14,9 @@ local Jail = require 'modules.control.jail' --- @dep modules.control.jail local Colors = require 'utils.color_presets' --- @dep utils.color_presets local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common -local selected_player_store = '' -local selected_action_store = '' -local function set_store_uids(player,action) - selected_player_store = player - selected_action_store = action +local SelectedPlayer, SelectedAction +local function set_datastores(player, action) + SelectedPlayer, SelectedAction = player, action end -- auth that will only allow when on player's of lower roles @@ -33,13 +30,13 @@ end -- gets the action player and a coloured name for the action to be used on local function get_action_player_name(player) - local selected_player_name = Store.get(selected_player_store,player) + local selected_player_name = SelectedPlayer:get(player) local selected_player = Game.get_player_from_any(selected_player_name) local selected_player_color = format_chat_player_name(selected_player) return selected_player_name, selected_player_color end --- telports one player to another +-- teleports one player to another local function teleport(from_player,to_player) local surface = to_player.surface local position = surface.find_non_colliding_position('character',to_player.position,32,1) @@ -109,7 +106,7 @@ local report_player = new_button('utility/spawn_flag',{'player-list.report-playe if Reports.is_reported(selected_player_name,player.name) then player.print({'expcom-report.already-reported'},Colors.orange_red) else - Store.set(selected_action_store,player,'command/report') + SelectedAction:set(player, 'command/report') end end) @@ -125,7 +122,7 @@ end -- @element warn_player local warn_player = new_button('utility/spawn_flag',{'player-list.warn-player'}) :on_click(function(player) - Store.set(selected_action_store,player,'command/give-warning') + SelectedAction:set(player, 'command/give-warning') end) local function warn_player_callback(player,reason) @@ -143,7 +140,7 @@ local jail_player = new_button('utility/multiplayer_waiting_icon',{'player-list. if Jail.is_jailed(selected_player_name) then player.print({'expcom-jail.already-jailed', selected_player_color},Colors.orange_red) else - Store.set(selected_action_store,player,'command/jail') + SelectedAction:set(player, 'command/jail') end end) @@ -162,7 +159,7 @@ local temp_ban_player = new_button('utility/warning_white',{'player-list.temp-ba if Jail.is_jailed(selected_player_name) then player.print({'expcom-jail.already-banned', selected_player_color},Colors.orange_red) else - Store.set(selected_action_store,player,'command/temp-ban') + SelectedAction:set(player, 'command/temp-ban') end end) @@ -177,7 +174,7 @@ end -- @element kick_player local kick_player = new_button('utility/warning_icon',{'player-list.kick-player'}) :on_click(function(player) - Store.set(selected_action_store,player,'command/kick') + SelectedAction:set(player, 'command/kick') end) local function kick_player_callback(player,reason) @@ -189,7 +186,7 @@ end -- @element ban_player local ban_player = new_button('utility/danger_icon',{'player-list.ban-player'}) :on_click(function(player) - Store.set(selected_action_store,player,'command/ban') + SelectedAction:set(player, 'command/ban') end) local function ban_player_callback(player,reason) @@ -198,7 +195,7 @@ local function ban_player_callback(player,reason) end return { - set_store_uids = set_store_uids, + set_datastores = set_datastores, buttons = { ['command/teleport'] = { auth=function(player,selected_player) diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index c6291970..9b73be17 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -15,7 +15,6 @@ local interface_modules = { ['output']=Common.player_return, ['Group']='expcore.permission_groups', ['Roles']='expcore.roles', - ['Store']='expcore.store', ['Gui']='expcore.gui', ['Async']='expcore.async', ['Datastore']='expcore.datastore' diff --git a/modules/gui/debug/expcore_store_view.lua b/modules/gui/debug/expcore_store_view.lua deleted file mode 100644 index 36ab8027..00000000 --- a/modules/gui/debug/expcore_store_view.lua +++ /dev/null @@ -1,128 +0,0 @@ -local Gui = require 'utils.gui' --- @dep utils.gui -local Store = require 'expcore.store' --- @dep utils.global -local Color = require 'utils.color_presets' --- @dep utils.color_presets -local Model = require 'modules.gui.debug.model' --- @dep modules.gui.debug.model - -local dump = Model.dump -local dump_text = Model.dump_text -local concat = table.concat - -local Public = {} - -local header_name = Gui.uid_name() -local left_panel_name = Gui.uid_name() -local right_panel_name = Gui.uid_name() -local input_text_box_name = Gui.uid_name() -local refresh_name = Gui.uid_name() - -Public.name = 'Store' - -function Public.show(container) - local main_flow = container.add {type = 'flow', direction = 'horizontal'} - - local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name} - local left_panel_style = left_panel.style - left_panel_style.width = 300 - - for store_id, file_path in pairs(Store.file_paths) do - local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = store_id..' - '..file_path} - Gui.set_data(header, store_id) - end - - local right_flow = main_flow.add {type = 'flow', direction = 'vertical'} - - local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'} - - local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name} - local input_text_box_style = input_text_box.style - input_text_box_style.horizontally_stretchable = true - input_text_box_style.height = 32 - input_text_box_style.maximal_width = 1000 - - local refresh_button = - right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'} - local refresh_button_style = refresh_button.style - refresh_button_style.width = 32 - refresh_button_style.height = 32 - - local right_panel = right_flow.add {type = 'text-box', name = right_panel_name} - right_panel.read_only = true - right_panel.selectable = true - - local right_panel_style = right_panel.style - right_panel_style.vertically_stretchable = true - right_panel_style.horizontally_stretchable = true - right_panel_style.maximal_width = 1000 - right_panel_style.maximal_height = 1000 - - local data = { - right_panel = right_panel, - input_text_box = input_text_box, - selected_header = nil - } - - Gui.set_data(input_text_box, data) - Gui.set_data(left_panel, data) - Gui.set_data(refresh_button, data) -end - -Gui.on_click( - header_name, - function(event) - local element = event.element - local store_id = Gui.get_data(element) - - local left_panel = element.parent.parent - local data = Gui.get_data(left_panel) - local right_panel = data.right_panel - local selected_header = data.selected_header - local input_text_box = data.input_text_box - - if selected_header then - selected_header.style.font_color = Color.white - end - - element.style.font_color = Color.orange - data.selected_header = element - - input_text_box.text = concat {'global.data_store[', store_id, ']'} - input_text_box.style.font_color = Color.black - - local content = dump(Store.get(store_id)) or 'nil' - right_panel.text = content - end -) - -local function update_dump(text_input, data, player) - local suc, ouput = dump_text(text_input.text, player) - if not suc then - text_input.style.font_color = Color.red - else - text_input.style.font_color = Color.black - data.right_panel.text = ouput - end -end - -Gui.on_text_changed( - input_text_box_name, - function(event) - local element = event.element - local data = Gui.get_data(element) - - update_dump(element, data, event.player) - end -) - -Gui.on_click( - refresh_name, - function(event) - local element = event.element - local data = Gui.get_data(element) - - local input_text_box = data.input_text_box - - update_dump(input_text_box, data, event.player) - end -) - -return Public diff --git a/modules/gui/debug/main_view.lua b/modules/gui/debug/main_view.lua index bdc93f43..6fef9c16 100644 --- a/modules/gui/debug/main_view.lua +++ b/modules/gui/debug/main_view.lua @@ -6,7 +6,6 @@ local Public = {} local pages = { require 'modules.gui.debug.redmew_global_view', require 'modules.gui.debug.expcore_datastore_view', - require 'modules.gui.debug.expcore_store_view', require 'modules.gui.debug.expcore_gui_view', require 'modules.gui.debug.global_view', require 'modules.gui.debug.package_view', diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 497c6793..83c37431 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -7,25 +7,21 @@ -- luacheck:ignore 211/Colors local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles -local Store = require 'expcore.store' --- @dep expcore.store +local Datastore = require 'expcore.datastore' --- @dep expcore.datastore local Game = require 'utils.game' --- @dep utils.game local Event = require 'utils.event' --- @dep utils.event local config = require 'config.gui.player_list_actions' --- @dep config.gui.player_list_actions local Colors = require 'utils.color_presets' --- @dep utils.color_presets local format_time = _C.format_time --- @dep expcore.common --- Stores the name of the player a player has selected -local selected_player_store = Store.register(function(player) - return player.name -end) - --- Stores the current action that a player wants to do -local selected_action_store = Store.register(function(player) - return player.name -end) +--- Stores all data for the warp gui +local PlayerListData = Datastore.connect('PlayerListData') +PlayerListData:set_serializer(Datastore.name_serializer) +local SelectedPlayer = PlayerListData:combine('SelectedPlayer') +local SelectedAction = PlayerListData:combine('SelectedAction') -- Set the config to use these stores -config.set_store_uids(selected_player_store, selected_action_store) +config.set_datastores(SelectedPlayer, SelectedAction) --- Button used to open the action bar -- @element open_action_bar @@ -43,11 +39,11 @@ Gui.element{ } :on_click(function(player, element, _) local selected_player_name = element.parent.name - local old_selected_player_name = Store.get(selected_player_store, player) + local old_selected_player_name = SelectedPlayer:get(player) if selected_player_name == old_selected_player_name then - Store.clear(selected_player_store, player) + SelectedPlayer:remove(player) else - Store.set(selected_player_store, player, selected_player_name) + SelectedPlayer:set(player, selected_player_name) end end) @@ -62,8 +58,8 @@ Gui.element{ } :style(Gui.sprite_style(30, -1, { top_margin = -1, right_margin = -1 })) :on_click(function(player, _) - Store.clear(selected_player_store, player) - Store.clear(selected_action_store, player) + SelectedPlayer:remove(player) + SelectedAction:remove(player) end) --- Button used to confirm a reason @@ -78,11 +74,11 @@ Gui.element{ :style(Gui.sprite_style(30, -1, { left_margin = -2, right_margin = -1 })) :on_click(function(player, element) local reason = element.parent.entry.text or 'Non Given' - local action_name = Store.get(selected_action_store, player) + local action_name = SelectedAction:get(player) local reason_callback = config.buttons[action_name].reason_callback reason_callback(player, reason) - Store.clear(selected_player_store, player) - Store.clear(selected_action_store, player) + SelectedPlayer:remove(player) + SelectedAction:remove(player) element.parent.entry.text = '' end) @@ -126,12 +122,12 @@ end) event.player.zoom_to_world(position, 1.75) else -- RMB will toggle the settings - local old_selected_player_name = Store.get(selected_player_store, player) + local old_selected_player_name = SelectedPlayer:get(player) if selected_player_name == old_selected_player_name then - Store.clear(selected_player_store, player) - Store.clear(selected_action_store, player) + SelectedPlayer:remove(player) + SelectedAction:remove(player) else - Store.set(selected_player_store, player, selected_player_name) + SelectedPlayer:set(player, selected_player_name) end end end) @@ -174,7 +170,7 @@ end) --- Updates the visible state of the action bar buttons local function update_action_bar(element) local player = Gui.get_player_from_element(element) - local selected_player_name = Store.get(selected_player_store, player) + local selected_player_name = SelectedPlayer:get(player) if not selected_player_name then -- Hide the action bar when no player is selected @@ -185,8 +181,8 @@ local function update_action_bar(element) if not selected_player.connected then -- If the player is offline then reest stores element.visible = false - Store.clear(selected_player_store, player) - Store.clear(selected_action_store, player) + SelectedPlayer:remove(player) + SelectedAction:remove(player) else -- Otherwise check what actions the player is allowed to use @@ -367,10 +363,10 @@ Event.add(defines.events.on_player_left_game, function(event) local scroll_table = frame.container.scroll.table remove_player_base(scroll_table, remove_player) - local selected_player_name = Store.get(selected_player_store, player) + local selected_player_name = SelectedPlayer:get(player) if selected_player_name == remove_player.name then - Store.clear(selected_player_store, player) - Store.clear(selected_action_store, player) + SelectedPlayer:remove(player) + SelectedAction:remove(player) end end end) @@ -393,7 +389,7 @@ Event.add(Roles.events.on_role_assigned, redraw_player_list) Event.add(Roles.events.on_role_unassigned, redraw_player_list) --- When the action player is changed the action bar will update -Store.watch(selected_player_store, function(value, player_name) +SelectedPlayer:on_update(function(player_name, selected_player) local player = Game.get_player_from_any(player_name) local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table @@ -401,7 +397,7 @@ Store.watch(selected_player_store, function(value, player_name) for _, next_player in pairs(game.connected_players) do local element = scroll_table[next_player.name][open_action_bar.name] local style = 'frame_button' - if next_player.name == value then + if next_player.name == selected_player then style = 'tool_button' end element.style = style @@ -413,20 +409,20 @@ Store.watch(selected_player_store, function(value, player_name) end) --- When the action name is changed the reason input will update -Store.watch(selected_action_store, function(value, player_name) +SelectedAction:on_update(function(player_name, selected_action) local player = Game.get_player_from_any(player_name) local frame = Gui.get_left_element(player, player_list_container) local element = frame.container.reason_bar - if value then + if selected_action then -- if there is a new value then check the player is still online - local selected_player_name = Store.get(selected_player_store, player_name) + local selected_player_name = SelectedPlayer:get(player_name) local selected_player = Game.get_player_from_any(selected_player_name) if selected_player.connected then element.visible = true else -- Clear if the player is offline - Store.clear(selected_player_store, player_name) - Store.clear(selected_action_store, player_name) + SelectedPlayer:remove(player) + SelectedAction:remove(player) end else From 8ff06ece1f37dad4114403ffe9a39e97ad7b241c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 23:12:55 +0100 Subject: [PATCH 058/106] Removed Store From Core --- expcore/store.lua | 523 ------------------------------------ modules/data/statistics.lua | 2 +- 2 files changed, 1 insertion(+), 524 deletions(-) delete mode 100644 expcore/store.lua diff --git a/expcore/store.lua b/expcore/store.lua deleted file mode 100644 index c6353d64..00000000 --- a/expcore/store.lua +++ /dev/null @@ -1,523 +0,0 @@ ---[[-- Core Module - Store -- Used to store and watch for updates for values in the global table -@core Store -@alias Store - -@usage-- Require the module and add a store with no keys --- Store with no keys does not need a serializer -local Store = require 'expcore.store' --- @dep expcore.store -local scenario_diffculty = Store.register() - --- When the store is changed this function will trigger -Store.watch(scenario_diffculty, function(value) - game.print('The scenario diffculty has been set to '..value) -end) - -Store.set(scenario_diffculty, 'hard') -- Set the value stored to 'hard' -Store.get(scenario_diffculty) -- Returns 'hard' -Store.update(scenario_diffculty, function(value) -- Will set value to 'normal' if no value is present - return not value and 'normal' -end) - -@usage-- Require the module and add a store with keys --- Store with keys does not require a serializer but it can be helpful -local Store = require 'expcore.store' --- @dep expcore.store -local player_scores = Store.register(function(player) -- Use player name as the key - return player.name -end) - --- When any key in the store is changed this function will trigger -Store.watch(player_scores, function(value, key, old_value) - game.print(key..' now has a score of '..value) -end) - -Store.set(player_scores, game.player, 10) -- Set your score to 10 -Store.get(scenario_diffculty, game.player) -- Returns 10 -Store.update(scenario_diffculty, game.player, function(value) -- Add 1 to your score - return value + 1 -end) - -]] - -local Event = require 'utils.event' --- @dep utils.event - -local Store = { - --- The current highest uid that is being used, will not increase during runtime - -- @field uid - uid = 0, - --- An array of the serializers that stores are using, key is store uids - -- @table serializers - serializers = {}, - --- An array of watchers that stores will trigger, key is store uids - -- @table watchers - watchers = {}, - --- An index used for debuging to find the file where different stores where registered - -- @table file_paths - file_paths = {} -} - --- All data is stored in global.data_store and is accessed here with data_store -local data_store = {} -global.data_store = data_store -Event.on_load(function() - data_store = global.data_store -end) - ---- Store Setup. --- @section setup - ---[[-- An error checking and serializing function for checking store uids and keys, note key is not required -@tparam number store the uid of the store that you want to check is valid -@tparam[opt] ?string|any key the key that you want to serialize or check is a string -@tparam[opt=1] number error_stack the position in the stack relative to the current function (1) to raise this error on -@treturn string if key is given and a serializer is registered, or key was already a string, then the key is returned - -@usage-- Registering a new store and checking that it is valid --- New store will use player names as the keys -local player_scores = Store.register(function(player) - return player.name -end) - --- player_scores is a valid store and key will be your player name -local key = Store.validate(player_scores, game.player) - -]] -function Store.validate(store, key, error_stack) - error_stack = error_stack or 1 - - if type(store) ~= 'number' then - -- Store is not a number and so if not valid - error('Store uid given is not a number; recived type '..type(store), error_stack+1) - elseif store > Store.uid then - -- Store is a number but it is out of range, ie larger than the current highest uid - error('Store uid is out of range; recived '..tostring(store), error_stack+1) - elseif key ~= nil and type(key) ~= 'string' and Store.serializers[store] == nil then - -- Key is present but is not a string and there is no serializer registered - error('Store key is not a string and no serializer has been registered; recived '..type(key), error_stack+1) - elseif key ~= nil then - -- Key is present and so it is serialized and returned - local serializer = Store.serializers[store] - if type(key) ~= 'string' then - local success, serialized_key = pcall(serializer, key) - - if not success then - -- Serializer casued an error while serializing the key - error('Store watcher casued an error:\n\t'..key, error_stack+1) - elseif type(serialized_key) ~= 'string' then - -- Serializer was successful but failed to return a string value - error('Store key serializer did not return a string; recived type '..type(key), error_stack+1) - end - - return serialized_key - end - - return key - end - -end - ---[[-- Required to create new stores and register an serializer to a store, serializer not required -@tparam[opt] function serializer the function used to convert non string keys into strings to be used in the store -@treturn number the uid for the new store that you have created, use this as the first param to all other functions - -@usage-- Creating a store with no serializer -local scenario_diffculty = Store.register() - -@usage-- Creating a store which can take LuaPlayer -local player_scores = Store.register(function(player) - return player.name -end) - -]] -function Store.register(serializer) - if _LIFECYCLE ~= _STAGE.control then - -- Only allow this function to be called during the control stage - error('Store can not be registered durring runtime', 2) - end - - -- Increment the uid counter - local uid = Store.uid + 1 - Store.uid = uid - - -- Register the serializer if given - if serializer then - Store.serializers[uid] = serializer - end - - -- Add entry in the debug table - local file_path = debug.getinfo(2, 'S').source:match('^.+/currently%-playing/(.+)$'):sub(1, -5) - Store.file_paths[uid] = file_path - - -- Return the new uid - return uid -end - ---[[-- Register a watch function to a store that is called when the value in the store is changed, triggers for any key -@tparam number store the uid of the store that you want to watch for changes to -@tparam function watcher the function that will be called when there is a change to the store - -@usage-- Printing the changed value to all players, no keys --- Register the new store, we are not using keys so we dont need a serializer -local scenario_diffculty = Store.register() - --- Register the watcher so that when we change the value the message is printed -Store.watch(scenario_diffculty, function(value) - game.print('The scenario diffculty has been set to '..value) -end) - --- Set a new value for the diffculty and see that it has printed to the game -Store.set(scenario_diffculty, 'hard') - -@usage-- Printing the changed value to all players, with keys --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_scores = Store.register(function(player) - return player.name -end) - --- Register the watcher so that when we change the value the message is printed -Store.watch(player_scores, function(value, key, old_value) - game.print(key..' now has a score of '..value) -end) - --- Set a new value for your score and see that it has printed to the game -Store.set(player_scores, game.player, 10) - -]] -function Store.watch(store, watcher) - if _LIFECYCLE ~= _STAGE.control then - -- Only allow this function to be called during the control stage - error('Store watcher can not be registered durring runtime', 2) - end - - Store.validate(store, nil, 2) - - -- Add the watchers table if it does not exist - local watchers = Store.watchers[store] - if not watchers then - watchers = {} - Store.watchers[store] = watchers - end - - -- Append the new watcher function - watchers[#watchers+1] = watcher -end - ---- Store Data Management. --- @section data - ---[[-- Used to retrive the current data that is stored, key is optional depending on if you are using them -@tparam number store the uid of the store that you want to get the value from -@tparam[opt] ?string|any key the key that you want to get the value of, must be a string unless you have a serializer -@treturn any the data that is stored - -@usage-- Getting the value of a store with no keys --- Register the new store, we are not using keys so we dont need a serializer -local scenario_diffculty = Store.register() - --- Get the current diffculty for the scenario -local diffculty = Store.get(scenario_diffculty) - -@usage-- Getting the data from a store with keys --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_scores = Store.register(function(player) - return player.name -end) - --- Get your current score -local my_score = Store.get(player_scores, game.player) - --- Get all scores -lcoal scores = Store.get(player_scores) - -]] -function Store.get(store, key) - key = Store.validate(store, key, 2) - - -- Get the data from the data store - local data = data_store[store] - if key then - if type(data) ~= 'table' then - data_store[store] = {_value = data_store[store]} - return nil - else - return data[key] - end - end - - -- Return all data if there is no key - return data -end - ---[[-- Used to clear the data in a store, will trigger any watchers, key is optional depending on if you are using them -@tparam number store the uid of the store that you want to clear -@tparam[opt] ?string|any key the key that you want to clear, must be a string unless you have a serializer - -@usage-- Clear a store which does not use keys --- Register the new store, we are not using keys so we dont need a serializer -local scenario_diffculty = Store.register() - --- Clear the scenario diffculty -Store.clear(scenario_diffculty) - -@usage-- Clear data that is in a store with keys --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_scores = Store.register(function(player) - return player.name -end) - --- Clear your score -Store.clear(player_scores, game.player) - --- Clear all scores -Store.clear(player_scores) - -]] -function Store.clear(store, key) - key = Store.validate(store, key, 2) - local old_value - - -- Check if there is a key being used - if key then - if type(data_store[store]) == 'table' then - old_value = data_store[store][key] - data_store[store][key] = nil - end - else - old_value = data_store[store] - data_store[store] = nil - end - - -- Trigger any watch functions - Store.raw_trigger(store, key, nil, old_value) -end - ---[[-- Used to set the data in a store, will trigger any watchers, key is optional depending on if you are using them -@tparam number store the uid of the store that you want to set -@tparam[opt] ?string|any key the key that you want to set, must be a string unless you have a serializer -@tparam any value the value that you want to set - -@usage-- Setting a store which does not use keys --- Register the new store, we are not using keys so we dont need a serializer -local scenario_diffculty = Store.register() - --- Set the new scenario diffculty -Store.set(scenario_diffculty, 'hard') - -@usage-- Set data in a store with keys --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_scores = Store.register(function(player) - return player.name -end) - --- Set your current score -Store.set(player_scores, game.player, 10) - --- Set all scores, note this might not have much use -Store.set(player_scores, { - [game.player.name] = 10, - ['SomeOtherPlayer'] = 0 -}) - -]] -function Store.set(store, key, value) - -- Allow for key to be optional - if value == nil then - value = key - key = nil - end - - -- Check the store is valid - key = Store.validate(store, key, 2) - local old_value - - -- If there is a key being used then the store must be a able - if key then - if type(data_store[store]) ~= 'table' then - data_store[store] = {_value = data_store[store]} - end - old_value = data_store[store][key] - data_store[store][key] = value - else - old_value = data_store[store] - data_store[store] = value - end - - -- Trigger any watchers - Store.raw_trigger(store, key, value, old_value) -end - ---[[-- Used to update the data in a store, use this with tables, will trigger any watchers, key is optional depending on if you are using them -@tparam number store the uid of the store that you want to update -@tparam[opt] ?string|any key the key that you want to update, must be a string unless you have a serializer -@tparam function updater the function which is called to make changes to the value, such as changing table keys, if a value is returned it will replace the current value in the store - -@usage-- Incrementing a global score --- Because we are only going to have one score so we will not need keys or a serializer -local game_score = Store.register() - --- Setting a default value -Store.set(game_score, 0) - --- We now will update the game score by one, we return the value so that it is set as the new value in the store -Store.update(game_score, function(value) - return value + 1 -end) - -@usage-- Updating keys in a table of data --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_data = Store.register(function(player) - return player.name -end) - --- Setting a default value for your player, used to show the table structure -Store.set(player_data, game.player, { - group = 'Admin', - role = 'Owner', - show_group_config = false -}) - --- Updating the show_group_config key in your player data, note that it would be harder to call set every time --- We do not need to return anything in this case as we are not replacing all the data -Store.update(player_data, game.player, function(data) - data.show_group_config = not data.show_group_config -end) - -]] -function Store.update(store, key, updater) - -- Allow for key to be nil - if updater == nil then - updater = key - key = nil - end - - -- Check the store is valid - key = Store.validate(store, key, 2) - local value, old_value - - -- If a key is used then the store must be a table - if key then - if type(data_store[store]) ~= 'table' then - data_store[store] = {_value = data_store[store]} - end - - -- Call the updater and if it returns a value then set this value - local rtn = updater(data_store[store][key]) - if rtn then - old_value = data_store[store][key] - data_store[store][key] = rtn - end - value = data_store[store][key] - - else - -- Call the updater and if it returns a value then set this value - local rtn = updater(data_store[store]) - if rtn then - old_value = data_store[store][key] - data_store[store] = rtn - end - value = data_store[store] - - end - - -- Trigger any watchers - Store.raw_trigger(store, key, value, old_value) -end - ---[[-- Used to update all values that are in a store, similar to Store.update but acts on all keys at once, will trigger watchers for every key present -@tparam number store the uid of the store that you want to map -@tparam function updater the function that is called on every key in this store - -@usage-- Updating keys in a table of data --- Register the new store, we are not using player names as the keys so it would be useful to accept LuaPlayer objects -local player_data = Store.register(function(player) - return player.name -end) - --- Setting a default value for your player, used to show the table structure -Store.set(player_data, game.player, { - group = 'Admin', - role = 'Owner', - show_group_config = false -}) - --- Updating the show_group_config key for all players, note that it would be harder to call set every time --- We do not need to return anything in this case as we are not replacing all the data --- We also have access to the current key being updated if needed -Store.map(player_data, function(data, key) - data.show_group_config = not data.show_group_config -end) - -]] -function Store.map(store, updater) - Store.validate(store, nil, 2) - - -- Get all that data in the store and check its a table - local data = data_store[store] - if type(data) ~= 'table' then - return - end - - -- Loop over all the keys and call the updater, setting value if returned, and calling watcher functions - for key, value in pairs(data) do - local rtn = updater(value, key) - if rtn then - data[key] = rtn - end - Store.raw_trigger(store, key, data[key], value) - end -end - ---[[-- Used to trigger watcher functions, this may be used to trigger them if you did not use Store.update or Store.set -@tparam number store the uid of the store that you want to trigger -@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer -@usage-- Faking the update to a store --- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting -local scenario_diffculty = Store.register() - --- Trigger the watchers with a fake change of diffculty -Store.trigger(scenario_diffculty) - -]] -function Store.trigger(store, key) - key = Store.validate(store, key, 2) - - -- Get the data from the data store - local data = data_store[store] - if key then - data = data[key] - Store.raw_trigger(store, key, data, data) - else - Store.raw_trigger(store, key, data, data) - end -end - ---[[-- Used to trigger watcher functions, the value and key are passed directly to the watchers regardless if the value is correct -@tparam number store the uid of the store that you want to trigger -@tparam[opt] ?string|any key the key that you want to trigger, must be a string unless you have a serializer -@tparam[opt] any value the new value that is at this key or store, passed directly to the watcher -@tparam[opt] any old_value the old value that was at this key or store often the same if value is a table, passed directly to the watcher - -@usage-- Triggering a manule call of the watchers --- The type of store we use does not really matter for this as long as you pass it what you watchers are expecting -local scenario_diffculty = Store.register() - --- Trigger the watchers with a fake change of diffculty --- This is mostly used internally but it can be useful in other cases -Store.raw_trigger(scenario_diffculty, nil, 'normal', 'normal') - -]] -function Store.raw_trigger(store, key, value, old_value) - key = Store.validate(store, key, 2) - - -- Get the watchers and then loop over them - local watchers = Store.watchers[store] or {} - for _, watcher in pairs(watchers) do - local success, err = pcall(watcher, value, key, old_value) - if not success then - error('Store watcher casued an error:\n\t'..err) - end - end -end - --- Module return -return Store \ No newline at end of file diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index fd554b8b..5aa305fa 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -89,7 +89,7 @@ if config.DamageDealt then local stat = Statistics:combine('Kills') Event.add(defines.events.on_entity_died, function(event) local character = event.cause -- Check character is valid - if not character.valid or character.type ~= 'character' then return end + if not character or not character.valid or character.type ~= 'character' then return end local player = character.player -- Check player is valid if not player.valid or not player.connected then return end local entity = event.entity -- Check entity is valid From 028dd2bc95d019bdb1b5f8f1cefde6ca24a6e3e7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 30 May 2020 22:35:44 +0000 Subject: [PATCH 059/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 3 +- docs/addons/Chat-Popups.html | 3 +- docs/addons/Chat-Reply.html | 3 +- docs/addons/Compilatron.html | 3 +- docs/addons/Damage-Popups.html | 3 +- docs/addons/Death-Logger.html | 3 +- docs/addons/Discord-Alerts.html | 3 +- docs/addons/Inventory-Clear.html | 3 +- docs/addons/Pollution-Grading.html | 3 +- docs/addons/Scorched-Earth.html | 3 +- docs/addons/Spawn-Area.html | 3 +- docs/addons/Tree-Decon.html | 3 +- docs/commands/Admin-Chat.html | 3 +- docs/commands/Cheat-Mode.html | 3 +- docs/commands/Clear-Inventory.html | 3 +- docs/commands/Debug.html | 3 +- docs/commands/Find.html | 3 +- docs/commands/Help.html | 3 +- docs/commands/Home.html | 3 +- docs/commands/Interface.html | 3 +- docs/commands/Jail.html | 3 +- docs/commands/Kill.html | 3 +- docs/commands/Me.html | 3 +- docs/commands/Rainbow.html | 3 +- docs/commands/Repair.html | 3 +- docs/commands/Reports.html | 3 +- docs/commands/Roles.html | 3 +- docs/commands/Spawn.html | 3 +- docs/commands/Teleport.html | 3 +- docs/commands/Warnings.html | 3 +- docs/configs/Advanced-Start.html | 3 +- docs/configs/Bonuses.html | 3 +- docs/configs/Chat-Reply.html | 3 +- docs/configs/Commands-Auth-Admin.html | 3 +- docs/configs/Commands-Auth-Roles.html | 3 +- .../Commands-Auth-Runtime-Disable.html | 3 +- docs/configs/Commands-Parse-Roles.html | 3 +- docs/configs/Commands-Parse.html | 3 +- docs/configs/Compilatron.html | 3 +- docs/configs/Death-Logger.html | 3 +- docs/configs/Discord-Alerts.html | 3 +- docs/configs/File-Loader.html | 3 +- docs/configs/Permission-Groups.html | 3 +- docs/configs/Player-List.html | 31 +--- docs/configs/Pollution-Grading.html | 3 +- docs/configs/Popup-Messages.html | 3 +- docs/configs/Preset-Player-Colours.html | 3 +- docs/configs/Preset-Player-Quickbar.html | 3 +- docs/configs/Repair.html | 3 +- docs/configs/Rockets.html | 3 +- docs/configs/Roles.html | 3 +- docs/configs/Science.html | 3 +- docs/configs/Scorched-Earth.html | 3 +- docs/configs/Spawn-Area.html | 3 +- docs/configs/Statistics.html | 3 +- docs/configs/Tasks.html | 3 +- docs/configs/Warnings.html | 3 +- docs/configs/Warps.html | 9 +- docs/configs/inventory_clear.html | 3 +- docs/control/Jail.html | 3 +- docs/control/Production.html | 3 +- docs/control/Reports.html | 3 +- docs/control/Rockets.html | 3 +- docs/control/Tasks.html | 37 +---- docs/control/Warnings.html | 3 +- docs/control/Warps.html | 45 ++---- docs/core/Async.html | 3 +- docs/core/Commands.html | 3 +- docs/core/Common.html | 3 +- docs/core/Datastore.html | 3 +- docs/core/Groups.html | 3 +- docs/core/Gui.html | 3 +- docs/core/PlayerData.html | 3 +- docs/core/Roles.html | 3 +- docs/data/Alt-View.html | 3 +- docs/data/Bonus.html | 3 +- docs/data/Greetings.html | 3 +- docs/data/Player-Colours.html | 3 +- docs/data/Quickbar.html | 3 +- docs/data/Tag.html | 3 +- docs/guis/Player-List.html | 9 +- docs/guis/Readme.html | 3 +- docs/guis/Rocket-Info.html | 3 +- docs/guis/Science-Info.html | 3 +- docs/guis/Task-List.html | 3 +- docs/guis/Warps-List.html | 135 +++++++++++++----- docs/guis/server-ups.html | 3 +- docs/index.html | 7 +- docs/modules/control.html | 3 +- .../modules.addons.station-auto-name.html | 3 +- docs/modules/overrides.debug.html | 3 +- docs/modules/overrides.math.html | 3 +- docs/modules/overrides.table.html | 3 +- docs/modules/utils.event.html | 3 +- docs/modules/utils.event_core.html | 3 +- docs/modules/utils.task.html | 3 +- docs/topics/LICENSE.html | 3 +- docs/topics/README.md.html | 3 +- 98 files changed, 213 insertions(+), 333 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 9fdecd6e..5a6b8449 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -76,7 +76,6 @@ - @@ -362,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index eb355e9b..2942c0bc 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -76,7 +76,6 @@ - @@ -363,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 31abe5c8..99bf09d8 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -76,7 +76,6 @@ - @@ -390,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index ecfb09b5..fbce2287 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -77,7 +77,6 @@ - @@ -599,7 +598,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 4536430f..1b6b0787 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -76,7 +76,6 @@ - @@ -363,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 94412bc5..9f77ec33 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -76,7 +76,6 @@ - @@ -418,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index df4b1a82..95ee0167 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -76,7 +76,6 @@ - @@ -474,7 +473,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index db651249..0ce68777 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -76,7 +76,6 @@ - @@ -362,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 5f925633..05c32236 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -76,7 +76,6 @@ - @@ -334,7 +333,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 676c8260..b24220b8 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -76,7 +76,6 @@ - @@ -418,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 2869e2a1..e8a3bb5d 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -76,7 +76,6 @@ - @@ -390,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 638e8af6..ff88223a 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -76,7 +76,6 @@ - @@ -390,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 1ff9064b..ab97f68d 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -83,7 +83,6 @@ - @@ -402,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 64ab7505..d23db61b 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -83,7 +83,6 @@ - @@ -375,7 +374,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 29be96fc..beccf3b3 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -83,7 +83,6 @@ - @@ -402,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 0f5d22d9..b38c265d 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -83,7 +83,6 @@ - @@ -379,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 587b8509..397b1835 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -83,7 +83,6 @@ - @@ -374,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 389fb242..3367f516 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -83,7 +83,6 @@ - @@ -418,7 +417,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 2e7e9571..aac5a4df 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -83,7 +83,6 @@ - @@ -472,7 +471,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 647c3f17..a8bb5382 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -83,7 +83,6 @@ - @@ -430,7 +429,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index ce1fc05c..14d97866 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -83,7 +83,6 @@ - @@ -625,7 +624,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 2b7fcb55..d8e07f5b 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -83,7 +83,6 @@ - @@ -403,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 97d5ef46..5e9e3195 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -83,7 +83,6 @@ - @@ -374,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index b6420aa2..cf7d22d0 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -83,7 +83,6 @@ - @@ -402,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 3d06d57e..ce37a4a4 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -82,7 +82,6 @@ - @@ -335,7 +334,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 92ed22e9..4dc3a0e0 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -83,7 +83,6 @@ - @@ -599,7 +598,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 091505ec..4a688d67 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -83,7 +83,6 @@ - @@ -571,7 +570,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 75c10cdf..e43b219c 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -83,7 +83,6 @@ - @@ -403,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 5938cbe8..74388aa2 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -83,7 +83,6 @@ - @@ -498,7 +497,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 46aff727..1008741d 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -83,7 +83,6 @@ - @@ -583,7 +582,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index a8130f3c..f25bf167 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -93,7 +93,6 @@ - @@ -520,7 +519,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 2f0c9bfc..04774998 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -85,7 +85,6 @@ - @@ -251,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 2f9709df..f098e5d4 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -94,7 +94,6 @@ - @@ -499,7 +498,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index cc8ee72f..2b236d7b 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -93,7 +93,6 @@ - @@ -308,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index e1f1d5e3..24957184 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -93,7 +93,6 @@ - @@ -334,7 +333,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 257d9725..f4fa83fa 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -94,7 +94,6 @@ - @@ -456,7 +455,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 4413689b..4dc7de3e 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -93,7 +93,6 @@ - @@ -368,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 7fa4cb51..2868dcbd 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -93,7 +93,6 @@ - @@ -352,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 1f3210cc..5a99bff4 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -93,7 +93,6 @@ - @@ -368,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 97baa8d8..8f7ca6c1 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -93,7 +93,6 @@ - @@ -430,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 5a6045b6..bcd4655e 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -85,7 +85,6 @@ - @@ -251,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index a76ab7db..783e596d 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -85,7 +85,6 @@ - @@ -254,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 5d1f0589..b11eba2d 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -93,7 +93,6 @@ - @@ -309,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index bb9ddd90..5cf1adb0 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -94,7 +94,6 @@ - @@ -267,9 +266,6 @@
    - - - @@ -383,31 +379,6 @@ - - - - - - - -
    -
    -
    - # - expcore.store -
    -
    -
    -
    - - - - - - - - - @@ -826,7 +797,7 @@ generated by LDoc
    diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index d57f547e..2f15ddc0 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -93,7 +93,6 @@ - @@ -398,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 2989009f..c5b4fa5e 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -93,7 +93,6 @@ - @@ -428,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index afc4f0f5..63d852d4 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -93,7 +93,6 @@ - @@ -338,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index c52eb147..495d2657 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -85,7 +85,6 @@ - @@ -251,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 8ce9e134..c32b11f5 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -93,7 +93,6 @@ - @@ -428,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index b4886ecf..830f0125 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -93,7 +93,6 @@ - @@ -848,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 79aa411b..6bbd8c83 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -93,7 +93,6 @@ - @@ -306,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index bde26def..2bf61f84 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -93,7 +93,6 @@ - @@ -368,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 87c60539..539c6d80 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -93,7 +93,6 @@ - @@ -402,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 2f542c86..48fc5871 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -93,7 +93,6 @@ - @@ -758,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 4a6ebf2f..5cb313e7 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -93,7 +93,6 @@ - @@ -608,7 +607,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 7476997b..6b03a8fd 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -93,7 +93,6 @@ - @@ -398,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index fce56ce3..1a98d575 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -93,7 +93,6 @@ - @@ -369,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index a96d1a0b..774cf9d2 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -93,7 +93,6 @@ - @@ -270,7 +269,7 @@
    - + @@ -452,8 +451,8 @@
    - # - cooldown_duraction + # + cooldown_duration
    @@ -788,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 22bf541b..5b9b36eb 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -85,7 +85,6 @@ - @@ -251,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 67094491..0911259b 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -74,7 +74,6 @@ - @@ -1222,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 6742ff29..7b4cab45 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -74,7 +74,6 @@ - @@ -1343,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 1065af7d..1e975af7 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -74,7 +74,6 @@ - @@ -1124,7 +1123,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 3db8b3a6..12a812f6 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -73,7 +73,6 @@ - @@ -998,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index b7399b8d..ad3b8ec9 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -73,7 +73,6 @@ - @@ -265,14 +264,11 @@ Tasks.update_task(task_id, 'We need more iron!', gam
    - + - - -
    BonusCommands Module - Bonus - - Adds a command that allows players to have increased stats
    Cheat-Mode Commands Module - Cheat Mode - Adds a command that allows players to enter cheat mode
    QuickbarCommands Module - Quickbar - - Adds a command that allows players to load Quickbar presets
    Rainbow Commands Module - Rainbow - Adds a command that prints your message in rainbow font
    TagCommands Module - Tag - - Adds a command that allows players to have a custom tag after their name
    Teleport Commands Module - Teleport - Adds a command that allows players to teleport to other players 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)
    StatisticsA list of all tracked statistics and the events which trigger them
    Warnings Config file for the warning system, this is very similar to reports but is for the use of moderators rather than normal users.
    expcore.roles
    expcore.store
    utils.game
    expcore_roles_bypass_warp_cooldown
    cooldown_duractioncooldown_duration
    bypass_warp_proximity
    expcore.storeexpcore.datastore
    utils.global
    utils.token
    @@ -333,8 +329,8 @@ Tasks.update_task(task_id, 'We need more iron!', gam
    - # - expcore.store + # + expcore.datastore
    @@ -373,31 +369,6 @@ Tasks.update_task(task_id, 'We need more iron!', gam - - - - - - -
    -
    -
    -
    - # - utils.token -
    -
    -
    -
    - - - - - - - - - @@ -1012,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc
    diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 347bcbbd..57d43498 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -73,7 +73,6 @@ - @@ -1479,7 +1478,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index abac232c..42cd887a 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -44,7 +44,7 @@ - + @@ -74,7 +74,6 @@ - @@ -221,7 +220,7 @@ - + @@ -277,15 +276,12 @@ Warps.make_warp_tag(warp_id)
    - + - - - @@ -344,7 +340,7 @@ Warps.make_warp_tag(warp_id)
    expcore.storeexpcore.datastore
    utils.global
    utils.token
    config.warps
    -

    Map Intergration

    +

    Map Integration

    @@ -384,8 +380,8 @@ Warps.make_warp_tag(warp_id)
    - # - expcore.store + # + expcore.datastore
    @@ -424,31 +420,6 @@ Warps.make_warp_tag(warp_id) - - - - - - -
    -
    -
    -
    - # - utils.token -
    -
    -
    -
    - - - - - - - - - @@ -1168,7 +1139,7 @@ Warps.make_warp_tag(warp_id)
    -

    Map Intergration

    +

    Map Integration

    @@ -1549,7 +1520,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 2dfa34d8..ffd1e45b 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -58,7 +58,6 @@ - @@ -612,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 074380a5..57acfd00 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -64,7 +64,6 @@ - @@ -2397,7 +2396,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 684e8861..21ac0209 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -61,7 +61,6 @@ - @@ -2766,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 833bc23a..d5d976f0 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -63,7 +63,6 @@ - @@ -2946,7 +2945,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 2bc7a866..1bf64be1 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -61,7 +61,6 @@ - @@ -1442,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index c701bfa0..daefcd1c 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -66,7 +66,6 @@ - @@ -4420,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 2348e69f..b7c3a0b6 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -58,7 +58,6 @@ - @@ -530,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 1fc9a1a2..2190c925 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -65,7 +65,6 @@ - @@ -3349,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index 6800954f..d55aad15 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -70,7 +70,6 @@ - @@ -334,7 +333,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index b7c64d7f..37ca37de 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -71,7 +71,6 @@ - @@ -486,7 +485,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 2dc49cb4..bfdca1be 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -71,7 +71,6 @@ - @@ -429,7 +428,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 16bde4bd..77cf6ac2 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -70,7 +70,6 @@ - @@ -390,7 +389,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 3a344472..3773168e 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -71,7 +71,6 @@ - @@ -407,7 +406,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 0411e368..4ca8c3d6 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -71,7 +71,6 @@ - @@ -485,7 +484,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 9d54971a..b0f12a4f 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -72,7 +72,6 @@ - @@ -264,7 +263,7 @@
    - + @@ -379,8 +378,8 @@
    - # - expcore.store + # + expcore.datastore
    @@ -733,7 +732,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index b16a7df7..e79c9f55 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -72,7 +72,6 @@ - @@ -770,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index bcec0e6e..81233cbf 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -72,7 +72,6 @@ - @@ -705,7 +704,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 2f76523d..b024ec4d 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -72,7 +72,6 @@ - @@ -584,7 +583,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index c5fe849c..4020572d 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -72,7 +72,6 @@ - @@ -770,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index a0e07525..bdd5376d 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -43,6 +43,7 @@ @@ -72,7 +73,6 @@ - @@ -218,6 +218,7 @@ @@ -261,7 +262,7 @@
    - + @@ -270,9 +271,6 @@ - - - @@ -321,7 +319,7 @@ - + @@ -349,6 +347,18 @@
    expcore.roles
    expcore.storeexpcore.datastore
    utils.game expcore.gui
    expcore.storeexpcore.datastore
    utils.globalutils.event
    utils.game
    expcore.roles
    warp_editingEditing state for a warp, contrins a text field and the two edit buttonsEditing state for a warp, contains a text field and the two edit buttons
    warp_label
    + + +

    Functions

    + + + + + + + + +
    update_wrap_buttons(player, timer, in_range)Update the warp buttons for a player

    @@ -384,8 +394,8 @@
    - # - expcore.store + # + expcore.datastore
    @@ -449,31 +459,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -781,7 +766,7 @@
    -

    Editing state for a warp, contrins a text field and the two edit buttons

    +

    Editing state for a warp, contains a text field and the two edit buttons

    @@ -953,6 +938,86 @@ + + + + + + +
    +
    +

    Functions

    +
    +
    +
    +
    + # + update_wrap_buttons(player, timer, in_range) +
    +
    +
    +
    + +

    Update the warp buttons for a player

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + + + + +
    • + + + + + +
    • + + timer + + + + + +
    • + + + + + +
    • + + in_range + + : + + + Get the warp table + +
    • + + +
    + + + + + + + @@ -975,7 +1040,7 @@ generated by LDoc
    diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index d51a9362..e41ea3c5 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -73,7 +73,6 @@ - @@ -451,7 +450,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 44c76ee0..dc3b8ce7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -83,11 +83,6 @@ Roles Core Module - Roles - Factorio role system to manage custom permissions. - - - Store - Core Module - Store -- Used to store and watch for updates for values in the global table

    Control

    @@ -545,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 4954312b..7f3eb19a 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -72,7 +72,6 @@ - @@ -309,7 +308,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 05cb9c3f..83ac9ddb 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -72,7 +72,6 @@ - @@ -307,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 09707d61..b175f514 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -72,7 +72,6 @@ - @@ -668,7 +667,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index caa8894a..3bf9a513 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -72,7 +72,6 @@ - @@ -367,7 +366,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index cb9dc2a8..72bc3296 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -74,7 +74,6 @@ - @@ -2022,7 +2021,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index dbfed0fb..4efd1950 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -73,7 +73,6 @@ - @@ -1306,7 +1305,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 31413255..10b173aa 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -72,7 +72,6 @@ - @@ -448,7 +447,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index ce25a89e..a8c63ed7 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -73,7 +73,6 @@ - @@ -665,7 +664,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 3670121a..8d3a2cfa 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -58,7 +58,6 @@ - @@ -803,7 +802,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 9d2aab2e..c825802b 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -58,7 +58,6 @@ - @@ -355,7 +354,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 136fbca71ccd8dec2d2ac6ceca9d8f2e6db91a9d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 1 Jun 2020 18:05:50 +0100 Subject: [PATCH 060/106] Added Data tab --- expcore/player_data.lua | 5 +++ locale/en/expcore.cfg | 5 ++- locale/en/gui.cfg | 9 ++++- modules/gui/readme.lua | 90 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) diff --git a/expcore/player_data.lua b/expcore/player_data.lua index ba9a127c..e05caa6c 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -56,6 +56,11 @@ local DataSavingPreference = PlayerData:combine('DataSavingPreference') local PreferenceEnum = { 'All', 'Statistics', 'Settings', 'Required' } for k,v in ipairs(PreferenceEnum) do PreferenceEnum[v] = k end DataSavingPreference:set_default('All') +DataSavingPreference:set_metadata{ + name = {'expcore-data.preference'}, + tooltip = {'expcore-data.preference-tooltip'}, + value_tooltip ={'expcore-data.preference-value-tooltip'} +} --- Sets your data saving preference -- @command set-data-preference diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index 7d50cd29..d2078788 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -42,4 +42,7 @@ set-preference=You data saving preference has been set to __1__. Existing data w get-preference=You data saving preference is __1__. Use /set-preference to change this. Use /save-data to get a local copy of your data. get-data=Your player data has been writen to file, location: factorio/script_output/expgaming_player_data.json data-failed=Your player data has failed to load. Any changes to your data will not be saved. -data-restore=Your player data has been restored and changes will now save when you leave. \ No newline at end of file +data-restore=Your player data has been restored and changes will now save when you leave. +preference=Saving Preference +preference-tooltip=Which areas will be saved when you leave the game +preference-value-tooltip=Use /set-preference to change your preference \ No newline at end of file diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index fca7827f..cf5feb0b 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -155,4 +155,11 @@ backers-management=Administrators backers-board=Board Members and Senior Backers backers-staff=Staff Members backers-backers=Sponsors and Supporters -backers-active=Active Players \ No newline at end of file +backers-active=Active Players +data-tab=Data +data-tooltip=All of your stored player data +data-general=Our servers will save your player data externaly so that we can sync it between servers. All of your data can be found below, if you wish to save a copy localy then use /save-data. If you want to change what data is saved then use /set-preference. +data-settings=Settings +data-statistics=Statistics +data-required=Required +data-misc=Miscellaneous \ No newline at end of file diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index cf4bc29d..ccf85b6b 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -7,6 +7,7 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles local Commands = require 'expcore.commands' --- @dep expcore.commands +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local Event = require 'utils.event' --- @dep utils.event local Game = require 'utils.game' --- @dep utils.game local format_time = _C.format_time --- @dep expcore.common @@ -259,6 +260,95 @@ Gui.element(function(_, parent) return container end)) +--- Content area for the player data tab +-- @element commands_content +Tab({'readme.data-tab'}, {'readme.data-tooltip'}, +Gui.element(function(_, parent) + local container = parent.add{ type='flow', direction='vertical' } + local player = Gui.get_player_from_element(parent) + local player_name = player.name + + local enum = PlayerData.PreferenceEnum + local preference = PlayerData.DataSavingPreference:get(player_name) + local preference_meta = PlayerData.DataSavingPreference.metadata + preference = enum[preference] + + -- Add the title and description to the content + Gui.title_label(container, title_width, {'readme.data-tab'}) + Gui.centered_label(container, frame_width, {'readme.data-general'}) + Gui.bar(container) + container.add{ type='flow' } + local scroll_pane = title_table_scroll(container) + + -- Add the required area + local required = title_table(scroll_pane, 250, {'readme.data-required'}, 2) + Gui.centered_label(required, 140, preference_meta.name, preference_meta.tooltip) + Gui.centered_label(required, 430, enum[preference], preference_meta.value_tooltip) + + for name, child in pairs(PlayerData.Required.children) do + local metadata = child.metadata + local value = child:get(player_name) + if value ~= nil or metadata.show_always then + if metadata.stringify then value = metadata.stringify(value) end + Gui.centered_label(required, 140, metadata.name or name, metadata.tooltip) + Gui.centered_label(required, 430, tostring(value), metadata.value_tooltip) + end + end + + -- Add the settings area + if preference <= enum.Settings then + local settings = title_table(scroll_pane, 255, {'readme.data-settings'}, 2) + for name, child in pairs(PlayerData.Settings.children) do + local metadata = child.metadata + local value = child:get(player_name) + if value ~= nil or metadata.show_always then + if metadata.stringify then value = metadata.stringify(value) end + Gui.centered_label(settings, 140, metadata.name or name, metadata.tooltip) + Gui.centered_label(settings, 430, tostring(value), metadata.value_tooltip) + end + end + end + + -- Add the statistics area + if preference <= enum.Statistics then + local count = 4 + local statistics = title_table(scroll_pane, 250, {'readme.data-statistics'}, 4) + for name, child in pairs(PlayerData.Statistics.children) do + local metadata = child.metadata + local value = child:get(player_name) + if value ~= nil or metadata.show_always then + count = count - 2 + Gui.centered_label(statistics, 140, metadata.name or name, metadata.tooltip) + Gui.centered_label(statistics, 140, tostring(value), metadata.value_tooltip) + end + end + if count > 0 then + for i = 1, count do Gui.centered_label(statistics, 140) end + end + end + + -- Add the misc area + local skip = {DataSavingPreference=true, Settings=true, Statistics=true, Required=true} + local count = 0; for _ in pairs(PlayerData.All.children) do count = count + 1 end + if preference <= enum.All and count > 4 then + local misc = title_table(scroll_pane, 232, {'readme.data-misc'}, 2) + for name, child in pairs(PlayerData.All.children) do + if not skip[name] then + local metadata = child.metadata + local value = child:get(player_name) + if value ~= nil or metadata.show_always then + if metadata.stringify then value = metadata.stringify(value) end + Gui.centered_label(misc, 140, metadata.name or name, metadata.tooltip) + Gui.centered_label(misc, 430, tostring(value), metadata.value_tooltip) + end + end + end + end + + return container +end)) + + --- Main readme container for the center flow -- @element readme local readme_toggle From f1864985ffb01b332dd71210a7ed586e43e68dc4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 1 Jun 2020 19:29:44 +0100 Subject: [PATCH 061/106] Added locale --- config/statistics.lua | 17 ++++++++- locale/en/data.cfg | 74 ++++++++++++++++++++++++++++++++++++- locale/en/expcore.cfg | 2 +- modules/data/statistics.lua | 5 ++- modules/gui/readme.lua | 24 ++++++------ 5 files changed, 107 insertions(+), 15 deletions(-) diff --git a/config/statistics.lua b/config/statistics.lua index 36c60da3..b91b48d4 100644 --- a/config/statistics.lua +++ b/config/statistics.lua @@ -26,6 +26,21 @@ return { Deaths = e.on_player_died, JoinCount = e.on_player_joined_game, TilesRemoved = e.on_player_mined_tile, - CapsulesUsed = e.on_player_used_capsule + CapsulesUsed = e.on_player_used_capsule, + EntityRepaired= e.on_player_repaired_entity + }, + display_order = { --- @setting display_order The order that the statistics should be shown in when in a gui or command + 'MapsPlayed', 'JoinCount', + 'Playtime', 'AfkTime', + 'ChatMessages', 'CommandsUsed', + 'RocketsLaunched', 'ResearchCompleted', + 'MachinesBuilt', 'MachinesRemoved', + 'TilesBuilt', 'TilesRemoved', + 'TreesDestroyed', 'OreMined', + 'ItemsCrafted', 'ItemsPickedUp', + 'Kills', 'Deaths', + 'DamageDealt', 'DistanceTraveled', + 'CapsulesUsed', 'EntityRepaired', + 'DeconstructionPlanerUsed', 'MapTagsMade', } } \ No newline at end of file diff --git a/locale/en/data.cfg b/locale/en/data.cfg index 6816c16b..a264cebd 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -3,4 +3,76 @@ greet=[color=0,1,0] Welcome to explosive gaming community server! If you like th message-set=Your join message has been updated. [quickbar] -saved=Your quickbar filters have been saved. \ No newline at end of file +saved=Your quickbar filters have been saved. + +[exp-required] + +[exp-settings] +Colour=Colour +Colour-tooltip=Your player colour +Colour-value-tooltip=Change by using /color +JoinMessage=Join Message +JoinMessage-tooltip=The message that is displayed when you join +JoinMessage-value-tooltip=Change by using /join-message +QuickbarFilters=Quickbar Filters +QuickbarFilters-tooltip=The filters that are on your quickbar +QuickbarFilters-value-tooltip=Change by using /save-quickbar +UsesAlt=Alt View +UsesAlt-tooltip=If you use alt view when you play +UsesAlt-value-tooltip=Change by pressing __CONTROL__show-info__ +Tag=Player Tag +Tag-tooltip=The tag that is shown after your name +Tag-value-tooltip=Change by using /tag +Bonus=Player Bonus +Bonus-tooltip=The bonus that is given to your character +Bonus-value-tooltip=Change by using /bonus + +[exp-statistics] +MapsPlayed=Maps Played +MapsPlayed-tooltip=The amount of maps you have played on +JoinCount=Join Count +JoinCount-tooltip=The amount of times you have joined our servers +Playtime=Playtime +Playtime-tooltip=The amount of time you have played on our servers +AfkTime=AFK Time +AfkTime-tooltip=The amount of time you have been afk on our servers +ChatMessages=Messages +ChatMessages-tooltip=The amount of message you have sent in chat +CommandsUsed=Commands +CommandsUsed-tooltip=The amount of commands you have used +RocketsLaunched=Rockets Launched +RocketsLaunched-tooltip=The amount of rockets launched while you were online +ResearchCompleted=Research Completed +ResearchCompleted-tooltip=The amount of research completed while you were online +MachinesBuilt=Machines Built +MachinesBuilt-tooltip=The amount of machines you have built +MachinesRemoved=Machines Removed +MachinesRemoved-tooltip=The amount of machines you have removed +TilesBuilt=Tiles Placed +TilesBuilt-tooltip=The amount of tiles you have placed +TilesRemoved=Tiles Removed +TilesRemoved-tooltip=The amount of tiles you have removed +TreesDestroyed=Trees Destroyed +TreesDestroyed-tooltip=The amount of trees you have destroyed +OreMined=Ore Mined +OreMined-tooltip=The amount of ore you have mined +ItemsCrafted=Items Crafted +ItemsCrafted-tooltip=The amount of items you have crafted +ItemsPickedUp=Items Picked Up +ItemsPickedUp-tooltip=The amount of items you have picked up +Kills=Kills +Kills-tooltip=The amount of things you have killed +Deaths=Deaths +Deaths-tooltip=The amount of times you have died +DamageDealt=Damage Delt +DamageDealt-tooltip=The amount of damage you have dealt to other forces +DistanceTraveled=Distance Traveled +DistanceTraveled-tooltip=The amount of tiles you have traveled across +CapsulesUsed=Capsules Used +CapsulesUsed-tooltip=The amount of capsules you have used +EntityRepaired=Machines Repaired +EntityRepaired-tooltip=The amount of machines which you have repaired +DeconstructionPlanerUsed=Decon Planner Used +DeconstructionPlanerUsed-tooltip=The amount of times you have used the deconstruction planer +MapTagsMade=Map Tags Used +MapTagsMade-tooltip=The amount of map tags you have created \ No newline at end of file diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index d2078788..857c8c10 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -45,4 +45,4 @@ data-failed=Your player data has failed to load. Any changes to your data will n data-restore=Your player data has been restored and changes will now save when you leave. preference=Saving Preference preference-tooltip=Which areas will be saved when you leave the game -preference-value-tooltip=Use /set-preference to change your preference \ No newline at end of file +preference-value-tooltip=Change by using /set-preference \ No newline at end of file diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index 5aa305fa..8cbad10e 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -8,6 +8,9 @@ local afk_required = 5*3600 -- 5 minutes local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local AllPlayerData = PlayerData.All local Statistics = PlayerData.Statistics +Statistics:set_metadata{ + display_order = config.display_order +} --- Update your statistics with any which happened before the data was valid Statistics:on_load(function(player_name, player_statistics) @@ -85,7 +88,7 @@ if config.DamageDealt then end --- Add Kills if it is enabled -if config.DamageDealt then +if config.Kills then local stat = Statistics:combine('Kills') Event.add(defines.events.on_entity_died, function(event) local character = event.cause -- Check character is valid diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index ccf85b6b..7b8c2ed8 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -11,6 +11,7 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local Event = require 'utils.event' --- @dep utils.event local Game = require 'utils.game' --- @dep utils.game local format_time = _C.format_time --- @dep expcore.common +local format_number = require('util').format_number --- @dep util local tabs = {} local function Tab(caption, tooltip, element_define) @@ -282,16 +283,16 @@ Gui.element(function(_, parent) -- Add the required area local required = title_table(scroll_pane, 250, {'readme.data-required'}, 2) - Gui.centered_label(required, 140, preference_meta.name, preference_meta.tooltip) - Gui.centered_label(required, 430, enum[preference], preference_meta.value_tooltip) + Gui.centered_label(required, 150, preference_meta.name, preference_meta.tooltip) + Gui.centered_label(required, 420, enum[preference], preference_meta.value_tooltip) for name, child in pairs(PlayerData.Required.children) do local metadata = child.metadata local value = child:get(player_name) if value ~= nil or metadata.show_always then if metadata.stringify then value = metadata.stringify(value) end - Gui.centered_label(required, 140, metadata.name or name, metadata.tooltip) - Gui.centered_label(required, 430, tostring(value), metadata.value_tooltip) + Gui.centered_label(settings, 150, metadata.name or {'exp-required.'..name}, metadata.tooltip or {'exp-required.'..name..'-tooltip'}) + Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-required.'..name..'-value-tooltip'}) end end @@ -303,8 +304,8 @@ Gui.element(function(_, parent) local value = child:get(player_name) if value ~= nil or metadata.show_always then if metadata.stringify then value = metadata.stringify(value) end - Gui.centered_label(settings, 140, metadata.name or name, metadata.tooltip) - Gui.centered_label(settings, 430, tostring(value), metadata.value_tooltip) + Gui.centered_label(settings, 150, metadata.name or {'exp-settings.'..name}, metadata.tooltip or {'exp-settings.'..name..'-tooltip'}) + Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-settings.'..name..'-value-tooltip'}) end end end @@ -313,13 +314,14 @@ Gui.element(function(_, parent) if preference <= enum.Statistics then local count = 4 local statistics = title_table(scroll_pane, 250, {'readme.data-statistics'}, 4) - for name, child in pairs(PlayerData.Statistics.children) do + for _, name in pairs(PlayerData.Statistics.metadata.display_order) do + local child = PlayerData.Statistics[name] local metadata = child.metadata local value = child:get(player_name) if value ~= nil or metadata.show_always then count = count - 2 - Gui.centered_label(statistics, 140, metadata.name or name, metadata.tooltip) - Gui.centered_label(statistics, 140, tostring(value), metadata.value_tooltip) + Gui.centered_label(statistics, 150, metadata.name or {'exp-statistics.'..name}, metadata.tooltip or {'exp-statistics.'..name..'-tooltip'}) + Gui.centered_label(statistics, 130, format_number(value or 0), metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'}) end end if count > 0 then @@ -338,8 +340,8 @@ Gui.element(function(_, parent) local value = child:get(player_name) if value ~= nil or metadata.show_always then if metadata.stringify then value = metadata.stringify(value) end - Gui.centered_label(misc, 140, metadata.name or name, metadata.tooltip) - Gui.centered_label(misc, 430, tostring(value), metadata.value_tooltip) + Gui.centered_label(misc, 150, metadata.name or name, metadata.tooltip) + Gui.centered_label(misc, 420, tostring(value), metadata.value_tooltip) end end end From 7811ad2e1111a86bb5ec4b9fe6f0d7b57a1e7b29 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 1 Jun 2020 20:29:17 +0100 Subject: [PATCH 062/106] Added settings and warnings --- locale/en/commands.cfg | 3 +- locale/en/data.cfg | 7 ++- modules/commands/warnings.lua | 10 ++-- modules/control/warnings.lua | 85 +++++++++++++++++++-------------- modules/data/alt-view.lua | 5 +- modules/data/bonus.lua | 7 +++ modules/data/player-colours.lua | 7 +++ modules/data/quickbar.lua | 8 ++++ modules/gui/readme.lua | 17 +++---- modules/gui/server-ups.lua | 17 +++++++ 10 files changed, 112 insertions(+), 54 deletions(-) diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 081b8f36..8d3213ce 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -45,7 +45,8 @@ removed=__1__ has one or more reports removed by __2__. [expcom-warnings] received=__1__ received a warning from __2__ for __3__. player=__1__ has __2__ warnings and __3__/__4__ script warnings. -list-tilte=The following player have this many warnings (and this many script warnings): +player-detail=__1__ gave warning for: __2__ +list-title=The following player have this many warnings (and this many script warnings): list=__1__: __2__ (__3__/__4__) cleared=__1__ had all they warnings cleared by __2__. diff --git a/locale/en/data.cfg b/locale/en/data.cfg index a264cebd..59f2877b 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -6,7 +6,9 @@ message-set=Your join message has been updated. saved=Your quickbar filters have been saved. [exp-required] - +Warnings=Warnings +Warnings-tooltip=The number of warnings that have been given to you by staff +Warnings-value-tooltip=The number of warnings that have been given to you by staff [exp-settings] Colour=Colour Colour-tooltip=Your player colour @@ -20,6 +22,9 @@ QuickbarFilters-value-tooltip=Change by using /save-quickbar UsesAlt=Alt View UsesAlt-tooltip=If you use alt view when you play UsesAlt-value-tooltip=Change by pressing __CONTROL__show-info__ +UsesServerUps=Server Ups +UsesServerUps-tooltip=If you use server ups view when you play +UsesServerUps-value-tooltip=Change by using /server-ups Tag=Player Tag Tag-tooltip=The tag that is shown after your name Tag-value-tooltip=Change by using /tag diff --git a/modules/commands/warnings.lua b/modules/commands/warnings.lua index 888c4709..ccd4d6a0 100644 --- a/modules/commands/warnings.lua +++ b/modules/commands/warnings.lua @@ -36,12 +36,14 @@ Commands.new_command('get-warnings', 'Gets the number of warnings a player has. local warnings = Warnings.get_warnings(player) local script_warnings = Warnings.get_script_warnings(player) local player_name_color = format_chat_player_name(player) - Commands.print{'expcom-warnings.player', player_name_color, warnings, script_warnings, config.temp_warning_limit} + Commands.print{'expcom-warnings.player', player_name_color, #warnings, #script_warnings, config.temp_warning_limit} + for _, warning in ipairs(warnings) do + Commands.print{'expcom-warnings.player-detail', format_chat_player_name(warning.by_player_name), warning.reason} + end else local rtn = {} - local user_warnings = Warnings.user_warnings local user_script_warnings = Warnings.user_script_warnings - for player_name, warnings in pairs(user_warnings) do + for player_name, warnings in pairs(Warnings.user_warnings:get_all()) do rtn[player_name] = {#warnings, 0} end for player_name, warnings in pairs(user_script_warnings) do @@ -50,7 +52,7 @@ Commands.new_command('get-warnings', 'Gets the number of warnings a player has. end rtn[player_name][2] = #warnings end - Commands.print{'expcom-warnings.list-tilte'} + Commands.print{'expcom-warnings.list-title'} for player_name, warnings in pairs(rtn) do local player_name_color = format_chat_player_name(player_name) Commands.print{'expcom-warnings.list', player_name_color, warnings[1], warnings[2], config.temp_warning_limit} diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua index dd7bcba4..0145a01f 100644 --- a/modules/control/warnings.lua +++ b/modules/control/warnings.lua @@ -28,8 +28,20 @@ local config = require 'config.warnings' --- @dep config.warnings local valid_player = Game.get_player_from_any +--- Stores the quickbar filters for a player +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local PlayerWarnings = PlayerData.Required:combine('Warnings') +PlayerWarnings:set_metadata{ + stringify = function(value) + if not value then return 'You have no warnings against you' end + local count = 0 + for _ in pairs(value) do count = count + 1 end + return 'You have '..count..' warnings against you' + end +} + local Warnings = { - user_warnings={}, + user_warnings=PlayerWarnings, user_script_warnings={}, events = { --- When a warning is added to a player @@ -52,7 +64,7 @@ local Warnings = { -- @tparam string reason the reason that the player was given a warning -- @tparam number warning_count the new number of warnings that the player has on_script_warning_added = script.generate_event_name(), - --- When a warning is remnoved from a player, by the script + --- When a warning is removed from a player, by the script -- @event on_script_warning_removed -- @tparam number player_index the index of the player who is having the warning removed -- @tparam number warning_count the new number of warnings that the player has @@ -60,30 +72,24 @@ local Warnings = { } } -local user_warnings = Warnings.user_warnings local user_script_warnings = Warnings.user_script_warnings -Global.register({ - user_warnings = user_warnings, - user_script_warnings = user_script_warnings -}, function(tbl) - Warnings.user_warnings = tbl.user_warnings - Warnings.user_script_warnings = tbl.user_script_warnings - user_warnings = Warnings.user_warnings - user_script_warnings = Warnings.user_script_warnings +Global.register(user_script_warnings, function(tbl) + Warnings.user_script_warnings = tbl + user_script_warnings = tbl end) ---- Gets an array of warnings that the player has, always returns a list even if emtpy +--- Gets an array of warnings that the player has, always returns a list even if empty -- @tparam LuaPlayer player the player to get the warning for -- @treturn table an array of all the warnings on this player, contains tick, by_player_name and reason function Warnings.get_warnings(player) - return user_warnings[player.name] or {} + return PlayerWarnings:get(player.name, {}) end --- Gets the number of warnings that a player has on them -- @tparam LuaPlayer player the player to count the warnings for -- @treturn number the number of warnings that the player has function Warnings.count_warnings(player) - local warnings = user_warnings[player.name] or {} + local warnings = PlayerWarnings:get(player.name, {}) return #warnings end @@ -99,19 +105,21 @@ function Warnings.add_warning(player, by_player_name, reason) reason = reason or 'Non given.' - local warnings = user_warnings[player.name] - if not warnings then - warnings = {} - user_warnings[player.name] = warnings - end + local warning_count + PlayerWarnings:update(player.name, function(_, warnings) + local warning = { + by_player_name = by_player_name, + reason = reason + } - table.insert(warnings, { - tick = game.tick, - by_player_name = by_player_name, - reason = reason - }) - - local warning_count = #warnings + if not warnings then + warning_count = 1 + return {warning} + else + table.insert(warnings, warning) + warning_count = #warnings + end + end) script.raise_event(Warnings.events.on_warning_added, { name = Warnings.events.on_warning_added, @@ -122,7 +130,7 @@ function Warnings.add_warning(player, by_player_name, reason) reason = reason }) - local action = config.actions[#warnings] + local action = config.actions[warning_count] if action then local _type = type(action) if _type == 'function' then @@ -156,7 +164,7 @@ local function warning_removed_event(player, warning_by_name, removed_by_name, w }) end ---- Removes a warning from a player, always removes the earlyist warning, fifo +--- Removes a warning from a player, always removes the earliest warning, fifo -- @tparam LuaPlayer player the player to remove a warning from -- @tparam string by_player_name the name of the player who is doing the action -- @treturn number the number of warnings that the player has @@ -165,14 +173,17 @@ function Warnings.remove_warning(player, by_player_name) if not player then return end if not by_player_name then return end - local warnings = user_warnings[player.name] - if not warnings then return end + local warning, warning_count + PlayerWarnings:update(player.name, function(_, warnings) + if not warnings then return end + warning = table.remove(warnings, 1) + warning_count = #warnings + end) - local warning = table.remove(warnings, 1) + if not warning then return end + warning_removed_event(player, warning.by_player_name, by_player_name, warning_count) - warning_removed_event(player, warning.by_player_name, by_player_name, #warnings) - - return #warnings + return warning_count end --- Removes all warnings from a player, will trigger remove event for each warning @@ -184,7 +195,7 @@ function Warnings.clear_warnings(player, by_player_name) if not player then return end if not by_player_name then return end - local warnings = user_warnings[player.name] + local warnings = PlayerWarnings:get(player) if not warnings then return end local warning_count = #warnings @@ -192,7 +203,7 @@ function Warnings.clear_warnings(player, by_player_name) warning_removed_event(player, warning.by_player_name, by_player_name, warning_count-n) end - user_warnings[player.name] = nil + PlayerWarnings:remove(player) return true end @@ -249,7 +260,7 @@ function Warnings.add_script_warning(player, reason) return warning_count end ---- Script warning removed event tigger due to it being looped in clear script warnings +--- Script warning removed event trigger due to it being looped in clear script warnings -- @tparam LuaPlayer player the player who is having a script warning removed -- @tparam number warning_count the number of warning that the player has local function script_warning_removed_event(player, warning_count) diff --git a/modules/data/alt-view.lua b/modules/data/alt-view.lua index 83aca25a..609851ad 100644 --- a/modules/data/alt-view.lua +++ b/modules/data/alt-view.lua @@ -3,10 +3,13 @@ local Event = require 'utils.event' ---@dep utils.event ---- Stores the join message that the player have +--- Stores the visible state of alt mode local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local UsesAlt = PlayerData.Settings:combine('UsesAlt') UsesAlt:set_default(false) +UsesAlt:set_metadata{ + stringify = function(value) return value and 'Visible' or 'Hidden' end +} --- When your data loads apply alt view if you have it enabled UsesAlt:on_load(function(player_name, uses_alt) diff --git a/modules/data/bonus.lua b/modules/data/bonus.lua index 2275d543..1c5b7a70 100644 --- a/modules/data/bonus.lua +++ b/modules/data/bonus.lua @@ -12,6 +12,13 @@ require 'config.expcore.command_general_parse' --- Stores the bonus for the player local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerBonus = PlayerData.Settings:combine('Bonus') +PlayerBonus:set_default(0) +PlayerBonus:set_metadata{ + stringify = function(value) + if not value or value == 0 then return 'None set' end + return (value*100)..'%' + end +} --- Apply a bonus amount to a player local function apply_bonus(player, amount) diff --git a/modules/data/player-colours.lua b/modules/data/player-colours.lua index bed8012f..aff392a8 100644 --- a/modules/data/player-colours.lua +++ b/modules/data/player-colours.lua @@ -8,6 +8,13 @@ local config = require 'config.preset_player_colours' --- @dep config.preset_pla --- Stores the colour that the player wants local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerColours = PlayerData.Settings:combine('Colour') +PlayerColours:set_metadata{ + stringify = function(value) + if not value then return 'None set' end + local c = value[1] + return string.format('Red: %d Green: %d Blue: %d', c[1], c[2], c[3]) + end +} --- Used to compact player colours to take less space local floor = math.floor diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua index d2352a7f..3353a8f3 100644 --- a/modules/data/quickbar.lua +++ b/modules/data/quickbar.lua @@ -9,6 +9,14 @@ local config = require 'config.preset_player_quickbar' --- @dep config.preset_pl --- Stores the quickbar filters for a player local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerFilters = PlayerData.Settings:combine('QuickbarFilters') +PlayerFilters:set_metadata{ + stringify = function(value) + if not value then return 'No filters set' end + local count = 0 + for _ in pairs(value) do count = count + 1 end + return count..' filters set' + end +} --- Loads your quickbar preset PlayerFilters:on_load(function(player_name, filters) diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index 7b8c2ed8..00fa4742 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -291,8 +291,8 @@ Gui.element(function(_, parent) local value = child:get(player_name) if value ~= nil or metadata.show_always then if metadata.stringify then value = metadata.stringify(value) end - Gui.centered_label(settings, 150, metadata.name or {'exp-required.'..name}, metadata.tooltip or {'exp-required.'..name..'-tooltip'}) - Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-required.'..name..'-value-tooltip'}) + Gui.centered_label(required, 150, metadata.name or {'exp-required.'..name}, metadata.tooltip or {'exp-required.'..name..'-tooltip'}) + Gui.centered_label(required, 420, tostring(value), metadata.value_tooltip or {'exp-required.'..name..'-value-tooltip'}) end end @@ -302,11 +302,10 @@ Gui.element(function(_, parent) for name, child in pairs(PlayerData.Settings.children) do local metadata = child.metadata local value = child:get(player_name) - if value ~= nil or metadata.show_always then - if metadata.stringify then value = metadata.stringify(value) end - Gui.centered_label(settings, 150, metadata.name or {'exp-settings.'..name}, metadata.tooltip or {'exp-settings.'..name..'-tooltip'}) - Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-settings.'..name..'-value-tooltip'}) - end + if metadata.stringify then value = metadata.stringify(value) end + if value == nil then value = 'None set' end + Gui.centered_label(settings, 150, metadata.name or {'exp-settings.'..name}, metadata.tooltip or {'exp-settings.'..name..'-tooltip'}) + Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-settings.'..name..'-value-tooltip'}) end end @@ -324,9 +323,7 @@ Gui.element(function(_, parent) Gui.centered_label(statistics, 130, format_number(value or 0), metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'}) end end - if count > 0 then - for i = 1, count do Gui.centered_label(statistics, 140) end - end + if count > 0 then for i = 1, count do Gui.centered_label(statistics, 140) end end end -- Add the misc area diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index 901c0816..6ae45fce 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -8,6 +8,14 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Event = require 'utils.event' --- @dep utils.event local Commands = require 'expcore.commands' --- @dep expcore.commands +--- Stores the visible state of server ups +local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data +local UsesServerUps = PlayerData.Settings:combine('UsesServerUps') +UsesServerUps:set_default(false) +UsesServerUps:set_metadata{ + stringify = function(value) return value and 'Visible' or 'Hidden' end +} + --- Label to show the server ups -- @element server_ups local server_ups = @@ -19,6 +27,14 @@ Gui.element{ font = 'default-game' } +--- Change the visible state when your data loads +UsesServerUps:on_load(function(player_name, visible) + local player = game.players[player_name] + local label = player.gui.screen[server_ups.name] + if not global.ext or not global.ext.server_ups then visible = false end + label.visible = visible +end) + --- Toggles if the server ups is visbile -- @command server-ups Commands.new_command('server-ups', 'Toggle the server ups display') @@ -29,6 +45,7 @@ Commands.new_command('server-ups', 'Toggle the server ups display') return Commands.error{'expcom-server-ups.no-ext'} end label.visible = not label.visible + UsesServerUps:set(player, label.visible) end) -- Set the location of the label From 3f2382d2ac161bcc025d2ae19ef8841a5907a027 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 3 Jun 2020 00:01:19 +0100 Subject: [PATCH 063/106] Added changes requested by mark --- config/statistics.lua | 10 +++--- locale/en/commands.cfg | 4 +-- locale/en/data.cfg | 64 ++++++++++++++++++------------------ locale/en/expcore.cfg | 8 +++-- locale/en/gui.cfg | 5 +-- modules/control/warnings.lua | 6 ++-- modules/data/statistics.lua | 21 +++++++++--- modules/gui/readme.lua | 6 ++-- modules/gui/server-ups.lua | 2 +- 9 files changed, 72 insertions(+), 54 deletions(-) diff --git a/config/statistics.lua b/config/statistics.lua index b91b48d4..856af59d 100644 --- a/config/statistics.lua +++ b/config/statistics.lua @@ -5,7 +5,7 @@ local e = defines.events -- order as per lua api as it was easier just to go dow return { Playtime = true, --- @setting Playtime If playtime is tracked for a player, play time measured in minutes AfkTime = true, --- @setting AfkTime If afk time is tracked for a player, play time measured in minutes, afk is once a player does nothing for 5 minutes - DistanceTraveled = true, --- @setting DistanceTraveled If distance traveled is checked, only counts if not afk + DistanceTravelled = true, --- @setting DistanceTravelled If distance Travelled is checked, only counts if not afk MachinesRemoved = true, --- @setting MachinesRemoved If removed machines are tracked, includes marked for decon and player mined entity TreesDestroyed = true, --- @setting OreMined If ore mined is tracked for a player, includes marked for decon and player mined entity but only trees OreMined = true, --- @setting OreMined If ore mined is tracked for a player, includes player mined entity but only ore @@ -22,7 +22,7 @@ return { TilesBuilt = e.on_player_built_tile, ItemsCrafted = e.on_player_crafted_item, MapsPlayed = e.on_player_created, - DeconstructionPlanerUsed = e.on_player_deconstructed_area, + DeconstructionPlannerUsed = e.on_player_deconstructed_area, Deaths = e.on_player_died, JoinCount = e.on_player_joined_game, TilesRemoved = e.on_player_mined_tile, @@ -30,8 +30,8 @@ return { EntityRepaired= e.on_player_repaired_entity }, display_order = { --- @setting display_order The order that the statistics should be shown in when in a gui or command - 'MapsPlayed', 'JoinCount', 'Playtime', 'AfkTime', + 'MapsPlayed', 'JoinCount', 'ChatMessages', 'CommandsUsed', 'RocketsLaunched', 'ResearchCompleted', 'MachinesBuilt', 'MachinesRemoved', @@ -39,8 +39,8 @@ return { 'TreesDestroyed', 'OreMined', 'ItemsCrafted', 'ItemsPickedUp', 'Kills', 'Deaths', - 'DamageDealt', 'DistanceTraveled', + 'DamageDealt', 'DistanceTravelled', 'CapsulesUsed', 'EntityRepaired', - 'DeconstructionPlanerUsed', 'MapTagsMade', + 'DeconstructionPlannerUsed', 'MapTagsMade', } } \ No newline at end of file diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 8d3213ce..5bc738ba 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -46,9 +46,9 @@ removed=__1__ has one or more reports removed by __2__. received=__1__ received a warning from __2__ for __3__. player=__1__ has __2__ warnings and __3__/__4__ script warnings. player-detail=__1__ gave warning for: __2__ -list-title=The following player have this many warnings (and this many script warnings): +list-title=The following players have this many warnings (and this many script warnings): list=__1__: __2__ (__3__/__4__) -cleared=__1__ had all they warnings cleared by __2__. +cleared=__1__ had all their warnings cleared by __2__. [expcom-spawn] unavailable=They was a problem getting you to spawn, please try again later. diff --git a/locale/en/data.cfg b/locale/en/data.cfg index 59f2877b..e045d478 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -7,77 +7,77 @@ saved=Your quickbar filters have been saved. [exp-required] Warnings=Warnings -Warnings-tooltip=The number of warnings that have been given to you by staff -Warnings-value-tooltip=The number of warnings that have been given to you by staff +Warnings-tooltip=The total number of warnings you have recieved from staff +Warnings-value-tooltip=The total number of warnings you have recieved from staff [exp-settings] Colour=Colour Colour-tooltip=Your player colour Colour-value-tooltip=Change by using /color JoinMessage=Join Message -JoinMessage-tooltip=The message that is displayed when you join +JoinMessage-tooltip=The message displayed when you join JoinMessage-value-tooltip=Change by using /join-message QuickbarFilters=Quickbar Filters -QuickbarFilters-tooltip=The filters that are on your quickbar +QuickbarFilters-tooltip=The filters on your quickbar QuickbarFilters-value-tooltip=Change by using /save-quickbar UsesAlt=Alt View -UsesAlt-tooltip=If you use alt view when you play +UsesAlt-tooltip=Whether you use alt view when you play UsesAlt-value-tooltip=Change by pressing __CONTROL__show-info__ -UsesServerUps=Server Ups -UsesServerUps-tooltip=If you use server ups view when you play +UsesServerUps=Server UPS +UsesServerUps-tooltip=Whether the current server UPS is shown UsesServerUps-value-tooltip=Change by using /server-ups Tag=Player Tag -Tag-tooltip=The tag that is shown after your name +Tag-tooltip=The tag shown after your name Tag-value-tooltip=Change by using /tag Bonus=Player Bonus -Bonus-tooltip=The bonus that is given to your character +Bonus-tooltip=The bonus given to your character Bonus-value-tooltip=Change by using /bonus [exp-statistics] MapsPlayed=Maps Played -MapsPlayed-tooltip=The amount of maps you have played on +MapsPlayed-tooltip=The number of unique maps you have played on JoinCount=Join Count JoinCount-tooltip=The amount of times you have joined our servers Playtime=Playtime -Playtime-tooltip=The amount of time you have played on our servers +Playtime-tooltip=The amount of time you have spent on our servers AfkTime=AFK Time -AfkTime-tooltip=The amount of time you have been afk on our servers +AfkTime-tooltip=The amount of time you have been AFK on our servers ChatMessages=Messages -ChatMessages-tooltip=The amount of message you have sent in chat +ChatMessages-tooltip=The number of messages you have sent in chat CommandsUsed=Commands -CommandsUsed-tooltip=The amount of commands you have used +CommandsUsed-tooltip=The number of commands you have used RocketsLaunched=Rockets Launched -RocketsLaunched-tooltip=The amount of rockets launched while you were online +RocketsLaunched-tooltip=The number of rockets launched while you were online ResearchCompleted=Research Completed -ResearchCompleted-tooltip=The amount of research completed while you were online +ResearchCompleted-tooltip=The number of research projects completed while you were online MachinesBuilt=Machines Built -MachinesBuilt-tooltip=The amount of machines you have built +MachinesBuilt-tooltip=The number of machines you have built MachinesRemoved=Machines Removed -MachinesRemoved-tooltip=The amount of machines you have removed +MachinesRemoved-tooltip=The number of machines you have removed TilesBuilt=Tiles Placed -TilesBuilt-tooltip=The amount of tiles you have placed +TilesBuilt-tooltip=The number of tiles you have placed TilesRemoved=Tiles Removed -TilesRemoved-tooltip=The amount of tiles you have removed +TilesRemoved-tooltip=The number of tiles you have removed TreesDestroyed=Trees Destroyed -TreesDestroyed-tooltip=The amount of trees you have destroyed +TreesDestroyed-tooltip=The number of trees you have destroyed OreMined=Ore Mined OreMined-tooltip=The amount of ore you have mined ItemsCrafted=Items Crafted -ItemsCrafted-tooltip=The amount of items you have crafted +ItemsCrafted-tooltip=The number of items you have crafted ItemsPickedUp=Items Picked Up -ItemsPickedUp-tooltip=The amount of items you have picked up +ItemsPickedUp-tooltip=The number of items you have picked up Kills=Kills -Kills-tooltip=The amount of things you have killed +Kills-tooltip=The number of biters and biter bases you have squished Deaths=Deaths Deaths-tooltip=The amount of times you have died DamageDealt=Damage Delt DamageDealt-tooltip=The amount of damage you have dealt to other forces -DistanceTraveled=Distance Traveled -DistanceTraveled-tooltip=The amount of tiles you have traveled across +DistanceTravelled=Distance Travelled +DistanceTravelled-tooltip=The total distance in tiles that you have travelled CapsulesUsed=Capsules Used -CapsulesUsed-tooltip=The amount of capsules you have used +CapsulesUsed-tooltip=The number of capsules you have used EntityRepaired=Machines Repaired -EntityRepaired-tooltip=The amount of machines which you have repaired -DeconstructionPlanerUsed=Decon Planner Used -DeconstructionPlanerUsed-tooltip=The amount of times you have used the deconstruction planer -MapTagsMade=Map Tags Used -MapTagsMade-tooltip=The amount of map tags you have created \ No newline at end of file +EntityRepaired-tooltip=The number of machines which you have repaired +DeconstructionPlannerUsed=Decon Planner Used +DeconstructionPlannerUsed-tooltip=The amount of times you have used the deconstruction Planner +MapTagsMade=Map Tags Created +MapTagsMade-tooltip=The number of map tags you have created \ No newline at end of file diff --git a/locale/en/expcore.cfg b/locale/en/expcore.cfg index 857c8c10..e5fc44df 100644 --- a/locale/en/expcore.cfg +++ b/locale/en/expcore.cfg @@ -44,5 +44,9 @@ get-data=Your player data has been writen to file, location: factorio/script_out data-failed=Your player data has failed to load. Any changes to your data will not be saved. data-restore=Your player data has been restored and changes will now save when you leave. preference=Saving Preference -preference-tooltip=Which areas will be saved when you leave the game -preference-value-tooltip=Change by using /set-preference \ No newline at end of file +preference-tooltip=Which categories will be saved when you leave the game +preference-value-tooltip=Change by using /set-preference +preference-All=All data will be saved +preference-Statistics=Only statistics, settings, and required data will be saved +preference-Settings=Only settings and required data will be saved +preference-Required=Only required data will be saved \ No newline at end of file diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index cf5feb0b..3305c3fc 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -158,8 +158,9 @@ backers-backers=Sponsors and Supporters backers-active=Active Players data-tab=Data data-tooltip=All of your stored player data -data-general=Our servers will save your player data externaly so that we can sync it between servers. All of your data can be found below, if you wish to save a copy localy then use /save-data. If you want to change what data is saved then use /set-preference. +data-general=Our servers will save your player data so that we can sync it between servers. All of your data can be found below, if you wish to save a copy locally then use /save-data. If you want to change what data is saved then use /set-preference. data-settings=Settings data-statistics=Statistics data-required=Required -data-misc=Miscellaneous \ No newline at end of file +data-misc=Miscellaneous +data-format=__1____2__ \ No newline at end of file diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua index 0145a01f..95c77a15 100644 --- a/modules/control/warnings.lua +++ b/modules/control/warnings.lua @@ -33,10 +33,10 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerWarnings = PlayerData.Required:combine('Warnings') PlayerWarnings:set_metadata{ stringify = function(value) - if not value then return 'You have no warnings against you' end + if not value then return 'You have no warnings' end local count = 0 for _ in pairs(value) do count = count + 1 end - return 'You have '..count..' warnings against you' + return 'You have '..count..' warnings' end } @@ -262,7 +262,7 @@ end --- Script warning removed event trigger due to it being looped in clear script warnings -- @tparam LuaPlayer player the player who is having a script warning removed --- @tparam number warning_count the number of warning that the player has +-- @tparam number warning_count the number of warnings that the player has local function script_warning_removed_event(player, warning_count) script.raise_event(Warnings.events.on_script_warning_removed, { name = Warnings.events.on_script_warning_removed, diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index 8cbad10e..b350d3b7 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -1,6 +1,7 @@ local Event = require 'utils.event' ---@dep utils.event local config = require 'config.statistics' ---@dep config.statistics +local format_time = _C.format_time local floor = math.floor local afk_required = 5*3600 -- 5 minutes @@ -29,11 +30,20 @@ Statistics:on_load(function(player_name, player_statistics) return player_statistics end) +--- Used to format time in minute format +local function format_minutes(value) + return format_time(value*3600, { + long = true, + hours = true, + minutes = true + }) +end + --- Add Playtime and AfkTime if it is enabled if config.Playtime or config.AfkTime then local playtime, afk_time - if config.Playtime then playtime = Statistics:combine('Playtime') end - if config.AfkTime then afk_time = Statistics:combine('AfkTime') end + if config.Playtime then playtime = Statistics:combine('Playtime') playtime:set_metadata{stringify=format_minutes} end + if config.AfkTime then afk_time = Statistics:combine('AfkTime') afk_time:set_metadata{stringify=format_minutes} end Event.on_nth_tick(3600, function() if game.tick == 0 then return end for _, player in pairs(game.connected_players) do @@ -43,9 +53,10 @@ if config.Playtime or config.AfkTime then end) end ---- Add DistanceTraveled if it is enabled -if config.DistanceTraveled then - local stat = Statistics:combine('DistanceTraveled') +--- Add DistanceTravelled if it is enabled +if config.DistanceTravelled then + local stat = Statistics:combine('DistanceTravelled') + stat:set_metadata{unit=' tiles'} Event.add(defines.events.on_player_changed_position, function(event) local player = game.players[event.player_index] if not player.valid or not player.connected or player.afk_time > afk_required then return end diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index 00fa4742..dbfaf13a 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -284,7 +284,7 @@ Gui.element(function(_, parent) -- Add the required area local required = title_table(scroll_pane, 250, {'readme.data-required'}, 2) Gui.centered_label(required, 150, preference_meta.name, preference_meta.tooltip) - Gui.centered_label(required, 420, enum[preference], preference_meta.value_tooltip) + Gui.centered_label(required, 420, {'expcore-data.preference-'..enum[preference]}, preference_meta.value_tooltip) for name, child in pairs(PlayerData.Required.children) do local metadata = child.metadata @@ -319,8 +319,10 @@ Gui.element(function(_, parent) local value = child:get(player_name) if value ~= nil or metadata.show_always then count = count - 2 + if metadata.stringify then value = metadata.stringify(value) + else value = format_number(value or 0) end Gui.centered_label(statistics, 150, metadata.name or {'exp-statistics.'..name}, metadata.tooltip or {'exp-statistics.'..name..'-tooltip'}) - Gui.centered_label(statistics, 130, format_number(value or 0), metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'}) + Gui.centered_label(statistics, 130, {'readme.data-format', value, metadata.unit or ''}, metadata.value_tooltip or {'exp-statistics.'..name..'-tooltip'}) end end if count > 0 then for i = 1, count do Gui.centered_label(statistics, 140) end end diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index 6ae45fce..e35b7ea4 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -37,7 +37,7 @@ end) --- Toggles if the server ups is visbile -- @command server-ups -Commands.new_command('server-ups', 'Toggle the server ups display') +Commands.new_command('server-ups', 'Toggle the server UPS display') :add_alias('sups', 'ups') :register(function(player) local label = player.gui.screen[server_ups.name] From 1c6ea05f5b72bb673afc26986d398dabf1d379a1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 3 Jun 2020 00:36:56 +0100 Subject: [PATCH 064/106] Added optional permission check for settings --- modules/data/bonus.lua | 1 + modules/data/greetings.lua | 3 +++ modules/data/quickbar.lua | 1 + modules/data/tag.lua | 3 +++ modules/gui/readme.lua | 10 ++++++---- modules/gui/server-ups.lua | 1 + 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/data/bonus.lua b/modules/data/bonus.lua index 1c5b7a70..cd87de7b 100644 --- a/modules/data/bonus.lua +++ b/modules/data/bonus.lua @@ -14,6 +14,7 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerBonus = PlayerData.Settings:combine('Bonus') PlayerBonus:set_default(0) PlayerBonus:set_metadata{ + permission = 'command/bonus', stringify = function(value) if not value or value == 0 then return 'None set' end return (value*100)..'%' diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 84def7e3..1c885eab 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -8,6 +8,9 @@ require 'config.expcore.command_general_parse' --- Stores the join message that the player have local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local CustomMessages = PlayerData.Settings:combine('JoinMessage') +CustomMessages:set_metadata{ + permission = 'command/join-message' +} --- When a players data loads show their message CustomMessages:on_load(function(player_name, player_message) diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua index 3353a8f3..e368eef8 100644 --- a/modules/data/quickbar.lua +++ b/modules/data/quickbar.lua @@ -10,6 +10,7 @@ local config = require 'config.preset_player_quickbar' --- @dep config.preset_pl local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerFilters = PlayerData.Settings:combine('QuickbarFilters') PlayerFilters:set_metadata{ + permission = 'command/save-quickbar', stringify = function(value) if not value then return 'No filters set' end local count = 0 diff --git a/modules/data/tag.lua b/modules/data/tag.lua index d01b6918..27190b7b 100644 --- a/modules/data/tag.lua +++ b/modules/data/tag.lua @@ -11,6 +11,9 @@ require 'config.expcore.command_role_parse' --- Stores the tag for a player local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerTags = PlayerData.Settings:combine('Tag') +PlayerTags:set_metadata{ + permission = 'command/tag' +} --- When your tag is updated then apply the changes PlayerTags:on_update(function(player_name, player_tag) diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index dbfaf13a..8938aedb 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -302,10 +302,12 @@ Gui.element(function(_, parent) for name, child in pairs(PlayerData.Settings.children) do local metadata = child.metadata local value = child:get(player_name) - if metadata.stringify then value = metadata.stringify(value) end - if value == nil then value = 'None set' end - Gui.centered_label(settings, 150, metadata.name or {'exp-settings.'..name}, metadata.tooltip or {'exp-settings.'..name..'-tooltip'}) - Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-settings.'..name..'-value-tooltip'}) + if not metadata.permission or Roles.player_allowed(player, metadata.permission) then + if metadata.stringify then value = metadata.stringify(value) end + if value == nil then value = 'None set' end + Gui.centered_label(settings, 150, metadata.name or {'exp-settings.'..name}, metadata.tooltip or {'exp-settings.'..name..'-tooltip'}) + Gui.centered_label(settings, 420, tostring(value), metadata.value_tooltip or {'exp-settings.'..name..'-value-tooltip'}) + end end end diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index e35b7ea4..edb4793b 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -13,6 +13,7 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local UsesServerUps = PlayerData.Settings:combine('UsesServerUps') UsesServerUps:set_default(false) UsesServerUps:set_metadata{ + permission = 'command/server-ups', stringify = function(value) return value and 'Visible' or 'Hidden' end } From db2c47ed9b4fadd0e8554bfe71f8c712d758d6d4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 3 Jun 2020 20:26:24 +0100 Subject: [PATCH 065/106] Cleaned Up Commands --- expcore/commands.lua | 781 +++++++++++++++++++++---------------------- 1 file changed, 389 insertions(+), 392 deletions(-) diff --git a/expcore/commands.lua b/expcore/commands.lua index 42b4bcbe..7b7b0c77 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -3,19 +3,17 @@ @core Commands @alias Commands -@usage--- Full code example, see below for explaination +@usage--- Full code example, see below for explanation 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('repeat-count', '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 + input = input:lower() + if input == 'true' or input == 'yes' then return true end + return false end) -:set_defaults{ smiley=false } -:set_flag('admin_only', true) -- command is admin only +:set_defaults{ smiley = false } +:set_flag('admin_only') -- 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) @@ -30,89 +28,85 @@ end) end end) -@usage--- 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. +@usage--- Example Command Explanation: +-- Making commands basics, 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 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: +-- First we create the new command, note 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) +-- Now for our first param, we have named it "repeat-count" and it will be a required value, between 1 and 5 inclusive: +-- By using "number-range-int" we are saying to use this parser to convert our input text, common ones exist in config.expcore.command_general_parse +:add_param('repeat-count', '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: +-- Our second param needs a custom parser, meaning it isnt defined with add_parser, this is an option for when it is unlikely for +-- any other command to use the same input type. In the example it is a boolean type and we are just showing it here as part of the example. +-- 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 + -- 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 + -- If it is not nil then we check for a truthy value + if input == 'true' or input == 'yes' then return true end + -- Note that because we did not return nil or reject then false will be passed to command callback, see example parse + return false 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: +-- Once all params are defined you can add some default values for your 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 fail and the default will not be used, the +-- default can also be a function which is passed the player as an argument and should return a value to be the default. +-- 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 + amount = 50, -- More than one value can be set at a time + player = function(player) return player end -- Default is the player using the command } --- 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 +-- Now the params are set up we can alter how the command works, we can set auth flags, add aliases, or enable "auto concat": +:set_flag('admin_only') -- 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: +-- want it to be, or as simple as our example; the command receives two params plus all param you have defined: -- 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 + -- 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 + -- See below for what can be used here end) --- Other values that can be returned from register -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 -- if any value is returned then it will be returned to the player via a Commands.success call +-- Values that can be returned from register callback +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 -- If any value is returned then it will be returned to the player via a Commands.success call @usage--- Example Authenticator: -- The command system is best used when you can control who uses commands; --- to do this would would need to define an authenticator which is ran every time a command is run; +-- to do this you 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 certain commands to require the user to be a game admin. -- For our admin only example we will set a flag to true when we want it to be admin only; --- when we define the command will will use :set_flag('admin_only', true); +-- when we define the command will will use :set_flag('admin_only'); -- then inside the authenticator we will test if the flag is present using: if flags.admin_only then -- When the authenticator is called by the command handler it will be passed 4 arguments: @@ -126,11 +120,11 @@ return -- if any value is returned then it will be returned to the player -- 1) when the "admin_only" flag is not set, which we take assume that any one can use it -- 2) when the "admin_only" flag is set, and the player is admin --- When want to prevent exicution of the command we must reject it, listed is how that can be done: +-- When want to prevent execution of the command we must reject it, listed is how that can be done: -- 1) return false -- this is the most basic rejection and should only be used while testing -- 2) return reject -- returning the reject function is as a fail safe in case you forget to call it, same as returning false --- 3) reject() -- this will block execution without to allowing further code to be ran in your authenticator --- 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned +-- 3) reject() -- this will block execution while allowing further code to be ran in your 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 your code before rejecting -- Example Code: @@ -145,15 +139,15 @@ Commands.add_authenticator(function(player, command, flags, reject) end end) -@usage--- Example Parse: +@usage--- Example Parser: -- Before you make a command 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 and validated before your command is executed; --- This module should is paired with a general command parse but you may want to create your own. +-- 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 -:add_param('repeat_count', false, 'number-range-int', 5, 10) -- "repeat_count" is required "number-range-int" in a range 5 to 10 inclusive +:add_param('repeat_count', 'number-range-int', 5, 10) -- "repeat_count" is a required "number-range-int" in a range 5 to 10 inclusive -- The command parse will be passed 3 arguments plus any other which you define, in our case: -- 1) input - the input that has been given by the user for this param, the role of this function is to transform this value @@ -193,133 +187,193 @@ end) local Game = require 'utils.game' --- @dep utils.game local player_return, write_json = _C.player_return, _C.write_json --- @dep expcore.common +local trace = debug.traceback local Commands = { - --- Values returned by the signal functions to cause the command system to react + --- Constant values used by the command system defines = { - error='CommandError', - unauthorized='CommandErrorUnauthorized', - success='CommandSuccess' + error = 'CommandError', + unauthorized = 'CommandErrorUnauthorized', + success = 'CommandSuccess' }, - --- Custom command data will be stored here - commands={}, - --- Set true to have authorize fail if a callback fails to run, more secure - authorization_fail_on_error=false, - --- Custom function are stored here which control who can use what commands - authorization={}, + --- An array of all custom commands that are registered + commands = {}, + --- When true any authenticator error will result in authorization failure, more secure + authorization_failure_on_error = false, + --- An array of all custom authenticators that are registered + authenticators = {}, --- Used to store default functions which are common parse function such as player or number in range - parse_functions={}, - -- Sends a value to the player, different to success as this does not signal the end of your command - print=player_return, - --- Used to store functions which gets added to new custom commands - _prototype={}, + parsers = {}, + --- Returns a value to the player, different to success as this does not signal the end of your command + print = player_return, + --- The command prototype which stores all command defining functions + _prototype = {}, } ---- Authenication. +--- Authentication. -- Functions that control who can use commands -- @section auth ---[[-- Adds an authorization callback, function used to check if a player if allowed to use a command -@tparam function callback the callback you want to register as an authenticator -@treturn number the index it was inserted at use to remove the callback, if anon function used +--[[-- Adds an authorization function, function used to check if a player if allowed to use a command +@tparam function authenticator The function you want to register as an authenticator +@treturn number The index it was inserted at, used to remove the authenticator -@usage-- Test if a command is admin only and if the player is admin +@usage-- If the admin_only flag is set, then make sure the player is an admin local admin_authenticator = Commands.add_authenticator(function(player, command, flags, reject) - if flags.admin_only then - return player.admin or reject('This command is for admins only!') + if flags.admin_only and not player.admin then + return reject('This command is for admins only!') else return true end end) ]] -function Commands.add_authenticator(callback) - table.insert(Commands.authorization, callback) - return #Commands.authorization +function Commands.add_authenticator(authenticator) + local next_index = #Commands.authenticators + 1 + Commands.authenticators[next_index] = authenticator + return next_index end ---[[-- Removes an authorization callback -@tparam function|number callback the callback to remove, an index returned by add_authenticator can be passed -@treturn boolean if the callback found and removed successfuly +--[[-- Removes an authorization function, can use the index or the function value +@tparam function|number authenticator The authenticator to remove, either the index return from add_authenticator or the function used +@treturn boolean If the authenticator was found and removed successfully -@usage-- Removing the admin authenticator, can not be done dueing runtime +@usage-- Removing the admin authenticator, can not be done during runtime Commands.remove_authenticator(admin_authenticator) ]] -function Commands.remove_authenticator(callback) - if type(callback) == 'number' then - -- if a number is passed then it is assumed to be the index - if Commands.authorization[callback] then - table.remove(Commands.authorization, callback) +function Commands.remove_authenticator(authenticator) + if type(authenticator) == 'number' then + -- If a number is passed then it is assumed to be the index + if Commands.authenticators[authenticator] then + Commands.authenticators[authenticator] = nil return true end else -- will search the array and remove the key - local index - for key, value in pairs(Commands.authorization) do - if value == callback then - index = key - break + for index, value in pairs(Commands.authenticators) do + if value == authenticator then + Commands.authenticators[index] = nil + return true end end - -- if the function was found it is removed - if index then - table.remove(Commands.authorization, index) - return true - end end return false end ---[[-- Mostly used internally, calls all authorization callbacks, returns if the player is authorized -@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 -@treturn[2] string|locale_string the reason given by the authenticator +--[[-- Mostly used internally, calls all authenticators, returns if the player is authorized +@tparam LuaPlayer player The player who is using the command, passed to authenticators +@tparam string command_name The name of the command being used, passed to authenticators +@treturn[1] boolean true Player is authorized +@treturn[1] string commands Define value for success +@treturn[2] boolean false Player is unauthorized +@treturn[2] string|locale_string The reason given by the failed authenticator @usage-- Test if a player can use "repeat-name" local authorized, status = Commands.authorize(game.player, 'repeat-name') ]] function Commands.authorize(player, command_name) - local failed - if not player then return true end local command_data = Commands.commands[command_name] if not command_data then return false end + if not player then return true end - -- function passed to authorization callback to make it simpler to use - local auth_fail = function(error_message) - failed = error_message or {'expcore-commands.unauthorized'} + -- This is the reject function given to authenticators + local failure_message + local function reject(message) + failure_message = message or {'expcore-commands.unauthorized'} return Commands.defines.unauthorized end - -- loops over each authorization callback if any return false or unauthorized command will fail - for _, callback in pairs(Commands.authorization) do - -- callback(player: LuaPlayer, command: string, flags: table, reject: function(error_message?: string)) - local success, rtn = pcall(callback, player, command_name, command_data.flags, auth_fail) - -- error handler - if not success then - -- the callback failed to run - log('[ERROR] Authorization failed: '..rtn) - if Commands.authorization_fail_on_error then - failed = 'Internal Error' - end - elseif rtn == false or rtn == Commands.defines.unauthorized or rtn == auth_fail or failed then - -- the callback returned unauthorized, failed be now be set if no value returned - failed = failed or {'expcore-commands.unauthorized'} - break + -- This is the internal error function used when an authenticator errors + local function authenticator_error(err) + log('[ERROR] Authorization failed: '..trace(err)) + if Commands.authorization_failure_on_error then + return reject('Internal Error') end end - -- checks if the authorization failed - if failed then - return false, failed - else - return true, Commands.defines.success + -- Loops over each authenticator, if any return false then then command will not be ran + for _, authenticator in pairs(Commands.authenticators) do + -- player: LuaPlayer, command: string, flags: table, reject: function(error_message: string) + local _, rtn = xpcall(authenticator, authenticator_error, player, command_name, command_data.flags, reject) + if rtn == false or rtn == Commands.defines.unauthorized or rtn == reject or failure_message ~= nil then + if failure_message == nil then failure_message = {'expcore-commands.unauthorized'} end + return false, failure_message + end end + + return true, Commands.defines.success +end + +--- Parse. +-- Functions that help with parsing +-- @section parse + +--[[-- Adds a parse function which can be called by name (used in add_param) +nb: this is not required as you can use the callback directly this just allows it to be called by name +@tparam string name The name of the parse, should describe a type of input such as number or player, must be unique +@tparam function parser The function that is ran to parse the input string +@treturn boolean Was the parse added, will be false if the name is already used + +@usage-- Adding a parse to validate integers in a given range +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 rather than a string, thus the param is now the correct type + return rtn + end +end) + +]] +function Commands.add_parse(name, parser) + if Commands.parsers[name] then return false end + Commands.parsers[name] = parser + return true +end + +--[[-- Removes a parse function, see add_parse for adding them, cant be done during runtime +@tparam string name The name of the parse to remove + +@usage-- Removing a parse +Commands.remove_parse('number-range-int') + +]] +function Commands.remove_parse(name) + Commands.parsers[name] = nil +end + +--[[-- Intended to be used within other parse functions, runs a parse and returns success and new value +@tparam string name The name of the parse to call, must be a registered parser +@tparam string input The input to pass to the parse, must be a string but not necessarily the original input +@tparam LuaPlayer player The player that is using the command, pass directly from your arguments +@tparam function reject The reject function, pass directly from your arguments +@treturn any The new value for the input, if nil is return then either there was an error or the input was nil + +@usage-- Parsing an int after first checking it is a number +Commands.add_parse('number', function(input, player, reject) + local number = tonumber(input) + if number then return number end + return reject('Input must be a number value') +end) + +Commands.add_parse('number-int', function(input, player, reject) + local number = Commands.parse('number', input, player, reject) + if not number then return end + return math.floor(number) +end) + +]] +function Commands.parse(name, input, player, reject, ...) + if not Commands.parsers[name] then return end + local success, rtn = pcall(Commands.parsers[name], input, player, reject, ...) + if not success then error(rtn, 2) return end + if not rtn or rtn == Commands.defines.error then return end + return rtn end --- Getters. @@ -327,10 +381,10 @@ end -- @section getters --[[-- Gets all commands that a player is allowed to use, game commands are not included -@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 +@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 -@usage-- Get the command you are allowed to use +@usage-- Get the commands you are allowed to use local commands = Commands.get(game.player) @usage-- Get all commands that are registered @@ -343,16 +397,16 @@ function Commands.get(player) local allowed = {} for name, command_data in pairs(Commands.commands) do if Commands.authorize(player, name) then - allowed[name]=command_data + allowed[name] = command_data end end return allowed end --[[-- Searches command names and help messages to find possible commands, game commands are included -@tparam string keyword the word which you are trying to find in your search -@tparam[opt] LuaPlayer 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 +@tparam string keyword The word which you are trying to find in your search +@tparam[opt] LuaPlayer 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 the player if a player was given @usage-- Get all commands which "repeat" local commands = Commands.search('repeat') @@ -365,7 +419,7 @@ function Commands.search(keyword, player) local custom_commands = Commands.get(player) local matches = {} keyword = keyword:lower() - -- loops over custom commands + -- Loops over custom commands for name, command_data in pairs(custom_commands) do -- combines name help and aliases into one message to be searched local search = string.format('%s %s %s', name, command_data.help, table.concat(command_data.aliases, ' ')) @@ -373,127 +427,63 @@ function Commands.search(keyword, player) matches[name] = command_data end end - -- loops over the names of game commands + -- Loops over the names of game commands for name, description in pairs(commands.game_commands) do if name:lower():match(keyword) then - -- because game commands lack some stuff that the custom ones have they are formated + -- because game commands lack some stuff that the custom ones have they are formatted matches[name] = { - name=name, - help=description, - description='', - aliases={} + name = name, + help = description, + description = '', + aliases = {} } end end return matches end ---- Parse. --- Functions that help with parsing --- @section parse - ---[[-- Adds a parse function which can be called by name (used in add_param) -nb: this is not required as you can use the callback directly this just allows it to be called by name -@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 -@treturn boolean was the parse added will be false if the name is already used - -@usage-- Adding a parse to validate ints in a given range -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 rather than a string, thus the param is now the correct type - return rtn - end -end) - -]] -function Commands.add_parse(name, callback) - if Commands.parse_functions[name] then - return false - else - Commands.parse_functions[name] = callback - return true - end -end - ---[[-- Removes a parse function, see add_parse for adding them -@tparam string name the name of the parse to remove - -@usage-- Removing a parse -Commands.remove_parse('number-range-int') - -]] -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 string name the name of the parse to call, must be registered parse -@tparam string input string the input to pass to the parse, must be a string but not necessarily the original input -@tparam LuaPlayer player the player that is 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 - -@usage-- Parsing a int in a given range -local parsed_input = Commands.parse('number-range-int', '7', player, reject, 1, 10) -- valid range 1 to 10 - -]] -function Commands.parse(name, input, player, reject, ...) - if not Commands.parse_functions[name] then return end - local success, rtn = pcall(Commands.parse_functions[name], input, player, reject, ...) - if not success then error(rtn, 2) return end - if not rtn then return end - if rtn == Commands.defines.error then return end - return rtn -end - --- Creation. -- Functions that create a new command -- @section creation ---[[-- Creates a new command object to added details to, note this does not register the command to the game api -@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 +--[[-- Creates a new command object to added details to, this does not register the command to the game api +@tparam string name The name of the command to be created +@tparam string help The help message for the command +@treturn table This will be used with other functions to define the new command @usage-- Define a new command -local command = Commands.new_command('repeat-name', 'Will repeat you name a number of times in chat.') ]] function Commands.new_command(name, help) local command = setmetatable({ - name=name, - help=help, - callback=function() Commands.internal_error(false, name, 'No callback registered') end, - auto_concat=false, - min_param_count=0, - max_param_count=0, - flags={}, -- stores flags that can be used by auth - aliases={}, -- n = name: string - params={}, -- [param_name] = {optional: boolean, default: any, parse: function, parse_args: table} + name = name, + help = help, + callback = function() Commands.internal_error(false, name, 'No callback registered') end, + auto_concat = false, + min_param_count = 0, + max_param_count = 0, + flags = {}, -- stores flags that can be used by auth + aliases = {}, -- stores aliases to this command + params = {}, -- [param_name] = {optional: boolean, default: any, parse: function, parse_args: table} }, { - __index= Commands._prototype + __index = Commands._prototype }) Commands.commands[name] = command return command end --[[-- Adds a new param to the command this will be displayed in the help and used to parse the input -@tparam string name the name of the new param that is being added to the command -@tparam[opt=false] 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 -@treturn Commands._prototype pass through to allow more functions to be called +@tparam string name The name of the new param that is being added to the command +@tparam[opt=false] boolean optional Is this param optional, these must be added after all required params +@tparam[opt] ?string|function parse This function will take the input and return a new value, if not given no parse is done +@tparam[opt] any ... Extra args you want to pass to the parse function; for example if the parse is general use +@treturn table Pass through to allow more functions to be called -@usage-- Adding a param which has an parse defined -command:add_param('repeat-count', false, 'number-range-int', 1, 5) +@usage-- Adding a required param which has a parser pre-defined +command:add_param('repeat-count', 'number-range-int', 1, 5) -@usage-- Adding a param which has a custom parse, see Commands.add_parse for details +@usage-- Adding an optional param which has a custom parse, see Commands.add_parse for details command:add_param('smiley', true, function(input, player, reject) if not input then return end return input:lower() == 'true' or input:lower() == 'yes' or false @@ -507,22 +497,24 @@ function Commands._prototype:add_param(name, optional, parse, ...) parse = optional optional = false end - parse = parse or function(string) return string end + self.params[name] = { - optional=optional, - parse=parse, - parse_args=parse_args + optional = optional, + parse = parse or function(string) return string end, + parse_args = parse_args } - self.max_param_count = self.max_param_count+1 + + self.max_param_count = self.max_param_count + 1 if not optional then - self.min_param_count = self.min_param_count+1 + self.min_param_count = self.min_param_count + 1 end + return self end ---[[-- Add default values to params, only as an effect if the param is optional, if default value is a function it is called with acting player -@tparam table defaults table which is keyed by the name of the param and the value is the default value -@treturn Commands._prototype pass through to allow more functions to be called +--[[-- Add default values to params, only as an effect if the param is optional, if default value is a function it is called with the acting player +@tparam table defaults A table which is keyed by the name of the param and the value is the default value for that param +@treturn table Pass through to allow more functions to be called @usage-- Adding default values command:set_defaults{ @@ -543,10 +535,10 @@ function Commands._prototype:set_defaults(defaults) return self 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 string name the name of the tag to be added, set to true if no value is given -@tparam[opt=true] any value the tag that you want can be anything that the authenticators are expecting -@treturn Commands._prototype pass through to allow more functions to be called +--[[-- Adds a flag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or usage type +@tparam string name The name of the flag to be added, set to true if no value is given +@tparam[opt=true] any value The value for the flag, can be anything that the authenticators are expecting +@treturn table Pass through to allow more functions to be called @usage-- Setting a custom flag command:set_flag('admin_only', true) @@ -556,31 +548,29 @@ command:set_flag('admin_only') ]] function Commands._prototype:set_flag(name, value) - value = value or true - self.flags[name] = value + self.flags[name] = value or true return self end ---[[-- Adds an alias, or multiple, that will also be registered with the same callback, eg /teleport can be used as /tp -@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 +--[[-- Adds an alias, or multiple, that will be registered to this command, eg /teleport can be used as /tp +@tparam string ... Any amount of aliases that you want this command to be callable with +@treturn table Pass through to allow more functions to be called @usage-- Added multiple aliases to a command command:add_alias('name', 'rname') ]] function Commands._prototype:add_alias(...) - for _, alias in pairs({...}) do - table.insert(self.aliases, alias) - --Commands.alias_map[alias] = self.name + local start_index = #self.aliases + for index, alias in ipairs{...} do + self.aliases[start_index+index] = alias end return self end ---[[-- Enables auto concatenation of any params on the end so quotes are not needed for last param +--[[-- Enables auto concatenation for this command, all params after the last are added to the last param, useful for reasons or other long text input 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 -@treturn Commands._prototype pass through to allow more functions to be called +@treturn table Pass through to allow more functions to be called @usage-- Enable auto concat for a command command:enable_auto_concat() @@ -591,12 +581,12 @@ function Commands._prototype:enable_auto_concat() return self end ---[[-- Adds the callback to the command and registers all aliases, params and help message with the game api +--[[-- Adds the callback to the command and registers: aliases, params and help message with the base game api nb: this must be the last function ran on the command and must be done for the command to work -@tparam function callback 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 any params added with add_param -@usage-- Registering your command to the game api -command:register(function(player, repeat_count, smiley, _) +@usage-- Registering your command to the base game api +command:register(function(player, repeat_count, smiley, raw) local msg = ') '..player.name if smiley then msg = ':'..msg end @@ -607,8 +597,9 @@ end) ]] function Commands._prototype:register(callback) - -- generates a description to be used self.callback = callback + + -- Generates a description to be used local description = '' for param_name, param_details in pairs(self.params) do if param_details.optional then @@ -618,19 +609,26 @@ function Commands._prototype:register(callback) end end self.description = description - -- registers the command under its own name - commands.add_command(self.name, {'expcore-commands.command-help', description, self.help}, function(command_event) - local success, err = pcall(Commands.run_command, command_event) - if not success then log('[ERROR] command/'..self.name..' :: '..err) end - end) - -- adds any aliases that it has + + -- Last resort error handler for commands + local function command_error(err) + Commands.internal_error(false, self.name, trace(err)) + end + + -- Callback that the game will call + local function command_callback(event) + event.name = self.name + xpcall(Commands.run_command, command_error, event) + end + + -- Registers the command under its own name + local help = {'expcore-commands.command-help', description, self.help} + commands.add_command(self.name, help, command_callback) + + -- Adds any aliases that it has for _, alias in pairs(self.aliases) do if not commands.commands[alias] and not commands.game_commands[alias] then - commands.add_command(alias, {'expcore-commands.command-help', description, self.help}, function(command_event) - command_event.name = self.name - local success, err = pcall(Commands.run_command, command_event) - Commands.internal_error(success, self.name, err) - end) + commands.add_command(alias, help, command_callback) end end end @@ -639,52 +637,9 @@ end -- Functions that indicate status -- @section status ---[[-- Sends an error message to the player and when returned will stop exicution of the command -nb: this is for non fatal errors meaning there is no log of this event, use during register callback -@tparam[opt=''] string error_message an optional error message that can be sent to the user -@tparam[opt=utility/wire_pickup] string play_sound the sound to play for the error -@treturn Commands.defines.error return this to command handler to exit execution - -@usage-- Send an error message to the player, and stops further code running -return Commands.error('The player you selected is offline') - -]] -function Commands.error(error_message, play_sound) - error_message = error_message or '' - player_return({'expcore-commands.command-fail', error_message}, 'orange_red') - if play_sound ~= false then - play_sound = play_sound or 'utility/wire_pickup' - if game.player then game.player.play_sound{path=play_sound} end - end - return Commands.defines.error -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 code exictuion may still continue -@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 - -@usage-- Used in the command system to log handler errors -local success, err = pcall(command_data.callback, player, unpack(params)) -if Commands.internal_error(success, command_data.name, err) then - return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err) -end - -]] -function Commands.internal_error(success, command_name, error_message) - if not success then - Commands.error('Internal Error, Please contact an admin', 'utility/cannot_build') - log{'expcore-commands.command-error-log-format', command_name, error_message} - end - return not success -end - ---[[-- Sends a value to the player, followed by a command complete message -nb: returning any value from your callback will trigger this function, return this function to prevent duplicate messages -@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 +--[[-- Sends a value to the player, followed by a command complete message, returning a value will trigger this automatically +@tparam[opt] any value The value to return to the player, if nil then only the success message is returned +@treturn Commands.defines.success Return this to the command handler to prevent two success messages @usage-- Print a custom success message return Commands.success('Your message has been printed') @@ -701,39 +656,81 @@ end --[[-- Sends a value to the player, different to success as this does not signal the end of your command @function print -@tparam any value the value that you want to return to the player -@tparam table colour the colour of the message that the player sees +@tparam any value The value that you want to return to the player +@tparam table colour The colour of the message that the player sees @usage-- Output a message to the player Commands.print('Your command is in progress') ]] --- logs command usage to file +--[[-- Sends an error message to the player and when returned will stop execution of the command +nb: this is for non fatal errors meaning there is no log of this event, use during register callback +@tparam[opt=''] string error_message An optional error message that can be sent to the user +@tparam[opt=utility/wire_pickup] string play_sound The sound to play for the error +@treturn Commands.defines.error Return this to command handler to terminate execution + +@usage-- Send an error message to the player, and stops further code running +return Commands.error('The player you selected is offline') + +]] +function Commands.error(error_message, play_sound) + error_message = error_message or '' + player_return({'expcore-commands.command-fail', error_message}, 'orange_red') + if play_sound ~= false then + play_sound = play_sound or 'utility/wire_pickup' + if game.player then game.player.play_sound{path=play_sound} end + end + return Commands.defines.error +end + +--[[-- Sends an error to the player and logs the error, used internally please avoid direct use +nb: use error(error_message) within your callback to trigger do not trigger directly as code execution may still continue +@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 + +@usage-- Used in the command system to log handler errors +local success, err = pcall(command_data.callback, player, unpack(params)) +if Commands.internal_error(success, command_data.name, err) then + return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err) +end + +]] +function Commands.internal_error(success, command_name, error_message) + if not success then + Commands.error('Internal Error, Please contact an admin', 'utility/cannot_build') + log{'expcore-commands.command-error-log-format', command_name, error_message} + end + return not success +end + +--- Logs command usage to file local function command_log(player, command, comment, params, raw, details) local player_name = player and player.name or '' write_json('log/commands.log', { - player_name=player_name, - command_name=command.name, - comment=comment, - details=details, - params=params, - raw=raw + player_name = player_name, + command_name = command.name, + comment = comment, + details = details, + params = params, + raw = raw }) end --- Main event function that is ran for all commands, used internally please avoid direct use --- @tparam table command_event passed directly from command event from the add_command function +-- @tparam table command_event Passed directly from the add_command function -- @usage Commands.run_command(event) function Commands.run_command(command_event) local command_data = Commands.commands[command_event.name] - -- player can be nil when it is the server + -- Player can be nil when it is the server local player if command_event.player_index and command_event.player_index > 0 then - player = Game.get_player_by_index(command_event.player_index) + player = game.players[command_event.player_index] end - -- checks if player is allowed to use the command + -- Check if the player is allowed to use the command local authorized, auth_fail = Commands.authorize(player, command_data.name) if not authorized then command_log(player, command_data, 'Failed Auth', {}, command_event.parameter) @@ -741,134 +738,134 @@ function Commands.run_command(command_event) return end - -- null param check + -- Check for parameter being nil if command_data.min_param_count > 0 and not command_event.parameter then command_log(player, command_data, 'No Params Given', {}, command_event.parameter) - Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) + Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description} return end - -- splits the arguments - local input_string = command_event.parameter or '' - local quote_params = {} -- stores any " " params - input_string = input_string:gsub(' "[^"]-"', function(w) - -- finds all " " params are removes spaces for the next part - local no_spaces = w:gsub('%s', '_') - local no_quotes = w:sub(2, -2) - quote_params[no_spaces]=no_quotes - if command_data.auto_concat then - -- if auto concat then don't remove quotes as it should be included later - quote_params[no_spaces]=w - end + -- Extract quoted arguments + local raw_input = command_event.parameter or '' + local quote_params = {} + local input_string = raw_input:gsub(' "[^"]-"', function(word) + word = word:sub(2) + local no_spaces = word:gsub('%s', '%%s') + quote_params[no_spaces] = word:sub(2, -2) return no_spaces end) - local raw_params = {} -- stores all params - local param_number = 0 + -- Extract unquoted arguments + local raw_params = {} local last_index = 0 + local param_number = 0 for word in input_string:gmatch('%S+') do param_number = param_number + 1 if param_number > command_data.max_param_count then -- there are too many params given to the command if not command_data.auto_concat then -- error as they should not be more - command_log(player, command_data, 'Invalid Input: Too Many Params', raw_params, input_string) - Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) + command_log(player, command_data, 'Invalid Input: Too Many Params', raw_params, raw_input) + Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description} return else -- concat to the last param if quote_params[word] then - -- if it was a " " param then the spaces are re added now - raw_params[last_index]=raw_params[last_index]..' '..quote_params[word] + raw_params[last_index] = raw_params[last_index]..' "'..quote_params[word]..'"' else - raw_params[last_index]=raw_params[last_index]..' '..word + raw_params[last_index] = raw_params[last_index]..' '..word end end else -- new param that needs to be added - -- all words are added to an array if quote_params[word] then - -- if it was a " " param then the spaces are re added now - table.insert(raw_params, quote_params[word]) last_index = last_index + 1 + raw_params[last_index] = quote_params[word] else - table.insert(raw_params, word) last_index = last_index + 1 + raw_params[last_index] = word end end end - -- checks param count + -- Check the param count local param_count = #raw_params if param_count < command_data.min_param_count then - command_log(player, command_data, 'Invalid Input: Not Enough Params', raw_params, input_string) - Commands.error({'expcore-commands.invalid-inputs', command_data.name, command_data.description}) + command_log(player, command_data, 'Invalid Input: Not Enough Params', raw_params, raw_input) + Commands.error{'expcore-commands.invalid-inputs', command_data.name, command_data.description} return end - -- parses the arguments + -- Parse the arguments local index = 1 local params = {} for param_name, param_data in pairs(command_data.params) do local parse_callback = param_data.parse + -- If its a string this get it from the parser table if type(parse_callback) == 'string' then - -- if its a string this allows it to be pulled from the common store - parse_callback = Commands.parse_functions[parse_callback] + parse_callback = Commands.parsers[parse_callback] end + + -- If its not a function throw and error if not type(parse_callback) == 'function' then - -- if its not a function throw and error Commands.internal_error(false, command_data.name, 'Invalid param parse '..tostring(param_data.parse)) - command_log(player, command_data, 'Internal Error: Invalid Param Parse', params, command_event.parameter, tostring(param_data.parse)) + command_log(player, command_data, 'Internal Error: Invalid Param Parse', params, raw_input, tostring(param_data.parse)) return end - -- used below as the reject function - local parse_fail = function(error_message) + + -- This is the reject function given to parse callbacks + local function reject(error_message) error_message = error_message or '' command_log(player, command_data, 'Invalid Param Given', raw_params, input_string) return Commands.error{'expcore-commands.invalid-param', param_name, error_message} end + -- input: string, player: LuaPlayer, reject: function, ... extra args - local success, param_parsed = pcall(parse_callback, raw_params[index], player, parse_fail, unpack(param_data.parse_args)) + local success, param_parsed = pcall(parse_callback, raw_params[index], player, reject, unpack(param_data.parse_args)) if Commands.internal_error(success, command_data.name, param_parsed) then - return command_log(player, command_data, 'Internal Error: Param Parse Fail', params, command_event.parameter, param_parsed) + return command_log(player, command_data, 'Internal Error: Param Parse Fail', params, raw_input, param_parsed) end + if param_data.optional == true and raw_params[index] == nil then - -- if it is optional and param is nil then it is set to default + -- If the param is optional and nil then it is set to default param_parsed = param_data.default if type(param_parsed) == 'function' then - -- player: LuaPlayer success, param_parsed = pcall(param_parsed, player) if Commands.internal_error(success, command_data.name, param_parsed) then - return command_log(player, command_data, 'Internal Error: Default Value Fail', params, command_event.parameter, param_parsed) + return command_log(player, command_data, 'Internal Error: Default Value Fail', params, raw_input, param_parsed) end end - elseif param_parsed == nil or param_parsed == Commands.defines.error or param_parsed == parse_fail then - -- no value was returned or error was returned, if nil then give generic error + + elseif param_parsed == nil or param_parsed == Commands.defines.error or param_parsed == reject then + -- No value was returned or error was returned, if nil then give generic error if not param_parsed == Commands.defines.error then - command_log(player, command_data, 'Invalid Param Given', raw_params, input_string, param_name) + command_log(player, command_data, 'Invalid Param Given', raw_params, raw_input, param_name) Commands.error{'expcore-commands.command-error-param-format', param_name, 'please make sure it is the correct type'} end return + end - -- adds the param to the table to be passed to the command callback - table.insert(params, param_parsed) - index=index+1 + + -- Add the param to the table to be passed to the command callback + params[index] = param_parsed + index = index + 1 end - -- runs the command + -- Run the command -- player: LuaPlayer, ... command params, raw: string - table.insert(params, command_data.max_param_count+1, input_string) - local success, err = pcall(command_data.callback, player, unpack(params)) - if Commands.internal_error(success, command_data.name, err) then - return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err) + params[command_data.max_param_count+1] = raw_input + local success, rtn = pcall(command_data.callback, player, unpack(params)) + if Commands.internal_error(success, command_data.name, rtn) then + return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, rtn) end - if err == Commands.defines.error or err == Commands.error then - return command_log(player, command_data, 'Custom Error', raw_params, input_string) - elseif err ~= Commands.defines.success and err ~= Commands.success then - -- in this case the user has not received any output - Commands.success(err) + + -- Give output to the player + if rtn == Commands.defines.error or rtn == Commands.error then + return command_log(player, command_data, 'Custom Error', raw_params, raw_input) + elseif rtn ~= Commands.defines.success and rtn ~= Commands.success then + Commands.success(rtn) end - command_log(player, command_data, 'Success', raw_params, input_string) + command_log(player, command_data, 'Success', raw_params, raw_input) end return Commands \ No newline at end of file From 8e1399e4fa7514805486a5eefc087231faac7a98 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 4 Jun 2020 13:53:52 +0100 Subject: [PATCH 066/106] Fixed more command quote errors --- expcore/commands.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/expcore/commands.lua b/expcore/commands.lua index 7b7b0c77..58efcbab 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -748,11 +748,11 @@ function Commands.run_command(command_event) -- Extract quoted arguments local raw_input = command_event.parameter or '' local quote_params = {} - local input_string = raw_input:gsub(' "[^"]-"', function(word) - word = word:sub(2) + local input_string = (' '..raw_input):gsub(' "[^"]-"', function(match) + local word = match:sub(2) local no_spaces = word:gsub('%s', '%%s') quote_params[no_spaces] = word:sub(2, -2) - return no_spaces + return ' '..no_spaces..' ' end) -- Extract unquoted arguments From b359af7af9f40cd174fa6e7981e3baa2e07f2155 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 4 Jun 2020 13:58:08 +0100 Subject: [PATCH 067/106] Removed Unnecessary Space --- expcore/commands.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/expcore/commands.lua b/expcore/commands.lua index 58efcbab..548fdddd 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -748,8 +748,7 @@ function Commands.run_command(command_event) -- Extract quoted arguments local raw_input = command_event.parameter or '' local quote_params = {} - local input_string = (' '..raw_input):gsub(' "[^"]-"', function(match) - local word = match:sub(2) + local input_string = raw_input:gsub('"[^"]-"', function(word) local no_spaces = word:gsub('%s', '%%s') quote_params[no_spaces] = word:sub(2, -2) return ' '..no_spaces..' ' From 45f26f76aa9bb7f22d26af8fb52cf76238783cc4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 5 Jun 2020 14:11:32 +0000 Subject: [PATCH 068/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 1118 +++++++++-------- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 98 files changed, 671 insertions(+), 641 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 5a6b8449..669c06d5 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 2942c0bc..f9e294f0 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 99bf09d8..7efb349b 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index fbce2287..424b99e8 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 1b6b0787..7b265ad7 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 9f77ec33..2c3d668c 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 95ee0167..91eb4362 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 0ce68777..fe66de58 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 05c32236..c9d89eeb 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index b24220b8..2d1f0b0a 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index e8a3bb5d..ffb5d96a 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index ff88223a..2bcfb928 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index ab97f68d..fae3b1b7 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index d23db61b..6f1c5581 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -374,7 +374,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index beccf3b3..569832f8 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index b38c265d..64b4add2 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -378,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 397b1835..2e73fbf2 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 3367f516..3a4b7e9e 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index aac5a4df..18f8d9a4 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -471,7 +471,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index a8bb5382..e9ad3e94 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 14d97866..8699f103 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -624,7 +624,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index d8e07f5b..ad156cc2 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 5e9e3195..0ccde92f 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index cf7d22d0..04c67a59 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index ce37a4a4..48697c49 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -334,7 +334,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 4dc3a0e0..85ca5e01 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 4a688d67..ab40976b 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -570,7 +570,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index e43b219c..9e6d0362 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 74388aa2..2e291447 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -497,7 +497,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 1008741d..ce01af65 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -582,7 +582,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index f25bf167..55e55431 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -519,7 +519,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 04774998..1aec71b0 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index f098e5d4..55a5e415 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -498,7 +498,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 2b236d7b..882e5a31 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 24957184..6148a87c 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index f4fa83fa..58fc5382 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -455,7 +455,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 4dc7de3e..1baa09db 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 2868dcbd..0081ead1 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -351,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 5a99bff4..33cceb93 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 8f7ca6c1..bebc1fc0 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index bcd4655e..c34c4d09 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 783e596d..a99a2c53 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -253,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index b11eba2d..a1853af2 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 5cf1adb0..fe5ae879 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -797,7 +797,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 2f15ddc0..d2e36ed5 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index c5b4fa5e..e098a32e 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 63d852d4..b65d9672 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -337,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 495d2657..4f581ac0 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index c32b11f5..f84a4cd0 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 830f0125..8bbffb73 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -847,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 6bbd8c83..e2f604e6 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -305,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 2bf61f84..b0b52719 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 539c6d80..30e3e500 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 48fc5871..d048df5e 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -757,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 5cb313e7..dd3fa74e 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -607,7 +607,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 6b03a8fd..62c651a7 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 1a98d575..dc1a65af 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 774cf9d2..ce4f147e 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -787,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 5b9b36eb..50dffbde 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 0911259b..2b4dfeb5 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1221,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 7b4cab45..9b4417b8 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1342,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 1e975af7..32e13820 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1123,7 +1123,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 12a812f6..6a1e6ddd 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -997,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index ad3b8ec9..ae643e4a 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -983,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 57d43498..dc0dc17c 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1478,7 +1478,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 42cd887a..f4dad565 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1520,7 +1520,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index ffd1e45b..7fa816ac 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -611,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 57acfd00..5fc3918f 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -44,9 +44,9 @@ - - + + @@ -224,9 +224,9 @@ - - + + @@ -258,19 +258,17 @@

    Usage

    -
    --- Full code example, see below for explaination
    +    
    --- Full code example, see below for explanation
     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('repeat-count', '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
    +    input = input:lower()
    +    if input == 'true' or input == 'yes' then return true end
    +    return false
     end)
    -:set_defaults{ smiley=false }
    -:set_flag('admin_only', true) -- command is admin only
    +:set_defaults{ smiley = false }
    +:set_flag('admin_only') -- 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)
    @@ -284,89 +282,85 @@
             Command.print(1..msg)
         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.
    +    
    --- Example Command Explanation:
    +-- Making commands basics, 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 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:
    +-- First we create the new command, note 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)
    +-- Now for our first param, we have named it "repeat-count" and it will be a required value, between 1 and 5 inclusive:
    +-- By using "number-range-int" we are saying to use this parser to convert our input text, common ones exist in config.expcore.command_general_parse
    +:add_param('repeat-count', '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:
    +-- Our second param needs a custom parser, meaning it isnt defined with add_parser, this is an option for when it is unlikely for
    +-- any other command to use the same input type. In the example it is a boolean type and we are just showing it here as part of the example.
    +-- 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
    +    -- 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
    +    -- If it is not nil then we check for a truthy value
    +    if input == 'true' or input == 'yes' then return true end
    +    -- Note that because we did not return nil or reject then false will be passed to command callback, see example parse
    +    return false
     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:
    +-- Once all params are defined you can add some default values for your 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 fail and the default will not be used, the
    +-- default can also be a function which is passed the player as an argument and should return a value to be the default.
    +-- 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
    -}
    +    amount = 50, -- More than one value can be set at a time
    +    player = function(player) return player end -- Default is the player using the command
    +}
     
    --- 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
    +-- Now the params are set up we can alter how the command works, we can set auth flags, add aliases, or enable "auto concat":
    +:set_flag('admin_only') -- 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:
    +-- want it to be, or as simple as our example; the command receives two params plus all param you have defined:
     -- 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
    +    -- 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
    +        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
    +    -- See below for what can be used here
     end)
     
    --- Other values that can be returned from register
    -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
    +-- Values that can be returned from register callback
    +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 Authenticator:
     -- The command system is best used when you can control who uses commands;
    --- to do this would would need to define an authenticator which is ran every time a command is run;
    +-- to do this you 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 certain commands to require the user to be a game admin.
     
     -- For our admin only example we will set a flag to true when we want it to be admin only;
    --- when we define the command will will use :set_flag('admin_only', true);
    +-- when we define the command will will use :set_flag('admin_only');
     -- then inside the authenticator we will test if the flag is present using: if flags.admin_only then
     
     -- When the authenticator is called by the command handler it will be passed 4 arguments:
    @@ -380,11 +374,11 @@
     -- 1) when the "admin_only" flag is not set, which we take assume that any one can use it
     -- 2) when the "admin_only" flag is set, and the player is admin
     
    --- When want to prevent exicution of the command we must reject it, listed is how that can be done:
    +-- When want to prevent execution of the command we must reject it, listed is how that can be done:
     -- 1) return false -- this is the most basic rejection and should only be used while testing
     -- 2) return reject -- returning the reject function is as a fail safe in case you forget to call it, same as returning false
    --- 3) reject() -- this will block execution without to allowing further code to be ran in your authenticator
    --- 4) reject('This command is for admins only!') -- Using reject as a function allows a error message to be returned
    +-- 3) reject() -- this will block execution while allowing further code to be ran in your 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 your code before rejecting
     
     -- Example Code:
    @@ -398,15 +392,15 @@
             return true
         end
     end)
    -
    --- Example Parse:
    +    
    --- Example Parser:
     -- Before you make a command 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 and validated before your command is executed;
    --- This module should is paired with a general command parse but you may want to create your own.
    +-- 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
    -:add_param('repeat_count', false, 'number-range-int', 5, 10) -- "repeat_count" is required "number-range-int" in a range 5 to 10 inclusive
    +:add_param('repeat_count', 'number-range-int', 5, 10) -- "repeat_count" is a required "number-range-int" in a range 5 to 10 inclusive
     
     -- The command parse will be passed 3 arguments plus any other which you define, in our case:
     -- 1) input - the input that has been given by the user for this param, the role of this function is to transform this value
    @@ -468,23 +462,23 @@
         
         
         defines
    -    Values returned by the signal functions to cause the command system to react
    +    Constant values used by the command system
         
         
         commands
    -    Custom command data will be stored here
    +    An array of all custom commands that are registered
         
         
    -    authorization
    -    Custom function are stored here which control who can use what commands
    +    authenticators
    +    An array of all custom authenticators that are registered
         
         
    -    parse_functions
    +    parsers
         Used to store default functions which are common parse function such as player or number in range
         
         
         _prototype
    -    Used to store functions which gets added to new custom commands
    +    The command prototype which stores all command defining functions
         
         
         
    @@ -495,28 +489,53 @@
         
         
         
    -    authorization_fail_on_error
    -    Set true to have authorize fail if a callback fails to run, more secure
    +    authorization_failure_on_error
    +    When true any authenticator error will result in authorization failure, more secure
    +    
    +    
    +    print
    +    Returns a value to the player, different to success as this does not signal the end of your command
         
         
         
         
    -    

    Authenication

    +

    Authentication

    - - + + - - + + - + + + +
    add_authenticator(callback)Adds an authorization callback, function used to check if a player if allowed to use a commandadd_authenticator(authenticator)Adds an authorization function, function used to check if a player if allowed to use a command
    remove_authenticator(callback)Removes an authorization callbackremove_authenticator(authenticator)Removes an authorization function, can use the index or the function value
    authorize(player, command_name)Mostly used internally, calls all authorization callbacks, returns if the player is authorizedMostly used internally, calls all authenticators, returns if the player is authorized
    + + +

    Parse

    + + + + + + + + + + + + + +
    add_parse(name, parser)Adds a parse function which can be called by name (used in add_param) +nb: this is not required 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, cant be done during runtime
    parse(name, input, player, reject)Intended to be used within other parse functions, runs a parse and returns success and new value
    @@ -538,60 +557,38 @@ -

    Parse

    - - - - - - - - - - - - - - - - -
    add_parse(name, callback)Adds a parse function which can be called by name (used in add_param) -nb: this is not required 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
    - -

    Creation

    - + - + - + - + - - + + - + - @@ -603,23 +600,22 @@ nb: this must be the last function ran on the command and must be done for the c - - - - - - - - - + + + + + + + + + @@ -697,7 +693,7 @@ nb: returning any value from your callback will trigger this function, return th
    -

    Values returned by the signal functions to cause the command system to react

    +

    Constant values used by the command system

    @@ -773,7 +769,7 @@ nb: returning any value from your callback will trigger this function, return th
    -

    Custom command data will be stored here

    +

    An array of all custom commands that are registered

    @@ -793,14 +789,14 @@ nb: returning any value from your callback will trigger this function, return th
    - # - authorization + # + authenticators
    -

    Custom function are stored here which control who can use what commands

    +

    An array of all custom authenticators that are registered

    @@ -820,8 +816,8 @@ nb: returning any value from your callback will trigger this function, return th
    - # - parse_functions + # + parsers
    @@ -854,7 +850,7 @@ nb: returning any value from your callback will trigger this function, return th
    -

    Used to store functions which gets added to new custom commands

    +

    The command prototype which stores all command defining functions

    @@ -877,14 +873,41 @@ nb: returning any value from your callback will trigger this function, return th
    - # - authorization_fail_on_error + # + authorization_failure_on_error
    -

    Set true to have authorize fail if a callback fails to run, more secure

    +

    When true any authenticator error will result in authorization failure, more secure

    +

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + print +
    +
    +
    +
    + +

    Returns a value to the player, different to success as this does not signal the end of your command

    @@ -902,19 +925,19 @@ nb: returning any value from your callback will trigger this function, return th
    -

    Authenication

    +

    Authentication

    # - add_authenticator(callback) + add_authenticator(authenticator)
    -

    Adds an authorization callback, function used to check if a player if allowed to use a command

    +

    Adds an authorization function, function used to check if a player if allowed to use a command

    @@ -928,13 +951,13 @@ nb: returning any value from your callback will trigger this function, return th
  • - callback + authenticator : (function) - the callback you want to register as an authenticator + The function you want to register as an authenticator
  • @@ -948,7 +971,7 @@ nb: returning any value from your callback will trigger this function, return th
    • (number) - the index it was inserted at use to remove the callback, if anon function used + The index it was inserted at, used to remove the authenticator
    @@ -959,11 +982,11 @@ nb: returning any value from your callback will trigger this function, return th Usage: -
    -- Test if a command is admin only and if the player is admin
    +    
    -- If the admin_only flag is set, then make sure the player is an admin
     local admin_authenticator =
     Commands.add_authenticator(function(player, command, flags, reject)
    -    if flags.admin_only then
    -        return player.admin or reject('This command is for admins only!')
    +    if flags.admin_only and not player.admin then
    +        return reject('This command is for admins only!')
         else
             return true
         end
    @@ -975,13 +998,13 @@ Commands.add_authenticator(function(player, command
         
    # - remove_authenticator(callback) + remove_authenticator(authenticator)
    -

    Removes an authorization callback

    +

    Removes an authorization function, can use the index or the function value

    @@ -995,13 +1018,13 @@ Commands.add_authenticator(function(player, command
  • - callback + authenticator : (function or number) - the callback to remove, an index returned by add_authenticator can be passed + The authenticator to remove, either the index return from add_authenticator or the function used
  • @@ -1015,7 +1038,7 @@ Commands.add_authenticator(function(player, command
    • (boolean) - if the callback found and removed successfuly + If the authenticator was found and removed successfully
    @@ -1026,7 +1049,7 @@ Commands.add_authenticator(function(player, command Usage: -
    -- Removing the admin authenticator, can not be done dueing runtime
    +    
    -- Removing the admin authenticator, can not be done during runtime
     Commands.remove_authenticator(admin_authenticator)
    @@ -1041,7 +1064,7 @@ Commands.add_authenticator(function(player, command
    -

    Mostly used internally, calls all authorization callbacks, returns if the player is authorized

    +

    Mostly used internally, calls all authenticators, returns if the player is authorized

    @@ -1061,7 +1084,7 @@ Commands.add_authenticator(function(player, command (LuaPlayer) - the player that is using the command, passed to callbacks + The player who is using the command, passed to authenticators @@ -1077,7 +1100,7 @@ Commands.add_authenticator(function(player, command (string) - the command that is being used, passed to callbacks + The name of the command being used, passed to authenticators @@ -1091,22 +1114,22 @@ Commands.add_authenticator(function(player, command
    • (boolean) - true player is authorized + true Player is authorized
    • (string) - commands const for success + commands Define value for success
    Or
    • (boolean) - false player is unauthorized + false Player is unauthorized
    • (string or locale_string) - the reason given by the authenticator + The reason given by the failed authenticator
    @@ -1121,151 +1144,6 @@ Commands.add_authenticator(function(player, command local authorized, status = Commands.authorize(game.player, 'repeat-name')
    -
    -
    -

    Getters

    -
    -
    -
    -
    - # - get([player]) -
    -
    -
    -
    - -

    Gets all commands that a player is allowed to use, game commands are not included

    -

    - - - Parameters: - -
      - - - - - -
    • - - player - - : - - (LuaPlayer) - - the player that you want to get commands of, nil will return all commands - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (table) - all commands that that player is allowed to use, or all commands -
    • -
    - - - - - - - - Usage: -
    -- Get the command you are allowed to use
    -local commands = Commands.get(game.player)
    -
    -- Get all commands that are registered
    -local commands = Commands.get()
    - - -
    -
    -
    -
    - # - search(keyword[, player]) -
    -
    -
    -
    - -

    Searches command names and help messages to find possible commands, game commands are included

    -

    - - - Parameters: - -
      - - - - - -
    • - - keyword - - : - - (string) - - the word which you are trying to find in your search - -
    • - - - - - -
    • - - player - - : - - (LuaPlayer) - - the player to get allowed commands of, if nil all commands are searched - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (table) - all commands that contain the key word, and allowed by player if player given -
    • -
    - - - - - - - - Usage: -
    -- Get all commands which "repeat"
    -local commands = Commands.search('repeat')
    -
    -- Get all commands which "repeat" and you are allowed to use
    -local commands = Commands.search('repeat', game.player)
    - -

    Parse

    @@ -1274,7 +1152,7 @@ Commands.add_authenticator(function(player, command
    # - add_parse(name, callback) + add_parse(name, parser)
    @@ -1301,7 +1179,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - the name of the parse, should be the type like player or player_alive, must be unique + The name of the parse, should describe a type of input such as number or player, must be unique @@ -1311,13 +1189,13 @@ nb: this is not required as you can use the callback directly this just allows i
  • - callback + parser : (function) - the callback that is ran to parse the input + The function that is ran to parse the input string
  • @@ -1331,7 +1209,7 @@ nb: this is not required as you can use the callback directly this just allows i
    • (boolean) - was the parse added will be false if the name is already used + Was the parse added, will be false if the name is already used
    @@ -1342,14 +1220,14 @@ nb: this is not required as you can use the callback directly this just allows i Usage: -
    -- Adding a parse to validate ints in a given range
    +    
    -- Adding a parse to validate integers in a given range
     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
    +        -- 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 rather than a string, thus the param is now the correct type
    +        -- Returns the input as a number rather than a string, thus the param is now the correct type
             return rtn
         end
     end)
    @@ -1366,7 +1244,7 @@ nb: this is not required as you can use the callback directly this just allows i
    -

    Removes a parse function, see add_parse for adding them

    +

    Removes a parse function, see add_parse for adding them, cant be done during runtime

    @@ -1386,7 +1264,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - the name of the parse to remove + The name of the parse to remove @@ -1439,7 +1317,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - the name of the parse to call, must be registered parse + The name of the parse to call, must be a registered parser @@ -1455,7 +1333,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - string the input to pass to the parse, must be a string but not necessarily the original input + The input to pass to the parse, must be a string but not necessarily the original input @@ -1471,7 +1349,7 @@ nb: this is not required as you can use the callback directly this just allows i (LuaPlayer) - the player that is using the command + The player that is using the command, pass directly from your arguments @@ -1487,7 +1365,7 @@ nb: this is not required as you can use the callback directly this just allows i (function) - the reject function that was passed by the command hander + The reject function, pass directly from your arguments @@ -1501,7 +1379,7 @@ nb: this is not required as you can use the callback directly this just allows i
    • (any) - the new value for the input, may be nil, if nil then either there was an error or input was nil + The new value for the input, if nil is return then either there was an error or the input was nil
    @@ -1512,9 +1390,163 @@ nb: this is not required as you can use the callback directly this just allows i Usage: -
    -- Parsing a int in a given range
    -local parsed_input = Commands.parse('number-range-int', '7', player, reject, 1, 10) -- valid range 1 to 10
    -
    +
    -- Parsing an int after first checking it is a number
    +Commands.add_parse('number', function(input, player, reject)
    +    local number = tonumber(input)
    +    if number then return number end
    +    return reject('Input must be a number value')
    +end)
    +
    +Commands.add_parse('number-int', function(input, player, reject)
    +    local number = Commands.parse('number', input, player, reject)
    +    if not number then return end
    +    return math.floor(number)
    +end)
    + + +
    + +

    Getters

    +
    +
    +
    +
    + # + get([player]) +
    +
    +
    +
    + +

    Gets all commands that a player is allowed to use, game commands are not included

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + The player that you want to get commands of, nil will return all commands + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + All commands that that player is allowed to use, or all commands +
    • +
    + + + + + + + + Usage: +
    -- Get the commands you are allowed to use
    +local commands = Commands.get(game.player)
    +
    -- Get all commands that are registered
    +local commands = Commands.get()
    + + +
    +
    +
    +
    + # + search(keyword[, player]) +
    +
    +
    +
    + +

    Searches command names and help messages to find possible commands, game commands are included

    +

    + + + Parameters: + +
      + + + + + +
    • + + keyword + + : + + (string) + + The word which you are trying to find in your search + +
    • + + + + + +
    • + + player + + : + + (LuaPlayer) + + The player to get allowed commands of, if nil all commands are searched + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + All commands that contain the key word, and allowed by the player if a player was given +
    • +
    + + + + + + + + Usage: +
    -- Get all commands which "repeat"
    +local commands = Commands.search('repeat')
    +
    -- Get all commands which "repeat" and you are allowed to use
    +local commands = Commands.search('repeat', game.player)
    @@ -1531,7 +1563,7 @@ nb: this is not required as you can use the callback directly this just allows i
    -

    Creates a new command object to added details to, note this does not register the command to the game api

    +

    Creates a new command object to added details to, this does not register the command to the game api

    @@ -1551,7 +1583,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - the name of the command to be created + The name of the command to be created @@ -1567,7 +1599,7 @@ nb: this is not required as you can use the callback directly this just allows i (string) - the help message for the command + The help message for the command @@ -1580,8 +1612,8 @@ nb: this is not required as you can use the callback directly this just allows i Returns:
    • - (Commands._prototype) - this will be used with other functions to generate the command functions + (table) + This will be used with other functions to define the new command
    @@ -1593,8 +1625,7 @@ nb: this is not required as you can use the callback directly this just allows i Usage:
    -- Define a new command
    -local command =
    -Commands.new_command('repeat-name', 'Will repeat you name a number of times in chat.')
    +Commands.new_command('repeat-name', 'Will repeat you name a number of times in chat.')
    @@ -1602,7 +1633,7 @@ Commands.new_command('repeat-name',
    # - Commands._prototype:add_param(name[, optional=false][, parse=pass function through][, ...]) + Commands._prototype:add_param(name[, optional=false][, parse][, ...])
    @@ -1628,7 +1659,7 @@ Commands.new_command('repeat-name', string) - the name of the new param that is being added to the command + The name of the new param that is being added to the command @@ -1644,7 +1675,7 @@ Commands.new_command('repeat-name', boolean) - is this param required for this command, these must be after all required params + Is this param optional, these must be added after all required params (default: false) @@ -1661,9 +1692,9 @@ Commands.new_command('repeat-name', string or function) - this function will take the input and return a new (or same) value + This function will take the input and return a new value, if not given no parse is done - (default: pass function through) + (optional) @@ -1676,8 +1707,9 @@ Commands.new_command('repeat-name', any) - extra args you want to pass to the parse function; for example if the parse is general use + Extra args you want to pass to the parse function; for example if the parse is general use (optional) @@ -1691,8 +1723,8 @@ Commands.new_command('repeat-name', Commands._prototype) - pass through to allow more functions to be called + (table) + Pass through to allow more functions to be called @@ -1703,9 +1735,9 @@ Commands.new_command('repeat-name', -- Adding a param which has an parse defined -command:add_param('repeat-count', false, 'number-range-int', 1, 5) -
    -- Adding a param which has a custom parse, see Commands.add_parse for details
    +    
    -- Adding a required param which has a parser pre-defined
    +command:add_param('repeat-count', 'number-range-int', 1, 5)
    +
    -- Adding an optional param which has a custom parse, see Commands.add_parse for details
     command:add_param('smiley', true, function(input, player, reject)
         if not input then return end
         return input:lower() == 'true' or input:lower() == 'yes' or false
    @@ -1723,7 +1755,7 @@ Commands.new_command('repeat-name', 
     
    -    

    Add default values to params, only as an effect if the param is optional, if default value is a function it is called with acting player

    +

    Add default values to params, only as an effect if the param is optional, if default value is a function it is called with the acting player

    @@ -1743,7 +1775,7 @@ Commands.new_command('repeat-name', table) - table which is keyed by the name of the param and the value is the default value + A table which is keyed by the name of the param and the value is the default value for that param @@ -1756,8 +1788,8 @@ Commands.new_command('repeat-name', Commands._prototype) - pass through to allow more functions to be called + (table) + Pass through to allow more functions to be called @@ -1789,7 +1821,7 @@ Commands.new_command('repeat-name', -

    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

    +

    Adds a flag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or usage type

    @@ -1809,7 +1841,7 @@ Commands.new_command('repeat-name', string) - the name of the tag to be added, set to true if no value is given + The name of the flag to be added, set to true if no value is given @@ -1825,7 +1857,7 @@ Commands.new_command('repeat-name', any) - the tag that you want can be anything that the authenticators are expecting + The value for the flag, can be anything that the authenticators are expecting (default: true) @@ -1839,8 +1871,8 @@ Commands.new_command('repeat-name', Commands._prototype) - pass through to allow more functions to be called + (table) + Pass through to allow more functions to be called @@ -1862,13 +1894,13 @@ Commands.new_command('repeat-name',
    # - Commands._prototype:add_alias(any) + Commands._prototype:add_alias(...)
    -

    Adds an alias, or multiple, that will also be registered with the same callback, eg /teleport can be used as /tp

    +

    Adds an alias, or multiple, that will be registered to this command, eg /teleport can be used as /tp

    @@ -1882,13 +1914,13 @@ Commands.new_command('repeat-name', - any + ... : (string) - ... amount of aliases that you want this command to be callable with + Any amount of aliases that you want this command to be callable with @@ -1901,8 +1933,8 @@ Commands.new_command('repeat-name', Commands._prototype) - pass through to allow more functions to be called + (table) + Pass through to allow more functions to be called @@ -1928,9 +1960,8 @@ Commands.new_command('repeat-name', -

    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

    +

    Enables auto concatenation for this command, all params after the last are added to the last param, useful for reasons or other long text input +nb: this will disable max param checking as they will be concatenated onto the end of that last param

    @@ -1940,8 +1971,8 @@ this can be useful for reasons or longs text, can only have one per command

    Returns:
    • - (Commands._prototype) - pass through to allow more functions to be called + (table) + Pass through to allow more functions to be called
    @@ -1967,7 +1998,7 @@ this can be useful for reasons or longs text, can only have one per command

    -

    Adds the callback to the command and registers all aliases, params and help message with the game api +

    Adds the callback to the command and registers: aliases, params and help message with the base game api nb: this must be the last function ran on the command and must be done for the command to work

    @@ -1988,7 +2019,7 @@ nb: this must be the last function ran on the command and must be done for the c (function) - the callback for the command, will receive the player running command, and params added with add_param + The callback for the command, will receive the player running command, and any params added with add_param @@ -2006,8 +2037,8 @@ nb: this must be the last function ran on the command and must be done for the c Usage: -
    -- Registering your command to the game api
    -command:register(function(player, repeat_count, smiley, _)
    +    
    -- Registering your command to the base game api
    +command:register(function(player, repeat_count, smiley, raw)
         local msg = ') '..player.name
         if smiley then msg = ':'..msg end
     
    @@ -2024,181 +2055,6 @@ nb: this must be the last function ran on the command and must be done for the c
         
    - # - error([error_message=''][, play_sound=utility/wire_pickup]) -
    -
    -
    -
    - -

    Sends an error message to the player and when returned will stop exicution of the command -nb: this is for non fatal errors meaning there is no log of this event, use during register callback

    -

    - - - Parameters: - -
      - - - - - -
    • - - error_message - - : - - (string) - - an optional error message that can be sent to the user - - (default: '') -
    • - - - - - -
    • - - play_sound - - : - - (string) - - the sound to play for the error - - (default: utility/wire_pickup) -
    • - - -
    - - - - - Returns: -
      -
    • - (Commands.defines.error) - return this to command handler to exit execution -
    • -
    - - - - - - - - Usage: -
    -- Send an error message to the player, and stops further code running
    -return Commands.error('The player you selected is offline')
    - - -
    -
    -
    -
    - # - 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 code exictuion may still continue

    -

    - - - Parameters: - -
      - - - - - -
    • - - success - - : - - (boolean) - - the success value returned from pcall, or just false to trigger error - -
    • - - - - - -
    • - - command_name - - : - - (string) - - the name of the command this is used within the log - -
    • - - - - - -
    • - - error_message - - : - - (string) - - the error returned by pcall or some other error, this is logged and not returned to player - -
    • - - -
    - - - - - Returns: -
      -
    • - (boolean) - the opposite of success so true means to cancel execution, used internally -
    • -
    - - - - - - - - Usage: -
    -- Used in the command system to log handler errors
    -local success, err = pcall(command_data.callback, player, unpack(params))
    -if Commands.internal_error(success, command_data.name, err) then
    -    return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err)
    -end
    - - -
    -
    -
    -
    # success([value])
    @@ -2206,8 +2062,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire
    -

    Sends a value to the player, followed by a command complete message -nb: returning any value from your callback will trigger this function, return this function to prevent duplicate messages

    +

    Sends a value to the player, followed by a command complete message, returning a value will trigger this automatically

    @@ -2227,7 +2082,7 @@ nb: returning any value from your callback will trigger this function, return th (any) - the value to return to the player, if nil then only success message returned + The value to return to the player, if nil then only the success message is returned (optional) @@ -2242,7 +2097,7 @@ nb: returning any value from your callback will trigger this function, return th
    • (Commands.defines.success) - return this to the command handler to prevent two success messages + Return this to the command handler to prevent two success messages
    @@ -2290,7 +2145,7 @@ nb: returning any value from your callback will trigger this function, return th (any) - the value that you want to return to the player + The value that you want to return to the player @@ -2306,7 +2161,7 @@ nb: returning any value from your callback will trigger this function, return th (table) - the colour of the message that the player sees + The colour of the message that the player sees @@ -2328,6 +2183,181 @@ nb: returning any value from your callback will trigger this function, return th Commands.print('Your command is in progress')
    +
    +
    +
    +
    + # + error([error_message=''][, play_sound=utility/wire_pickup]) +
    +
    +
    +
    + +

    Sends an error message to the player and when returned will stop execution of the command +nb: this is for non fatal errors meaning there is no log of this event, use during register callback

    +

    + + + Parameters: + +
      + + + + + +
    • + + error_message + + : + + (string) + + An optional error message that can be sent to the user + + (default: '') +
    • + + + + + +
    • + + play_sound + + : + + (string) + + The sound to play for the error + + (default: utility/wire_pickup) +
    • + + +
    + + + + + Returns: +
      +
    • + (Commands.defines.error) + Return this to command handler to terminate execution +
    • +
    + + + + + + + + Usage: +
    -- Send an error message to the player, and stops further code running
    +return Commands.error('The player you selected is offline')
    + + +
    +
    +
    +
    + # + internal_error(success, command_name, error_message) +
    +
    +
    +
    + +

    Sends an error to the player and logs the error, used internally please avoid direct use +nb: use error(error_message) within your callback to trigger do not trigger directly as code execution may still continue

    +

    + + + Parameters: + +
      + + + + + +
    • + + success + + : + + (boolean) + + The success value returned from pcall, or just false to trigger error + +
    • + + + + + +
    • + + command_name + + : + + (string) + + The name of the command this is used within the log + +
    • + + + + + +
    • + + error_message + + : + + (string) + + The error returned by pcall or some other error, this is logged and not returned to player + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + The opposite of success so true means to cancel execution, used internally +
    • +
    + + + + + + + + Usage: +
    -- Used in the command system to log handler errors
    +local success, err = pcall(command_data.callback, player, unpack(params))
    +if Commands.internal_error(success, command_data.name, err) then
    +    return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err)
    +end
    + +
    @@ -2359,7 +2389,7 @@ nb: returning any value from your callback will trigger this function, return th (table) - passed directly from command event from the add_command function + Passed directly from the add_command function @@ -2396,7 +2426,7 @@ nb: returning any value from your callback will trigger this function, return th generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 21ac0209..13e05173 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2765,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index d5d976f0..530fe6ab 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2945,7 +2945,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 1bf64be1..4bf5814d 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1441,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index daefcd1c..3665e58d 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4419,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index b7c3a0b6..68c80163 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -529,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 2190c925..a94bcd3a 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3348,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index d55aad15..b2e4a570 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 37ca37de..c0ebd14f 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index bfdca1be..057b26d0 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -428,7 +428,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 77cf6ac2..aa18e92d 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 3773168e..75269c96 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -406,7 +406,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 4ca8c3d6..0f53f092 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index b0f12a4f..005be88f 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -732,7 +732,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index e79c9f55..d35b07c5 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -769,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 81233cbf..7d119932 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -704,7 +704,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index b024ec4d..35554414 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -583,7 +583,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 4020572d..234a52bf 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -769,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index bdd5376d..4d1a8a45 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1040,7 +1040,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index e41ea3c5..fd463d14 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -450,7 +450,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index dc3b8ce7..118574fd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -540,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 7f3eb19a..ee9a3a9e 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 83ac9ddb..61efcb6f 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -306,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index b175f514..f96e2246 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -667,7 +667,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 3bf9a513..01c6abf4 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 72bc3296..2068f31c 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2021,7 +2021,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 4efd1950..0d432869 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1305,7 +1305,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 10b173aa..8a752b58 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index a8c63ed7..1936ce1c 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -664,7 +664,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 8d3a2cfa..b0ab1beb 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -802,7 +802,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index c825802b..1b4fd5f4 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -354,7 +354,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 3fdf4fd6120e459b36ba1252327654561d4b7936 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 5 Jun 2020 20:44:23 +0100 Subject: [PATCH 069/106] Fixed marks issues round 2 --- locale/en/data.cfg | 12 ++++++------ modules/control/warnings.lua | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/en/data.cfg b/locale/en/data.cfg index e045d478..5c52ed15 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -7,8 +7,8 @@ saved=Your quickbar filters have been saved. [exp-required] Warnings=Warnings -Warnings-tooltip=The total number of warnings you have recieved from staff -Warnings-value-tooltip=The total number of warnings you have recieved from staff +Warnings-tooltip=The total number of warnings you have received from staff +Warnings-value-tooltip=The total number of warnings you have received from staff [exp-settings] Colour=Colour Colour-tooltip=Your player colour @@ -36,7 +36,7 @@ Bonus-value-tooltip=Change by using /bonus MapsPlayed=Maps Played MapsPlayed-tooltip=The number of unique maps you have played on JoinCount=Join Count -JoinCount-tooltip=The amount of times you have joined our servers +JoinCount-tooltip=The number of times you have joined our servers Playtime=Playtime Playtime-tooltip=The amount of time you have spent on our servers AfkTime=AFK Time @@ -68,8 +68,8 @@ ItemsPickedUp-tooltip=The number of items you have picked up Kills=Kills Kills-tooltip=The number of biters and biter bases you have squished Deaths=Deaths -Deaths-tooltip=The amount of times you have died -DamageDealt=Damage Delt +Deaths-tooltip=The number of times you have died +DamageDealt=Damage Dealt DamageDealt-tooltip=The amount of damage you have dealt to other forces DistanceTravelled=Distance Travelled DistanceTravelled-tooltip=The total distance in tiles that you have travelled @@ -78,6 +78,6 @@ CapsulesUsed-tooltip=The number of capsules you have used EntityRepaired=Machines Repaired EntityRepaired-tooltip=The number of machines which you have repaired DeconstructionPlannerUsed=Decon Planner Used -DeconstructionPlannerUsed-tooltip=The amount of times you have used the deconstruction Planner +DeconstructionPlannerUsed-tooltip=The number of times you have used the deconstruction planner MapTagsMade=Map Tags Created MapTagsMade-tooltip=The number of map tags you have created \ No newline at end of file diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua index 95c77a15..71614c48 100644 --- a/modules/control/warnings.lua +++ b/modules/control/warnings.lua @@ -103,7 +103,7 @@ function Warnings.add_warning(player, by_player_name, reason) if not player then return end if not by_player_name then return end - reason = reason or 'Non given.' + reason = reason or 'None given.' local warning_count PlayerWarnings:update(player.name, function(_, warnings) From 2709cc9a7dec733e924f8772d16bacbdb691c99b Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 6 Jun 2020 01:02:46 +0000 Subject: [PATCH 070/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 40 +++++++-- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 42 +++++++-- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 89 ++++++++++++++++++- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 30 ++++++- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 98 files changed, 281 insertions(+), 108 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 669c06d5..de6825c9 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index f9e294f0..c3f48db8 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 7efb349b..82af5bda 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 424b99e8..ab4773b7 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 7b265ad7..b4ae7b75 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 2c3d668c..495af07e 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 91eb4362..2ed803a6 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index fe66de58..14a95521 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index c9d89eeb..f70591ca 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 2d1f0b0a..7af67ea8 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index ffb5d96a..e9191a83 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 2bcfb928..01e7e238 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index fae3b1b7..ea59d9e4 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 6f1c5581..dec6279c 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -374,7 +374,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 569832f8..a3ce0bd3 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 64b4add2..da326dfa 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -378,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 2e73fbf2..b1541d96 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 3a4b7e9e..b04d2a98 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 18f8d9a4..40bc6705 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -471,7 +471,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index e9ad3e94..ce07a2dd 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 8699f103..1b6d3b06 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -624,7 +624,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index ad156cc2..735f7680 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 0ccde92f..42101805 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 04c67a59..20edfff3 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 48697c49..95fd333f 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -334,7 +334,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 85ca5e01..d44d6c46 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index ab40976b..fd5b9c47 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -570,7 +570,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 9e6d0362..0a00d231 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 2e291447..31ce2dc2 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -497,7 +497,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index ce01af65..f242a55b 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -582,7 +582,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 55e55431..8cc9f9c5 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -519,7 +519,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 1aec71b0..d4409959 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 55a5e415..8aed7829 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -498,7 +498,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 882e5a31..b1a8d584 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 6148a87c..2f851205 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 58fc5382..7c6ea247 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -455,7 +455,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 1baa09db..d02294ee 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 0081ead1..20ab2b44 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -351,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 33cceb93..5366c261 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index bebc1fc0..45d5e856 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index c34c4d09..aff18133 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index a99a2c53..d0fff0df 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -253,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index a1853af2..53b6a5d8 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index fe5ae879..fc027ea0 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -797,7 +797,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index d2e36ed5..fd55ea06 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index e098a32e..c308f31d 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index b65d9672..81b7076b 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -337,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 4f581ac0..412ca1d2 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index f84a4cd0..58666542 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 8bbffb73..8716c6fc 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -847,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index e2f604e6..6ad34f42 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -305,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index b0b52719..f6290b9a 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 30e3e500..aa532141 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index d048df5e..995e7f19 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -757,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index dd3fa74e..bb0989ab 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -260,7 +260,7 @@
    - + @@ -286,6 +286,9 @@ + + +
    new_command(name, help)Creates a new command object to added details to, note this does not register the command to the game apiCreates a new command object to added details to, this does not register the command to the game api
    Commands._prototype:add_param(name[, optional=false][, parse=pass function through][, ...])Commands._prototype:add_param(name[, optional=false][, parse][, ...]) 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)Add default values to params, only as an effect if the param is optional, if default value is a function it is called with acting playerAdd default values to params, only as an effect if the param is optional, if default value is a function it is called with the acting player
    Commands._prototype:set_flag(name[, value=true])Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or typeAdds a flag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or usage type
    Commands._prototype:add_alias(any)Adds an alias, or multiple, that will also be registered with the same callback, eg /teleport can be used as /tpCommands._prototype:add_alias(...)Adds an alias, or multiple, that will be registered to this command, eg /teleport can be used as /tp
    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 commandEnables auto concatenation for this command, all params after the last are added to the last param, useful for reasons or other long text input +nb: this will disable max param checking as they will be concatenated onto the end of that last param
    Commands._prototype:register(callback)Adds the callback to the command and registers all aliases, params and help message with the game api + Adds the callback to the command and registers: aliases, params and help message with the base game api 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=utility/wire_pickup])Sends an error message to the player and when returned will stop exicution of the command -nb: this is for non fatal errors meaning there is no log of this event, use during register callback
    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 code exictuion may still continue
    success([value])Sends a value to the player, followed by a command complete message -nb: returning any value from your callback will trigger this function, return this function to prevent duplicate messagesSends a value to the player, followed by a command complete message, returning a value will trigger this automatically
    print(value, colour) Sends a value to the player, different to success as this does not signal the end of your command
    error([error_message=''][, play_sound=utility/wire_pickup])Sends an error message to the player and when returned will stop execution of the command +nb: this is for non fatal errors meaning there is no log of this event, use during register callback
    internal_error(success, command_name, error_message)Sends an error to the player and logs the error, used internally please avoid direct use +nb: use error(error_message) within your callback to trigger do not trigger directly as code execution may still continue
    run_command(command_event) AfkTime
    DistanceTraveledDistanceTravelled
    MachinesRemoved
    counters
    display_order
    @@ -352,15 +355,15 @@
    - # - DistanceTraveled + # + DistanceTravelled

    -

    If distance traveled is checked, only counts if not afk

    +

    If distance Travelled is checked, only counts if not afk

    @@ -585,6 +588,33 @@ + + + + + + +
    +
    +
    +
    + # + display_order +
    +
    +
    +
    + +

    +

    The order that the statistics should be shown in when in a gui or command

    + + + + + + + + @@ -607,7 +637,7 @@ generated by LDoc
    diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 62c651a7..90ef3ab9 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index dc1a65af..e4c292b7 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index ce4f147e..bc538b34 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -787,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 50dffbde..abad4951 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 2b4dfeb5..fa2e53ea 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1221,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 9b4417b8..a377af30 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1342,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 32e13820..5dff543b 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1123,7 +1123,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 6a1e6ddd..d5fdb1a6 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -997,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index ae643e4a..984250fe 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -983,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index dc0dc17c..fa7a7977 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -287,6 +287,9 @@ config.warnings + + expcore.player_data + @@ -309,7 +312,7 @@ - +
    on_script_warning_removedWhen a warning is remnoved from a player, by the scriptWhen a warning is removed from a player, by the script
    @@ -321,7 +324,7 @@ get_warnings(player) - Gets an array of warnings that the player has, always returns a list even if emtpy + Gets an array of warnings that the player has, always returns a list even if empty count_warnings(player) @@ -333,7 +336,7 @@ remove_warning(player, by_player_name) - Removes a warning from a player, always removes the earlyist warning, fifo + Removes a warning from a player, always removes the earliest warning, fifo clear_warnings(player, by_player_name) @@ -461,6 +464,31 @@ + + + + + + +
    +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + @@ -759,7 +787,7 @@
    -

    When a warning is remnoved from a player, by the script

    +

    When a warning is removed from a player, by the script

    @@ -828,7 +856,7 @@
    -

    Gets an array of warnings that the player has, always returns a list even if emtpy

    +

    Gets an array of warnings that the player has, always returns a list even if empty

    @@ -1032,7 +1060,7 @@
    -

    Removes a warning from a player, always removes the earlyist warning, fifo

    +

    Removes a warning from a player, always removes the earliest warning, fifo

    @@ -1478,7 +1506,7 @@ generated by LDoc
    diff --git a/docs/control/Warps.html b/docs/control/Warps.html index f4dad565..e11b929f 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1520,7 +1520,7 @@ Warps.make_warp_tag(warp_id)
    generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 7fa816ac..37f7e007 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -611,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 5fc3918f..59736ed2 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2426,7 +2426,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 13e05173..b9b685c6 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2765,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 530fe6ab..2cf1bbf1 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2945,7 +2945,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 4bf5814d..bac4e0a8 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1441,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 3665e58d..e12b59af 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4419,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 68c80163..7f791ea1 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -529,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index a94bcd3a..952c61f7 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3348,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index b2e4a570..4840cbb5 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index c0ebd14f..759769e0 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 057b26d0..67b64d59 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -428,7 +428,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index aa18e92d..6d9b0ab6 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 75269c96..a88f2a84 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -406,7 +406,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 0f53f092..48b9a8d7 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 005be88f..3495bf87 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -732,7 +732,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index d35b07c5..6d328541 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -266,6 +266,9 @@ expcore.commands + expcore.player_data + + utils.event @@ -274,6 +277,9 @@ expcore.common + + util + @@ -315,6 +321,10 @@ + + + + @@ -399,6 +409,31 @@ + + + + + + + +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + @@ -474,6 +509,31 @@ + + + + + + +
    +
    +
    +
    + # + util +
    +
    +
    +
    + + + + + + + + + @@ -693,6 +753,33 @@ + + + + + + +
    +
    +
    +
    + # + commands_content +
    +
    +
    +
    + +

    Content area for the player data tab

    +

    + + + + + + + + @@ -769,7 +856,7 @@ generated by LDoc
    diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 7d119932..1b1e664f 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -704,7 +704,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 35554414..58c6d724 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -583,7 +583,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 234a52bf..bada7383 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -769,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 4d1a8a45..e99e8edd 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1040,7 +1040,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index fd463d14..62f48099 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -267,6 +267,9 @@
    + + +
    Content area for the servers tab
    commands_contentContent area for the player data tab
    readme Main readme container for the center flow
    expcore.commands
    expcore.player_data
    @@ -368,6 +371,31 @@ + + + + + + + +
    +
    +
    + # + expcore.player_data +
    +
    +
    +
    + + + + + + + + + @@ -450,7 +478,7 @@ generated by LDoc
    diff --git a/docs/index.html b/docs/index.html index 118574fd..feaa2df9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -540,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index ee9a3a9e..d75a3586 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 61efcb6f..d9bd3568 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -306,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index f96e2246..f4b0dd18 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -667,7 +667,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 01c6abf4..afcf3255 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 2068f31c..2e05bd16 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2021,7 +2021,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 0d432869..246739de 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1305,7 +1305,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 8a752b58..3d84dc23 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 1936ce1c..4a7529f7 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -664,7 +664,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index b0ab1beb..4bda0bff 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -802,7 +802,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 1b4fd5f4..87f1dc0d 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -354,7 +354,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From aff3fea29db845876ca5ad76a4cccd3c2df6e374 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 14 Jun 2020 18:48:24 +0100 Subject: [PATCH 071/106] Added External Core Module --- expcore/external.lua | 159 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 expcore/external.lua diff --git a/expcore/external.lua b/expcore/external.lua new file mode 100644 index 00000000..3a54b195 --- /dev/null +++ b/expcore/external.lua @@ -0,0 +1,159 @@ +--[[-- Core Module - External +- A module used to make accessing externally set data easier. +@core External +@alias External + +@usage-- Printing all server to chat +local External = require 'expcore.external' --- @dep expcore.external + +local message = 'id: %s name: %s version: %s status: %s' +for server_id, server in pairs(External.get_servers()) do + local status = External.get_server_status(server_id) + game.print(message:format(server_id, server.name, server.version, status)) +end + +]] + +local Event = require 'utils.event' --- @dep utils.event +local concat = table.concat + +local External = {} + +--- Makes local links to the data is global.ext if it exists +local ext, var +Event.on_load(function() + ext = global.ext + if ext then var = ext.var end +end) + +--[[-- Checks that local links are valid, will try to add the links if invalid +@treturn boolean If the external data is valid, if false you should not call any other methods from External + +@usage-- Check that external data is valid +if not External.validate() then + -- error code here +end + +]] +function External.validate() + if ext ~= nil and var ~= nil then + return true + elseif global.ext ~= nil then + ext = global.ext + var = ext.var + return var ~= nil + end + return false +end + +--[[-- Gets a table of all the servers, key is the server id, value is the server details +@treturn table A table containing all the servers, key is the server id, value is the server details + +@usage-- Get all servers +local servers = External.get_servers() + +]] +function External.get_servers() + assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + return assert(ext.servers, 'No server list was found, please ensure that the external service is running') +end + +--[[-- Gets a table of all the servers filtered by name, key is the server id, value is the server details +@tparam string search The string to search for, names, short_names and ids are checked for this string. +@treturn table A table containing all the servers filtered by name, key is the server id, value is the server details + +@usage-- Get all servers with public in the name +local servers = External.get_servers_filtered(public) + +]] +function External.get_servers_filtered(search) + assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') + local found_servers = {} + search = search:lower() + for server_id, server in pairs(servers) do + local str = concat{server.name, server.short_name, server.id} + if str:lower():match(search, 1, true) then found_servers[server_id] = server end + end + return found_servers +end + +--[[-- Gets the details of the current server +@treturn table The details for the current server + +@usage-- Get the details of the current server +local server = External.get_current_server() + +]] +function External.get_current_server() + assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') + local server_id = assert(ext.current, 'No current id was found, please ensure that the external service is running') + return servers[server_id] +end + +--[[-- Gets the details of the given server +@tparam string server_id The internal server if for the server you want the details of +@treturn table The details of the given server + +@usage-- Get the details of the given server +local server = External.get_server_details('eu-01') + +]] +function External.get_server_details(server_id) + assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') + return servers[server_id] +end + +--[[-- Gets the status of the given server +@tparam string server_id The internal server if for the server you want the status of +@treturn string The status of the given server, one of: Online, Modded, Protected, Offline + +@usage-- Get the status of the given server +local status = External.get_server_status('eu-01') + +]] +function External.get_server_status(server_id) + assert(var, 'No external data was found, use External.validate() to ensure external data exists.') + local servers = assert(ext.status, 'No server status was found, please ensure that the external service is running') + return servers[server_id] +end + +--[[-- Gets the ups of the current server +@usage-- Get the ups of the current server +local server_ups = External.get_server_ups() + +]] +function External.get_server_ups() + assert(var, 'No external data was found, use External.validate() to ensure external data exists.') + return assert(var.server_ups, 'No server ups was found, please ensure that the external service is running') +end + +--[[-- Connect a player to the given server +@tparam LuaPlayer player The player that you want to request to join a different server +@tparam string server_id The internal id of the server to connect to, can also be any address but this will show Unknown Server +@tparam[opt=false] boolean self_requested If the player requested the join them selfs, this will hide the message about being asked to switch + +@usage-- Request that a player joins a different server +External.request_connection(player, 'eu-01') + +@usage-- Request that a player joins a different server, by own request +External.request_connection(player, 'eu-01', true) + +]] +function External.request_connection(player, server_id, self_requested) + assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') + local server = servers[server_id] or { address = server_id, name = 'Unknown Server', description = 'This server is not ran by us, please check the address of the server.' } + local message = 'Please press the connect button below to join.' + if not self_requested then message = 'You have been asked to switch to a different server. '..message end + player.connect_to_server{ + address = server.address, + name = '\n[color=orange]'..server.name..'[/color]\n', + description = server.description..'\n'..message + } +end + +--- Module return +return External \ No newline at end of file From 5150d28fd31edc432dfee0fcc38a0617af1273c1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 14 Jun 2020 23:07:51 +0100 Subject: [PATCH 072/106] Added server connect button --- expcore/external.lua | 28 ++++++------ locale/en/gui.cfg | 5 +++ modules/commands/interface.lua | 20 ++++----- modules/gui/readme.lua | 81 +++++++++++++++++++++++++++------- modules/gui/server-ups.lua | 8 ++-- 5 files changed, 97 insertions(+), 45 deletions(-) diff --git a/expcore/external.lua b/expcore/external.lua index 3a54b195..26751fa0 100644 --- a/expcore/external.lua +++ b/expcore/external.lua @@ -30,13 +30,13 @@ end) @treturn boolean If the external data is valid, if false you should not call any other methods from External @usage-- Check that external data is valid -if not External.validate() then +if not External.valid() then -- error code here end ]] -function External.validate() - if ext ~= nil and var ~= nil then +function External.valid() + if ext ~= nil and ext == global.ext then return true elseif global.ext ~= nil then ext = global.ext @@ -54,7 +54,7 @@ local servers = External.get_servers() ]] function External.get_servers() - assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') return assert(ext.servers, 'No server list was found, please ensure that the external service is running') end @@ -67,7 +67,7 @@ local servers = External.get_servers_filtered(public) ]] function External.get_servers_filtered(search) - assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') local found_servers = {} search = search:lower() @@ -79,14 +79,14 @@ function External.get_servers_filtered(search) end --[[-- Gets the details of the current server -@treturn table The details for the current server +@treturn table The details of the current server @usage-- Get the details of the current server local server = External.get_current_server() ]] function External.get_current_server() - assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') local server_id = assert(ext.current, 'No current id was found, please ensure that the external service is running') return servers[server_id] @@ -101,7 +101,7 @@ local server = External.get_server_details('eu-01') ]] function External.get_server_details(server_id) - assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') return servers[server_id] end @@ -115,8 +115,8 @@ local status = External.get_server_status('eu-01') ]] function External.get_server_status(server_id) - assert(var, 'No external data was found, use External.validate() to ensure external data exists.') - local servers = assert(ext.status, 'No server status was found, please ensure that the external service is running') + assert(var, 'No external data was found, use External.valid() to ensure external data exists.') + local servers = assert(var.status, 'No server status was found, please ensure that the external service is running') return servers[server_id] end @@ -126,7 +126,7 @@ local server_ups = External.get_server_ups() ]] function External.get_server_ups() - assert(var, 'No external data was found, use External.validate() to ensure external data exists.') + assert(var, 'No external data was found, use External.valid() to ensure external data exists.') return assert(var.server_ups, 'No server ups was found, please ensure that the external service is running') end @@ -143,14 +143,14 @@ External.request_connection(player, 'eu-01', true) ]] function External.request_connection(player, server_id, self_requested) - assert(ext, 'No external data was found, use External.validate() to ensure external data exists.') + assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') local server = servers[server_id] or { address = server_id, name = 'Unknown Server', description = 'This server is not ran by us, please check the address of the server.' } local message = 'Please press the connect button below to join.' - if not self_requested then message = 'You have been asked to switch to a different server. '..message end + if not self_requested then message = 'You have been asked to switch to a different server.\n'..message end player.connect_to_server{ address = server.address, - name = '\n[color=orange]'..server.name..'[/color]\n', + name = '\n[color=orange][font=heading-1]'..server.name..'[/font][/color]\n', description = server.description..'\n'..message } end diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 3305c3fc..59c58b7e 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -146,6 +146,11 @@ servers-7=S7 Event servers-d7=This is our event server, we try to run events at least once per week. servers-8=S8 T̷-̶s̶-̴:̷ servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸ +servers-connect-Offline=Server is currently offline +servers-connect-Version=Server is on a different version: __1__ +servers-connect-Password=Server requires a password +servers-connect-Modded=Server requires mods to be downloaded +servers-connect-Online=Server is online servers-external=External Links servers-open-in-browser=Open in your browser backers-tab=Backers diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index 9b73be17..41d2942d 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -5,25 +5,23 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands local Global = require 'utils.global' --- @dep utils.global -local Common = require 'expcore.common' --- @dep expcore.common -- modules that are loaded into the interface env to be accessed local interface_modules = { - ['Game']='utils.game', - ['_C']=Common, - ['Commands']=Commands, - ['output']=Common.player_return, - ['Group']='expcore.permission_groups', - ['Roles']='expcore.roles', - ['Gui']='expcore.gui', - ['Async']='expcore.async', - ['Datastore']='expcore.datastore' + ['Commands'] = Commands, + ['output'] = _C.player_return, + ['Group'] = 'expcore.permission_groups', + ['Roles'] = 'expcore.roles', + ['Gui'] = 'expcore.gui', + ['Async'] = 'expcore.async', + ['Datastore'] = 'expcore.datastore', + ['External'] = 'expcore.external' } -- loads all the modules given in the above table for key, value in pairs(interface_modules) do if type(value) == 'string' then - interface_modules[key] = Common.opt_require(value) + interface_modules[key] = _C.opt_require(value) end end diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index 8938aedb..b74d4a0b 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -4,12 +4,12 @@ @alias readme ]] +local Event = require 'utils.event' --- @dep utils.event local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles local Commands = require 'expcore.commands' --- @dep expcore.commands local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data -local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game +local External = require 'expcore.external' --- @dep expcore.external local format_time = _C.format_time --- @dep expcore.common local format_number = require('util').format_number --- @dep util @@ -18,9 +18,9 @@ local function Tab(caption, tooltip, element_define) tabs[#tabs+1] = {caption, tooltip, element_define} end -local frame_width = 595 -- controls width of top descritions +local frame_width = 595 -- controls width of top descriptions local title_width = 270 -- controls the centering of the titles -local scroll_hieght = 275 -- controls the height of the scrolls +local scroll_height = 275 -- controls the height of the scrolls --- Sub content area used within the content areas -- @element sub_content @@ -70,15 +70,52 @@ Gui.element{ } :style{ padding = {1, 3}, - maximal_height = scroll_hieght, + maximal_height = scroll_height, horizontally_stretchable = true, } +--- Used to connect to servers in server list +-- @element join_server +local join_server = +Gui.element(function(event_trigger, parent, server_id, wrong_version) + local status = wrong_version and 'Version' or External.get_server_status(server_id) or 'Offline' + local flow = parent.add{ name = server_id, type = 'flow' } + local button = flow.add{ + name = event_trigger, + type = 'sprite-button', + sprite = 'utility/circuit_network_panel_white', --- network panel white, warning white, download white + hovered_sprite = 'utility/circuit_network_panel_black', --- network panel black, warning black, download black + tooltip = {'readme.servers-connect-'..status, wrong_version} + } + + if status == 'Offline' then + button.enabled = false + button.sprite = 'utility/circuit_network_panel_black' + elseif status == 'Version' then + button.enabled = false + button.sprite = 'utility/shuffle' + elseif status == 'Password' then + button.sprite = 'utility/warning_white' + button.hovered_sprite = 'utility/warning' + elseif status == 'Modded' then + button.sprite = 'utility/downloading_white' + button.hovered_sprite = 'utility/downloading' + end + + return button +end) +:style(Gui.sprite_style(20, -1)) +:on_click(function(player, element, _) + local server_id = element.parent.name + External.request_connection(player, server_id, true) +end) + --- Content area for the welcome tab -- @element welcome_content Tab({'readme.welcome-tab'}, {'readme.welcome-tooltip'}, Gui.element(function(_, parent) - local server_details = global.server_details or { name='ExpGaming S0 - Local', description='Failed to load description: disconnected from sync api.', reset_time='Non Set', branch='Unknown'} + local server_details = { name='ExpGaming S0 - Local', welcome='Failed to load description: disconnected from external api.', reset_time='Non Set', branch='Unknown'} + if External.valid() then server_details = External.get_current_server() end local container = parent.add{ type='flow', direction='vertical' } local player = Gui.get_player_from_element(parent) @@ -91,7 +128,7 @@ Gui.element(function(_, parent) -- Add the title and description to the top flow Gui.title_label(top_vertical_flow, 62, 'Welcome to '..server_details.name) - Gui.centered_label(top_vertical_flow, 380, server_details.description) + Gui.centered_label(top_vertical_flow, 380, server_details.welcome) Gui.bar(container) -- Get the names of the roles the player has @@ -124,7 +161,7 @@ Gui.element(function(_, parent) container.add{ type='flow' } -- Add a table for the rules - local rules = Gui.scroll_table(container, scroll_hieght, 1) + local rules = Gui.scroll_table(container, scroll_height, 1) rules.style = 'bordered_table' rules.style.cell_padding = 4 @@ -150,7 +187,7 @@ Gui.element(function(_, parent) container.add{ type='flow' } -- Add a table for the commands - local commands = Gui.scroll_table(container, scroll_hieght, 2) + local commands = Gui.scroll_table(container, scroll_height, 2) commands.style = 'bordered_table' commands.style.cell_padding = 0 @@ -177,13 +214,23 @@ Gui.element(function(_, parent) -- Draw the scroll local scroll_pane = title_table_scroll(container) - scroll_pane.style.maximal_height = scroll_hieght + 20 -- the text is a bit shorter + scroll_pane.style.maximal_height = scroll_height + 20 -- the text is a bit shorter -- Add the factorio servers - local factorio_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2) - for i = 1, 8 do - Gui.centered_label(factorio_servers, 110, {'readme.servers-'..i}) - Gui.centered_label(factorio_servers, 460, {'readme.servers-d'..i}) + if External.valid() then + local factorio_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 3) + local current_version = External.get_current_server().version + for server_id, server in pairs(External.get_servers()) do + Gui.centered_label(factorio_servers, 110, server.short_name) + Gui.centered_label(factorio_servers, 436, server.description) + join_server(factorio_servers, server_id, current_version ~= server.version and server.version) + end + else + local factorio_servers = title_table(scroll_pane, 225, {'readme.servers-factorio'}, 2) + for i = 1, 8 do + Gui.centered_label(factorio_servers, 110, {'readme.servers-'..i}) + Gui.centered_label(factorio_servers, 460, {'readme.servers-d'..i}) + end end -- Add the external links @@ -418,7 +465,7 @@ end) --- When a player joins the game for the first time show this gui Event.add(defines.events.on_player_created, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] local element = readme(player.gui.center) element.pane.selected_tab_index = 1 player.opened = element @@ -426,7 +473,7 @@ end) --- When a player joins clear center unless the player has something open Event.add(defines.events.on_player_joined_game, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] if not player.opened then player.gui.center.clear() end @@ -434,7 +481,7 @@ end) --- When a player respawns clear center unless the player has something open Event.add(defines.events.on_player_respawned, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] if not player.opened then player.gui.center.clear() end diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index edb4793b..798ac45e 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -7,6 +7,7 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Event = require 'utils.event' --- @dep utils.event local Commands = require 'expcore.commands' --- @dep expcore.commands +local External = require 'expcore.external' --- @dep expcore.external --- Stores the visible state of server ups local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data @@ -42,7 +43,8 @@ Commands.new_command('server-ups', 'Toggle the server UPS display') :add_alias('sups', 'ups') :register(function(player) local label = player.gui.screen[server_ups.name] - if not global.ext or not global.ext.server_ups then + if not External.valid() then + label.visible = false return Commands.error{'expcom-server-ups.no-ext'} end label.visible = not label.visible @@ -69,8 +71,8 @@ end) -- Update the caption for all online players Event.on_nth_tick(60, function() - if global.ext and global.ext.server_ups then - local caption = 'SUPS = '..global.ext.server_ups + if External.valid() then + local caption = 'SUPS = '..External.get_server_ups() for _, player in pairs(game.connected_players) do player.gui.screen[server_ups.name].caption = caption end From 43c1bc27880ada6af3eb7e3425400c056327622f Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 15 Jun 2020 00:29:23 +0100 Subject: [PATCH 073/106] Added connect command --- config/_file_loader.lua | 1 + config/expcore/command_general_parse.lua | 9 +- config/expcore/roles.lua | 3 + expcore/external.lua | 7 +- locale/en/commands.cfg | 9 +- modules/addons/chat-popups.lua | 2 +- modules/commands/connect.lua | 107 +++++++++++++++++++++++ 7 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 modules/commands/connect.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 5fd71d8d..be200bf3 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -27,6 +27,7 @@ return { 'modules.commands.warnings', 'modules.commands.find', 'modules.commands.home', + 'modules.commands.connect', --- Addons 'modules.addons.chat-popups', diff --git a/config/expcore/command_general_parse.lua b/config/expcore/command_general_parse.lua index 09f42c37..065db0ba 100644 --- a/config/expcore/command_general_parse.lua +++ b/config/expcore/command_general_parse.lua @@ -38,13 +38,8 @@ end) Commands.add_parse('string-options',function(input, player, reject, options) if not input then return end -- nil check - input = input:lower() - for _, option in ipairs(options) do - if input == option:lower() then - return option - end - end - return reject{'expcore-commands.reject-string-options', table.concat(options, ', ')} + local option = _C.auto_complete(options, input) + return option or reject{'expcore-commands.reject-string-options', table.concat(options, ', ')} end) Commands.add_parse('string-max-length',function(input, player, reject, max_length) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index c1904ada..df059559 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -49,6 +49,7 @@ Roles.new_role('Administrator','Admin') :allow{ 'gui/warp-list/bypass-cooldown', 'gui/warp-list/bypass-proximity', + 'command/connect-all', } Roles.new_role('Moderator','Mod') @@ -75,6 +76,7 @@ Roles.new_role('Moderator','Mod') 'command/home-set', 'command/home-get', 'command/return', + 'command/connect-player', 'gui/rocket-info/toggle-active', 'gui/rocket-info/remote_launch', 'fast-tree-decon', @@ -223,6 +225,7 @@ local default = Roles.new_role('Guest','') 'command/save-data', 'command/preference', 'command/set-preference', + 'command/connect', 'gui/player-list', 'gui/rocket-info', 'gui/science-info', diff --git a/expcore/external.lua b/expcore/external.lua index 26751fa0..745aafa3 100644 --- a/expcore/external.lua +++ b/expcore/external.lua @@ -73,7 +73,7 @@ function External.get_servers_filtered(search) search = search:lower() for server_id, server in pairs(servers) do local str = concat{server.name, server.short_name, server.id} - if str:lower():match(search, 1, true) then found_servers[server_id] = server end + if str:lower():find(search, 1, true) then found_servers[server_id] = server end end return found_servers end @@ -143,9 +143,8 @@ External.request_connection(player, 'eu-01', true) ]] function External.request_connection(player, server_id, self_requested) - assert(ext, 'No external data was found, use External.valid() to ensure external data exists.') - local servers = assert(ext.servers, 'No server list was found, please ensure that the external service is running') - local server = servers[server_id] or { address = server_id, name = 'Unknown Server', description = 'This server is not ran by us, please check the address of the server.' } + local server = { address = server_id, name = 'Unknown Server', description = 'This server is not ran by us, please check the address of the server.' } + if ext and ext.servers and ext.servers[server_id] then server = ext.servers[server_id] end local message = 'Please press the connect button below to join.' if not self_requested then message = 'You have been asked to switch to a different server.\n'..message end player.connect_to_server{ diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 5bc738ba..6c9fb44f 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -76,4 +76,11 @@ return-set=Your return point has been set to x: __1__ y: __2__ home-get=Your home point is at x: __1__ y: __2__ [expcom-server-ups] -no-ext=No external source was found, cannot display server ups. \ No newline at end of file +no-ext=No external source was found, cannot display server ups. + +[expcom-connect] +too-many-matching=Multiple server were found with the given name: __1__ +wrong-version=Servers were found but are on a different version: __1__ +same-server=You are already connected to the server: __1__ +offline=You cannot connect as the server is currently offline: __1__ +none-matching=No servers were found with that name, if you used an address please append true to the end of your command. \ No newline at end of file diff --git a/modules/addons/chat-popups.lua b/modules/addons/chat-popups.lua index ab197e7d..22e9c772 100644 --- a/modules/addons/chat-popups.lua +++ b/modules/addons/chat-popups.lua @@ -29,7 +29,7 @@ Event.add(defines.events.on_console_chat, function(event) -- Loops over online players to see if they name is included for _, mentioned_player in pairs(game.connected_players) do if mentioned_player.index ~= player.index then - if search_string:match(mentioned_player.name:lower(), 1, true) then + if search_string:find(mentioned_player.name:lower(), 1, true) then send_text(mentioned_player.index, {'chat-popup.ping', player.name}, player.chat_color) end end diff --git a/modules/commands/connect.lua b/modules/commands/connect.lua new file mode 100644 index 00000000..7951e628 --- /dev/null +++ b/modules/commands/connect.lua @@ -0,0 +1,107 @@ +--[[-- Commands Module - Connect + - Adds a commands that allows you to request a player move to another server + @commands Connect +]] + +local Async = require 'expcore.async' --- @dep expcore.async +local External = require 'expcore.external' --- @dep expcore.external +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_role_parse' +local concat = table.concat + +local request_connection = Async.register(External.request_connection) + +local function get_server_id(server) + local current_server = External.get_current_server() + local current_version = current_server.version + local servers = External.get_servers_filtered(server) + + local server_names_before, server_names = {}, {} + local server_count_before, server_count = 0, 0 + for next_server_id, server_details in pairs(servers) do + server_count_before = server_count_before + 1 + server_names_before[server_count_before] = server_details.name + if server_details.version == current_version then + server_count = server_count + 1 + server_names[server_count] = server_details.name + else + servers[next_server_id] = nil + end + end + + if server_count > 1 then + return false, Commands.error{'expcom-connect.too-many-matching', concat(server_names, ', ')} + elseif server_count == 1 then + local server_id, server_details = next(servers) + local status = External.get_server_status(server_id) + if server_id == current_server.id then + return false, Commands.error{'expcom-connect.same-server', server_details.name} + elseif status == 'Offline' then + return false, Commands.error{'expcom-connect.offline', server_details.name} + end + return true, server_id + elseif server_count_before > 0 then + return false, Commands.error{'expcom-connect.wrong-version', concat(server_names_before, ', ')} + else + return false, Commands.error{'expcom-connect.none-matching'} + end +end + +--- Connect to a different server +-- @command connect +-- @tparam string server The address or name of the server to connect to +-- @tparam[opt=false] boolean is_address If an address was given for the server param +Commands.new_command('connect', 'Connect to another server') +:add_param('server') +:add_param('is_address', true, 'boolean') +:add_alias('join', 'server') +:register(function(player, server, is_address) + local server_id = server + if not is_address and External.valid() then + local success, new_server_id = get_server_id(server) + if not success then return new_server_id end + server_id = new_server_id + end + + Async(request_connection, player, server_id, true) +end) + +--- Connect a player to a different server +-- @command connect-player +-- @tparam string address The address or name of the server to connect to +-- @tparam LuaPlayer player The player to connect to a different server +-- @tparam[opt=false] boolean is_address If an address was given for the server param +Commands.new_command('connect-player', 'Send a player to a different server') +:add_param('player', 'player-role') +:add_param('server') +:add_param('is_address', true, 'boolean') +:register(function(_, player, server, is_address) + local server_id = server + if not is_address and External.valid() then + local success, new_server_id = get_server_id(server) + if not success then return new_server_id end + server_id = new_server_id + end + + External.request_connection(player, server_id) +end) + +--- Connect all players to a different server +-- @command connect-all +-- @tparam string address The address or name of the server to connect to +-- @tparam[opt=false] boolean is_address If an address was given for the server param +Commands.new_command('connect-all', 'Connect all players to another server') +:add_param('server') +:add_param('is_address', true, 'boolean') +:register(function(_, server, is_address) + local server_id = server + if not is_address and External.valid() then + local success, new_server_id = get_server_id(server) + if not success then return new_server_id end + server_id = new_server_id + end + + for _, player in pairs(game.connected_players) do + External.request_connection(player, server_id) + end +end) \ No newline at end of file From a5eff7964ccdcaedd8467c32cbcd3a409e1c9185 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 15 Jun 2020 18:59:11 +0100 Subject: [PATCH 074/106] Fixed Potential desync issue --- expcore/external.lua | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/expcore/external.lua b/expcore/external.lua index 745aafa3..61f1d614 100644 --- a/expcore/external.lua +++ b/expcore/external.lua @@ -14,18 +14,11 @@ end ]] -local Event = require 'utils.event' --- @dep utils.event +local ext, var local concat = table.concat local External = {} ---- Makes local links to the data is global.ext if it exists -local ext, var -Event.on_load(function() - ext = global.ext - if ext then var = ext.var end -end) - --[[-- Checks that local links are valid, will try to add the links if invalid @treturn boolean If the external data is valid, if false you should not call any other methods from External @@ -36,14 +29,14 @@ end ]] function External.valid() - if ext ~= nil and ext == global.ext then - return true - elseif global.ext ~= nil then + if global.ext == nil then return false end + if ext == global.ext and var == ext.var then + return var ~= nil + else ext = global.ext var = ext.var return var ~= nil end - return false end --[[-- Gets a table of all the servers, key is the server id, value is the server details From 535d77086966dc274ddb6d049c01e1121abd6f26 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 16 Jun 2020 13:58:18 +0000 Subject: [PATCH 075/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 98 files changed, 98 insertions(+), 98 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index de6825c9..cb81819a 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index c3f48db8..7396897d 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 82af5bda..16e3ca27 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index ab4773b7..77558e11 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index b4ae7b75..f9ff8ade 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 495af07e..c7d17fdd 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 2ed803a6..33645060 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 14a95521..7ce622bf 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index f70591ca..32ef3656 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 7af67ea8..0a31328e 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index e9191a83..5d96c8ef 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 01e7e238..020f9de7 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index ea59d9e4..ee6bab2f 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index dec6279c..269427ee 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -374,7 +374,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index a3ce0bd3..722db4ce 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index da326dfa..73ae9b91 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -378,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index b1541d96..8972fd64 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index b04d2a98..aba8dbae 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 40bc6705..879b81eb 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -471,7 +471,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index ce07a2dd..e72c871c 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 1b6d3b06..2a9eaf3a 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -624,7 +624,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 735f7680..92662ede 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 42101805..c91790d7 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 20edfff3..7ea6f5a9 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 95fd333f..cd32438a 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -334,7 +334,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index d44d6c46..2e5fbec4 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index fd5b9c47..691f79ed 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -570,7 +570,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 0a00d231..e54bcef6 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 31ce2dc2..8174e4c0 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -497,7 +497,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index f242a55b..2203fef8 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -582,7 +582,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 8cc9f9c5..1fa42c89 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -519,7 +519,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index d4409959..36a25368 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 8aed7829..5894c922 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -498,7 +498,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index b1a8d584..ac14ab39 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 2f851205..c1320d42 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 7c6ea247..afc586ac 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -455,7 +455,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index d02294ee..4d82d1bb 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 20ab2b44..0aee12b4 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -351,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 5366c261..fcaea157 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 45d5e856..6817ab56 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index aff18133..d42cbbb0 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index d0fff0df..7963f691 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -253,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 53b6a5d8..458a6ee3 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index fc027ea0..324226d6 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -797,7 +797,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index fd55ea06..65a05db0 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index c308f31d..5110f055 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 81b7076b..4ac0f60b 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -337,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 412ca1d2..cedd6db3 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 58666542..4018d584 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 8716c6fc..989b1f82 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -847,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 6ad34f42..4548c387 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -305,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index f6290b9a..ba7dc7bc 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index aa532141..014f2e43 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 995e7f19..c4d03e74 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -757,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index bb0989ab..1b5608b3 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -637,7 +637,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 90ef3ab9..e3607e8d 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index e4c292b7..3f36bc5f 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index bc538b34..cd18521c 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -787,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index abad4951..7e2ec758 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index fa2e53ea..2f69225f 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1221,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index a377af30..654c4eed 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1342,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 5dff543b..33bf0cc6 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1123,7 +1123,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index d5fdb1a6..58c68146 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -997,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 984250fe..deb5b527 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -983,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index fa7a7977..a0e978bf 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1506,7 +1506,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index e11b929f..fea79c2c 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1520,7 +1520,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 37f7e007..92c153ee 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -611,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 59736ed2..e3a6d14d 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2426,7 +2426,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index b9b685c6..eefdbad4 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2765,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 2cf1bbf1..57499adf 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2945,7 +2945,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index bac4e0a8..684a1c89 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1441,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index e12b59af..0e299b92 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4419,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 7f791ea1..a074e33f 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -529,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 952c61f7..0ce11277 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3348,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index 4840cbb5..e6c0dd5f 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 759769e0..b240a042 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 67b64d59..3690c4fd 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -428,7 +428,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 6d9b0ab6..1b5e0e3f 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index a88f2a84..f80c7435 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -406,7 +406,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 48b9a8d7..4c7c0df6 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 3495bf87..9d117bd0 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -732,7 +732,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 6d328541..c8bd4e38 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -856,7 +856,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 1b1e664f..0d1436c4 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -704,7 +704,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 58c6d724..c6fd1be0 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -583,7 +583,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index bada7383..a646f68f 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -769,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index e99e8edd..e9098e9a 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1040,7 +1040,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 62f48099..5fe52485 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -478,7 +478,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index feaa2df9..c69548d3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -540,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index d75a3586..8a572b6a 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index d9bd3568..a4de057c 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -306,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index f4b0dd18..2ccfa24b 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -667,7 +667,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index afcf3255..885fff6b 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 2e05bd16..7b353063 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2021,7 +2021,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 246739de..ab056f7e 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1305,7 +1305,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 3d84dc23..527f298c 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 4a7529f7..643238de 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -664,7 +664,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 4bda0bff..38ad2114 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -802,7 +802,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 87f1dc0d..b0403101 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -354,7 +354,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 009cf14a10ccd5734799d2673f53e41c4d22e9ef Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 3 Jul 2020 18:15:23 +0100 Subject: [PATCH 076/106] Added versions for api and redmew --- overrides/version.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/overrides/version.lua b/overrides/version.lua index 5afe94d9..663ad0a1 100644 --- a/overrides/version.lua +++ b/overrides/version.lua @@ -1,3 +1,5 @@ return { - expgaming = '6.0.0' + expgaming_lua = '6.0.0', + expgaming_api = '2.0.0', + redmew_lua = '2019-02-24-76871ee' } \ No newline at end of file From b4772dc59d3ac28f6913cc0b1b1a2546bd17bfea Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 Jul 2020 21:27:24 +0100 Subject: [PATCH 077/106] Fixed issue with add_player and remove_player --- expcore/roles.lua | 179 ++++++++++++++++++++++------------------------ 1 file changed, 87 insertions(+), 92 deletions(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index ad18234b..a95d1918 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -119,15 +119,15 @@ local write_json = _C.write_json --- @dep expcore.common local Roles = { _prototype={}, config={ - order={}, -- Contains the order of the roles, lower index is better - roles={}, -- Contains the raw info for the roles, indexed by role name - flags={}, -- Contains functions that run when a flag is added/removed from a player - internal={}, -- Contains all internally accessed roles, such as root, default - players={} -- Contains the roles that players have + order = {}, -- Contains the order of the roles, lower index is better + roles = {}, -- Contains the raw info for the roles, indexed by role name + flags = {}, -- Contains functions that run when a flag is added/removed from a player + internal = {}, -- Contains all internally accessed roles, such as root, default + players = {} -- Contains the roles that players have }, events = { - on_role_assigned=script.generate_event_name(), - on_role_unassigned=script.generate_event_name(), + on_role_assigned = script.generate_event_name(), + on_role_unassigned = script.generate_event_name(), } } @@ -145,7 +145,7 @@ end) -- there is a second half called role_update which triggers after the event call, it also is called when a player joins local function emit_player_roles_updated(player, type, roles, by_player_name, skip_game_print) by_player_name = game.player and game.player.name or by_player_name or '' - local by_player = Game.get_player_from_any(by_player_name) + local by_player = game.players[by_player_name] local by_player_index = by_player and by_player.index or 0 -- get the event id from the type of emit local event = Roles.events.on_role_assigned @@ -153,12 +153,13 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk event = Roles.events.on_role_unassigned end -- convert the roles to objects and get the names of the roles - local role_names = {} - for index, role in pairs(roles) do + local index, role_names, valid_roles = 0, {}, {} + for _, role in ipairs(roles) do role = Roles.get_role_from_any(role) if role then - roles[index] = role - table.insert(role_names, role.name) + index = index + 1 + valid_roles[index] = role + role_names[index] = role.name end end -- output to all the different locations: game print, player sound, event trigger and role log @@ -175,7 +176,7 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk tick=game.tick, player_index=player.index, by_player_index=by_player_index, - roles=roles + roles=valid_roles }) write_json('log/roles.log', { player_name=player.name, @@ -194,7 +195,7 @@ game.player.print(Roles.debug()) ]] function Roles.debug() local output = '' - for index, role_name in pairs(Roles.config.order) do + for index, role_name in ipairs(Roles.config.order) do local role = Roles.config.roles[role_name] local color = role.custom_color or Colours.white color = string.format('[color=%d, %d, %d]', color.r, color.g, color.b) @@ -212,7 +213,7 @@ Roles.print_to_roles({'Administrator', 'Moderator'}, 'Hello, World!') ]] function Roles.print_to_roles(roles, message) - for _, role in pairs(roles) do + for _, role in ipairs(roles) do role = Roles.get_role_from_any(role) if role then role:print(message) end end @@ -230,9 +231,9 @@ function Roles.print_to_roles_higher(role, message) role = Roles.get_role_from_any(role) if not role then return end local roles = {} - for index, role_name in pairs(Roles.config.order) do + for index, role_name in ipairs(Roles.config.order) do if index <= role.index and role_name ~= Roles.config.internal.default then - table.insert(roles, role_name) + roles[#roles+1] = role_name end end Roles.print_to_roles(roles, message) @@ -250,9 +251,9 @@ function Roles.print_to_roles_lower(role, message) role = Roles.get_role_from_any(role) if not role then return end local roles = {} - for index, role_name in pairs(Roles.config.order) do + for index, role_name in ipairs(Roles.config.order) do if index >= role.index and role_name ~= Roles.config.internal.default then - table.insert(roles, role_name) + roles[#roles+1] = role_name end end Roles.print_to_roles(roles, message) @@ -318,8 +319,8 @@ function Roles.get_player_roles(player) local roles = Roles.config.players[player.name] or {} local default = Roles.config.roles[Roles.config.internal.default] local rtn = {default} - for _, role_name in pairs(roles) do - table.insert(rtn, Roles.config.roles[role_name]) + for index, role_name in ipairs(roles) do + rtn[index+1] = Roles.config.roles[role_name] end return rtn end @@ -336,7 +337,7 @@ function Roles.get_player_highest_role(player) local roles = Roles.get_player_roles(player) if not roles then return end local highest - for _, role in pairs(roles) do + for _, role in ipairs(roles) do if not highest or role.index < highest.index then highest = role end @@ -344,9 +345,9 @@ function Roles.get_player_highest_role(player) return highest end ---- Assinment. +--- Assignment. -- Functions for changing player's roles --- @section assinment +-- @section assignment --[[-- Gives a player the given role(s) with an option to pass a by player name used in the log @tparam LuaPlayer player the player that will be assigned the roles @@ -365,10 +366,11 @@ Roles.assign_player('Cooldude2606', 'Moderator', nil, true) function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) local valid_player = Game.get_player_from_any(player) if not skip_checks and not valid_player then return end + if not player then return end if type(roles) ~= 'table' or roles.name then roles = {roles} end - for _, role in pairs(roles) do + for _, role in ipairs(roles) do role = Roles.get_role_from_any(role) if role then role:add_player(valid_player or player, valid_player == nil, true) @@ -400,7 +402,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen if type(roles) ~= 'table' or roles.name then roles = {roles} end - for _, role in pairs(roles) do + for _, role in ipairs(roles) do role = Roles.get_role_from_any(role) if role then role:remove_player(valid_player or player, valid_player == nil, true) @@ -453,7 +455,7 @@ function Roles.player_has_role(player, search_role) if not roles then return end search_role = Roles.get_role_from_any(search_role) if not search_role then return end - for _, role in pairs(roles) do + for _, role in ipairs(roles) do if role.name == search_role.name then return true end end return false @@ -471,7 +473,7 @@ local has_flag = Roles.player_has_flag(game.player, 'is_donator') function Roles.player_has_flag(player, flag_name) local roles = Roles.get_player_roles(player) if not roles then return end - for _, role in pairs(roles) do + for _, role in ipairs(roles) do if role:has_flag(flag_name) then return true end @@ -491,7 +493,7 @@ local has_flag = Roles.player_has_flag(game.player, 'is_donator') function Roles.player_allowed(player, action) local roles = Roles.get_player_roles(player) if not roles then return end - for _, role in pairs(roles) do + for _, role in ipairs(roles) do if role:is_allowed(action) then return true end @@ -499,7 +501,7 @@ function Roles.player_allowed(player, action) return false end ---- Definations. +--- Definitions. -- Functions which are used to define roles -- @section checks @@ -522,17 +524,17 @@ function Roles.define_role_order(order) _C.error_if_runtime() Roles.config.order = {} local done = {} - for _, role in ipairs(order) do + for index, role in ipairs(order) do if type(role) == 'table' and role.name then done[role.name] = true - table.insert(Roles.config.order, role.name) + Roles.config.order[index] = role.name else done[role] = true - table.insert(Roles.config.order, role) + Roles.config.order[index] = role end end -- Check no roles were missed - for role_name, _ in pairs(Roles.config.roles) do + for role_name in pairs(Roles.config.roles) do if not done[role_name] then error('Role missing '..role_name..' from role order, all defined roles must be included.', 2) end @@ -555,7 +557,7 @@ end @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 -@usage-- Defineing a flag trigger +@usage-- Defining a flag trigger Roles.define_flag_trigger('is_donator', function(player, state) player.character_running_speed_modifier = state and 1.5 or 1 end) @@ -598,7 +600,7 @@ end @tparam[opt=name] string short_hand the shortened version of the name @treturn Roles._prototype the start of the config chain for this role -@usage-- Defineing a new role +@usage-- Defining a new role local role = Roles.new_role('Moderator', 'Mod') ]] @@ -649,7 +651,7 @@ function Roles._prototype:allow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _, action in pairs(actions) do + for _, action in ipairs(actions) do self.allowed_actions[action]=true end return self @@ -659,7 +661,7 @@ end @tparam table actions indexed with numbers and is an array of action names, order has no effect @treturn Roles._prototype allows chaining -@usage-- Disalow an action for a role, useful if inherit an action from a parent +@usage-- Disallow an action for a role, useful if inherit an action from a parent role:disallow{ 'command/kill', 'gui/game settings' @@ -670,7 +672,7 @@ function Roles._prototype:disallow(actions) if type(actions) ~= 'table' then actions = {actions} end - for _, action in pairs(actions) do + for _, action in ipairs(actions) do self.allowed_actions[action]=false end return self @@ -733,7 +735,7 @@ function Roles._prototype:has_flag(name) end --- Role Properties. --- Functions for chaning other proerties +-- Functions for changing other properties -- @section properties --[[-- Sets a custom player tag for the role, can be accessed by other code @@ -850,30 +852,31 @@ role:add_player(game.player) ]] function Roles._prototype:add_player(player, skip_check, skip_event) - player = Game.get_player_from_any(player) + local valid_player = Game.get_player_from_any(player) -- Default role cant have players added or removed if self.name == Roles.config.internal.default then return end -- Check the player is valid, can be skipped but a name must be given - if not player then - if skip_check then - player = {name=player} - else - return false - end + local player_name + if valid_player then + player_name = valid_player.name + elseif skip_check then + player_name = player + else + return false end -- Add the role name to the player's roles - local player_roles = Roles.config.players[player.name] + local player_roles = Roles.config.players[player_name] if player_roles then - for _, role_name in pairs(player_roles) do + for _, role_name in ipairs(player_roles) do if role_name == self.name then return false end end - table.insert(player_roles, self.name) + player_roles[#player_roles+1] = self.name else - Roles.config.players[player.name] = {self.name} + Roles.config.players[player_name] = {self.name} end -- Emits event if required - if not skip_event then - emit_player_roles_updated(player, 'assign', {self}) + if valid_player and not skip_event then + emit_player_roles_updated(valid_player, 'assign', {self}) end return true end @@ -889,37 +892,39 @@ role:remove_player(game.player) ]] function Roles._prototype:remove_player(player, skip_check, skip_event) - player = Game.get_player_from_any(player) + local valid_player = Game.get_player_from_any(player) -- Default role cant have players added or removed if self.name == Roles.config.internal.default then return end -- Check the player is valid, can be skipped but a name must be given - if not player then - if skip_check then - player = {name=player} - else - return false - end + local player_name + if valid_player then + player_name = valid_player.name + elseif skip_check then + player_name = player + else + return false end -- Remove the role from the players roles - local player_roles = Roles.config.players[player.name] - local rtn = false + local player_roles = Roles.config.players[player_name] + local found = false if player_roles then - for index, role_name in pairs(player_roles) do + for index, role_name in ipairs(player_roles) do if role_name == self.name then - table.remove(player_roles, index) - rtn = true + player_roles[index] = player_roles[#player_roles] + player_roles[#player_roles] = nil + found = true break end end if #player_roles == 0 then - Roles.config.players[player.name] = nil + Roles.config.players[player_name] = nil end end -- Emits event if required - if not skip_event then - emit_player_roles_updated(player, 'unassign', {self}) + if valid_player and not skip_event then + emit_player_roles_updated(valid_player, 'unassign', {self}) end - return rtn + return found end --[[-- Returns an array of all the players who have this role, can be filtered by online status @@ -935,30 +940,20 @@ local players = role:get_players(true) ]] function Roles._prototype:get_players(online) local players = {} - -- Gets all players that have this role + -- Search all players to check if they have this role for player_name, player_roles in pairs(Roles.config.players) do - for _, role_name in pairs(player_roles) do + for _, role_name in ipairs(player_roles) do if role_name == self.name then - table.insert(players, player_name) + local player = game.players[player_name] + -- Filter by online state if required + if online == nil or player.connected == online then + players[#players+1] = player + end + break end end end - -- Convert the player names to LuaPlayer - for index, player_name in pairs(players) do - players[index] = Game.get_player_from_any(player_name) - end - -- Filter by online if param is defined - if online == nil then - return players - else - local filtered = {} - for _, player in pairs(players) do - if player.connected == online then - table.insert(filtered, player) - end - end - return filtered - end + return players end --[[-- Will print a message to all players with this role @@ -971,7 +966,7 @@ role:print('Hello, World!') ]] function Roles._prototype:print(message) local players = self:get_players(true) - for _, player in pairs(players) do + for _, player in ipairs(players) do player.print(message) end return #players @@ -979,7 +974,7 @@ end --- Used internally to be the first trigger on an event change, would be messy to include this in 4 different places local function role_update(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] -- Updates flags given to the player for flag, async_token in pairs(Roles.config.flags) do local state = Roles.player_has_flag(player, flag) @@ -1006,8 +1001,8 @@ Event.add(defines.events.on_player_joined_game, role_update) -- Every 60 seconds the auto promote check is preformed Event.on_nth_tick(3600, function() local promotes = {} - for _, player in pairs(game.connected_players) do - for _, role in pairs(Roles.config.roles) do + for _, player in ipairs(game.connected_players) do + for _, role in ipairs(Roles.config.roles) do if role.auto_promote_condition then local success, err = pcall(role.auto_promote_condition, player) if not success then From e5c8c6030f93dc4d7c05c40b9cff0441952ccd56 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 26 Jul 2020 21:35:51 +0100 Subject: [PATCH 078/106] Fixed padding assignment on "order" --- expcore/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index a95d1918..477a5fb5 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -119,7 +119,7 @@ local write_json = _C.write_json --- @dep expcore.common local Roles = { _prototype={}, config={ - order = {}, -- Contains the order of the roles, lower index is better + order = {}, -- Contains the order of the roles, lower index is better roles = {}, -- Contains the raw info for the roles, indexed by role name flags = {}, -- Contains functions that run when a flag is added/removed from a player internal = {}, -- Contains all internally accessed roles, such as root, default From 550e11c83d4a37a162d177b6bc3dd5a03debd950 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 1 Aug 2020 00:05:35 +0000 Subject: [PATCH 079/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 24 +++++++++---------- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 98 files changed, 109 insertions(+), 109 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index cb81819a..b4fedd31 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 7396897d..7645cb1b 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 16e3ca27..bef5ca5b 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 77558e11..74459852 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index f9ff8ade..593ac914 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -362,7 +362,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index c7d17fdd..b44e1aa4 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 33645060..700191e0 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 7ce622bf..d3c74619 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -361,7 +361,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 32ef3656..07eca129 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 0a31328e..b31fe9e2 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 5d96c8ef..3e635291 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 020f9de7..f353d1ef 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index ee6bab2f..fe1bd0d5 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 269427ee..c0cdead4 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -374,7 +374,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 722db4ce..6dd3fdc6 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 73ae9b91..b6b2e741 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -378,7 +378,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 8972fd64..3f3256dc 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index aba8dbae..b6766805 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -417,7 +417,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 879b81eb..295fb230 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -471,7 +471,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index e72c871c..cea8d2cc 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 2a9eaf3a..62c68f97 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -624,7 +624,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 92662ede..105dadaf 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index c91790d7..4d01e797 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -373,7 +373,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 7ea6f5a9..b44da161 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index cd32438a..b269385e 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -334,7 +334,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 2e5fbec4..35f1096b 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -598,7 +598,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 691f79ed..42e1079a 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -570,7 +570,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index e54bcef6..11c5a7aa 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -402,7 +402,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 8174e4c0..fe0c7a4f 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -497,7 +497,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 2203fef8..778f0551 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -582,7 +582,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 1fa42c89..f21731ae 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -519,7 +519,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 36a25368..0ecfb68b 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 5894c922..dafc3c1b 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -498,7 +498,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index ac14ab39..7c827aae 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index c1320d42..7e2bd450 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index afc586ac..1b6e7ef1 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -455,7 +455,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 4d82d1bb..09e772cb 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 0aee12b4..74b87fed 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -351,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index fcaea157..422c8b5e 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 6817ab56..fa9157d4 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index d42cbbb0..5943b415 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 7963f691..e4cec416 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -253,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 458a6ee3..d1bbb2d7 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 324226d6..a68bac4f 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -797,7 +797,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 65a05db0..36030d46 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 5110f055..a21a4d19 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 4ac0f60b..24509ce0 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -337,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index cedd6db3..f7a9aee0 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 4018d584..a2634fc4 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 989b1f82..22649334 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -847,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 4548c387..7f55c015 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -305,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index ba7dc7bc..e63c0b2f 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 014f2e43..956d486e 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index c4d03e74..cac1ee1a 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -757,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 1b5608b3..a075e436 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -637,7 +637,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index e3607e8d..64ef9d93 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 3f36bc5f..45912912 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index cd18521c..838d0f13 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -787,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 7e2ec758..56ec0832 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 2f69225f..0601bd9b 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1221,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 654c4eed..9c17f791 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1342,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 33bf0cc6..a955e881 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1123,7 +1123,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 58c68146..c5a98580 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -997,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index deb5b527..ace37844 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -983,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index a0e978bf..6a839ee3 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1506,7 +1506,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index fea79c2c..0576e2fb 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1520,7 +1520,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 92c153ee..fbac0d1a 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -611,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index e3a6d14d..9d8d4e7e 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2426,7 +2426,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index eefdbad4..df19de0e 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2765,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 57499adf..41dbb360 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2945,7 +2945,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 684a1c89..cdf418d2 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1441,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 0e299b92..31f1c814 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4419,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index a074e33f..ea1ce743 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -529,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 0ce11277..eac56200 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -43,9 +43,9 @@
    -

    Assinment

    +

    Assignment

    @@ -482,7 +482,7 @@ nb: this function is used for the input for most outward facing functions
    -

    Definations

    +

    Definitions

    @@ -1342,7 +1342,7 @@ nb: this function is used for the input for most outward facing functions

    -

    Assinment

    +

    Assignment

    @@ -1895,7 +1895,7 @@ nb: this function is used for the input for most outward facing functions

    -

    Definations

    +

    Definitions

    @@ -2021,7 +2021,7 @@ nb: this function is used for the input for most outward facing functions

    Usage: -
    -- Defineing a flag trigger
    +    
    -- Defining a flag trigger
     Roles.define_flag_trigger('is_donator', function(player, state)
         player.character_running_speed_modifier = state and 1.5 or 1
     end)
    @@ -2206,7 +2206,7 @@ nb: this function is used for the input for most outward facing functions

    Usage: -
    -- Defineing a new role
    +    
    -- Defining a new role
     local role = Roles.new_role('Moderator', 'Mod')
    @@ -2393,7 +2393,7 @@ nb: this function is used for the input for most outward facing functions

    Usage: -
    -- Disalow an action for a role, useful if inherit an action from a parent
    +    
    -- Disallow an action for a role, useful if inherit an action from a parent
     role:disallow{
         'command/kill',
         'gui/game settings'
    @@ -3348,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html
    index e6c0dd5f..b3791a3c 100644
    --- a/docs/data/Alt-View.html
    +++ b/docs/data/Alt-View.html
    @@ -333,7 +333,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html
    index b240a042..5b775ce7 100644
    --- a/docs/data/Bonus.html
    +++ b/docs/data/Bonus.html
    @@ -485,7 +485,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html
    index 3690c4fd..c716681d 100644
    --- a/docs/data/Greetings.html
    +++ b/docs/data/Greetings.html
    @@ -428,7 +428,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html
    index 1b5e0e3f..6abcb35e 100644
    --- a/docs/data/Player-Colours.html
    +++ b/docs/data/Player-Colours.html
    @@ -389,7 +389,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html
    index f80c7435..55c466dc 100644
    --- a/docs/data/Quickbar.html
    +++ b/docs/data/Quickbar.html
    @@ -406,7 +406,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/data/Tag.html b/docs/data/Tag.html
    index 4c7c0df6..3ec608a5 100644
    --- a/docs/data/Tag.html
    +++ b/docs/data/Tag.html
    @@ -484,7 +484,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html
    index 9d117bd0..dfee3eaf 100644
    --- a/docs/guis/Player-List.html
    +++ b/docs/guis/Player-List.html
    @@ -732,7 +732,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html
    index c8bd4e38..d1febd43 100644
    --- a/docs/guis/Readme.html
    +++ b/docs/guis/Readme.html
    @@ -856,7 +856,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html
    index 0d1436c4..21755f8b 100644
    --- a/docs/guis/Rocket-Info.html
    +++ b/docs/guis/Rocket-Info.html
    @@ -704,7 +704,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html
    index c6fd1be0..5213a184 100644
    --- a/docs/guis/Science-Info.html
    +++ b/docs/guis/Science-Info.html
    @@ -583,7 +583,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html
    index a646f68f..8f0183b1 100644
    --- a/docs/guis/Task-List.html
    +++ b/docs/guis/Task-List.html
    @@ -769,7 +769,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html
    index e9098e9a..0abe9e83 100644
    --- a/docs/guis/Warps-List.html
    +++ b/docs/guis/Warps-List.html
    @@ -1040,7 +1040,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html
    index 5fe52485..67b79094 100644
    --- a/docs/guis/server-ups.html
    +++ b/docs/guis/server-ups.html
    @@ -478,7 +478,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/index.html b/docs/index.html
    index c69548d3..d250158e 100644
    --- a/docs/index.html
    +++ b/docs/index.html
    @@ -540,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/control.html b/docs/modules/control.html
    index 8a572b6a..ad8edb2e 100644
    --- a/docs/modules/control.html
    +++ b/docs/modules/control.html
    @@ -308,7 +308,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html
    index a4de057c..64b6bd78 100644
    --- a/docs/modules/modules.addons.station-auto-name.html
    +++ b/docs/modules/modules.addons.station-auto-name.html
    @@ -306,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html
    index 2ccfa24b..706d526b 100644
    --- a/docs/modules/overrides.debug.html
    +++ b/docs/modules/overrides.debug.html
    @@ -667,7 +667,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html
    index 885fff6b..903334f6 100644
    --- a/docs/modules/overrides.math.html
    +++ b/docs/modules/overrides.math.html
    @@ -366,7 +366,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html
    index 7b353063..5e97b51d 100644
    --- a/docs/modules/overrides.table.html
    +++ b/docs/modules/overrides.table.html
    @@ -2021,7 +2021,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html
    index ab056f7e..55613cc2 100644
    --- a/docs/modules/utils.event.html
    +++ b/docs/modules/utils.event.html
    @@ -1305,7 +1305,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html
    index 527f298c..c0ea215f 100644
    --- a/docs/modules/utils.event_core.html
    +++ b/docs/modules/utils.event_core.html
    @@ -447,7 +447,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html
    index 643238de..166a9cfc 100644
    --- a/docs/modules/utils.task.html
    +++ b/docs/modules/utils.task.html
    @@ -664,7 +664,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html
    index 38ad2114..a3853998 100644
    --- a/docs/topics/LICENSE.html
    +++ b/docs/topics/LICENSE.html
    @@ -802,7 +802,7 @@ Public License instead of this License.  But first, please read
         generated by LDoc 
         
         
         
         
    diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html
    index b0403101..d5ececac 100644
    --- a/docs/topics/README.md.html
    +++ b/docs/topics/README.md.html
    @@ -354,7 +354,7 @@ Please report these errors to [the issues page](issues).
         generated by LDoc 
         
         
         
         
    
    From d93b413ecf8fa3a91e45009f16726cc982298519 Mon Sep 17 00:00:00 2001
    From: Cooldude2606 
    Date: Thu, 6 Aug 2020 17:03:42 +0100
    Subject: [PATCH 080/106] Fixed warnings not logging to discord
    
    ---
     modules/addons/discord-alerts.lua | 14 +++++++++-----
     modules/control/reports.lua       | 12 +++++++++---
     modules/control/warnings.lua      | 10 +++++++---
     3 files changed, 25 insertions(+), 11 deletions(-)
    
    diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua
    index ab124d84..9387d8d5 100644
    --- a/modules/addons/discord-alerts.lua
    +++ b/modules/addons/discord-alerts.lua
    @@ -92,13 +92,15 @@ if config.player_reports then
             }
         end)
         Event.add(Reports.events.on_report_removed,function(event)
    +        if event.batch ~= 1 then return end
             local player_name = get_player_name(event)
             emit_event{
    -            title='Report Removed',
    +            title='Reports Removed',
                 description='A player has a report removed',
                 color=Colors.green,
                 ['Player:']=''..player_name,
    -            ['By:']=''..event.removed_by_name
    +            ['By:']=''..event.removed_by_name,
    +            ['Amount:']=''..event.batch_count
             }
         end)
     end
    @@ -118,13 +120,15 @@ if config.player_warnings then
             }
         end)
         Event.add(Warnings.events.on_warning_removed,function(event)
    -        local player_name,by_player_name = get_player_name(event)
    +        if event.batch ~= 1 then return end
    +        local player_name = get_player_name(event)
             emit_event{
    -            title='Warning Removed',
    +            title='Warnings Removed',
                 description='A player has a warning removed',
                 color=Colors.green,
                 ['Player:']=''..player_name,
    -            ['By:']=''..by_player_name
    +            ['By:']=''..event.removed_by_name,
    +            ['Amount:']=''..event.batch_count
             }
         end)
     end
    diff --git a/modules/control/reports.lua b/modules/control/reports.lua
    index d5d5cf1b..535dca6f 100644
    --- a/modules/control/reports.lua
    +++ b/modules/control/reports.lua
    @@ -43,6 +43,8 @@ local Reports = {
             -- @tparam number player_index the player index of the player who has the report removed
             -- @tparam string reported_by_name the name of the player who made the removed report
             -- @tparam string removed_by_name the name of the player who removed the report
    +        -- @tparam number batch_count the number of reports removed in this batch, always one when not a batch
    +        -- @tparam number batch the index of this event in a batch, always one when not a batch
             on_report_removed = script.generate_event_name()
         }
     }
    @@ -159,13 +161,15 @@ end
     -- @tparam LuaPlayer player the player who is having the report removed from them
     -- @tparam string reported_by_name the player who had the report
     -- @tparam string removed_by_name the player who is clearing the report
    -local function report_removed_event(player,reported_by_name,removed_by_name)
    +local function report_removed_event(player,reported_by_name,removed_by_name,batch,batch_count)
         script.raise_event(Reports.events.on_report_removed,{
             name = Reports.events.on_report_removed,
             tick = game.tick,
             player_index = player.index,
             reported_by_name = reported_by_name,
    -        removed_by_name = removed_by_name
    +        removed_by_name = removed_by_name,
    +        batch_count = batch_count or 1,
    +        batch = batch or 1
         })
     end
     
    @@ -207,8 +211,10 @@ function Reports.remove_all(player,removed_by_name)
             return false
         end
     
    +    local ctn, total = 0, #reports
         for reported_by_name,_ in pairs(reports) do
    -        report_removed_event(player,reported_by_name,removed_by_name)
    +        ctn = ctn + 1
    +        report_removed_event(player, reported_by_name, removed_by_name, ctn, total)
         end
     
         user_reports[player.name] = nil
    diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua
    index 2e6d057b..a877bd3b 100644
    --- a/modules/control/warnings.lua
    +++ b/modules/control/warnings.lua
    @@ -45,6 +45,8 @@ local Warnings = {
             -- @tparam string warning_by_name the name of the player who gave the warning
             -- @tparam string removed_by_name the name of the player who is removing the warning
             -- @tparam number warning_count the new number of warnings that the player has
    +        -- @tparam number batch_count the number of warnings removed in this batch, always one when not a batch
    +        -- @tparam number batch the index of this event in a batch, always one when not a batch
             on_warning_removed = script.generate_event_name(),
             --- When a warning is added to a player, by the script
             -- @event on_script_warning_added
    @@ -145,14 +147,16 @@ end
     -- @tparam string warning_by_name the name of the player who made the warning
     -- @tparam string removed_by_name the name of the player who is doing the action
     -- @tparam number warning_count the number of warnings that the player how has
    -local function warning_removed_event(player,warning_by_name,removed_by_name,warning_count)
    +local function warning_removed_event(player,warning_by_name,removed_by_name,warning_count,batch,batch_count)
         script.raise_event(Warnings.events.on_warning_removed,{
             name = Warnings.events.on_warning_removed,
             tick = game.tick,
             player_index = player.index,
             warning_count = warning_count,
             warning_by_name = warning_by_name,
    -        removed_by_name = removed_by_name
    +        removed_by_name = removed_by_name,
    +        batch_count = batch_count or 1,
    +        batch = batch or 1
         })
     end
     
    @@ -189,7 +193,7 @@ function Warnings.clear_warnings(player,by_player_name)
     
         local warning_count = #warnings
         for n,warning in pairs(warnings) do
    -        warning_removed_event(player,warning.by_player_name,by_player_name,warning_count-n)
    +        warning_removed_event(player,warning.by_player_name,by_player_name,warning_count-n,n,warning_count)
         end
     
         user_warnings[player.name] = nil
    
    From a2676f0cc17b75403908be9ea107436fa4eccd2b Mon Sep 17 00:00:00 2001
    From: Cooldude2606 
    Date: Thu, 6 Aug 2020 19:55:20 +0100
    Subject: [PATCH 081/106] Fixed Datastore
    
    ---
     expcore/datastore.lua | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/expcore/datastore.lua b/expcore/datastore.lua
    index f0d5baa9..3fb93017 100644
    --- a/expcore/datastore.lua
    +++ b/expcore/datastore.lua
    @@ -437,7 +437,7 @@ function Datastore:set_serializer(callback)
     end
     
     --[[-- Set a default value to be returned by get if no other default is given, using will mean get will never return nil, set using the default will set to nil to save space
    -@tparam any default The value that will be deep copied by get if the value is nil and no other default is given
    +@tparam any value The value that will be deep copied by get if the value is nil and no other default is given
     @tparam boolean allowSet When true if the default is passed as the value for set it will be set rather than setting nil
     
     @usage-- Set a default value to be returned by get
    @@ -747,6 +747,7 @@ local function event_error(err) log('An error ocurred in a datastore event handl
     @tparam string event_name The name of the event to raise for this datastore
     @tparam string key The key that this event is being raised for
     @tparam[opt] any value The current value that this key has, might be a deep copy of the value
    +@tparam[opt] any old_value The previous value that this key has, might be a deep copy of the value
     @tparam[opt] string source Where this call came from, used to do event recursion so can be parent or child
     @treturn any The value that is left after being passed through all the event handlers
     
    
    From e44b8d52ba6fb67bde7ba17783a9566c19a8a524 Mon Sep 17 00:00:00 2001
    From: Cooldude2606 
    Date: Thu, 6 Aug 2020 19:58:10 +0100
    Subject: [PATCH 082/106] Fixed Reports and warnings
    
    ---
     modules/control/reports.lua  | 9 +++------
     modules/control/warnings.lua | 2 ++
     2 files changed, 5 insertions(+), 6 deletions(-)
    
    diff --git a/modules/control/reports.lua b/modules/control/reports.lua
    index 2c62ce75..ea2a710f 100644
    --- a/modules/control/reports.lua
    +++ b/modules/control/reports.lua
    @@ -161,13 +161,10 @@ end
     -- @tparam LuaPlayer player the player who is having the report removed from them
     -- @tparam string reported_by_name the player who had the report
     -- @tparam string removed_by_name the player who is clearing the report
    -<<<<<<< HEAD
    -local function report_removed_event(player, reported_by_name, removed_by_name)
    +-- @tparam number batch the index of this event in a batch, always one when not a batch
    +-- @tparam number batch_count the number of reports removed in this batch, always one when not a batch
    +local function report_removed_event(player, reported_by_name, removed_by_name, batch, batch_count)
         script.raise_event(Reports.events.on_report_removed, {
    -=======
    -local function report_removed_event(player,reported_by_name,removed_by_name,batch,batch_count)
    -    script.raise_event(Reports.events.on_report_removed,{
    ->>>>>>> 6.0.11
             name = Reports.events.on_report_removed,
             tick = game.tick,
             player_index = player.index,
    diff --git a/modules/control/warnings.lua b/modules/control/warnings.lua
    index 10d75e77..aca6f1ba 100644
    --- a/modules/control/warnings.lua
    +++ b/modules/control/warnings.lua
    @@ -155,6 +155,8 @@ end
     -- @tparam string warning_by_name the name of the player who made the warning
     -- @tparam string removed_by_name the name of the player who is doing the action
     -- @tparam number warning_count the number of warnings that the player how has
    +-- @tparam number batch the index of this event in a batch, always one when not a batch
    +-- @tparam number batch_count the number of reports removed in this batch, always one when not a batch
     local function warning_removed_event(player, warning_by_name, removed_by_name, warning_count, batch, batch_count)
         script.raise_event(Warnings.events.on_warning_removed, {
             name = Warnings.events.on_warning_removed,
    
    From 1ac81a8d139395ada15b56477ab31861bf5d45f6 Mon Sep 17 00:00:00 2001
    From: Cooldude2606 
    Date: Thu, 6 Aug 2020 19:01:02 +0000
    Subject: [PATCH 083/106] Automatic Doc Update
    
    ---
     docs/addons/Advanced-Start.html               |  2 +-
     docs/addons/Chat-Popups.html                  |  2 +-
     docs/addons/Chat-Reply.html                   |  2 +-
     docs/addons/Compilatron.html                  |  2 +-
     docs/addons/Damage-Popups.html                |  2 +-
     docs/addons/Death-Logger.html                 |  2 +-
     docs/addons/Discord-Alerts.html               |  2 +-
     docs/addons/Inventory-Clear.html              |  2 +-
     docs/addons/Pollution-Grading.html            |  2 +-
     docs/addons/Scorched-Earth.html               |  2 +-
     docs/addons/Spawn-Area.html                   |  2 +-
     docs/addons/Tree-Decon.html                   |  2 +-
     docs/commands/Admin-Chat.html                 |  2 +-
     docs/commands/Cheat-Mode.html                 |  2 +-
     docs/commands/Clear-Inventory.html            |  2 +-
     docs/commands/Debug.html                      |  2 +-
     docs/commands/Find.html                       |  2 +-
     docs/commands/Help.html                       |  2 +-
     docs/commands/Home.html                       |  2 +-
     docs/commands/Interface.html                  |  2 +-
     docs/commands/Jail.html                       |  2 +-
     docs/commands/Kill.html                       |  2 +-
     docs/commands/Me.html                         |  2 +-
     docs/commands/Rainbow.html                    |  2 +-
     docs/commands/Repair.html                     |  2 +-
     docs/commands/Reports.html                    |  2 +-
     docs/commands/Roles.html                      |  2 +-
     docs/commands/Spawn.html                      |  2 +-
     docs/commands/Teleport.html                   |  2 +-
     docs/commands/Warnings.html                   |  2 +-
     docs/configs/Advanced-Start.html              |  2 +-
     docs/configs/Bonuses.html                     |  2 +-
     docs/configs/Chat-Reply.html                  |  2 +-
     docs/configs/Commands-Auth-Admin.html         |  2 +-
     docs/configs/Commands-Auth-Roles.html         |  2 +-
     .../Commands-Auth-Runtime-Disable.html        |  2 +-
     docs/configs/Commands-Parse-Roles.html        |  2 +-
     docs/configs/Commands-Parse.html              |  2 +-
     docs/configs/Compilatron.html                 |  2 +-
     docs/configs/Death-Logger.html                |  2 +-
     docs/configs/Discord-Alerts.html              |  2 +-
     docs/configs/File-Loader.html                 |  2 +-
     docs/configs/Permission-Groups.html           |  2 +-
     docs/configs/Player-List.html                 |  2 +-
     docs/configs/Pollution-Grading.html           |  2 +-
     docs/configs/Popup-Messages.html              |  2 +-
     docs/configs/Preset-Player-Colours.html       |  2 +-
     docs/configs/Preset-Player-Quickbar.html      |  2 +-
     docs/configs/Repair.html                      |  2 +-
     docs/configs/Rockets.html                     |  2 +-
     docs/configs/Roles.html                       |  2 +-
     docs/configs/Science.html                     |  2 +-
     docs/configs/Scorched-Earth.html              |  2 +-
     docs/configs/Spawn-Area.html                  |  2 +-
     docs/configs/Statistics.html                  |  2 +-
     docs/configs/Tasks.html                       |  2 +-
     docs/configs/Warnings.html                    |  2 +-
     docs/configs/Warps.html                       |  2 +-
     docs/configs/inventory_clear.html             |  2 +-
     docs/control/Jail.html                        |  2 +-
     docs/control/Production.html                  |  2 +-
     docs/control/Reports.html                     | 34 ++++++++++++++++++-
     docs/control/Rockets.html                     |  2 +-
     docs/control/Tasks.html                       |  2 +-
     docs/control/Warnings.html                    | 34 ++++++++++++++++++-
     docs/control/Warps.html                       |  2 +-
     docs/core/Async.html                          |  2 +-
     docs/core/Commands.html                       |  2 +-
     docs/core/Common.html                         |  2 +-
     docs/core/Datastore.html                      | 29 ++++++++++++----
     docs/core/Groups.html                         |  2 +-
     docs/core/Gui.html                            |  2 +-
     docs/core/PlayerData.html                     |  2 +-
     docs/core/Roles.html                          |  2 +-
     docs/data/Alt-View.html                       |  2 +-
     docs/data/Bonus.html                          |  2 +-
     docs/data/Greetings.html                      |  2 +-
     docs/data/Player-Colours.html                 |  2 +-
     docs/data/Quickbar.html                       |  2 +-
     docs/data/Tag.html                            |  2 +-
     docs/guis/Player-List.html                    |  2 +-
     docs/guis/Readme.html                         |  2 +-
     docs/guis/Rocket-Info.html                    |  2 +-
     docs/guis/Science-Info.html                   |  2 +-
     docs/guis/Task-List.html                      |  2 +-
     docs/guis/Warps-List.html                     |  2 +-
     docs/guis/server-ups.html                     |  2 +-
     docs/index.html                               |  2 +-
     docs/modules/control.html                     |  2 +-
     .../modules.addons.station-auto-name.html     |  2 +-
     docs/modules/overrides.debug.html             |  2 +-
     docs/modules/overrides.math.html              |  2 +-
     docs/modules/overrides.table.html             |  2 +-
     docs/modules/utils.event.html                 |  2 +-
     docs/modules/utils.event_core.html            |  2 +-
     docs/modules/utils.task.html                  |  2 +-
     docs/topics/LICENSE.html                      |  2 +-
     docs/topics/README.md.html                    |  2 +-
     98 files changed, 184 insertions(+), 103 deletions(-)
    
    diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html
    index b4fedd31..96250255 100644
    --- a/docs/addons/Advanced-Start.html
    +++ b/docs/addons/Advanced-Start.html
    @@ -361,7 +361,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html
    index 7645cb1b..c6e2a872 100644
    --- a/docs/addons/Chat-Popups.html
    +++ b/docs/addons/Chat-Popups.html
    @@ -362,7 +362,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html
    index bef5ca5b..ccdf2d0f 100644
    --- a/docs/addons/Chat-Reply.html
    +++ b/docs/addons/Chat-Reply.html
    @@ -389,7 +389,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html
    index 74459852..0282db03 100644
    --- a/docs/addons/Compilatron.html
    +++ b/docs/addons/Compilatron.html
    @@ -598,7 +598,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html
    index 593ac914..4f63ada1 100644
    --- a/docs/addons/Damage-Popups.html
    +++ b/docs/addons/Damage-Popups.html
    @@ -362,7 +362,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html
    index b44e1aa4..f0ca05f9 100644
    --- a/docs/addons/Death-Logger.html
    +++ b/docs/addons/Death-Logger.html
    @@ -417,7 +417,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html
    index 700191e0..da597649 100644
    --- a/docs/addons/Discord-Alerts.html
    +++ b/docs/addons/Discord-Alerts.html
    @@ -473,7 +473,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html
    index d3c74619..9c397054 100644
    --- a/docs/addons/Inventory-Clear.html
    +++ b/docs/addons/Inventory-Clear.html
    @@ -361,7 +361,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html
    index 07eca129..e37bdcc0 100644
    --- a/docs/addons/Pollution-Grading.html
    +++ b/docs/addons/Pollution-Grading.html
    @@ -333,7 +333,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html
    index b31fe9e2..70af5da4 100644
    --- a/docs/addons/Scorched-Earth.html
    +++ b/docs/addons/Scorched-Earth.html
    @@ -417,7 +417,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html
    index 3e635291..c9b1fe0d 100644
    --- a/docs/addons/Spawn-Area.html
    +++ b/docs/addons/Spawn-Area.html
    @@ -389,7 +389,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html
    index f353d1ef..4c56e730 100644
    --- a/docs/addons/Tree-Decon.html
    +++ b/docs/addons/Tree-Decon.html
    @@ -389,7 +389,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html
    index fe1bd0d5..21482eba 100644
    --- a/docs/commands/Admin-Chat.html
    +++ b/docs/commands/Admin-Chat.html
    @@ -401,7 +401,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html
    index c0cdead4..4c0fe1ac 100644
    --- a/docs/commands/Cheat-Mode.html
    +++ b/docs/commands/Cheat-Mode.html
    @@ -374,7 +374,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html
    index 6dd3fdc6..78ba22a9 100644
    --- a/docs/commands/Clear-Inventory.html
    +++ b/docs/commands/Clear-Inventory.html
    @@ -401,7 +401,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html
    index b6b2e741..7241009b 100644
    --- a/docs/commands/Debug.html
    +++ b/docs/commands/Debug.html
    @@ -378,7 +378,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Find.html b/docs/commands/Find.html
    index 3f3256dc..250d30d2 100644
    --- a/docs/commands/Find.html
    +++ b/docs/commands/Find.html
    @@ -373,7 +373,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Help.html b/docs/commands/Help.html
    index b6766805..1e48c92f 100644
    --- a/docs/commands/Help.html
    +++ b/docs/commands/Help.html
    @@ -417,7 +417,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Home.html b/docs/commands/Home.html
    index 295fb230..08a4ae33 100644
    --- a/docs/commands/Home.html
    +++ b/docs/commands/Home.html
    @@ -471,7 +471,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html
    index cea8d2cc..1648ca1a 100644
    --- a/docs/commands/Interface.html
    +++ b/docs/commands/Interface.html
    @@ -429,7 +429,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html
    index 62c68f97..cac7fbdf 100644
    --- a/docs/commands/Jail.html
    +++ b/docs/commands/Jail.html
    @@ -624,7 +624,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html
    index 105dadaf..79db9c51 100644
    --- a/docs/commands/Kill.html
    +++ b/docs/commands/Kill.html
    @@ -402,7 +402,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Me.html b/docs/commands/Me.html
    index 4d01e797..34d74506 100644
    --- a/docs/commands/Me.html
    +++ b/docs/commands/Me.html
    @@ -373,7 +373,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html
    index b44da161..c35b611a 100644
    --- a/docs/commands/Rainbow.html
    +++ b/docs/commands/Rainbow.html
    @@ -401,7 +401,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html
    index b269385e..4434d8ec 100644
    --- a/docs/commands/Repair.html
    +++ b/docs/commands/Repair.html
    @@ -334,7 +334,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html
    index 35f1096b..3193bf82 100644
    --- a/docs/commands/Reports.html
    +++ b/docs/commands/Reports.html
    @@ -598,7 +598,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html
    index 42e1079a..f7ab5ef0 100644
    --- a/docs/commands/Roles.html
    +++ b/docs/commands/Roles.html
    @@ -570,7 +570,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html
    index 11c5a7aa..3cd3ae75 100644
    --- a/docs/commands/Spawn.html
    +++ b/docs/commands/Spawn.html
    @@ -402,7 +402,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html
    index fe0c7a4f..71fc2b2d 100644
    --- a/docs/commands/Teleport.html
    +++ b/docs/commands/Teleport.html
    @@ -497,7 +497,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html
    index 778f0551..552aedca 100644
    --- a/docs/commands/Warnings.html
    +++ b/docs/commands/Warnings.html
    @@ -582,7 +582,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html
    index f21731ae..a4baf206 100644
    --- a/docs/configs/Advanced-Start.html
    +++ b/docs/configs/Advanced-Start.html
    @@ -519,7 +519,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html
    index 0ecfb68b..20fb9309 100644
    --- a/docs/configs/Bonuses.html
    +++ b/docs/configs/Bonuses.html
    @@ -250,7 +250,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html
    index dafc3c1b..4ed8c08f 100644
    --- a/docs/configs/Chat-Reply.html
    +++ b/docs/configs/Chat-Reply.html
    @@ -498,7 +498,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html
    index 7c827aae..87c99fb8 100644
    --- a/docs/configs/Commands-Auth-Admin.html
    +++ b/docs/configs/Commands-Auth-Admin.html
    @@ -307,7 +307,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html
    index 7e2bd450..afc9e66e 100644
    --- a/docs/configs/Commands-Auth-Roles.html
    +++ b/docs/configs/Commands-Auth-Roles.html
    @@ -333,7 +333,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html
    index 1b6e7ef1..5d38f85f 100644
    --- a/docs/configs/Commands-Auth-Runtime-Disable.html
    +++ b/docs/configs/Commands-Auth-Runtime-Disable.html
    @@ -455,7 +455,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html
    index 09e772cb..4ea6c11c 100644
    --- a/docs/configs/Commands-Parse-Roles.html
    +++ b/docs/configs/Commands-Parse-Roles.html
    @@ -367,7 +367,7 @@
         generated by LDoc 
         
         
         
         
    diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html
    index 74b87fed..3763878d 100644
    --- a/docs/configs/Commands-Parse.html
    +++ b/docs/configs/Commands-Parse.html
    @@ -351,7 +351,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 422c8b5e..68d869f8 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index fa9157d4..99690c01 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 5943b415..646dcda2 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index e4cec416..c902276a 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -253,7 +253,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index d1bbb2d7..5ee5de2e 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index a68bac4f..01c15a99 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -797,7 +797,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 36030d46..96673fd0 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index a21a4d19..d6a2f305 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 24509ce0..6c6c4710 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -337,7 +337,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index f7a9aee0..6c451a89 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index a2634fc4..ee8835f6 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -427,7 +427,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 22649334..1bd9ab8c 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -847,7 +847,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 7f55c015..3d2a3828 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -305,7 +305,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index e63c0b2f..bf96f7e7 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -367,7 +367,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 956d486e..e8fe0424 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -401,7 +401,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index cac1ee1a..ef3a9c24 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -757,7 +757,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index a075e436..13860f44 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -637,7 +637,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 64ef9d93..af3c2dbd 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -397,7 +397,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 45912912..c0b715cd 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 838d0f13..a59a2e1d 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -787,7 +787,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 56ec0832..38480f76 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -250,7 +250,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 0601bd9b..8c95347e 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1221,7 +1221,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 9c17f791..7b5e6aef 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1342,7 +1342,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index a955e881..66551361 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -557,6 +557,38 @@ + + + +
  • + + batch_count + + : + + (number) + + the number of reports removed in this batch, always one when not a batch + +
  • + + + + + +
  • + + batch + + : + + (number) + + the index of this event in a batch, always one when not a batch + +
  • + + @@ -1123,7 +1155,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index c5a98580..bc6e6c1e 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -997,7 +997,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index ace37844..03af2e53 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -983,7 +983,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 6a839ee3..4a8d1fc6 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -680,6 +680,38 @@ + + + +
  • + + batch_count + + : + + (number) + + the number of warnings removed in this batch, always one when not a batch + +
  • + + + + + +
  • + + batch + + : + + (number) + + the index of this event in a batch, always one when not a batch + +
  • + + @@ -1506,7 +1538,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 0576e2fb..b8167cf4 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1520,7 +1520,7 @@ Warps.make_warp_tag(warp_id)
    generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index fbac0d1a..cd3f2a7b 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -611,7 +611,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 9d8d4e7e..11a0a179 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2426,7 +2426,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index df19de0e..7bbe0ea6 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2765,7 +2765,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 41dbb360..a390b022 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -496,7 +496,7 @@ PlayerData.Statistics:combine('JoinCount')
    - + @@ -572,7 +572,7 @@ PlayerData.Statistics:combine('JoinCount') - + @@ -1602,7 +1602,7 @@ ExampleData:set_serializer(function(rawKey)
    # - set_default(default, allowSet) + set_default(value, allowSet)
    @@ -1622,7 +1622,7 @@ ExampleData:set_serializer(function(rawKey)
  • - default + value : @@ -2549,7 +2549,7 @@ ExampleData:unload_all(function(key, value)
    # - raise_event(event_name, key[, value][, source]) + raise_event(event_name, key[, value][, old_value][, source])
    @@ -2616,6 +2616,23 @@ ExampleData:unload_all(function(key, value) +
  • + + old_value + + : + + (any) + + The previous value that this key has, might be a deep copy of the value + + (optional) +
  • + + + + +
  • source @@ -2945,7 +2962,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index cdf418d2..1988bce5 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1441,7 +1441,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 31f1c814..85de422b 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4419,7 +4419,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index ea1ce743..1f285cdc 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -529,7 +529,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index eac56200..68f1c306 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3348,7 +3348,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index b3791a3c..abc3d607 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -333,7 +333,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 5b775ce7..d3142c03 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -485,7 +485,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index c716681d..8998c9f9 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -428,7 +428,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 6abcb35e..f5488878 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -389,7 +389,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 55c466dc..745dfef6 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -406,7 +406,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 3ec608a5..8195f1a4 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -484,7 +484,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index dfee3eaf..47547080 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -732,7 +732,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index d1febd43..d74e69aa 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -856,7 +856,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 21755f8b..aa09ceb5 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -704,7 +704,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 5213a184..0d99d863 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -583,7 +583,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 8f0183b1..ab2005cd 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -769,7 +769,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 0abe9e83..c85a7eae 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1040,7 +1040,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 67b79094..3c53ea30 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -478,7 +478,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index d250158e..326b106f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -540,7 +540,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index ad8edb2e..06e5786f 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -308,7 +308,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 64b6bd78..94a9f6a2 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -306,7 +306,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 706d526b..b369f4ab 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -667,7 +667,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 903334f6..c726fc05 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -366,7 +366,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 5e97b51d..49f92dd6 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2021,7 +2021,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 55613cc2..1c3fcc30 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1305,7 +1305,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index c0ea215f..a763cd7e 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 166a9cfc..d9c5c91c 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -664,7 +664,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index a3853998..5952bef6 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -802,7 +802,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index d5ececac..2cbaef22 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -354,7 +354,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 86370aeada9eaf7c8f1f47aab629e4ac621c54eb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 13 Aug 2020 23:30:03 +0000 Subject: [PATCH 084/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 4 +- docs/addons/Chat-Popups.html | 4 +- docs/addons/Chat-Reply.html | 4 +- docs/addons/Compilatron.html | 4 +- docs/addons/Damage-Popups.html | 4 +- docs/addons/Death-Logger.html | 4 +- docs/addons/Discord-Alerts.html | 4 +- docs/addons/Inventory-Clear.html | 4 +- docs/addons/Pollution-Grading.html | 4 +- docs/addons/Scorched-Earth.html | 4 +- docs/addons/Spawn-Area.html | 4 +- docs/addons/Tree-Decon.html | 4 +- docs/commands/Admin-Chat.html | 4 +- docs/commands/Cheat-Mode.html | 4 +- docs/commands/Clear-Inventory.html | 4 +- docs/commands/Connect.html | 614 +++++++++++++++ docs/commands/Debug.html | 4 +- docs/commands/Find.html | 4 +- docs/commands/Help.html | 4 +- docs/commands/Home.html | 4 +- docs/commands/Interface.html | 32 +- docs/commands/Jail.html | 4 +- docs/commands/Kill.html | 4 +- docs/commands/Me.html | 4 +- docs/commands/Rainbow.html | 4 +- docs/commands/Repair.html | 4 +- docs/commands/Reports.html | 4 +- docs/commands/Roles.html | 4 +- docs/commands/Spawn.html | 4 +- docs/commands/Teleport.html | 4 +- docs/commands/Warnings.html | 4 +- docs/configs/Advanced-Start.html | 4 +- docs/configs/Bonuses.html | 4 +- docs/configs/Chat-Reply.html | 4 +- docs/configs/Commands-Auth-Admin.html | 4 +- docs/configs/Commands-Auth-Roles.html | 4 +- .../Commands-Auth-Runtime-Disable.html | 4 +- docs/configs/Commands-Parse-Roles.html | 4 +- docs/configs/Commands-Parse.html | 4 +- docs/configs/Compilatron.html | 4 +- docs/configs/Death-Logger.html | 4 +- docs/configs/Discord-Alerts.html | 4 +- docs/configs/File-Loader.html | 4 +- docs/configs/Permission-Groups.html | 4 +- docs/configs/Player-List.html | 4 +- docs/configs/Pollution-Grading.html | 4 +- docs/configs/Popup-Messages.html | 4 +- docs/configs/Preset-Player-Colours.html | 4 +- docs/configs/Preset-Player-Quickbar.html | 4 +- docs/configs/Repair.html | 4 +- docs/configs/Rockets.html | 4 +- docs/configs/Roles.html | 4 +- docs/configs/Science.html | 4 +- docs/configs/Scorched-Earth.html | 4 +- docs/configs/Spawn-Area.html | 4 +- docs/configs/Statistics.html | 4 +- docs/configs/Tasks.html | 4 +- docs/configs/Warnings.html | 4 +- docs/configs/Warps.html | 4 +- docs/configs/inventory_clear.html | 4 +- docs/control/Jail.html | 4 +- docs/control/Production.html | 4 +- docs/control/Reports.html | 4 +- docs/control/Rockets.html | 4 +- docs/control/Tasks.html | 4 +- docs/control/Warnings.html | 4 +- docs/control/Warps.html | 4 +- docs/core/Async.html | 4 +- docs/core/Commands.html | 4 +- docs/core/Common.html | 4 +- docs/core/Datastore.html | 4 +- docs/core/External.html | 740 ++++++++++++++++++ docs/core/Groups.html | 4 +- docs/core/Gui.html | 4 +- docs/core/PlayerData.html | 4 +- docs/core/Roles.html | 4 +- docs/data/Alt-View.html | 4 +- docs/data/Bonus.html | 4 +- docs/data/Greetings.html | 4 +- docs/data/Player-Colours.html | 4 +- docs/data/Quickbar.html | 4 +- docs/data/Tag.html | 4 +- docs/guis/Player-List.html | 4 +- docs/guis/Readme.html | 206 ++++- docs/guis/Rocket-Info.html | 4 +- docs/guis/Science-Info.html | 4 +- docs/guis/Task-List.html | 4 +- docs/guis/Warps-List.html | 4 +- docs/guis/server-ups.html | 32 +- docs/index.html | 12 +- docs/modules/control.html | 4 +- .../modules.addons.station-auto-name.html | 4 +- docs/modules/overrides.debug.html | 4 +- docs/modules/overrides.math.html | 4 +- docs/modules/overrides.table.html | 4 +- docs/modules/utils.event.html | 4 +- docs/modules/utils.event_core.html | 4 +- docs/modules/utils.task.html | 4 +- docs/topics/LICENSE.html | 4 +- docs/topics/README.md.html | 4 +- 100 files changed, 1855 insertions(+), 157 deletions(-) create mode 100644 docs/commands/Connect.html create mode 100644 docs/core/External.html diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 96250255..6aeb414d 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -72,6 +72,7 @@
  • + @@ -127,6 +128,7 @@ + @@ -361,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index c6e2a872..16c72de1 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -362,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index ccdf2d0f..3464d378 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -389,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 0282db03..bf731c46 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -73,6 +73,7 @@ + @@ -128,6 +129,7 @@ + @@ -598,7 +600,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 4f63ada1..1d0b632d 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -362,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index f0ca05f9..1514ec1f 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -417,7 +419,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index da597649..fc4544d0 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -473,7 +475,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 9c397054..891b2b3e 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -361,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index e37bdcc0..03ead1bd 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -333,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 70af5da4..ca4ef857 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -417,7 +419,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index c9b1fe0d..bb5564e9 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -389,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 4c56e730..80c6f75e 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -72,6 +72,7 @@ + @@ -127,6 +128,7 @@ + @@ -389,7 +391,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 21482eba..495fcca4 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -401,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 4c0fe1ac..9470341f 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -374,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 78ba22a9..addbf00f 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -401,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Connect.html b/docs/commands/Connect.html new file mode 100644 index 00000000..6c136657 --- /dev/null +++ b/docs/commands/Connect.html @@ -0,0 +1,614 @@ + + + + + + + + Connect commands + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    Connect commands

    +

    Commands Module - Connect + - Adds a commands that allows you to request a player move to another server

    +

    + + + + + + + + + + + +
  • Set a callback that will be used to serialize keys which aren't strings
    set_default(default, allowSet)set_default(value, allowSet) Set a default value to be returned by get if no other default is given, using will mean get will never return nil, set using the default will set to nil to save space
    raise_event(event_name, key[, value][, source])raise_event(event_name, key[, value][, old_value][, source]) Internal, Raise an event on this datastore
    + +

    Dependencies

    + +
    + + + + + + + + + + + +
    expcore.async
    expcore.external
    expcore.commands
    + + +

    Commands

    + + + + + + + + + + + + + + + + +
    connectConnect to a different server
    connect-playerConnect a player to a different server
    connect-allConnect all players to a different server
    + + +
    + + +

    Dependencies

    +
    +
    +
    +
    + # + expcore.async +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.external +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.commands +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    Commands

    +
    +
    +
    +
    + # + connect +
    +
    +
    +
    + +

    Connect to a different server

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + server + + : + + (string) + + The address or name of the server to connect to + +
    • + + + + + +
    • + + is_address + + : + + (boolean) + + If an address was given for the server param + + (default: false) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + connect-player +
    +
    +
    +
    + +

    Connect a player to a different server

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + address + + : + + (string) + + The address or name of the server to connect to + +
    • + + + + + +
    • + + player + + : + + (LuaPlayer) + + The player to connect to a different server + +
    • + + + + + +
    • + + is_address + + : + + (boolean) + + If an address was given for the server param + + (default: false) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + connect-all +
    +
    +
    +
    + +

    Connect all players to a different server

    +

    + + + Command Parameters: + +
      + + + + + +
    • + + address + + : + + (string) + + The address or name of the server to connect to + +
    • + + + + + +
    • + + is_address + + : + + (boolean) + + If an address was given for the server param + + (default: false) +
    • + + +
    + + + + + + + + + + + + + +
    +
    + + + + + + + + + + diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 7241009b..3e18232a 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -378,7 +380,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 250d30d2..a24912fa 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -373,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 1e48c92f..8d6603f9 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -417,7 +419,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 08a4ae33..7ddba845 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -471,7 +473,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 1648ca1a..5da0a630 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -262,9 +264,6 @@ utils.global - - expcore.common - @@ -329,31 +328,6 @@ - - - - - - - -
    -
    -
    - # - expcore.common -
    -
    -
    -
    - - - - - - - - - @@ -429,7 +403,7 @@ generated by LDoc
    diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index cac7fbdf..c6bb3260 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -624,7 +626,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 79db9c51..93d35e5d 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -402,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 34d74506..68121998 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -373,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index c35b611a..75705b05 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -401,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 4434d8ec..03c57b14 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -52,6 +52,7 @@ + @@ -78,6 +79,7 @@ + @@ -334,7 +336,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 3193bf82..cbd14acf 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -598,7 +600,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index f7ab5ef0..60445452 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -570,7 +572,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 3cd3ae75..e01029bf 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -402,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 71fc2b2d..a78fcb0f 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -497,7 +499,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 552aedca..941acb8a 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -53,6 +53,7 @@ + @@ -79,6 +80,7 @@ + @@ -582,7 +584,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index a4baf206..3aed98c0 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -519,7 +521,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 20fb9309..183dd04f 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -81,6 +81,7 @@ + @@ -155,6 +156,7 @@ + @@ -250,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 4ed8c08f..d445ab74 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -90,6 +90,7 @@ + @@ -164,6 +165,7 @@ + @@ -498,7 +500,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 87c99fb8..069c2cc1 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -307,7 +309,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index afc9e66e..626c6c60 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -333,7 +335,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 5d38f85f..827aa0db 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -90,6 +90,7 @@ + @@ -164,6 +165,7 @@ + @@ -455,7 +457,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 4ea6c11c..651e371f 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -367,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 3763878d..edaa3da2 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -351,7 +353,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 68d869f8..8c4ac199 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -367,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 99690c01..db88dc39 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -429,7 +431,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 646dcda2..8ff2a878 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -81,6 +81,7 @@ + @@ -155,6 +156,7 @@ + @@ -250,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index c902276a..8d7055ba 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -81,6 +81,7 @@ + @@ -155,6 +156,7 @@ + @@ -253,7 +255,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 5ee5de2e..217eb4a6 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -308,7 +310,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 01c15a99..3ab18659 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -90,6 +90,7 @@ + @@ -164,6 +165,7 @@ + @@ -797,7 +799,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 96673fd0..5e2d1d52 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -397,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index d6a2f305..129eae8b 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -427,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 6c6c4710..cb16dae3 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -337,7 +339,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 6c451a89..f4ab75f8 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -81,6 +81,7 @@ + @@ -155,6 +156,7 @@ + @@ -250,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index ee8835f6..1cb9f8e5 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -427,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 1bd9ab8c..511fa00c 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -847,7 +849,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 3d2a3828..f684cf40 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -305,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index bf96f7e7..27081b1e 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -367,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index e8fe0424..121029f2 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -401,7 +403,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index ef3a9c24..3d9aebd7 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -757,7 +759,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 13860f44..555010db 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -637,7 +639,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index af3c2dbd..84859b6d 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -397,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index c0b715cd..8c6d3222 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -368,7 +370,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index a59a2e1d..249332bb 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -89,6 +89,7 @@ + @@ -163,6 +164,7 @@ + @@ -787,7 +789,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 38480f76..98abe81a 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -81,6 +81,7 @@ + @@ -155,6 +156,7 @@ + @@ -250,7 +252,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 8c95347e..c7247d67 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -70,6 +70,7 @@ + @@ -130,6 +131,7 @@ + @@ -1221,7 +1223,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 7b5e6aef..48b82ed7 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -70,6 +70,7 @@ + @@ -130,6 +131,7 @@ + @@ -1342,7 +1344,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 66551361..423283d2 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -70,6 +70,7 @@ + @@ -130,6 +131,7 @@ + @@ -1155,7 +1157,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index bc6e6c1e..923c8917 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -69,6 +69,7 @@ + @@ -129,6 +130,7 @@ + @@ -997,7 +999,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 03af2e53..1632e2e8 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -69,6 +69,7 @@ + @@ -129,6 +130,7 @@ + @@ -983,7 +985,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 4a8d1fc6..5635cfe7 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -69,6 +69,7 @@ + @@ -129,6 +130,7 @@ + @@ -1538,7 +1540,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index b8167cf4..2302ae32 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -70,6 +70,7 @@ + @@ -130,6 +131,7 @@ + @@ -1520,7 +1522,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index cd3f2a7b..b3fb18b7 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -54,6 +54,7 @@ + @@ -128,6 +129,7 @@ + @@ -611,7 +613,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 11a0a179..ce74a937 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -60,6 +60,7 @@ + @@ -134,6 +135,7 @@ + @@ -2426,7 +2428,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 7bbe0ea6..1acadfd2 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -57,6 +57,7 @@ + @@ -131,6 +132,7 @@ + @@ -2765,7 +2767,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index a390b022..a0ee6364 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -59,6 +59,7 @@ + @@ -133,6 +134,7 @@ + @@ -2962,7 +2964,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/External.html b/docs/core/External.html new file mode 100644 index 00000000..2e411712 --- /dev/null +++ b/docs/core/External.html @@ -0,0 +1,740 @@ + + + + + + + + External core + + + + + + + +
    +
    + + + + + + + +
    + + + + + + + + +

    External core

    +

    Core Module - External +- A module used to make accessing externally set data easier.

    +

    + + + + + + +

    Usage

    +
    -- Printing all server to chat
    +local External = require 'expcore.external' --- @dep expcore.external
    +
    +local message = 'id: %s name: %s version: %s status: %s'
    +for server_id, server in pairs(External.get_servers()) do
    +    local status = External.get_server_status(server_id)
    +    game.print(message:format(server_id, server.name, server.version, status))
    +end
    + + + + + +
    + +

    Functions

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    valid()Checks that local links are valid, will try to add the links if invalid
    get_servers()Gets a table of all the servers, key is the server id, value is the server details
    get_servers_filtered(search)Gets a table of all the servers filtered by name, key is the server id, value is the server details
    get_current_server()Gets the details of the current server
    get_server_details(server_id)Gets the details of the given server
    get_server_status(server_id)Gets the status of the given server
    get_server_ups()Gets the ups of the current server
    request_connection(player, server_id[, self_requested=false])Connect a player to the given server
    + + +
    + + +

    Functions

    +
    +
    +
    +
    + # + valid() +
    +
    +
    +
    + +

    Checks that local links are valid, will try to add the links if invalid

    +

    + + + + + + Returns: +
      +
    • + (boolean) + If the external data is valid, if false you should not call any other methods from External +
    • +
    + + + + + + + + Usage: +
    -- Check that external data is valid
    +if not External.valid() then
    +    -- error code here
    +end
    + + +
    +
    +
    +
    + # + get_servers() +
    +
    +
    +
    + +

    Gets a table of all the servers, key is the server id, value is the server details

    +

    + + + + + + Returns: +
      +
    • + (table) + A table containing all the servers, key is the server id, value is the server details +
    • +
    + + + + + + + + Usage: +
    -- Get all servers
    +local servers = External.get_servers()
    + + +
    +
    +
    +
    + # + get_servers_filtered(search) +
    +
    +
    +
    + +

    Gets a table of all the servers filtered by name, key is the server id, value is the server details

    +

    + + + Parameters: + +
      + + + + + +
    • + + search + + : + + (string) + + The string to search for, names, short_names and ids are checked for this string. + +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + A table containing all the servers filtered by name, key is the server id, value is the server details +
    • +
    + + + + + + + + Usage: +
    -- Get all servers with public in the name
    +local servers = External.get_servers_filtered(public)
    + + +
    +
    +
    +
    + # + get_current_server() +
    +
    +
    +
    + +

    Gets the details of the current server

    +

    + + + + + + Returns: +
      +
    • + (table) + The details of the current server +
    • +
    + + + + + + + + Usage: +
    -- Get the details of the current server
    +local server = External.get_current_server()
    + + +
    +
    +
    +
    + # + get_server_details(server_id) +
    +
    +
    +
    + +

    Gets the details of the given server

    +

    + + + Parameters: + +
      + + + + + +
    • + + server_id + + : + + (string) + + The internal server if for the server you want the details of + +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + The details of the given server +
    • +
    + + + + + + + + Usage: +
    -- Get the details of the given server
    +local server = External.get_server_details('eu-01')
    + + +
    +
    +
    +
    + # + get_server_status(server_id) +
    +
    +
    +
    + +

    Gets the status of the given server

    +

    + + + Parameters: + +
      + + + + + +
    • + + server_id + + : + + (string) + + The internal server if for the server you want the status of + +
    • + + +
    + + + + + Returns: +
      +
    • + (string) + The status of the given server, one of: Online, Modded, Protected, Offline +
    • +
    + + + + + + + + Usage: +
    -- Get the status of the given server
    +local status = External.get_server_status('eu-01')
    + + +
    +
    +
    +
    + # + get_server_ups() +
    +
    +
    +
    + +

    Gets the ups of the current server

    +

    + + + + + + + + + + + + + Usage: +
    -- Get the ups of the current server
    +local server_ups = External.get_server_ups()
    + + +
    +
    +
    +
    + # + request_connection(player, server_id[, self_requested=false]) +
    +
    +
    +
    + +

    Connect a player to the given server

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + The player that you want to request to join a different server + +
    • + + + + + +
    • + + server_id + + : + + (string) + + The internal id of the server to connect to, can also be any address but this will show Unknown Server + +
    • + + + + + +
    • + + self_requested + + : + + (boolean) + + If the player requested the join them selfs, this will hide the message about being asked to switch + + (default: false) +
    • + + +
    + + + + + + + + + + + + Usage: +
    -- Request that a player joins a different server
    +External.request_connection(player, 'eu-01')
    +
    -- Request that a player joins a different server, by own request
    +External.request_connection(player, 'eu-01', true)
    + + +
    +
    + + + + + + + + + + diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 1988bce5..822d5175 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -57,6 +57,7 @@ + @@ -131,6 +132,7 @@ + @@ -1441,7 +1443,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 85de422b..4afa7364 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -62,6 +62,7 @@ + @@ -136,6 +137,7 @@ + @@ -4419,7 +4421,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 1f285cdc..348700b3 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -54,6 +54,7 @@ + @@ -128,6 +129,7 @@ + @@ -529,7 +531,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 68f1c306..2758606b 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -61,6 +61,7 @@ + @@ -135,6 +136,7 @@ + @@ -3348,7 +3350,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index abc3d607..2df8b895 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -66,6 +66,7 @@ + @@ -127,6 +128,7 @@ + @@ -333,7 +335,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index d3142c03..97c61a50 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -67,6 +67,7 @@ + @@ -128,6 +129,7 @@ + @@ -485,7 +487,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 8998c9f9..4c77c675 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -67,6 +67,7 @@ + @@ -128,6 +129,7 @@ + @@ -428,7 +430,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index f5488878..3d4fba97 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -66,6 +66,7 @@ + @@ -127,6 +128,7 @@ + @@ -389,7 +391,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 745dfef6..913fb300 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -67,6 +67,7 @@ + @@ -128,6 +129,7 @@ + @@ -406,7 +408,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 8195f1a4..7fb581dd 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -67,6 +67,7 @@ + @@ -128,6 +129,7 @@ + @@ -484,7 +486,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 47547080..f1b999ca 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -68,6 +68,7 @@ + @@ -128,6 +129,7 @@ + @@ -732,7 +734,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index d74e69aa..9109aa86 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -43,6 +43,8 @@ @@ -68,6 +70,7 @@ + @@ -128,6 +131,7 @@ + @@ -217,6 +221,8 @@ @@ -257,6 +263,9 @@ + utils.event + + expcore.gui @@ -269,10 +278,7 @@ expcore.player_data - utils.event - - - utils.game + expcore.external expcore.common @@ -301,6 +307,10 @@ Scroll to be used with Gui.title_label tables + join_server + Used to connect to servers in server list + + welcome_content Content area for the welcome tab @@ -334,6 +344,30 @@ + + +

    Tables

    + + + + + + + + +
    tooltipnetwork panel black, warning black, download black
    + + +

    Fields

    + + + + + + + + +
    hovered_spritenetwork panel white, warning white, download white

    @@ -344,6 +378,31 @@
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    # expcore.gui
    @@ -444,33 +503,8 @@
    - # - utils.event -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    -
    -
    -
    - # - utils.game + # + expcore.external
    @@ -618,6 +652,33 @@ + + + + + + +
    +
    +
    +
    + # + join_server +
    +
    +
    +
    + +

    Used to connect to servers in server list

    +

    + + + + + + + + @@ -834,6 +895,87 @@ + + + + + + +
    +
    +

    Tables

    +
    +
    +
    +
    + # + tooltip +
    +
    +
    +
    + +

    network panel black, warning black, download black

    +

    + + + Fields: + +
      + + + + + +
    • + + wrong_version + + + + + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +

    Fields

    +
    +
    +
    +
    + # + hovered_sprite +
    +
    +
    +
    + +

    network panel white, warning white, download white

    +

    + + + + + + + + @@ -856,7 +998,7 @@ generated by LDoc
    diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index aa09ceb5..1eae671b 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -68,6 +68,7 @@ + @@ -128,6 +129,7 @@ + @@ -704,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 0d99d863..bbdc5ff1 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -68,6 +68,7 @@ + @@ -128,6 +129,7 @@ + @@ -583,7 +585,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index ab2005cd..00b9bfa9 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -68,6 +68,7 @@ + @@ -128,6 +129,7 @@ + @@ -769,7 +771,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index c85a7eae..8859c31e 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -69,6 +69,7 @@ + @@ -129,6 +130,7 @@ + @@ -1040,7 +1042,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 3c53ea30..ae8c0d1b 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -69,6 +69,7 @@ + @@ -129,6 +130,7 @@ + @@ -268,6 +270,9 @@ expcore.commands + expcore.external + + expcore.player_data @@ -371,6 +376,31 @@ + + + + + + +
    +
    +
    +
    + # + expcore.external +
    +
    +
    +
    + + + + + + + + + @@ -478,7 +508,7 @@ generated by LDoc
    diff --git a/docs/index.html b/docs/index.html index 326b106f..10eb1cd8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -63,6 +63,11 @@ Datastore Core Module - Datastore - A module used to store data in the global table with the option to have it sync to an external source. + + + External + Core Module - External +- A module used to make accessing externally set data easier. Gui @@ -262,6 +267,11 @@ - Adds a command that allows admins to clear people's inventorys + Connect + Commands Module - Connect + - Adds a commands that allows you to request a player move to another server + + Debug Commands Module - Debug - Adds a command that opens the debug frame @@ -540,7 +550,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 06e5786f..18d0df09 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -68,6 +68,7 @@ + @@ -142,6 +143,7 @@ + @@ -308,7 +310,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 94a9f6a2..9dcf29a5 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -68,6 +68,7 @@ + @@ -142,6 +143,7 @@ + @@ -306,7 +308,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index b369f4ab..30dfdfb0 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -68,6 +68,7 @@ + @@ -142,6 +143,7 @@ + @@ -667,7 +669,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index c726fc05..a3db1736 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -68,6 +68,7 @@ + @@ -142,6 +143,7 @@ + @@ -366,7 +368,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 49f92dd6..ff468fe3 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -70,6 +70,7 @@ + @@ -144,6 +145,7 @@ + @@ -2021,7 +2023,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 1c3fcc30..d7dcbeb0 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -69,6 +69,7 @@ + @@ -143,6 +144,7 @@ + @@ -1305,7 +1307,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index a763cd7e..31225f93 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -68,6 +68,7 @@ + @@ -142,6 +143,7 @@ + @@ -447,7 +449,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index d9c5c91c..60d5683e 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -69,6 +69,7 @@ + @@ -143,6 +144,7 @@ + @@ -664,7 +666,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 5952bef6..3d655000 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -54,6 +54,7 @@ + @@ -128,6 +129,7 @@ + @@ -802,7 +804,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 2cbaef22..43d9ee05 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -54,6 +54,7 @@ + @@ -128,6 +129,7 @@ + @@ -354,7 +356,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From e0eba193a4646fbd72ccabfed6921a4a0dd72c81 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 01:54:51 +0100 Subject: [PATCH 085/106] Cleaned up use of the Game module --- config/expcore/command_general_parse.lua | 3 +- config/expcore/permission_groups.lua | 6 +- config/gui/player_list_actions.lua | 9 +-- modules/addons/advanced-start.lua | 3 +- modules/addons/chat-popups.lua | 2 +- modules/addons/chat-reply.lua | 2 +- modules/addons/compilatron.lua | 2 +- modules/addons/death-logger.lua | 5 +- modules/addons/discord-alerts.lua | 8 +- modules/addons/scorched-earth.lua | 5 +- modules/addons/spawn-area.lua | 2 +- modules/addons/tree-decon.lua | 2 +- modules/gui/player-list.lua | 13 ++-- utils/game.lua | 96 ++++++++++-------------- 14 files changed, 69 insertions(+), 89 deletions(-) diff --git a/config/expcore/command_general_parse.lua b/config/expcore/command_general_parse.lua index 065db0ba..2cc88b73 100644 --- a/config/expcore/command_general_parse.lua +++ b/config/expcore/command_general_parse.lua @@ -20,7 +20,6 @@ see ./expcore/commands.lua for more details ]] local Commands = require 'expcore.commands' --- @dep expcore.commands -local Game = require 'utils.game' --- @dep utils.game -- luacheck:ignore 212/player Commands.add_parse('boolean',function(input, player) @@ -94,7 +93,7 @@ end) Commands.add_parse('player',function(input, player, reject) if not input then return end -- nil check - local input_player = Game.get_player_from_any(input) + local input_player = game.players[input] if not input_player then return reject{'expcore-commands.reject-player',input} else diff --git a/config/expcore/permission_groups.lua b/config/expcore/permission_groups.lua index 6a78e026..7b57a820 100644 --- a/config/expcore/permission_groups.lua +++ b/config/expcore/permission_groups.lua @@ -120,17 +120,17 @@ local function assign_group(player) end Event.add(defines.events.on_player_joined_game,function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] assign_group(player) end) Event.add(defines.events.on_player_promoted,function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] assign_group(player) end) Event.add(defines.events.on_player_demoted,function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] assign_group(player) end) diff --git a/config/gui/player_list_actions.lua b/config/gui/player_list_actions.lua index 611cd0f0..2d956e94 100644 --- a/config/gui/player_list_actions.lua +++ b/config/gui/player_list_actions.lua @@ -7,7 +7,6 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles -local Game = require 'utils.game' --- @dep utils.game local Reports = require 'modules.control.reports' --- @dep modules.control.reports local Warnings = require 'modules.control.warnings' --- @dep modules.control.warnings local Jail = require 'modules.control.jail' --- @dep modules.control.jail @@ -31,7 +30,7 @@ end -- gets the action player and a coloured name for the action to be used on local function get_action_player_name(player) local selected_player_name = SelectedPlayer:get(player) - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] local selected_player_color = format_chat_player_name(selected_player) return selected_player_name, selected_player_color end @@ -64,7 +63,7 @@ end local goto_player = new_button('utility/export',{'player-list.goto-player'}) :on_click(function(player) local selected_player_name = get_action_player_name(player) - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if not player.character or not selected_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) else @@ -77,7 +76,7 @@ end) local bring_player = new_button('utility/import',{'player-list.bring-player'}) :on_click(function(player) local selected_player_name = get_action_player_name(player) - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if not player.character or not selected_player.character then player.print({'expcore-commands.reject-player-alive'},Colors.orange_red) else @@ -90,7 +89,7 @@ end) local kill_player = new_button('utility/too_far',{'player-list.kill-player'}) :on_click(function(player) local selected_player_name = get_action_player_name(player) - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if selected_player.character then selected_player.character.die() else diff --git a/modules/addons/advanced-start.lua b/modules/addons/advanced-start.lua index a6952b54..dad7802b 100644 --- a/modules/addons/advanced-start.lua +++ b/modules/addons/advanced-start.lua @@ -2,12 +2,11 @@ -- @addon Advanced-Start local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local config = require 'config.advanced_start' --- @dep config.advanced_start local items = config.items Event.add(defines.events.on_player_created, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] -- game init settings if event.player_index == 1 then player.force.friendly_fire = config.friendly_fire diff --git a/modules/addons/chat-popups.lua b/modules/addons/chat-popups.lua index 22e9c772..8bc18701 100644 --- a/modules/addons/chat-popups.lua +++ b/modules/addons/chat-popups.lua @@ -10,7 +10,7 @@ local send_text = Game.print_player_floating_text -- (player_index, text, color) Event.add(defines.events.on_console_chat, function(event) if not event.player_index or event.player_index < 1 then return end - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] -- Some basic sanity checks if not player then return end diff --git a/modules/addons/chat-reply.lua b/modules/addons/chat-reply.lua index 2d63cd70..2c699de3 100644 --- a/modules/addons/chat-reply.lua +++ b/modules/addons/chat-reply.lua @@ -9,7 +9,7 @@ local config = require 'config.chat_reply' --- @dep config.chat_reply Event.add(defines.events.on_console_chat, function(event) local player_index = event.player_index if not player_index or player_index < 1 then return end - local player = Game.get_player_by_index(player_index) + local player = game.players[player_index] local message = event.message:lower():gsub("%s+", "") local allowed = true if config.command_admin_only and not player.admin then allowed = false end diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index a987aff1..737ca62f 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -95,7 +95,7 @@ end -- When the first player is created this will create all compilatrons that are resisted in the config Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] for location in pairs(locations) do Public.spawn_compilatron(player.surface, location) end diff --git a/modules/addons/death-logger.lua b/modules/addons/death-logger.lua index f3fc56f6..a046fa35 100644 --- a/modules/addons/death-logger.lua +++ b/modules/addons/death-logger.lua @@ -2,7 +2,6 @@ -- @addon Death-Logger local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Global = require 'utils.global' --- @dep utils.global local config = require 'config.death_logger' --- @dep config.death_logger local format_time, move_items = _C.format_time, _C.move_items --- @dep expcore.common @@ -17,7 +16,7 @@ end) --- Creates a new death marker and saves it to the given death local function create_map_tag(death) - local player = Game.get_player_from_any(death.player_name) + local player = game.players[death.player_name] local message = player.name..' died' if config.include_time_of_death then local time = format_time(death.time_of_death, {hours=true, minutes=true, string=true}) @@ -59,7 +58,7 @@ end -- when a player dies a new death is added to the records and a map marker is made Event.add(defines.events.on_player_died, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] local corpse = player.surface.find_entity('character-corpse', player.position) if config.use_chests_as_bodies then local items = corpse.get_inventory(defines.inventory.character_corpse).get_contents() diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index d45a4b87..b88dcdfe 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -8,7 +8,7 @@ local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.c local config = require 'config.discord_alerts' --- @dep config.discord_alerts local function get_player_name(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] return player.name, event.by_player_name end @@ -189,7 +189,7 @@ end if config.player_bans then Event.add(defines.events.on_player_banned, function(event) if event.by_player then - local by_player = Game.get_player_by_index(event.by_player) + local by_player = game.players[event.by_player] emit_event{ title='Banned', description='A player has been banned', @@ -202,7 +202,7 @@ if config.player_bans then end) Event.add(defines.events.on_player_unbanned, function(event) if event.by_player then - local by_player = Game.get_player_by_index(event.by_player) + local by_player = game.players[event.by_player] emit_event{ title='Un-Banned', description='A player has been un-banned', @@ -241,7 +241,7 @@ if config.player_kicks then Event.add(defines.events.on_player_kicked, function(event) if event.by_player then local player_name = get_player_name(event) - local by_player = Game.get_player_by_index(event.by_player) + local by_player = game.players[event.by_player] emit_event{ title='Kick', description='A player has been kicked', diff --git a/modules/addons/scorched-earth.lua b/modules/addons/scorched-earth.lua index 6e342f54..1af6b59b 100644 --- a/modules/addons/scorched-earth.lua +++ b/modules/addons/scorched-earth.lua @@ -2,7 +2,6 @@ -- @addon Scorched-Earth local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Global = require 'utils.global' --- @dep utils.global local print_grid_value, clear_flying_text = _C.print_grid_value, _C.clear_flying_text --- @dep expcore.common local config = require 'config.scorched_earth' --- @dep config.scorched_earth @@ -94,7 +93,7 @@ end -- When the player changes position the tile will have a chance to downgrade, debug check is here Event.add(defines.events.on_player_changed_position, function(event) - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] local surface = player.surface local position = player.position local strength = get_tile_strength(surface, position) @@ -133,7 +132,7 @@ end) -- Used as a way to access the global table return function(player_name, state) - local player = Game.get_player_from_any(player_name) + local player = game.players[player_name] clear_flying_text(player.surface) debug_players[player_name] = state end \ No newline at end of file diff --git a/modules/addons/spawn-area.lua b/modules/addons/spawn-area.lua index dfff3f1b..2eab875f 100644 --- a/modules/addons/spawn-area.lua +++ b/modules/addons/spawn-area.lua @@ -134,7 +134,7 @@ end) Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end - local player = Game.get_player_by_index(event.player_index) + local player = game.players[event.player_index] local p = {x=0, y=0} local s = player.surface spawn_base(s, p) diff --git a/modules/addons/tree-decon.lua b/modules/addons/tree-decon.lua index 57f44fe3..8df49466 100644 --- a/modules/addons/tree-decon.lua +++ b/modules/addons/tree-decon.lua @@ -19,7 +19,7 @@ Event.add(defines.events.on_marked_for_deconstruction, function(event) -- Check which type of decon a player is allowed local index = event.player_index if chache[index] == nil then - local player = Game.get_player_by_index(index) + local player = game.players[index] if Roles.player_allowed(player, 'fast-tree-decon') then chache[index] = 'fast' elseif Roles.player_allowed(player, 'standard-decon') then chache[index] = 'standard' else chache[index] = player.force end diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 83c37431..ab9bb13d 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -8,7 +8,6 @@ local Gui = require 'expcore.gui' --- @dep expcore.gui local Roles = require 'expcore.roles' --- @dep expcore.roles local Datastore = require 'expcore.datastore' --- @dep expcore.datastore -local Game = require 'utils.game' --- @dep utils.game local Event = require 'utils.event' --- @dep utils.event local config = require 'config.gui.player_list_actions' --- @dep config.gui.player_list_actions local Colors = require 'utils.color_presets' --- @dep utils.color_presets @@ -115,7 +114,7 @@ Gui.element(function(event_trigger, parent, player_data) end) :on_click(function(player, element, event) local selected_player_name = element.caption - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if event.button == defines.mouse_button_type.left then -- LMB will open the map to the selected player local position = selected_player.position @@ -177,7 +176,7 @@ local function update_action_bar(element) element.visible = false else - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if not selected_player.connected then -- If the player is offline then reest stores element.visible = false @@ -357,7 +356,7 @@ end) --- When a player leaves only remove they entry Event.add(defines.events.on_player_left_game, function(event) - local remove_player = Game.get_player_by_index(event.player_index) + local remove_player = game.players[event.player_index] for _, player in pairs(game.connected_players) do local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table @@ -390,7 +389,7 @@ Event.add(Roles.events.on_role_unassigned, redraw_player_list) --- When the action player is changed the action bar will update SelectedPlayer:on_update(function(player_name, selected_player) - local player = Game.get_player_from_any(player_name) + local player = game.players[player_name] local frame = Gui.get_left_element(player, player_list_container) local scroll_table = frame.container.scroll.table update_action_bar(frame.container.action_bar) @@ -410,13 +409,13 @@ end) --- When the action name is changed the reason input will update SelectedAction:on_update(function(player_name, selected_action) - local player = Game.get_player_from_any(player_name) + local player = game.players[player_name] local frame = Gui.get_left_element(player, player_list_container) local element = frame.container.reason_bar if selected_action then -- if there is a new value then check the player is still online local selected_player_name = SelectedPlayer:get(player_name) - local selected_player = Game.get_player_from_any(selected_player_name) + local selected_player = game.players[selected_player_name] if selected_player.connected then element.visible = true else diff --git a/utils/game.lua b/utils/game.lua index c5ff5db2..f2259bf6 100644 --- a/utils/game.lua +++ b/utils/game.lua @@ -1,64 +1,39 @@ -local Global = require 'utils.global' --- @dep utils.global -local Color = require 'utils.color_presets' --- @dep utils.color_presets -local pairs = pairs +local Color = require 'utils.color_presets' --- @dep utils.color_presets local Game = {} -local bad_name_players = {} -Global.register( - bad_name_players, - function(tbl) - bad_name_players = tbl - end -) +--[[ Note to readers +Game.get_player_from_name was removed because game.players[name] works without any edge cases +always true: game.players[name].name == name + +Game.get_player_by_index was added originally as a workaround for the following edge case: +player with index of 5 and name of "Cooldude2606" +player with index of 10 and name of "5" +game.players[5].name == "5" + +Discovered the following logic: +all keys are first converted to string and search against player names +if this fails it attempts to convert it to a number and search against player indexes +sometimes fails: game.players[index].index == index + +Game.get_player_by_index was removed after the above logic was corrected to the following: +when a key is a number it is searched against player indexes, and only their indexes +when a key is a string it is searched against player names, and then against their indexes +always true: game.players[name].name == name; game.players[index].index == index ---[[ - Due to a bug in the Factorio api the following expression isn't guaranteed to be true. - game.players[player.index] == player - get_player_by_index(index) will always return the correct player. - When looking up players by name or iterating through all players use game.players instead. ]] -function Game.get_player_by_index(index) - local p = game.players[index] - - if not p then - return nil - end - if p.index == index then - return p - end - - p = bad_name_players[index] - if p then - if p.valid then - return p - else - return nil - end - end - - for k, v in pairs(game.players) do - if k == index then - bad_name_players[index] = v - return v - end - end -end --- Returns a valid LuaPlayer if given a number, string, or LuaPlayer. Returns nil otherwise. -- obj function Game.get_player_from_any(obj) - local o_type = type(obj) - local p - if o_type == 'number' then - p = Game.get_player_by_index(obj) - elseif o_type == 'string' then + local o_type, p = type(obj) + if o_type == 'table' then + p = obj + elseif o_type == 'string' or o_type == 'number' then p = game.players[obj] - elseif o_type == 'table' and obj.valid and obj.is_player() then - return obj end - if p and p.valid then + if p and p.valid and p.is_player() then return p end end @@ -95,16 +70,18 @@ function Game.print_floating_text(surface, position, text, color) end --[[ - Creates a floating text entity at the player location with the specified color in {r, g, b} format. + Creates a floating text entity at the player location with the specified color and offset. Example: "+10 iron" or "-10 coins" @param text String to display @param color table in {r = 0~1, g = 0~1, b = 0~1}, defaults to white. + @param x_offset number the x offset for the floating text + @param y_offset number the y offset for the floating text @return the created entity ]] -function Game.print_player_floating_text_position(player_index, text, color, x_offset, y_offset) - local player = Game.get_player_by_index(player_index) +function Game.print_player_floating_text_position(player, text, color, x_offset, y_offset) + player = Game.get_player_from_any(player) if not player or not player.valid then return end @@ -113,8 +90,17 @@ function Game.print_player_floating_text_position(player_index, text, color, x_o return Game.print_floating_text(player.surface, {x = position.x + x_offset, y = position.y + y_offset}, text, color) end -function Game.print_player_floating_text(player_index, text, color) - Game.print_player_floating_text_position(player_index, text, color, 0, -1.5) +--[[ + Creates a floating text entity at the player location with the specified color in {r, g, b} format. + Example: "+10 iron" or "-10 coins" + + @param text String to display + @param color table in {r = 0~1, g = 0~1, b = 0~1}, defaults to white. + + @return the created entity +]] +function Game.print_player_floating_text(player, text, color) + Game.print_player_floating_text_position(player, text, color, 0, -1.5) end -return Game +return Game \ No newline at end of file From 97f2d9b9674cc4b0f6b21d0c5747be3422bd8c20 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 02:17:51 +0100 Subject: [PATCH 086/106] Fixed Chat Reply --- config/chat_reply.lua | 144 ++++++++++++++------------- config/expcore/permission_groups.lua | 1 - modules/addons/chat-reply.lua | 18 ++-- modules/addons/compilatron.lua | 1 - modules/addons/discord-alerts.lua | 1 - modules/addons/spawn-area.lua | 1 - modules/addons/tree-decon.lua | 1 - 7 files changed, 81 insertions(+), 86 deletions(-) diff --git a/config/chat_reply.lua b/config/chat_reply.lua index 2f653569..c8ce7407 100644 --- a/config/chat_reply.lua +++ b/config/chat_reply.lua @@ -4,115 +4,117 @@ local Async = require 'expcore.async' local format_time = _C.format_time --- @dep expcore.common +-- eg Async(async_message, is_command or player, message) local async_message = Async.register(function(player, message) - player.print(message) + if player == true then game.print(message) else player.print(message) end end) +-- luacheck:ignore 212/player 212/is_command return { allow_command_prefix_for_messages = true, --- @setting allow_command_prefix_for_messages when true any message trigger will print to all player when prefixed messages = { --- @setting messages will trigger when ever the word is said - ['discord']={'info.discord'}, - ['expgaming']={'info.website'}, - ['website']={'info.website'}, - ['wiki']={'info.wiki'}, - ['status']={'info.status'}, - ['github']={'info.github'}, - ['patreon']={'info.patreon'}, - ['donate']={'info.patreon'}, - ['command']={'info.custom-commands'}, - ['commands']={'info.custom-commands'}, - ['softmod']={'info.softmod'}, - ['script']={'info.softmod'}, - ['loop']={'chat-bot.loops'}, - ['rhd']={'info.lhd'}, - ['lhd']={'info.lhd'}, - ['roundabout']={'chat-bot.loops'}, - ['roundabouts']={'chat-bot.loops'}, - ['redmew']={'info.redmew'}, - ['afk']=function(player) - local max=player - for _,next_player in pairs(game.connected_players) do + ['discord'] = {'info.discord'}, + ['expgaming'] = {'info.website'}, + ['website'] = {'info.website'}, + ['wiki'] = {'info.wiki'}, + ['status'] = {'info.status'}, + ['github'] = {'info.github'}, + ['patreon'] = {'info.patreon'}, + ['donate'] = {'info.patreon'}, + ['command'] = {'info.custom-commands'}, + ['commands'] = {'info.custom-commands'}, + ['softmod'] = {'info.softmod'}, + ['script'] = {'info.softmod'}, + ['loop'] = {'chat-bot.loops'}, + ['rhd'] = {'info.lhd'}, + ['lhd'] = {'info.lhd'}, + ['roundabout'] = {'chat-bot.loops'}, + ['roundabouts'] = {'chat-bot.loops'}, + ['redmew'] = {'info.redmew'}, + ['afk'] = function(player) + local max = player + for _, next_player in pairs(game.connected_players) do if max.afk_time < next_player.afk_time then - max=next_player + max = next_player end end - return {'chat-bot.afk',max.name,format_time(max.afk_time,{minutes=true,seconds=true,long=true})} + return {'chat-bot.afk', max.name, format_time(max.afk_time, {minutes = true, seconds = true, long = true})} end, - ['players']=function() - return {'chat-bot.players',#game.players} + ['players'] = function() + return {'chat-bot.players', #game.players} end, - ['online']=function() - return {'chat-bot.players-online',#game.connected_players} + ['online'] = function() + return {'chat-bot.players-online', #game.connected_players} end, - ['r!verify']=function(player) - return {'chat-bot.verify',player.name} + ['r!verify'] = function(player) + return {'chat-bot.verify', player.name} end, }, command_admin_only = false, --- @setting command_admin_only when true will only allow chat commands for admins command_permission = 'command/chat-bot', --- @setting command_permission the permission used to allow command prefixes command_prefix = '!', --- @setting command_prefix prefix used for commands below and to print to all players (if enabled above) commands = { --- @setting commands will trigger only when command prefix is given - ['dev']={'chat-bot.not-real-dev'}, - ['blame']=function(player) - local names = {'Cooldude2606','arty714','badgamernl', 'mark9064', 'aldldl', 'Drahc_pro',player.name} - for _,next_player in pairs(game.connected_players) do + ['dev'] = {'chat-bot.not-real-dev'}, + ['blame'] = function(player) + local names = {'Cooldude2606', 'arty714', 'badgamernl', 'mark9064', 'aldldl', 'Drahc_pro', player.name} + for _, next_player in pairs(game.connected_players) do names[#names + 1] = next_player.name end - return {'chat-bot.blame',table.get_random_dictionary_entry(names)} + return {'chat-bot.blame', table.get_random_dictionary_entry(names)} end, - ['magic']={'chat-bot.magic'}, - ['aids']={'chat-bot.aids'}, - ['riot']={'chat-bot.riot'}, - ['lenny']={'chat-bot.lenny'}, - ['hodor']=function() - local options = {'?','.','!','!!!'} - return {'chat-bot.hodor',table.get_random_dictionary_entry(options)} + ['magic'] = {'chat-bot.magic'}, + ['aids'] = {'chat-bot.aids'}, + ['riot'] = {'chat-bot.riot'}, + ['lenny'] = {'chat-bot.lenny'}, + ['hodor'] = function() + local options = {'?', '.', '!', '!!!'} + return {'chat-bot.hodor', table.get_random_dictionary_entry(options)} end, - ['evolution']=function() - return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} + ['evolution'] = function() + return {'chat-bot.current-evolution', string.format('%.2f', game.forces['enemy'].evolution_factor)} end, - ['makepopcorn']=function(player) + ['makepopcorn'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-popcorn-2',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-popcorn-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-popcorn-2', player.name}}) end, - ['passsomesnaps']=function(player) + ['passsomesnaps'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-2',player.name}}) - Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-snaps-3',player.name}}) + Async(async_message, player, {'chat-bot.reply', {'chat-bot.get-snaps-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-snaps-2', player.name}}) + Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.get-snaps-3', player.name}}) end, - ['makecocktail']=function(player) + ['makecocktail'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-2',player.name}}) - Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.get-cocktail-3',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-2', player.name}}) + Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.get-cocktail-3', player.name}}) end, - ['makecoffee']=function(player) + ['makecoffee'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-coffee-2',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-coffee-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.make-coffee-2', player.name}}) end, - ['orderpizza']=function(player) + ['orderpizza'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-2',player.name}}) - Async.wait(timeout*(math.random()+0.5),async_message,player,{'chat-bot.reply',{'chat-bot.order-pizza-3',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-2', player.name}}) + Async.wait(timeout*(math.random()+0.5), async_message, true, {'chat-bot.reply', {'chat-bot.order-pizza-3', player.name}}) end, - ['maketea']=function(player) + ['maketea'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.make-tea-2',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.make-tea-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.make-tea-2', player.name}}) end, - ['meadplease']=function(player) + ['meadplease'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-mead-2',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-mead-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-mead-2', player.name}}) end, - ['passabeer']=function(player) + ['passabeer'] = function(player) local timeout = math.floor(180*(math.random()+0.5)) - Async(async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-1'}}) - Async.wait(timeout,async_message,player,{'chat-bot.reply',{'chat-bot.get-beer-2',player.name}}) + Async(async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-1'}}) + Async.wait(timeout, async_message, true, {'chat-bot.reply', {'chat-bot.get-beer-2', player.name}}) end } } diff --git a/config/expcore/permission_groups.lua b/config/expcore/permission_groups.lua index 7b57a820..2e893e77 100644 --- a/config/expcore/permission_groups.lua +++ b/config/expcore/permission_groups.lua @@ -5,7 +5,6 @@ -- @config Permission-Groups --local Event = require 'utils.event' -- @dep utils.event ---local Game = require 'utils.game' -- @dep utils.game local Permission_Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups Permission_Groups.new_group('Admin') diff --git a/modules/addons/chat-reply.lua b/modules/addons/chat-reply.lua index 2c699de3..e0fc661c 100644 --- a/modules/addons/chat-reply.lua +++ b/modules/addons/chat-reply.lua @@ -1,8 +1,7 @@ ---- Adds auto replies to chat messages; aswell as chat commands +--- Adds auto replies to chat messages; as well as chat commands -- @addon Chat-Reply local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Roles = require 'expcore.roles' --- @dep expcore.roles local config = require 'config.chat_reply' --- @dep config.chat_reply @@ -18,16 +17,15 @@ Event.add(defines.events.on_console_chat, function(event) local prefix = config.command_prefix for key_word, reply in pairs(config.messages) do if message:find(key_word) then + local is_command = message:find(prefix..key_word) if type(reply) == 'function' then - reply = reply(player) + reply = reply(player, is_command) end - if message:find(prefix..key_word) then - if allowed then - game.print{'chat-bot.reply', reply} - else - player.print{'chat-bot.disallow'} - end + if is_command and allowed then + game.print{'chat-bot.reply', reply} + elseif is_command then + player.print{'chat-bot.disallow'} elseif not allowed then player.print{'chat-bot.reply', reply} end @@ -39,7 +37,7 @@ Event.add(defines.events.on_console_chat, function(event) for key_word, reply in pairs(config.commands) do if message:find(prefix..key_word) then if type(reply) == 'function' then - reply = reply(player) + reply = reply(player, true) if reply then game.print{'chat-bot.reply', reply} diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index 737ca62f..f2932ca7 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -3,7 +3,6 @@ local Event = require 'utils.event' --- @dep utils.event local Global = require 'utils.global' --- @dep utils.global -local Game = require 'utils.game' --- @dep utils.game local Task = require 'utils.task' --- @dep utils.task local Token = require 'utils.token' --- @dep utils.token local config = require 'config.compilatron' --- @dep config.compilatron diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index b88dcdfe..6219f426 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -2,7 +2,6 @@ -- @addon Discord-Alerts local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Colors = require 'utils.color_presets' --- @dep utils.color_presets local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common local config = require 'config.discord_alerts' --- @dep config.discord_alerts diff --git a/modules/addons/spawn-area.lua b/modules/addons/spawn-area.lua index 2eab875f..4b9daf3b 100644 --- a/modules/addons/spawn-area.lua +++ b/modules/addons/spawn-area.lua @@ -3,7 +3,6 @@ local Global = require 'utils.global' --- @dep utils.global local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local config = require 'config.spawn_area' --- @dep config.spawn_area local tiles = config.tiles local entities = config.entities diff --git a/modules/addons/tree-decon.lua b/modules/addons/tree-decon.lua index 8df49466..da32b298 100644 --- a/modules/addons/tree-decon.lua +++ b/modules/addons/tree-decon.lua @@ -2,7 +2,6 @@ -- @addon Tree-Decon local Event = require 'utils.event' --- @dep utils.event -local Game = require 'utils.game' --- @dep utils.game local Global = require 'utils.global' --- @dep utils.global local Roles = require 'expcore.roles' --- @dep expcore.roles From 2ec8581c52119f6b3b2b09572379cccf12a55842 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 02:35:04 +0100 Subject: [PATCH 087/106] Fixed clear-inv --- config/expcore/command_role_parse.lua | 4 ++-- modules/commands/clear-inventory.lua | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/expcore/command_role_parse.lua b/config/expcore/command_role_parse.lua index 211fbc15..9faabf94 100644 --- a/config/expcore/command_role_parse.lua +++ b/config/expcore/command_role_parse.lua @@ -44,11 +44,11 @@ end) Commands.add_parse('player-role-online',function(input, player, reject) local input_player = Commands.parse('player-role',input, player, reject) if not input_player then return end -- nil check - return Commands.parse('player-online',input_player, player, reject) + return Commands.parse('player-online',input_player.name, player, reject) end) Commands.add_parse('player-role-alive',function(input, player, reject) local input_player = Commands.parse('player-role',input, player, reject) if not input_player then return end -- nil check - return Commands.parse('player-alive',input_player, player, reject) + return Commands.parse('player-alive',input_player.name, player, reject) end) \ No newline at end of file diff --git a/modules/commands/clear-inventory.lua b/modules/commands/clear-inventory.lua index 806badeb..04155978 100644 --- a/modules/commands/clear-inventory.lua +++ b/modules/commands/clear-inventory.lua @@ -11,10 +11,13 @@ require 'config.expcore.command_role_parse' -- @command clear-inventory -- @tparam LuaPlayer player the player to clear the inventory of Commands.new_command('clear-inventory', 'Clears a players inventory') -:add_param('player', false, 'player-role-alive') +:add_param('player', false, 'player-role') :add_alias('clear-inv', 'move-inventory', 'move-inv') :register(function(_, player) local inv = player.get_main_inventory() + if not inv then + return Commands.error{'expcore-commands.reject-player-alive'} + end move_items(inv.get_contents()) inv.clear() end) \ No newline at end of file From 38cf0f10ec7c2918f6699063a40f79367b246a78 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 03:18:15 +0100 Subject: [PATCH 088/106] Added "Current" status to server list --- expcore/external.lua | 8 +++++--- locale/en/gui.cfg | 1 + modules/gui/readme.lua | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/expcore/external.lua b/expcore/external.lua index 61f1d614..314901ad 100644 --- a/expcore/external.lua +++ b/expcore/external.lua @@ -101,16 +101,18 @@ end --[[-- Gets the status of the given server @tparam string server_id The internal server if for the server you want the status of -@treturn string The status of the given server, one of: Online, Modded, Protected, Offline +@tparam boolean raw When true Current will not be returned as status but rather the raw status for the server +@treturn string The status of the given server, one of: Online, Modded, Protected, Current, Offline @usage-- Get the status of the given server local status = External.get_server_status('eu-01') ]] -function External.get_server_status(server_id) +function External.get_server_status(server_id, raw) assert(var, 'No external data was found, use External.valid() to ensure external data exists.') local servers = assert(var.status, 'No server status was found, please ensure that the external service is running') - return servers[server_id] + local current = assert(ext.current, 'No current id was found, please ensure that the external service is running') + return not raw and server_id == current and 'Current' or servers[server_id] end --[[-- Gets the ups of the current server diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 59c58b7e..aaec09be 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -147,6 +147,7 @@ servers-d7=This is our event server, we try to run events at least once per week servers-8=S8 T̷-̶s̶-̴:̷ servers-d8=N̵o̴ ̶o̷-̶e̵ ̴k̸n̷-̶w̵s̸ ̴w̷h̷a̶-̶ ̷h̴a̴p̷p̴e̷n̷s̸ ̷o̶n̴ ̷t̶h̴-̶s̶ ̷s̷e̶r̸v̸e̴r̷,̶ ̸i̸t̴ ̷m̶-̸g̴h̶t̷ ̸n̸-̶t̵ ̷e̴v̸e̸n̶t̷ ̵-̷x̴i̵s̶t̸.̸ servers-connect-Offline=Server is currently offline +servers-connect-Current=This is your current server servers-connect-Version=Server is on a different version: __1__ servers-connect-Password=Server requires a password servers-connect-Modded=Server requires mods to be downloaded diff --git a/modules/gui/readme.lua b/modules/gui/readme.lua index b74d4a0b..ca38e40e 100644 --- a/modules/gui/readme.lua +++ b/modules/gui/readme.lua @@ -78,7 +78,8 @@ Gui.element{ -- @element join_server local join_server = Gui.element(function(event_trigger, parent, server_id, wrong_version) - local status = wrong_version and 'Version' or External.get_server_status(server_id) or 'Offline' + local status = External.get_server_status(server_id) or 'Offline' + if wrong_version then status = 'Version' end local flow = parent.add{ name = server_id, type = 'flow' } local button = flow.add{ name = event_trigger, @@ -88,7 +89,7 @@ Gui.element(function(event_trigger, parent, server_id, wrong_version) tooltip = {'readme.servers-connect-'..status, wrong_version} } - if status == 'Offline' then + if status == 'Offline' or status == 'Current' then button.enabled = false button.sprite = 'utility/circuit_network_panel_black' elseif status == 'Version' then From 91d60ba6d79a85801da58bca56100cce32244433 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 03:22:40 +0100 Subject: [PATCH 089/106] Fixed game time in discord alerts --- modules/addons/discord-alerts.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index 6219f426..f6460792 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -31,8 +31,8 @@ local function emit_event(args) color = to_hex(color) end - local tick = args.tick or 0 - local tick_formated = format_time(tick, {hours = true, minutes = true, string = true, long = true}) + local tick = args.tick or game.tick + local tick_formatted = format_time(tick, {hours = true, minutes = true, string = true, long = true}) local players_online = 0 local admins_online = 0 @@ -46,7 +46,7 @@ local function emit_event(args) local done = {title=true, color=true, description=true} local fields = {{ name='Server Details', - value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s', players_online, admins_online, tick_formated) + value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s', players_online, admins_online, tick_formatted) }} for key, value in pairs(args) do From 67c2b8265c6f0c340bb40219e125d61192877ebb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 03:43:02 +0100 Subject: [PATCH 090/106] Fixed Discord Alerts --- modules/addons/discord-alerts.lua | 76 +++++++++++++++---------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index f6460792..27b89ad9 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -32,7 +32,7 @@ local function emit_event(args) end local tick = args.tick or game.tick - local tick_formatted = format_time(tick, {hours = true, minutes = true, string = true, long = true}) + local tick_formatted = format_time(tick, {days = true, hours = true, minutes = true, string = true, long = true}) local players_online = 0 local admins_online = 0 @@ -46,7 +46,7 @@ local function emit_event(args) local done = {title=true, color=true, description=true} local fields = {{ name='Server Details', - value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s', players_online, admins_online, tick_formatted) + value=string.format('Server: ${serverName} Time: %s\nTotal: %d Online: %d Admins: %d', tick_formatted, #game.players, players_online, admins_online) }} for key, value in pairs(args) do @@ -85,9 +85,9 @@ if config.player_reports then title='Report', description='A player was reported', color=Colors.yellow, - ['Player:']=''..player_name, - ['By:']=''..by_player_name, - ['Reason:']=event.reason + ['Player']=''..player_name, + ['By']=''..by_player_name, + ['Reason']=event.reason } end) Event.add(Reports.events.on_report_removed, function(event) @@ -97,9 +97,9 @@ if config.player_reports then title='Reports Removed', description='A player has a report removed', color=Colors.green, - ['Player:']=''..player_name, - ['By:']=''..event.removed_by_name, - ['Amount:']=''..event.batch_count + ['Player']=''..player_name, + ['By']=''..event.removed_by_name, + ['Amount']=''..event.batch_count } end) end @@ -113,9 +113,9 @@ if config.player_warnings then title='Warning', description='A player has been given a warning', color=Colors.yellow, - ['Player:']=''..player_name, - ['By:']=''..by_player_name, - ['Reason:']=event.reason + ['Player']=''..player_name, + ['By']=''..by_player_name, + ['Reason']=event.reason } end) Event.add(Warnings.events.on_warning_removed, function(event) @@ -125,9 +125,9 @@ if config.player_warnings then title='Warnings Removed', description='A player has a warning removed', color=Colors.green, - ['Player:']=''..player_name, - ['By:']=''..event.removed_by_name, - ['Amount:']=''..event.batch_count + ['Player']=''..player_name, + ['By']=''..event.removed_by_name, + ['Amount']=''..event.batch_count } end) end @@ -141,9 +141,9 @@ if config.player_jail then title='Jail', description='A player has been jailed', color=Colors.yellow, - ['Player:']=''..player_name, - ['By:']=''..by_player_name, - ['Reason:']=event.reason + ['Player']=''..player_name, + ['By']=''..by_player_name, + ['Reason']=event.reason } end) Event.add(Jail.events.on_player_unjailed, function(event) @@ -152,8 +152,8 @@ if config.player_jail then title='Unjail', description='A player has been unjailed', color=Colors.green, - ['Player:']=''..player_name, - ['By:']=''..by_player_name + ['Player']=''..player_name, + ['By']=''..by_player_name } end) end @@ -167,9 +167,9 @@ if config.player_temp_ban then title='Temp Ban', description='A player has been temp banned', color=Colors.red, - ['Player:']=''..player_name, - ['By:']=''..by_player_name, - ['Reason:']=event.reason + ['Player']=''..player_name, + ['By']=''..by_player_name, + ['Reason']=event.reason } end) Event.add(Jail.events.on_player_untemp_banned, function(event) @@ -178,8 +178,8 @@ if config.player_temp_ban then title='Temp Ban Removed', description='A player has been untemp banned', color=Colors.green, - ['Player:']=''..player_name, - ['By:']=''..by_player_name + ['Player']=''..player_name, + ['By']=''..by_player_name } end) end @@ -193,9 +193,9 @@ if config.player_bans then title='Banned', description='A player has been banned', color=Colors.red, - ['Player:']=''..event.player_name, - ['By:']=''..by_player.name, - ['Reason:']=event.reason + ['Player']=''..event.player_name, + ['By']=''..by_player.name, + ['Reason']=event.reason } end end) @@ -206,8 +206,8 @@ if config.player_bans then title='Un-Banned', description='A player has been un-banned', color=Colors.green, - ['Player:']=''..event.player_name, - ['By:']=''..by_player.name + ['Player']=''..event.player_name, + ['By']=''..by_player.name } end end) @@ -221,7 +221,7 @@ if config.player_mutes then title='Muted', description='A player has been muted', color=Colors.yellow, - ['Player:']=''..player_name + ['Player']=''..player_name } end) Event.add(defines.events.on_player_unmuted, function(event) @@ -230,7 +230,7 @@ if config.player_mutes then title='Un-Muted', description='A player has been un-muted', color=Colors.green, - ['Player:']=''..player_name + ['Player']=''..player_name } end) end @@ -245,9 +245,9 @@ if config.player_kicks then title='Kick', description='A player has been kicked', color=Colors.orange, - ['Player:']=''..player_name, - ['By:']=''..by_player.name, - ['Reason:']=event.reason + ['Player']=''..player_name, + ['By']=''..by_player.name, + ['Reason']=event.reason } end end) @@ -261,7 +261,7 @@ if config.player_promotes then title='Promote', description='A player has been promoted', color=Colors.green, - ['Player:']=''..player_name + ['Player']=''..player_name } end) Event.add(defines.events.on_player_demoted, function(event) @@ -270,7 +270,7 @@ if config.player_promotes then title='Demote', description='A player has been demoted', color=Colors.yellow, - ['Player:']=''..player_name + ['Player']=''..player_name } end) end @@ -284,8 +284,8 @@ Event.add(defines.events.on_console_command, function(event) title=event.command:gsub('^%l', string.upper), description='/'..event.command..' was used', color=Colors.grey, - ['By:']=''..player_name, - ['Details:'] = event.parameters ~= '' and event.parameters or nil + ['By']=''..player_name, + ['Details'] = event.parameters ~= '' and event.parameters or nil } end end From 52aa754386fcf7f52224e31e2d0313f4e5dbc448 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 02:51:07 +0000 Subject: [PATCH 091/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 30 +---------------- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 32 ++----------------- docs/addons/Compilatron.html | 30 +---------------- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 30 +---------------- docs/addons/Discord-Alerts.html | 30 +---------------- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 30 +---------------- docs/addons/Spawn-Area.html | 30 +---------------- docs/addons/Tree-Decon.html | 30 +---------------- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Connect.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- .../Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 30 +---------------- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 30 +---------------- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/External.html | 24 +++++++++++--- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 30 +---------------- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 4 +-- docs/modules/control.html | 2 +- .../modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 100 files changed, 121 insertions(+), 413 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 6aeb414d..0ae92446 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -259,9 +259,6 @@ utils.event - utils.game - - config.advanced_start @@ -291,31 +288,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -363,7 +335,7 @@ generated by LDoc
    diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 16c72de1..9797dfb8 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 3464d378..f6575c97 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -236,7 +236,7 @@

    Chat-Reply addon

    -

    Adds auto replies to chat messages; aswell as chat commands

    +

    Adds auto replies to chat messages; as well as chat commands

    @@ -259,9 +259,6 @@ utils.event - utils.game - - expcore.roles @@ -294,31 +291,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -391,7 +363,7 @@ generated by LDoc
    diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index bf731c46..4d89e6ee 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -264,9 +264,6 @@ utils.global - utils.game - - utils.task @@ -343,31 +340,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -600,7 +572,7 @@ generated by LDoc
    diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 1d0b632d..d18ba76e 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 1514ec1f..16a8c53f 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -259,9 +259,6 @@ utils.event - utils.game - - utils.global @@ -297,31 +294,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -419,7 +391,7 @@ generated by LDoc
    diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index fc4544d0..286706dd 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -259,9 +259,6 @@ utils.event - utils.game - - utils.color_presets @@ -303,31 +300,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -475,7 +447,7 @@ generated by LDoc
    diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 891b2b3e..1643260a 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 03ead1bd..4a53971e 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index ca4ef857..8fd9740d 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -259,9 +259,6 @@ utils.event - utils.game - - utils.global @@ -297,31 +294,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -419,7 +391,7 @@ generated by LDoc
    diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index bb5564e9..3eea837e 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -262,9 +262,6 @@ utils.event - utils.game - - config.spawn_area @@ -319,31 +316,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -391,7 +363,7 @@ generated by LDoc
    diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 80c6f75e..194844b5 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -259,9 +259,6 @@ utils.event - utils.game - - utils.global @@ -294,31 +291,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -391,7 +363,7 @@ generated by LDoc
    diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 495fcca4..0f6f8a52 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 9470341f..897e7924 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index addbf00f..6f842a60 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Connect.html b/docs/commands/Connect.html index 6c136657..d0d077ad 100644 --- a/docs/commands/Connect.html +++ b/docs/commands/Connect.html @@ -606,7 +606,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 3e18232a..64f4e610 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -380,7 +380,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index a24912fa..1c8e1688 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 8d6603f9..d0e3f209 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 7ddba845..b139e681 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 5da0a630..c3d2d5fc 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index c6bb3260..65b7f63d 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -626,7 +626,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 93d35e5d..64fd8afc 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 68121998..a61efb80 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 75705b05..e9547dd5 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 03c57b14..144d09fb 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -336,7 +336,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index cbd14acf..1a9226ea 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -600,7 +600,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index 60445452..f68e93cd 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -572,7 +572,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index e01029bf..eb37b52e 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index a78fcb0f..115d2a32 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -499,7 +499,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 941acb8a..88d69db6 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -584,7 +584,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 3aed98c0..6a784705 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -521,7 +521,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 183dd04f..1f74c162 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index d445ab74..6d179ad0 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 069c2cc1..40ffd332 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -309,7 +309,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 626c6c60..daac8570 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 827aa0db..baeea3b0 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -457,7 +457,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 651e371f..e722023a 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index edaa3da2..02965626 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -276,9 +276,6 @@ see ./expcore/commands.lua for more details

    expcore.commands - - utils.game - @@ -306,31 +303,6 @@ see ./expcore/commands.lua for more details

    - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -353,7 +325,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc
    diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 8c4ac199..a36a83de 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index db88dc39..19477c82 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -431,7 +431,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 8ff2a878..a818acbd 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 8d7055ba..6e960d6a 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -255,7 +255,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 217eb4a6..97164ddc 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 3ab18659..f0dffa28 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -268,9 +268,6 @@ expcore.roles - utils.game - - modules.control.reports @@ -381,31 +378,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -799,7 +771,7 @@ generated by LDoc
    diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 5e2d1d52..1b3c3bd1 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 129eae8b..e696e323 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index cb16dae3..1877467a 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -339,7 +339,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index f4ab75f8..9d37bc4f 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 1cb9f8e5..8f0e583a 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 511fa00c..3e998547 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -849,7 +849,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index f684cf40..5b8a355f 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 27081b1e..5d890570 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 121029f2..30120fbc 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 3d9aebd7..6a89e672 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -759,7 +759,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 555010db..ade704a1 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -639,7 +639,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 84859b6d..56038642 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 8c6d3222..1f6266c4 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 249332bb..6d70a375 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -789,7 +789,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 98abe81a..0bcfeaa3 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index c7247d67..431f3831 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1223,7 +1223,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 48b82ed7..3c7dbf88 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1344,7 +1344,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 423283d2..26746583 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1157,7 +1157,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 923c8917..9287bf31 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -999,7 +999,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index 1632e2e8..e37ec184 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -985,7 +985,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 5635cfe7..3ff7402a 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1540,7 +1540,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index 2302ae32..c58c38bd 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1522,7 +1522,7 @@ Warps.make_warp_tag(warp_id)
    generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index b3fb18b7..6d6500bf 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -613,7 +613,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index ce74a937..a1c029a6 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2428,7 +2428,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 1acadfd2..79b9fe1a 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2767,7 +2767,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index a0ee6364..79e91704 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2964,7 +2964,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/External.html b/docs/core/External.html index 2e411712..a176a1ba 100644 --- a/docs/core/External.html +++ b/docs/core/External.html @@ -286,7 +286,7 @@ Gets the details of the given server - get_server_status(server_id) + get_server_status(server_id, raw) Gets the status of the given server @@ -543,7 +543,7 @@
    # - get_server_status(server_id) + get_server_status(server_id, raw)
    @@ -574,6 +574,22 @@ + + + +
  • + + raw + + : + + (boolean) + + When true Current will not be returned as status but rather the raw status for the server + +
  • + + @@ -583,7 +599,7 @@
    • (string) - The status of the given server, one of: Online, Modded, Protected, Offline + The status of the given server, one of: Online, Modded, Protected, Current, Offline
    @@ -732,7 +748,7 @@ generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 822d5175..599eac39 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1443,7 +1443,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 4afa7364..1b275c08 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4421,7 +4421,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 348700b3..d8138add 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -531,7 +531,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 2758606b..f8088315 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3350,7 +3350,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index 2df8b895..7f59f8d8 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 97c61a50..5443c76b 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -487,7 +487,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 4c77c675..336c9ad8 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -430,7 +430,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 3d4fba97..8c05c831 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 913fb300..4768099a 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -408,7 +408,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 7fb581dd..73ff0329 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -486,7 +486,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index f1b999ca..871f5a67 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -268,9 +268,6 @@ expcore.datastore - utils.game - - utils.event @@ -395,31 +392,6 @@ - - - - - - -
    -
    -
    -
    - # - utils.game -
    -
    -
    -
    - - - - - - - - - @@ -734,7 +706,7 @@ generated by LDoc
    diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 9109aa86..2a0370af 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -998,7 +998,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 1eae671b..ceed633d 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -706,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index bbdc5ff1..dff480cd 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 00b9bfa9..65efee25 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -771,7 +771,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index 8859c31e..aaae6147 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1042,7 +1042,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index ae8c0d1b..5acf4317 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -508,7 +508,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 10eb1cd8..68e9ba92 100644 --- a/docs/index.html +++ b/docs/index.html @@ -141,7 +141,7 @@ Chat-Reply - Adds auto replies to chat messages; aswell as chat commands + Adds auto replies to chat messages; as well as chat commands Compilatron @@ -550,7 +550,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 18d0df09..5b8b7bf3 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 9dcf29a5..6ff15a55 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -308,7 +308,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 30dfdfb0..5d34cbfa 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -669,7 +669,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index a3db1736..94f8ce18 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index ff468fe3..5331ac95 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2023,7 +2023,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index d7dcbeb0..d944ff68 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1307,7 +1307,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 31225f93..fdaa7391 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -449,7 +449,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 60d5683e..fbfd4b7d 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -666,7 +666,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 3d655000..e63700ba 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -804,7 +804,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 43d9ee05..f5b1810a 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -356,7 +356,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 40f7d00cbe283179fa7c157c7ccba0060493765c Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 16:07:34 +0100 Subject: [PATCH 092/106] Added ligten to player colours --- modules/data/player-colours.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/data/player-colours.lua b/modules/data/player-colours.lua index aff392a8..9ee9b547 100644 --- a/modules/data/player-colours.lua +++ b/modules/data/player-colours.lua @@ -26,6 +26,11 @@ local function compact(colour) } end +--- Returns a colour that is a bit lighter than the one given +local function lighten(c) + return {r = 1 - (1 - c.r) * 0.5, g = 1 - (1 - c.g) * 0.5, b = 1 - (1 - c.b) * 0.5, a = 1} +end + --- When your data loads apply the players colour, or a random on if none is saved PlayerColours:on_load(function(player_name, player_colour) if not player_colour then @@ -37,7 +42,7 @@ PlayerColours:on_load(function(player_name, player_colour) while config.disallow[colour_name] do colour_name = table.get_random_dictionary_entry(Colours, true) end - player_colour = {Colours[colour_name], Colours[colour_name]} + player_colour = {Colours[colour_name], lighten(Colours[colour_name])} end end From ad457343a4f645f777de80a93af42e61bacc1708 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 16:13:44 +0100 Subject: [PATCH 093/106] Added check for nil cause for damaged --- modules/data/statistics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index b350d3b7..709610fb 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -89,7 +89,7 @@ if config.DamageDealt then local stat = Statistics:combine('DamageDealt') Event.add(defines.events.on_entity_damaged, function(event) local character = event.cause -- Check character is valid - if not character.valid or character.type ~= 'character' then return end + if not character or not character.valid or character.type ~= 'character' then return end local player = character.player -- Check player is valid if not player.valid or not player.connected then return end local entity = event.entity -- Check entity is valid From 7939d8d3f72e168dd534d367f28547826338ea30 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 16:18:02 +0100 Subject: [PATCH 094/106] Added check for nil player for role get_players --- expcore/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index 477a5fb5..6076bd5f 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -946,7 +946,7 @@ function Roles._prototype:get_players(online) if role_name == self.name then local player = game.players[player_name] -- Filter by online state if required - if online == nil or player.connected == online then + if player and (online == nil or player.connected == online) then players[#players+1] = player end break From f5a2f7ed702b1271a78d019ad8a2ae4b1d310bd4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 16:23:22 +0100 Subject: [PATCH 095/106] Fixed role auto promote --- expcore/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index 6076bd5f..c2236f8c 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -1001,7 +1001,7 @@ Event.add(defines.events.on_player_joined_game, role_update) -- Every 60 seconds the auto promote check is preformed Event.on_nth_tick(3600, function() local promotes = {} - for _, player in ipairs(game.connected_players) do + for _, player in pairs(game.connected_players) do for _, role in ipairs(Roles.config.roles) do if role.auto_promote_condition then local success, err = pcall(role.auto_promote_condition, player) From 1172baf2b9e789b7045a69ef7c02972fb302d275 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 14 Aug 2020 16:49:55 +0100 Subject: [PATCH 096/106] Fixed role event emit --- expcore/roles.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/expcore/roles.lua b/expcore/roles.lua index c2236f8c..f97771a7 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -153,12 +153,11 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk event = Roles.events.on_role_unassigned end -- convert the roles to objects and get the names of the roles - local index, role_names, valid_roles = 0, {}, {} + local index, role_names = 0, {} for _, role in ipairs(roles) do role = Roles.get_role_from_any(role) if role then index = index + 1 - valid_roles[index] = role role_names[index] = role.name end end @@ -176,7 +175,7 @@ local function emit_player_roles_updated(player, type, roles, by_player_name, sk tick=game.tick, player_index=player.index, by_player_index=by_player_index, - roles=valid_roles + roles=role_names }) write_json('log/roles.log', { player_name=player.name, From e3a0376b30b0c38214e8bb877b9b02ee9e54ee10 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 17:45:04 +0100 Subject: [PATCH 097/106] Fixed bug with nil index for decon --- modules/addons/tree-decon.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/addons/tree-decon.lua b/modules/addons/tree-decon.lua index da32b298..29e13707 100644 --- a/modules/addons/tree-decon.lua +++ b/modules/addons/tree-decon.lua @@ -17,6 +17,7 @@ end) Event.add(defines.events.on_marked_for_deconstruction, function(event) -- Check which type of decon a player is allowed local index = event.player_index + if not index then return end if chache[index] == nil then local player = game.players[index] if Roles.player_allowed(player, 'fast-tree-decon') then chache[index] = 'fast' From 48d924d69dfbf8fa589be7ea858959d9b1f18467 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 19:00:29 +0100 Subject: [PATCH 098/106] Fixed player data error --- expcore/player_data.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/expcore/player_data.lua b/expcore/player_data.lua index e05caa6c..2eba29f5 100644 --- a/expcore/player_data.lua +++ b/expcore/player_data.lua @@ -128,6 +128,7 @@ end) Event.add(defines.events.on_player_joined_game, function(event) local player = game.players[event.player_index] Async.wait(300, check_data_loaded, player) + PlayerData:raw_set(player.name) PlayerData:request(player) end) @@ -135,7 +136,7 @@ end) Event.add(defines.events.on_player_left_game, function(event) local player = game.players[event.player_index] local player_data = PlayerData:get(player) - if player_data.valid == true then + if player_data and player_data.valid == true then PlayerData:unload(player) else PlayerData:raw_set(player.name) end end) From aa5946e3d2123fc13a38806ac2af447d7e8ae6bc Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 19:01:50 +0100 Subject: [PATCH 099/106] Fixed call to invalid entity during warp removal --- modules/control/warps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/control/warps.lua b/modules/control/warps.lua index 07be1b0f..b846460a 100644 --- a/modules/control/warps.lua +++ b/modules/control/warps.lua @@ -229,7 +229,7 @@ function Warps.remove_warp_area(warp_id) {position.x+radius, position.y+radius} } } - for _, entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end + for _, entity in pairs(entities) do if entity and entity.valid and entity.name ~= 'player' then entity.destroy() end end end --[[-- Set a warp to be the spawn point for a force, force must own this warp From 4ade68b7dff8faf417468b20041232f8f746647e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 19:45:08 +0100 Subject: [PATCH 100/106] Merge pull request #172 from tovernaar123/feature/rename_changes This will fix the bug where already named station get renamed --- modules/addons/station-auto-name.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/addons/station-auto-name.lua b/modules/addons/station-auto-name.lua index 6b3d28e5..15a9f21b 100644 --- a/modules/addons/station-auto-name.lua +++ b/modules/addons/station-auto-name.lua @@ -21,13 +21,29 @@ local function Angle(entity) return direction end end + return 'W' end +local custom_string = ' *' +local custom_string_len = #custom_string + local function station_name_changer(event) local entity = event.created_entity local name = entity.name + if name == "entity-ghost" then + if entity.ghost_name ~= "train-stop" then return end + local backername = entity.backer_name + if backername ~= '' then + entity.backer_name = backername..custom_string + end + + elseif name == "train-stop" then --only do the event if its a train stop + local backername = entity.backer_name + if backername:sub(-custom_string_len) == custom_string then + entity.backer_name = backername:sub(1, -custom_string_len) + return + end - if name == "train-stop" then --only do the event if its a train stop local boundingBox = entity.bounding_box -- expanded box for recourse search: local bounding2 = { {boundingBox.left_top.x -100 ,boundingBox.left_top.y -100} , {boundingBox.right_bottom.x +100, boundingBox.right_bottom.y +100 } } From 868f6a28e56902d95c6939e28a01474ce61ca4bb Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 19:46:40 +0100 Subject: [PATCH 101/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Connect.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 2 +- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/External.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 2 +- 100 files changed, 100 insertions(+), 100 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 0ae92446..e39cc41a 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 9797dfb8..038ad34e 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index f6575c97..7700c0ec 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 4d89e6ee..c7c56433 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -572,7 +572,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index d18ba76e..13d77b1e 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 16a8c53f..259dd255 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 286706dd..0763204a 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index 1643260a..ab750555 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 4a53971e..fa9ed33c 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 8fd9740d..c0eb6e5a 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 3eea837e..18445593 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index 194844b5..a3d37895 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 0f6f8a52..a41b3d91 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 897e7924..fc6e1d17 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 6f842a60..0fefd137 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Connect.html b/docs/commands/Connect.html index d0d077ad..d094c476 100644 --- a/docs/commands/Connect.html +++ b/docs/commands/Connect.html @@ -606,7 +606,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 64f4e610..0fc1441e 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -380,7 +380,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 1c8e1688..ff73a2fd 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index d0e3f209..31d69ca4 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index b139e681..ad004957 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index c3d2d5fc..24e698e1 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 65b7f63d..ae6bb899 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -626,7 +626,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 64fd8afc..bd1044a8 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index a61efb80..8c777251 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index e9547dd5..75b8b06d 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 144d09fb..83654ca4 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -336,7 +336,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 1a9226ea..7ed3df6a 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -600,7 +600,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index f68e93cd..aea73b9f 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -572,7 +572,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index eb37b52e..314c46b7 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 115d2a32..b8106d0e 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -499,7 +499,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 88d69db6..0a50ac10 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -584,7 +584,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 6a784705..6c0412d3 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -521,7 +521,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 1f74c162..77c828fe 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 6d179ad0..e32e3c56 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 40ffd332..44b6b162 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -309,7 +309,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index daac8570..08c2bcaf 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index baeea3b0..537a5d3f 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -457,7 +457,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index e722023a..09e6ad24 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 02965626..430492ea 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -325,7 +325,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index a36a83de..145677ad 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 19477c82..49463ce0 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -431,7 +431,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index a818acbd..c2b32cf8 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 6e960d6a..21eb6b51 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -255,7 +255,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index 97164ddc..f75ca882 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index f0dffa28..27ce8116 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -771,7 +771,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index 1b3c3bd1..e219946a 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index e696e323..5d581107 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index 1877467a..d3b203d1 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -339,7 +339,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 9d37bc4f..2954415c 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 8f0e583a..29686338 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 3e998547..66650cb3 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -849,7 +849,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 5b8a355f..b52de4f9 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 5d890570..7ee719a3 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index 30120fbc..d589f814 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 6a89e672..2c7c3172 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -759,7 +759,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index ade704a1..25fa0414 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -639,7 +639,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 56038642..990e08a0 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 1f6266c4..9b96c1da 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 6d70a375..12708074 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -789,7 +789,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 0bcfeaa3..05b602e4 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 431f3831..7cad6c81 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1223,7 +1223,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 3c7dbf88..a7ac2843 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1344,7 +1344,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 26746583..66af4afd 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1157,7 +1157,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 9287bf31..9d036302 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -999,7 +999,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index e37ec184..a96bb150 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -985,7 +985,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 3ff7402a..253a4a99 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1540,7 +1540,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index c58c38bd..df2dc465 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1522,7 +1522,7 @@ Warps.make_warp_tag(warp_id)
    generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 6d6500bf..5a636e87 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -613,7 +613,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index a1c029a6..2b4c62db 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2428,7 +2428,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index 79b9fe1a..a7b8e9dc 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2767,7 +2767,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 79e91704..09f67ac7 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2964,7 +2964,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/External.html b/docs/core/External.html index a176a1ba..15aac6c9 100644 --- a/docs/core/External.html +++ b/docs/core/External.html @@ -748,7 +748,7 @@ generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 599eac39..06a15fcd 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1443,7 +1443,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 1b275c08..c1543fcc 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4421,7 +4421,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index d8138add..861adf09 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -531,7 +531,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index f8088315..02bc5181 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3350,7 +3350,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index 7f59f8d8..b8d4ae49 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 5443c76b..1bbcf745 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -487,7 +487,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 336c9ad8..9138960f 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -430,7 +430,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 8c05c831..2a636fe0 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index 4768099a..ff73cff3 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -408,7 +408,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 73ff0329..5020e1de 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -486,7 +486,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 871f5a67..2ccddc26 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -706,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 2a0370af..50ecc877 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -998,7 +998,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index ceed633d..ae7a1d6f 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -706,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index dff480cd..26695b53 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 65efee25..78d230d2 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -771,7 +771,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index aaae6147..b12f4c78 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1042,7 +1042,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index 5acf4317..c86bad41 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -508,7 +508,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 68e9ba92..94d322ac 100644 --- a/docs/index.html +++ b/docs/index.html @@ -550,7 +550,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 5b8b7bf3..06abd897 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 6ff15a55..413f735b 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -308,7 +308,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index 5d34cbfa..f2e173a2 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -669,7 +669,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 94f8ce18..35205dfc 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index 5331ac95..a123cbb3 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2023,7 +2023,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index d944ff68..1475565f 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1307,7 +1307,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index fdaa7391..09726346 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -449,7 +449,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index fbfd4b7d..1cb66846 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -666,7 +666,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index e63700ba..99f695c6 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -804,7 +804,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index f5b1810a..a8da112f 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -356,7 +356,7 @@ Please report these errors to [the issues page](issues). generated by LDoc From 0cb77601be8c8ee99431ae57ee492e006058b0c1 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 19:56:55 +0100 Subject: [PATCH 102/106] Readme Update --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 851be090..08e9c873 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i | Scenario Version* | Version Name | Factorio Version** | |---|---|---| +| [v6.1][s6.1] | External Data Overhaul | [v1.0.0][f1.0.0] | | [v6.0][s6.0] | Gui / 0.18 Overhaul | [v0.18.17][f0.18.17] | | [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] | | [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | @@ -80,6 +81,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i \*\* Factorio versions show the version they were made for, often the minimum requirement. +[s6.1]: https://github.com/explosivegaming/scenario/releases/tag/6.1.0 [s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0 [s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0 [s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 @@ -98,6 +100,7 @@ All are welcome to make pull requests and issues for this scenario, if you are i [s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 [s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 +[f1.0.0]: https://wiki.factorio.com/Version_history/1.0.0#1.0.0 [f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17 [f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71 [f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 From ad1686ad604c3d236e419068426ef2cc211e5215 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 16 Aug 2020 21:12:29 +0100 Subject: [PATCH 103/106] Fixed player list colours --- modules/data/player-colours.lua | 4 ++-- modules/gui/player-list.lua | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/data/player-colours.lua b/modules/data/player-colours.lua index 9ee9b547..f32aa7ff 100644 --- a/modules/data/player-colours.lua +++ b/modules/data/player-colours.lua @@ -28,7 +28,7 @@ end --- Returns a colour that is a bit lighter than the one given local function lighten(c) - return {r = 1 - (1 - c.r) * 0.5, g = 1 - (1 - c.g) * 0.5, b = 1 - (1 - c.b) * 0.5, a = 1} + return {r = 255 - (255 - c.r) * 0.5, g = 255 - (255 - c.g) * 0.5, b = 255 - (255 - c.b) * 0.5, a = 255} end --- When your data loads apply the players colour, or a random on if none is saved @@ -36,7 +36,7 @@ PlayerColours:on_load(function(player_name, player_colour) if not player_colour then local preset = config.players[player_name] if preset then - player_colour = {preset, preset} + player_colour = {preset, lighten(preset)} else local colour_name = 'white' while config.disallow[colour_name] do diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index ab9bb13d..f0923073 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -324,6 +324,7 @@ local function get_player_list_order() end --[[Adds fake players to the player list + local tick = game.tick+1 for i = 1, 10 do local online_time = math.random(1, tick) local afk_time = math.random(online_time-(tick/10), tick) @@ -337,7 +338,7 @@ local function get_player_list_order() caption = caption, tooltip = tooltip } - end]] + end--]] return player_list_order end From 5ad4301f6788291472f31946269c96fa979ab57e Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 17 Aug 2020 15:18:34 +0100 Subject: [PATCH 104/106] Better sandboxing for /interface --- modules/commands/interface.lua | 85 +++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/modules/commands/interface.lua b/modules/commands/interface.lua index 41d2942d..a95d66be 100644 --- a/modules/commands/interface.lua +++ b/modules/commands/interface.lua @@ -31,67 +31,75 @@ Global.register(interface_env, function(tbl) interface_env = tbl end) ---- Adds a callback function when the interface command is used --- nb: returned value is saved in the env that the interface uses --- @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 +--- Adds a static module that can be accessed with the interface +-- @tparam string name The name that the value is assigned to +-- @tparam any value The value that will be accessible in the interface env -- callback param - player: LuaPlayer - the player who used the command +local function add_interface_module(name, value) + interface_modules[name] = value +end + +--- Adds a dynamic value that is calculated when the interface is used +-- @tparam string name The name that the value is assigned to +-- @tparam function callback The function that will be called to get the value local function add_interface_callback(name, callback) if type(callback) == 'function' then interface_callbacks[name] = callback end end --- this is a meta function for __index when self[key] is nil +--- Internal, this is a meta function for __index when self[key] is nil local function get_index(_, key) if interface_env[key] then return interface_env[key] elseif interface_modules[key] then return interface_modules[key] + elseif _G[key] then + return _G[key] end end ---- Sends an innovation to be ran and returns the result. +--- Sends an invocation to be ran and returns the result. -- @command interface --- @tparam string innovation the command that will be run -Commands.new_command('interface', 'Sends an innovation to be ran and returns the result.') -:add_param('innovation', false) +-- @tparam string invocation the command that will be run +Commands.new_command('interface', 'Sends an invocation to be ran and returns the result.') +:add_param('invocation', false) :enable_auto_concat() :set_flag('admin_only') -:register(function(player, innovation) - if not innovation:find('%s') and not innovation:find('return') then - -- if there are no spaces and return is not present then return is appended to the start - innovation='return '..innovation +:register(function(player, invocation) + -- If the invocation has no white space then prepend return to it + if not invocation:find('%s') and not invocation:find('return') then + invocation = 'return '..invocation end - -- temp_env will index to interface_env and interface_modules if value not found - local temp_env = setmetatable({}, {__index=get_index}) - if player then -- player can be nil when it is the server + + -- _env will be the new _ENV that the invocation will run inside of + local _env = setmetatable({}, { + __index = get_index, + __newindex = interface_env + }) + + -- If the command is ran by a player then load the dynamic values + if player then for name, callback in pairs(interface_callbacks) do - -- loops over callbacks and loads the values returned local _, rtn = pcall(callback, player) - temp_env[name]=rtn + rawset(_env, name, rtn) end end - -- sets the global metatable to prevent new values being made - -- global will index to temp_env and new indexes saved to interface_sandbox - local old_mt = getmetatable(_G) - setmetatable(_G, {__index=temp_env, __newindex=interface_env}) - -- runs the innovation and returns values to the player - innovation = loadstring(innovation) - local success, rtn = pcall(innovation) - setmetatable(_G, old_mt) + + -- Compile the invocation with the custom _env value + local invocation_func, compile_error = load(invocation, 'interface', nil, _env) + if compile_error then return Commands.error(compile_error) end + + -- Run the invocation + local success, rtn = pcall(invocation_func) if not success then - if type(rtn) == 'string' then - -- there may be stack trace that must be removed to avoid desyncs - rtn = rtn:gsub('%.%.%..-/temp/currently%-playing', '') - end - return Commands.error(rtn) - else - return Commands.success(rtn) + local err = rtn:gsub('%.%.%..-/temp/currently%-playing', '') + return Commands.error(err) end + return Commands.success(rtn) end) --- adds some basic callbacks for the interface +-- Adds some basic callbacks for the interface add_interface_callback('player', function(player) return player end) add_interface_callback('surface', function(player) return player.surface end) add_interface_callback('force', function(player) return player.force end) @@ -99,9 +107,10 @@ add_interface_callback('position', function(player) return player.position end) add_interface_callback('entity', function(player) return player.selected end) add_interface_callback('tile', function(player) return player.surface.get_tile(player.position) end) +-- Module Return return { - add_interface_callback=add_interface_callback, - interface_env=interface_env, - interface_callbacks=interface_callbacks, - clean_stack_trace=function(str) return str:gsub('%.%.%..-/temp/currently%-playing', '') end + add_interface_module = add_interface_module, + add_interface_callback = add_interface_callback, + interface_env = interface_env, + clean_stack_trace = function(str) return str:gsub('%.%.%..-/temp/currently%-playing', '') end } \ No newline at end of file From f98599ca8245076185d20bc4e7202a5aefe2f4b7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 17 Aug 2020 15:20:08 +0100 Subject: [PATCH 105/106] Fixed sups not showing when set to visible --- modules/gui/server-ups.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index 798ac45e..9d294b36 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -33,7 +33,7 @@ Gui.element{ UsesServerUps:on_load(function(player_name, visible) local player = game.players[player_name] local label = player.gui.screen[server_ups.name] - if not global.ext or not global.ext.server_ups then visible = false end + if not External.valid() or not global.ext.var.server_ups then visible = false end label.visible = visible end) From e1087caa9a3720627c3f8c795ddd6b19e66906f4 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 17 Aug 2020 14:39:40 +0000 Subject: [PATCH 106/106] Automatic Doc Update --- docs/addons/Advanced-Start.html | 2 +- docs/addons/Chat-Popups.html | 2 +- docs/addons/Chat-Reply.html | 2 +- docs/addons/Compilatron.html | 2 +- docs/addons/Damage-Popups.html | 2 +- docs/addons/Death-Logger.html | 2 +- docs/addons/Discord-Alerts.html | 2 +- docs/addons/Inventory-Clear.html | 2 +- docs/addons/Pollution-Grading.html | 2 +- docs/addons/Scorched-Earth.html | 2 +- docs/addons/Spawn-Area.html | 2 +- docs/addons/Tree-Decon.html | 2 +- docs/commands/Admin-Chat.html | 2 +- docs/commands/Cheat-Mode.html | 2 +- docs/commands/Clear-Inventory.html | 2 +- docs/commands/Connect.html | 2 +- docs/commands/Debug.html | 2 +- docs/commands/Find.html | 2 +- docs/commands/Help.html | 2 +- docs/commands/Home.html | 2 +- docs/commands/Interface.html | 8 ++++---- docs/commands/Jail.html | 2 +- docs/commands/Kill.html | 2 +- docs/commands/Me.html | 2 +- docs/commands/Rainbow.html | 2 +- docs/commands/Repair.html | 2 +- docs/commands/Reports.html | 2 +- docs/commands/Roles.html | 2 +- docs/commands/Spawn.html | 2 +- docs/commands/Teleport.html | 2 +- docs/commands/Warnings.html | 2 +- docs/configs/Advanced-Start.html | 2 +- docs/configs/Bonuses.html | 2 +- docs/configs/Chat-Reply.html | 2 +- docs/configs/Commands-Auth-Admin.html | 2 +- docs/configs/Commands-Auth-Roles.html | 2 +- docs/configs/Commands-Auth-Runtime-Disable.html | 2 +- docs/configs/Commands-Parse-Roles.html | 2 +- docs/configs/Commands-Parse.html | 2 +- docs/configs/Compilatron.html | 2 +- docs/configs/Death-Logger.html | 2 +- docs/configs/Discord-Alerts.html | 2 +- docs/configs/File-Loader.html | 2 +- docs/configs/Permission-Groups.html | 2 +- docs/configs/Player-List.html | 2 +- docs/configs/Pollution-Grading.html | 2 +- docs/configs/Popup-Messages.html | 2 +- docs/configs/Preset-Player-Colours.html | 2 +- docs/configs/Preset-Player-Quickbar.html | 2 +- docs/configs/Repair.html | 2 +- docs/configs/Rockets.html | 2 +- docs/configs/Roles.html | 2 +- docs/configs/Science.html | 2 +- docs/configs/Scorched-Earth.html | 2 +- docs/configs/Spawn-Area.html | 2 +- docs/configs/Statistics.html | 2 +- docs/configs/Tasks.html | 2 +- docs/configs/Warnings.html | 2 +- docs/configs/Warps.html | 2 +- docs/configs/inventory_clear.html | 2 +- docs/control/Jail.html | 2 +- docs/control/Production.html | 2 +- docs/control/Reports.html | 2 +- docs/control/Rockets.html | 2 +- docs/control/Tasks.html | 2 +- docs/control/Warnings.html | 2 +- docs/control/Warps.html | 2 +- docs/core/Async.html | 2 +- docs/core/Commands.html | 2 +- docs/core/Common.html | 2 +- docs/core/Datastore.html | 2 +- docs/core/External.html | 2 +- docs/core/Groups.html | 2 +- docs/core/Gui.html | 2 +- docs/core/PlayerData.html | 2 +- docs/core/Roles.html | 2 +- docs/data/Alt-View.html | 2 +- docs/data/Bonus.html | 2 +- docs/data/Greetings.html | 2 +- docs/data/Player-Colours.html | 2 +- docs/data/Quickbar.html | 2 +- docs/data/Tag.html | 2 +- docs/guis/Player-List.html | 2 +- docs/guis/Readme.html | 2 +- docs/guis/Rocket-Info.html | 2 +- docs/guis/Science-Info.html | 2 +- docs/guis/Task-List.html | 2 +- docs/guis/Warps-List.html | 2 +- docs/guis/server-ups.html | 2 +- docs/index.html | 2 +- docs/modules/control.html | 2 +- docs/modules/modules.addons.station-auto-name.html | 2 +- docs/modules/overrides.debug.html | 2 +- docs/modules/overrides.math.html | 2 +- docs/modules/overrides.table.html | 2 +- docs/modules/utils.event.html | 2 +- docs/modules/utils.event_core.html | 2 +- docs/modules/utils.task.html | 2 +- docs/topics/LICENSE.html | 2 +- docs/topics/README.md.html | 9 ++++++--- 100 files changed, 108 insertions(+), 105 deletions(-) diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index e39cc41a..535e9bfd 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index 038ad34e..3f442536 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 7700c0ec..6db112ae 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index c7c56433..bda49f7a 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -572,7 +572,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index 13d77b1e..003e30f8 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -364,7 +364,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 259dd255..601263fa 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index 0763204a..b0d5befb 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -447,7 +447,7 @@ generated by LDoc diff --git a/docs/addons/Inventory-Clear.html b/docs/addons/Inventory-Clear.html index ab750555..81417800 100644 --- a/docs/addons/Inventory-Clear.html +++ b/docs/addons/Inventory-Clear.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index fa9ed33c..0683847c 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index c0eb6e5a..118b6491 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 18445593..8b40d24b 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/addons/Tree-Decon.html b/docs/addons/Tree-Decon.html index a3d37895..be69c732 100644 --- a/docs/addons/Tree-Decon.html +++ b/docs/addons/Tree-Decon.html @@ -363,7 +363,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index a41b3d91..36f3cb7a 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index fc6e1d17..f5e8e341 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -376,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index 0fefd137..13ecb39a 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Connect.html b/docs/commands/Connect.html index d094c476..d1d7e478 100644 --- a/docs/commands/Connect.html +++ b/docs/commands/Connect.html @@ -606,7 +606,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 0fc1441e..7cf7af9a 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -380,7 +380,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index ff73a2fd..b2d8c3c6 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 31d69ca4..55d85b6d 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -419,7 +419,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index ad004957..200237e7 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -473,7 +473,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 24e698e1..3f6ab5eb 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -274,7 +274,7 @@ interface - Sends an innovation to be ran and returns the result. + Sends an invocation to be ran and returns the result. @@ -348,7 +348,7 @@
    -

    Sends an innovation to be ran and returns the result.

    +

    Sends an invocation to be ran and returns the result.

    @@ -362,7 +362,7 @@
  • - innovation + invocation : @@ -403,7 +403,7 @@ generated by LDoc
  • diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index ae6bb899..3e1719ab 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -626,7 +626,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index bd1044a8..043d511c 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 8c777251..4f483e18 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -375,7 +375,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index 75b8b06d..e18bab98 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index 83654ca4..2a80c500 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -336,7 +336,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index 7ed3df6a..2dc4b160 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -600,7 +600,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index aea73b9f..9261bfe7 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -572,7 +572,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index 314c46b7..42a8ca98 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -404,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index b8106d0e..b5a24b0a 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -499,7 +499,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index 0a50ac10..1acded09 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -584,7 +584,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 6c0412d3..5312c2fa 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -521,7 +521,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index 77c828fe..e5d87a51 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index e32e3c56..5c7b01d6 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -500,7 +500,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index 44b6b162..2b3a8e1b 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -309,7 +309,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index 08c2bcaf..20eb3109 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index 537a5d3f..11984c79 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -457,7 +457,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 09e6ad24..e62239d9 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 430492ea..d6317fc3 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -325,7 +325,7 @@ see ./expcore/commands.lua for more details

    generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 145677ad..aab7d220 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 49463ce0..7995c602 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -431,7 +431,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index c2b32cf8..d328ccb8 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 21eb6b51..41edc429 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -255,7 +255,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index f75ca882..65701525 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index 27ce8116..5fdf4cf2 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -771,7 +771,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index e219946a..3823f6a0 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 5d581107..a8d55d58 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index d3b203d1..7adb3974 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -339,7 +339,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Quickbar.html b/docs/configs/Preset-Player-Quickbar.html index 2954415c..1d158db0 100644 --- a/docs/configs/Preset-Player-Quickbar.html +++ b/docs/configs/Preset-Player-Quickbar.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index 29686338..eeef92dc 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -429,7 +429,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 66650cb3..ddad5eca 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -849,7 +849,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index b52de4f9..a6b6b5e7 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -307,7 +307,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index 7ee719a3..a74159a3 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -369,7 +369,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index d589f814..358d6ab6 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -403,7 +403,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index 2c7c3172..6e5a52cc 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -759,7 +759,7 @@ generated by LDoc diff --git a/docs/configs/Statistics.html b/docs/configs/Statistics.html index 25fa0414..a7b2ec84 100644 --- a/docs/configs/Statistics.html +++ b/docs/configs/Statistics.html @@ -639,7 +639,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 990e08a0..9194d7c8 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -399,7 +399,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index 9b96c1da..c306d3f1 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -370,7 +370,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 12708074..8215cf4c 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -789,7 +789,7 @@ generated by LDoc diff --git a/docs/configs/inventory_clear.html b/docs/configs/inventory_clear.html index 05b602e4..bec18e6f 100644 --- a/docs/configs/inventory_clear.html +++ b/docs/configs/inventory_clear.html @@ -252,7 +252,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index 7cad6c81..18ae5fca 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -1223,7 +1223,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index a7ac2843..a9242949 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -1344,7 +1344,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 66af4afd..6103bd77 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -1157,7 +1157,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 9d036302..03734968 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -999,7 +999,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index a96bb150..b82f48a1 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -985,7 +985,7 @@ Tasks.update_task(task_id, 'We need more iron!', gam generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 253a4a99..50f158af 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -1540,7 +1540,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index df2dc465..6d8f1f9d 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -1522,7 +1522,7 @@ Warps.make_warp_tag(warp_id) generated by LDoc diff --git a/docs/core/Async.html b/docs/core/Async.html index 5a636e87..bc1d3caa 100644 --- a/docs/core/Async.html +++ b/docs/core/Async.html @@ -613,7 +613,7 @@ Async.register(function(player, message) generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 2b4c62db..0411c950 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -2428,7 +2428,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire generated by LDoc diff --git a/docs/core/Common.html b/docs/core/Common.html index a7b8e9dc..355d0dc2 100644 --- a/docs/core/Common.html +++ b/docs/core/Common.html @@ -2767,7 +2767,7 @@ https://github.com/Refactorio/RedMew/blob/9184b2940f311d8c9c891e83429fc57ec7e0c4 generated by LDoc diff --git a/docs/core/Datastore.html b/docs/core/Datastore.html index 09f67ac7..062ec7f0 100644 --- a/docs/core/Datastore.html +++ b/docs/core/Datastore.html @@ -2964,7 +2964,7 @@ ExampleData:on_update(function(key, value) generated by LDoc diff --git a/docs/core/External.html b/docs/core/External.html index 15aac6c9..5618848d 100644 --- a/docs/core/External.html +++ b/docs/core/External.html @@ -748,7 +748,7 @@ generated by LDoc diff --git a/docs/core/Groups.html b/docs/core/Groups.html index 06a15fcd..7493f83d 100644 --- a/docs/core/Groups.html +++ b/docs/core/Groups.html @@ -1443,7 +1443,7 @@ generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index c1543fcc..323744e8 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -4421,7 +4421,7 @@ Gui.left_toolbar_button('entity/inserter', generated by LDoc diff --git a/docs/core/PlayerData.html b/docs/core/PlayerData.html index 861adf09..e911c5ce 100644 --- a/docs/core/PlayerData.html +++ b/docs/core/PlayerData.html @@ -531,7 +531,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index 02bc5181..09bd9cb7 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -3350,7 +3350,7 @@ nb: this is one way, failing false after already gaining the role will not revok generated by LDoc diff --git a/docs/data/Alt-View.html b/docs/data/Alt-View.html index b8d4ae49..5e4d30f6 100644 --- a/docs/data/Alt-View.html +++ b/docs/data/Alt-View.html @@ -335,7 +335,7 @@ generated by LDoc diff --git a/docs/data/Bonus.html b/docs/data/Bonus.html index 1bbcf745..8ab2f5af 100644 --- a/docs/data/Bonus.html +++ b/docs/data/Bonus.html @@ -487,7 +487,7 @@ generated by LDoc diff --git a/docs/data/Greetings.html b/docs/data/Greetings.html index 9138960f..4666859a 100644 --- a/docs/data/Greetings.html +++ b/docs/data/Greetings.html @@ -430,7 +430,7 @@ generated by LDoc diff --git a/docs/data/Player-Colours.html b/docs/data/Player-Colours.html index 2a636fe0..9fc2a1bd 100644 --- a/docs/data/Player-Colours.html +++ b/docs/data/Player-Colours.html @@ -391,7 +391,7 @@ generated by LDoc diff --git a/docs/data/Quickbar.html b/docs/data/Quickbar.html index ff73cff3..b14526c5 100644 --- a/docs/data/Quickbar.html +++ b/docs/data/Quickbar.html @@ -408,7 +408,7 @@ generated by LDoc diff --git a/docs/data/Tag.html b/docs/data/Tag.html index 5020e1de..17b9557f 100644 --- a/docs/data/Tag.html +++ b/docs/data/Tag.html @@ -486,7 +486,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 2ccddc26..1116c164 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -706,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Readme.html b/docs/guis/Readme.html index 50ecc877..b01eee7f 100644 --- a/docs/guis/Readme.html +++ b/docs/guis/Readme.html @@ -998,7 +998,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index ae7a1d6f..772e09cf 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -706,7 +706,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 26695b53..23f47c99 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -585,7 +585,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 78d230d2..2ec7904b 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -771,7 +771,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index b12f4c78..453645fd 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -1042,7 +1042,7 @@ generated by LDoc diff --git a/docs/guis/server-ups.html b/docs/guis/server-ups.html index c86bad41..5f7167be 100644 --- a/docs/guis/server-ups.html +++ b/docs/guis/server-ups.html @@ -508,7 +508,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index 94d322ac..02711460 100644 --- a/docs/index.html +++ b/docs/index.html @@ -550,7 +550,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 06abd897..7609ff89 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -310,7 +310,7 @@ generated by LDoc diff --git a/docs/modules/modules.addons.station-auto-name.html b/docs/modules/modules.addons.station-auto-name.html index 413f735b..2393a067 100644 --- a/docs/modules/modules.addons.station-auto-name.html +++ b/docs/modules/modules.addons.station-auto-name.html @@ -308,7 +308,7 @@ Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name generated by LDoc diff --git a/docs/modules/overrides.debug.html b/docs/modules/overrides.debug.html index f2e173a2..e01332f3 100644 --- a/docs/modules/overrides.debug.html +++ b/docs/modules/overrides.debug.html @@ -669,7 +669,7 @@ generated by LDoc diff --git a/docs/modules/overrides.math.html b/docs/modules/overrides.math.html index 35205dfc..d841d36a 100644 --- a/docs/modules/overrides.math.html +++ b/docs/modules/overrides.math.html @@ -368,7 +368,7 @@ generated by LDoc diff --git a/docs/modules/overrides.table.html b/docs/modules/overrides.table.html index a123cbb3..cfe9d613 100644 --- a/docs/modules/overrides.table.html +++ b/docs/modules/overrides.table.html @@ -2023,7 +2023,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index 1475565f..31375b50 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -1307,7 +1307,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 09726346..58fbb756 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -449,7 +449,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index 1cb66846..4911d741 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -666,7 +666,7 @@ generated by LDoc diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index 99f695c6..6caaa821 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -804,7 +804,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index a8da112f..dea00046 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -265,6 +265,7 @@ Please report these errors to [the issues page](issues).

    ## Releases

    | Scenario Version* | Version Name | Factorio Version** | |---|---|---| +| [v6.1][s6.1] | External Data Overhaul | [v1.0.0][f1.0.0] | | [v6.0][s6.0] | Gui / 0.18 Overhaul | [v0.18.17][f0.18.17] | | [v5.10][s5.10] | Data Store Rewrite | [v0.17.71][f0.17.71] | | [v5.9][s5.9] | Control Modules and Documentation | [v0.17.63][f0.17.63] | @@ -284,7 +285,8 @@ Please report these errors to [the issues page](issues). | [v0.1][s0.1] | First Tracked Version | [v0.14][f0.14] |

    \* Scenario patch versions have been omitted.

    \*\* Factorio versions show the version they were made for, often the minimum requirement. -

    [s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0 +

    [s6.1]: https://github.com/explosivegaming/scenario/releases/tag/6.1.0 +[s6.0]: https://github.com/explosivegaming/scenario/releases/tag/6.0.0 [s5.10]: https://github.com/explosivegaming/scenario/releases/tag/5.10.0 [s5.9]: https://github.com/explosivegaming/scenario/releases/tag/5.9.0 [s5.8]: https://github.com/explosivegaming/scenario/releases/tag/5.8.0 @@ -301,7 +303,8 @@ Please report these errors to [the issues page](issues). [s2.0]: https://github.com/explosivegaming/scenario/releases/tag/v2.0 [s1.0]: https://github.com/explosivegaming/scenario/releases/tag/v1.0 [s0.1]: https://github.com/explosivegaming/scenario/releases/tag/v0.1 -

    [f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17 +

    [f1.0.0]: https://wiki.factorio.com/Version_history/1.0.0#1.0.0 +[f0.18.17]: https://wiki.factorio.com/Version_history/0.18.0#0.18.17 [f0.17.71]: https://wiki.factorio.com/Version_history/0.17.0#0.17.71 [f0.17.63]: https://wiki.factorio.com/Version_history/0.17.0#0.17.63 [f0.17.49]: https://wiki.factorio.com/Version_history/0.17.0#0.17.49 @@ -356,7 +359,7 @@ Please report these errors to [the issues page](issues). generated by LDoc