1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-10-30 23:47:41 +02:00

Fix gui config when clicking poll and remove unused functions

This commit is contained in:
Gerkiz
2021-05-08 02:03:38 +02:00
parent a2463bbbfd
commit 1644b024cf
5 changed files with 28 additions and 13 deletions

View File

@@ -11,6 +11,8 @@ local Global = require 'utils.global'
local module_name = 'Config'
local Public = {}
local this = {
gui_config = {
spaghett = {},
@@ -666,3 +668,24 @@ Event.add(defines.events.on_gui_switch_state_changed, on_gui_switch_state_change
Event.add(defines.events.on_force_created, on_force_created)
Event.add(defines.events.on_built_entity, on_built_entity)
Event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
function Public.get(key)
if key then
return this[key]
else
return this
end
end
function Public.set(key, value)
if key and (value or value == false) then
this[key] = value
return this[key]
elseif key then
return this[key]
else
return this
end
end
return Public

View File

@@ -5,6 +5,7 @@ local Game = require 'utils.game'
local Server = require 'utils.server'
local Tabs = require 'comfy_panel.main'
local session = require 'utils.datastore.session_data'
local Config = require 'comfy_panel.config'
local Class = {}
@@ -345,7 +346,9 @@ local function draw_main_frame(left, player)
local right_flow = bottom_flow.add {type = 'flow'}
right_flow.style.horizontal_align = 'right'
if (trusted[player.name] or player.admin) or global.comfy_panel_config.poll_trusted == false then
local comfy_panel_config = Config.get('gui_config')
if (trusted[player.name] or player.admin) or comfy_panel_config.poll_trusted == false then
local create_poll_button = right_flow.add {type = 'button', name = create_poll_button_name, caption = 'Create Poll'}
apply_button_style(create_poll_button)
else

View File

@@ -260,7 +260,6 @@ function Public.reset_map()
game.forces.player.set_spawn_position({-27, 25}, surface)
Task.start_queue()
Task.set_queue_speed(16)
-- HS.get_scores()

View File

@@ -3,7 +3,7 @@ local Queue = {}
function Queue.new()
local queue = {
_head = 1,
_tail = 0
_tail = 1
}
return queue
end

View File

@@ -151,16 +151,6 @@ function Task.set_queue_speed(value)
primitives.task_queue_speed = value
end
function Task.start_queue()
if task_queue._tail == 0 then
task_queue._tail = 1
end
end
function Task.get_task_queue()
return task_queue
end
Event.add(defines.events.on_tick, on_tick)
return Task