From 2d90d1dcdd3071c7820a0083f006e4f5b5e61dde Mon Sep 17 00:00:00 2001 From: badgamernl Date: Wed, 26 Feb 2020 00:49:57 +0100 Subject: [PATCH] Rerenamed events --- expcore/gui/left_flow.lua | 4 ++-- expcore/gui/prototype.lua | 7 +++---- modules/gui/warp-list.lua | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/expcore/gui/left_flow.lua b/expcore/gui/left_flow.lua index 255823c5..74003f15 100644 --- a/expcore/gui/left_flow.lua +++ b/expcore/gui/left_flow.lua @@ -72,7 +72,7 @@ function Gui.left_toolbar_button(sprite,tooltip,element_define,authenticator) -- Raise custom event that tells listening elements if the element has changed visibility by a player clicking -- Used in warp gui to handle the keep open logic button:raise_custom_event{ - name = Gui.custom_events.on_visibility_changed_by_click, + name = Gui.events.on_visibility_changed_by_click, element = element, state = visibility_state } @@ -168,7 +168,7 @@ function Gui.hide_left_flow(player) local button_define = Gui.defines[element_define.toolbar_button] -- Raise the custom event if all of the top checks have passed button_define:raise_custom_event{ - name = Gui.custom_events.on_visibility_changed_by_click, + name = Gui.events.on_visibility_changed_by_click, element = button, state = false } diff --git a/expcore/gui/prototype.lua b/expcore/gui/prototype.lua index 6e7e6c5f..b307da02 100644 --- a/expcore/gui/prototype.lua +++ b/expcore/gui/prototype.lua @@ -352,10 +352,9 @@ Gui._prototype_element.on_value_changed = event_handler_factory(defines.events.o --- Custom element events. -- @section customEvents -Gui.custom_event = { - -- Triggered when a user changed the visibility of a left flow element by clicking a button - on_visibility_changed_by_click = 'on_visibility_changed_by_click' -} + +-- Triggered when a user changed the visibility of a left flow element by clicking a button +Gui.events.on_visibility_changed_by_click = 'on_visibility_changed_by_click' -- Module return return Gui \ No newline at end of file diff --git a/modules/gui/warp-list.lua b/modules/gui/warp-list.lua index b6954687..595a3ba2 100644 --- a/modules/gui/warp-list.lua +++ b/modules/gui/warp-list.lua @@ -439,7 +439,7 @@ end) Gui.left_toolbar_button('item/'..config.default_icon,{'warp-list.main-tooltip',config.standard_proximity_radius},warp_list_container, function(player) return Roles.player_allowed(player,'gui/warp-list') end) -:on_custom_event(Gui.custom_events.on_visibility_changed_by_click, function(player,_,event) +:on_custom_event(Gui.events.on_visibility_changed_by_click, function(player,_,event) -- Set gui keep open state for player that clicked the button: true if visible, false if invisible keep_gui_open[player.name] = event.state end)