You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
commands - buttons need to be activated to be able to use them
This commit is contained in:
+20
-5
@@ -7,7 +7,8 @@ local Global = require 'utils.global'
|
|||||||
local Gui = require 'utils.gui'
|
local Gui = require 'utils.gui'
|
||||||
|
|
||||||
local this = {
|
local this = {
|
||||||
players = {}
|
players = {},
|
||||||
|
activate_custom_buttons = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.register(
|
Global.register(
|
||||||
@@ -554,11 +555,19 @@ local function set_location(player)
|
|||||||
local scale = player.display_scale
|
local scale = player.display_scale
|
||||||
|
|
||||||
frame.location = {
|
frame.location = {
|
||||||
x = (resolution.width / 2) - ((54 + 258) * scale),
|
x = (resolution.width / 2) - ((54 + -528) * scale),
|
||||||
y = (resolution.height - (96 * scale))
|
y = (resolution.height - (96 * scale))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.activate_custom_buttons(value)
|
||||||
|
if value then
|
||||||
|
this.activate_custom_buttons = value
|
||||||
|
else
|
||||||
|
this.activate_custom_buttons = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Gui.on_click(
|
Gui.on_click(
|
||||||
clear_corpse_button_name,
|
clear_corpse_button_name,
|
||||||
function(event)
|
function(event)
|
||||||
@@ -572,7 +581,9 @@ Event.add(
|
|||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
on_player_joined_game(player)
|
on_player_joined_game(player)
|
||||||
|
|
||||||
set_location(player)
|
if this.activate_custom_buttons then
|
||||||
|
set_location(player)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -580,7 +591,9 @@ Event.add(
|
|||||||
defines.events.on_player_display_resolution_changed,
|
defines.events.on_player_display_resolution_changed,
|
||||||
function(event)
|
function(event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
set_location(player)
|
if this.activate_custom_buttons then
|
||||||
|
set_location(player)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -588,7 +601,9 @@ Event.add(
|
|||||||
defines.events.on_player_display_scale_changed,
|
defines.events.on_player_display_scale_changed,
|
||||||
function(event)
|
function(event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
set_location(player)
|
if this.activate_custom_buttons then
|
||||||
|
set_location(player)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ function Public.reset_map()
|
|||||||
Autostash.bottom_button(true)
|
Autostash.bottom_button(true)
|
||||||
BuriedEnemies.reset()
|
BuriedEnemies.reset()
|
||||||
Commands.reset()
|
Commands.reset()
|
||||||
|
Commands.activate_custom_buttons(true)
|
||||||
|
|
||||||
Poll.reset()
|
Poll.reset()
|
||||||
ICW.reset()
|
ICW.reset()
|
||||||
|
|||||||
Reference in New Issue
Block a user