@@ -128,4 +128,17 @@ require 'expcore.gui.left_flow'
|
|||||||
require 'expcore.gui.helper_functions'
|
require 'expcore.gui.helper_functions'
|
||||||
require 'expcore.gui.defines'
|
require 'expcore.gui.defines'
|
||||||
|
|
||||||
|
local Roles = _C.opt_require('expcore.roles')
|
||||||
|
local Event = _C.opt_require('utils.event')
|
||||||
|
|
||||||
|
if Roles and Event then
|
||||||
|
Event.add(Roles.events.on_role_assigned, function(e)
|
||||||
|
Gui.update_top_flow(game.get_player(e.player_index))
|
||||||
|
end)
|
||||||
|
Event.add(Roles.events.on_role_unassigned, function(e)
|
||||||
|
Gui.update_top_flow(game.get_player(e.player_index))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return Gui
|
return Gui
|
||||||
@@ -73,7 +73,8 @@ function Gui.update_top_flow(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set the visible state
|
-- Set the visible state
|
||||||
local allowed = type(authenticator) == 'function' and authenticator(player) or authenticator
|
local allowed = authenticator
|
||||||
|
if type(allowed) == 'function' then allowed = allowed(player) end
|
||||||
element.visible = is_visible and allowed or false
|
element.visible = is_visible and allowed or false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user