1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00

Merge pull request #312 from ComfyFactory/towny

Towny - disable show_inventory and where command.
This commit is contained in:
Gerkiz 2022-09-26 19:50:02 +02:00 committed by GitHub
commit 0bb8d99d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View File

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

View File

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

View File

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