mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Feature: Toolbar Menu (#268)
* Fix left flow not using uids * Mock Toolbar menu * Fix task list after core gui change * Allow show/hide override * Fix autofill permissions * Copy style from toolbar on change * Open and close automatically * Removed hacky prevent default * Fixed more core issues * Add reset button * Allow for custom draw order on join * Add methods to reorder ui flows * Impliment move buttons * Add locale * Add toolbar to player data * Better player data layout * Picked a suitable datastore id * Update locale for readme * Fix swaping left flow order * Fix datastore updates * Code cleanup * Fix incorrect top flow hashing on load * Fix loading of malformed data * Fixed loading state of left flows * Dont save default data * Dont open menu on join * Lint * Remove incorrect new index metamethod * Revert method used for move_toolbar_button * Fixed missing toolbar button * Fixed desync between visibilty and toggle state * Fix bad gui element path * Fixed enable state of toggle button * Change order of operations * Fix reset not showing top flow
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
local Game = require 'utils.game' -- @dep utils.game
|
||||
local Gui = require 'expcore.gui' -- @dep expcore.gui
|
||||
local Roles = require 'expcore.roles' -- @dep expcore.gui
|
||||
local Global = require 'utils.global' -- @dep utils.global
|
||||
local config = require 'config.gui.autofill' -- @dep config.gui.autofill
|
||||
local Event = require 'utils.event' -- @dep utils.event
|
||||
@@ -54,13 +55,14 @@ end)
|
||||
--- Toggle enitity button, used for toggling autofill for the specific entity
|
||||
-- All entity autofill settings will be ignored if its disabled
|
||||
-- @element entity_toggle
|
||||
local entity_toggle = Gui.element(function(definition, parent, entity_name)
|
||||
return definition:triggers_events(parent.add{
|
||||
local entity_toggle =
|
||||
Gui.element(function(_, parent, entity_name)
|
||||
return parent.add{
|
||||
type = 'sprite-button',
|
||||
sprite = 'utility/confirm_slot',
|
||||
tooltip = {'autofill.toggle-entity-tooltip', rich_img('item', entity_name)},
|
||||
style = 'shortcut_bar_button_green'
|
||||
})
|
||||
}
|
||||
end)
|
||||
:style(Gui.sprite_style(22))
|
||||
:on_click(function(player, element, _)
|
||||
@@ -112,11 +114,11 @@ Gui.element(function(definition, parent, section_name, table_size)
|
||||
|
||||
section_table.visible = false
|
||||
|
||||
return section_table
|
||||
return definition:no_events(section_table)
|
||||
end)
|
||||
:on_click(function(_, element, event)
|
||||
event.element = element.parent.alignment[toggle_section.name]
|
||||
toggle_section:raise_custom_event(event)
|
||||
toggle_section:raise_event(event)
|
||||
end)
|
||||
|
||||
--- Toggle item button, used for toggling autofill for the specific item
|
||||
@@ -294,7 +296,9 @@ end)
|
||||
|
||||
--- Button on the top flow used to toggle autofill container
|
||||
-- @element autofill_toggle
|
||||
Gui.left_toolbar_button(config.icon, {'autofill.main-tooltip'}, autofill_container)
|
||||
Gui.left_toolbar_button(config.icon, {'autofill.main-tooltip'}, autofill_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/autofill')
|
||||
end)
|
||||
|
||||
--- When a player is created make sure they have the default autofill settings
|
||||
Event.add(defines.events.on_player_created, function(event)
|
||||
|
||||
Reference in New Issue
Block a user