From cc64613f418e721e7a8e85ff398e5a0c2c5a5149 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 18 Apr 2019 23:29:21 +0100 Subject: [PATCH] Bug Fix Round One --- config/file_loader.lua | 7 +++++++ expcore/commands.lua | 2 +- modules/addons/compilatron.lua | 10 +++++----- modules/addons/random-player-colours.lua | 2 +- modules/commands/clear-inventory.lua | 2 +- modules/commands/spawn.lua | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/config/file_loader.lua b/config/file_loader.lua index 7a85b3cc..790aa6c6 100644 --- a/config/file_loader.lua +++ b/config/file_loader.lua @@ -16,6 +16,12 @@ return { 'modules.commands.help', 'modules.commands.roles', 'modules.commands.rainbow', + 'modules.commands.clear-inventory', + 'modules.commands.jail', + 'modules.commands.repair', + 'modules.commands.reports', + 'modules.commands.spawn', + 'modules.commands.warnings', -- QoL Addons 'modules.addons.chat-popups', 'modules.addons.damage-popups', @@ -25,6 +31,7 @@ return { 'modules.addons.compilatron', 'modules.addons.scorched-earth', 'modules.addons.pollution-grading', + 'modules.addons.random-player-colours', -- Config Files 'config.command_auth_admin', -- commands tagged with admin_only are blocked for non admins 'config.command_auth_roles', -- commands must be allowed via the role config diff --git a/expcore/commands.lua b/expcore/commands.lua index 9a8ef7f9..27257c9a 100644 --- a/expcore/commands.lua +++ b/expcore/commands.lua @@ -201,7 +201,7 @@ Commands.remove_parse(name) --- Removes a parse function, see add_parse for adding them Commands.parse(name,input,player,reject,...) --- Intended to be used within other parse functions, runs a parse and returns success and new value - Commands.add_command(name,help) --- Creates a new command object to added details to, note this does not register the command to the game + Commands.new_command(name,help) --- Creates a new command object to added details to, note this does not register the command to the game Commands._prototype:add_param(name,optional,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) --- Adds default values to params only matters if the param is optional Commands._prototype:set_flag(name,value) --- Adds a tag to the command which is passed via the flags param to the authenticators, can be used to assign command roles or type diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index 29fc2bfe..ef81281d 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -31,17 +31,17 @@ local callback = ent.surface.create_entity( {name = 'compi-speech-bubble', text = messages[name][msg_number], position = {0, 0}, source = ent} ) - Public.global.current_messages[name] = {message = message, msg_number = msg_number} + Public.current_messages[name] = {message = message, msg_number = msg_number} end ) --- This will move the messages onto the next message in the loop local function circle_messages() - for name, ent in pairs(Public.global.compilatrons) do + for name, ent in pairs(Public.compilatrons) do if not ent.valid then Public.spawn_compilatron(game.players[1].surface,name) end - local current_message = Public.global.current_messages[name] + local current_message = Public.current_messages[name] local msg_number local message if current_message ~= nil then @@ -71,12 +71,12 @@ function Public.add_compilatron(entity, name) if name == nil then return end - Public.global.compilatrons[name] = entity + Public.compilatrons[name] = entity local message = entity.surface.create_entity( {name = 'compi-speech-bubble', text = messages[name][1], position = {0, 0}, source = entity} ) - Public.global.current_messages[name] = {message = message, msg_number = 1} + Public.current_messages[name] = {message = message, msg_number = 1} end --- This spawns a new compilatron on a surface with the given location tag (not a position) diff --git a/modules/addons/random-player-colours.lua b/modules/addons/random-player-colours.lua index df5b190b..3a6fc2c1 100644 --- a/modules/addons/random-player-colours.lua +++ b/modules/addons/random-player-colours.lua @@ -1,4 +1,4 @@ -local Colours = require 'resources.colour_presets' +local Colours = require 'resources.color_presets' local Game = require 'utils.game' local Event = require 'utils.events' local config = require 'config.preset_player_colours' diff --git a/modules/commands/clear-inventory.lua b/modules/commands/clear-inventory.lua index 28fd9d35..0b8a8d26 100644 --- a/modules/commands/clear-inventory.lua +++ b/modules/commands/clear-inventory.lua @@ -1,4 +1,4 @@ -local Commands = 'expcore.commands' +local Commands = require 'expcore.commands' local move_items = ext_require('expcore.common','move_items') require 'config.command_parse_roles' diff --git a/modules/commands/spawn.lua b/modules/commands/spawn.lua index 0b923222..027c85f3 100644 --- a/modules/commands/spawn.lua +++ b/modules/commands/spawn.lua @@ -13,7 +13,7 @@ end Commands.new_command('go-to-spawn','Teleport to spawn') :add_param('player',true,'player-role-alive') -:add_defaults{ +:set_defaults{ player=function(player) if player.connected and player.character and player.character.health > 0 then return player