diff --git a/maps/scrap_towny_ffa/main.lua b/maps/scrap_towny_ffa/main.lua index fcbb2189..ee87fb83 100644 --- a/maps/scrap_towny_ffa/main.lua +++ b/maps/scrap_towny_ffa/main.lua @@ -34,6 +34,8 @@ local Evolution = require 'modules.scrap_towny_ffa.evolution' local mod_gui = require('mod-gui') local Gui = require 'utils.gui' local Color = require 'utils.color_presets' +local Where = require 'utils.commands.where' +local Inventory = require 'modules.show_inventory' -- for testing purposes only!!! local testing_mode = false @@ -295,6 +297,8 @@ local function on_init() Autostash.bottom_button(true) BottomFrame.reset() BottomFrame.activate_custom_buttons(true) + Where.module_disabled(true) + Inventory.module_disabled(true) --log("on_init") game.enemy_has_vision_on_land_mines = false diff --git a/modules/show_inventory.lua b/modules/show_inventory.lua index 6d5deb16..0956f776 100644 --- a/modules/show_inventory.lua +++ b/modules/show_inventory.lua @@ -4,7 +4,8 @@ local SpamProtection = require 'utils.spam_protection' local Event = require 'utils.event' local this = { - data = {} + data = {}, + module_disabled = false } local Public = {} @@ -464,6 +465,10 @@ commands.add_command( function(cmd) local player = game.player + if this.module_disabled then + return + end + if validate_player(player) then if not cmd.parameter then return @@ -506,6 +511,12 @@ function Public.get(key) end end +--- Disables the module. +---@param state boolean +function Public.module_disabled(state) + this.module_disabled = state or false +end + Event.add(defines.events.on_player_main_inventory_changed, update_gui) Event.add(defines.events.on_gui_closed, gui_closed) Event.add(defines.events.on_gui_click, on_gui_click) diff --git a/utils/commands/where.lua b/utils/commands/where.lua index 3bff328f..219b395c 100644 --- a/utils/commands/where.lua +++ b/utils/commands/where.lua @@ -7,7 +7,8 @@ local Gui = require 'utils.gui' local SpamProtection = require 'utils.spam_protection' local this = { - players = {} + players = {}, + module_disabled = false } Global.register( @@ -128,6 +129,10 @@ commands.add_command( return end + if this.module_disabled then + return + end + local target = game.get_player(cmd.parameter) if validate_player(target) then @@ -191,6 +196,12 @@ Gui.on_click( end ) +--- Disables the module. +---@param state boolean +function Public.module_disabled(state) + this.module_disabled = state or false +end + Public.create_mini_camera_gui = create_mini_camera_gui Public.remove_camera_frame = remove_camera_frame