Added custom event on_visibility_changed_by_click

Fixed warp flow issue because of this
This commit is contained in:
badgamernl
2020-02-24 23:43:41 +01:00
parent 0db5565024
commit 1273de4e86
3 changed files with 59 additions and 6 deletions

View File

@@ -439,9 +439,10 @@ 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_click(function(player,_,_)
local visible_state = Gui.toggle_left_element(player, warp_list_container)
keep_gui_open[player.name] = visible_state
:on_custom_event(Gui.events.on_visibility_changed_by_click, function(player,_,event)
local state = event.state -- true if visible, false if invisible
-- Set gui keep open state for player that clicked the button
keep_gui_open[player.name] = state
end)
--- When the name of a warp is updated this is triggered