1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-16 02:47:48 +02:00

Update changelog module and tiered dungeon to handle move of comfy_panel to utils.gui

This commit is contained in:
Eric Anderson 2022-04-07 21:50:05 -07:00
parent b8158f1f01
commit 938528798b
2 changed files with 11 additions and 46 deletions

View File

@ -14,9 +14,9 @@ local Get_noise = require 'utils.get_noise'
local Alert = require 'utils.alert'
local Research = require 'maps.dungeons.research'
local DungeonsTable = require 'maps.dungeons.table'
local BottomFrame = require 'comfy_panel.bottom_frame'
local BottomFrame = require 'utils.gui.bottom_frame'
local Autostash = require 'modules.autostash'
local Panel = require 'comfy_panel.config'
local Panel = require 'utils.gui.config'
Panel.get('gui_config').spaghett.noop = true
local Collapse = require 'modules.collapse'
Collapse.disable()

View File

@ -1,9 +1,7 @@
local Event = require 'utils.event'
local Tabs = require 'comfy_panel.main'
local SpamProtection = require 'utils.spam_protection'
local Gui = require 'utils.gui'
local Token = require 'utils.token'
local module_name = 'Changelog'
local module_name = Gui.uid_name()
local changelog = {
versions = {}
@ -57,51 +55,18 @@ local function create_changelog(data)
line_v.style.top_margin = 4
line_v.style.bottom_margin = 4
end
local b = frame.add {type = 'button', caption = 'CLOSE', name = 'close_changelog'}
b.style.font = 'heading-2'
b.style.padding = 2
b.style.top_margin = 3
b.style.left_margin = 333
b.style.horizontal_align = 'center'
b.style.vertical_align = 'center'
end
local create_changelog_token = Token.register(create_changelog)
local function on_gui_click(event)
if not event or not event.element or not event.element.valid then
return
Gui.on_click(
module_name,
function(event)
local player = event.player
Gui.reload_active_tab(player)
end
)
local player = game.get_player(event.player_index)
if not (player and player.valid) then
return
end
local name = event.element.name
if not name then
return
end
if name == 'tab_' .. module_name then
if SpamProtection.is_spamming(player, nil, 'Changelog Main Button') then
return
end
end
if name == 'close_changelog' then
if SpamProtection.is_spamming(player, nil, 'Changelog Close Button') then
return
end
player.gui.left.comfy_panel.destroy()
return
end
end
Tabs.add_tab_to_gui({name = module_name, id = create_changelog_token, admin = false})
Event.add(defines.events.on_gui_click, on_gui_click)
Gui.add_tab_to_gui({name = module_name, caption = 'Changelog', id = create_changelog_token, admin = false})
return Public