Hooks hooksclient
Part of Active UI
Hooks called by Active UI
Summary
Hooks
LazyTick, after the callback of the bar has refreshed its value.fl_text_entry themselves.Flux.Bars:register.on_close method of its open panel has been called.OnMenuPanelOpen has run for that one already).on_loaded methods have run and its Derma skin has been applied.Theme.reload has loaded the active theme again and called its OnReloaded theme hook.on_unloaded method has run and before it stops being the active theme.PostDrawBar theme hook.ShouldDrawBar, right before the bar is sorted into the prioritized list of top bars.PreDrawBar theme hook and before ShouldDrawBar is asked.avatar_panel, name_label and ping fields of the card), so that plugins can add to the card or rearrange it.Theme.create_panel.Theme.reload, which happens when the code is refreshed.Theme.unload_theme.Hooks
Called on the client every time the tab menu is opened, to collect its items.
Handlers register their buttons and panels with the menu's add_menu_item.
Parameters
- menu Panel The
fl_tab_menubeing built
Called from
Call sites
Called on the client for every registered bar each LazyTick, after the callback
of the bar has refreshed its value. Handlers can change the settings of the bar in
place.
Parameters
- id String bar ID
- bar Map bar data
Called from
Call sites
Lets plugins offset a top bar while the bars are being stacked. Called on the
client for every BAR_TOP bar each time the bars are repositioned, which happens
every LazyTick. The vertical offset is added to the bar's place in the stack, the
horizontal offset to the x position of the bar; the offset of the previous call is
taken back first, so it does not add up from call to call.
Parameters
- bar Map bar data
Returns
- Number horizontal offset in pixels
- Number vertical offset in pixels; each is 0 when nothing is returned
Called from
Call sites
Lets plugins move the buttons of the tab menu's button bar. Called on the client while the tab menu is being built, before its buttons are created.
Parameters
- menu Panel The
fl_tab_menubeing built
Returns
- Number X position of the first button in the bar; 0 when nothing is returned
- Number Y position of the buttons; 0 when nothing is returned
Called from
Call sites
Lets plugins draw an fl_text_entry themselves.
Called on the client every time such an entry is painted: for the entry of the chatbox as
well as for every other one.
Parameters
- panel Panel The text entry being painted
- x Number Left edge of the area to draw in, always 0
- y Number Top edge of the area to draw in, always 0
- w Number Width of the entry
- h Number Height of the entry
Returns
- Boolean Return true to skip the default background and text
Called from
Call sites
Called on the client every time the fonts are created again: when the gamemode loads,
once the schema has loaded and after a change of the screen resolution. The built-in fonts
exist at this point and the CreateFonts theme hook of the active theme has run. Create
your own fonts here with Font.create.
Called from
Call sites
CreateScoreboardPlayerMenu(menu, target, self)
client packages/active_ui/views/cl_scoreboard.lua:187Called on the client when a player card of the scoreboard is clicked, to fill the menu
of things to do with that player. The menu opens at the cursor if a handler has added
anything to it and is removed otherwise. The gamemode's handler, which runs last,
adds the options to open the Steam profile of the player and to copy their SteamID.
An option that does something on the server still has to be checked there: sending a
command with Flux.Command:send takes care of that.
function MyPlugin:CreateScoreboardPlayerMenu(menu, target, card)
if target != PLAYER and PLAYER:can('poke') then
menu:AddOption(t'ui.my_plugin.poke', function()
Flux.Command:send('poke "'..target:name()..'"')
end):SetIcon('icon16/user_comment.png')
end
end
Parameters
- menu Panel The
DermaMenuto add options to - target Player The player the card shows
- card Panel The
fl_scoreboard_playercard that was clicked
Returns
- Any Return nothing, so that the other handlers can add their options as well
Called from
Call sites
Called on the client after a HUD bar has been registered or overwritten with
Flux.Bars:register. Not called when a bar with this ID already exists and is kept.
Parameters
- bar Map the stored bar, with the defaults filled in
- id String bar ID
- force Boolean true if an existing bar with this ID was allowed to be overwritten, which is always the case in development mode
Called from
Call sites
Called on the client when the intro panel has been created and has started its animation.
Parameters
- panel Panel The
fl_intropanel
Called from
Call sites
Called on the client when the intro panel starts closing, one second before the panel itself is removed. The Characters plugin opens the main menu from it.
Called from
Call sites
Called on the client when a panel of the tab menu is opened, after the panel has been created, sized and rebuilt. The gamemode centers the panel in the menu.
Parameters
- menu_panel Panel The
fl_tab_menu - active_panel Panel The panel that has been opened
Call sites
Called on the client when the tab menu starts to close, whether the player closed it or
code did, after the on_close method of its open panel has been called. The menu is
still valid at that point: it is removed once its closing animation has finished.
Parameters
- menu Panel The tab menu that is closing
Called from
Call sites
Called on the client when the tab menu has been opened, with the scoreboard key or
from code, after its buttons have been created and the item it starts on has been
shown (OnMenuPanelOpen has run for that one already).
Parameters
- menu Panel The tab menu that has been opened
Called from
Call sites
Called on the client after a theme has become the active one: its on_loaded methods
have run and its Derma skin has been applied. It is called again every time the theme is
reloaded. Plugins use it to add their own colors, fonts, options and panels to the
theme.
Parameters
- current_theme ThemeBase the theme that has been loaded
Called from
Call sites
Called on the client after Theme.reload has loaded the active theme again and called
its OnReloaded theme hook.
Parameters
- current_theme ThemeBase the active theme
Called from
Call sites
Called on the client while the active theme is being unloaded, after its on_unloaded
method has run and before it stops being the active theme.
Parameters
- current_theme ThemeBase the theme that is being unloaded
Called from
Call sites
Asks whether a player is listed on the scoreboard. Called on the client for every initialized player each time the scoreboard is rebuilt, also when the Factions plugin groups the players by faction. A player who is kept off the scoreboard is not counted in its line of players online either.
Parameters
- target Player The player about to be listed
Returns
- Boolean Return false to keep the player off the scoreboard. Return nothing otherwise, so that the other handlers are asked as well
Called from
Call sites
Called on the client after a bar has been drawn, before the PostDrawBar theme hook.
Not called for bars that ShouldDrawBar has hidden.
Parameters
- bar_info Map bar data
Called from
Call sites
Called on the client for every bar that passes ShouldDrawBar, right before the bar is
sorted into the prioritized list of top bars. This happens every LazyTick and is the
place to change the priority of a bar.
Parameters
- bar Map bar data
Called from
Call sites
Called on the client when a bar is about to be drawn, before the PreDrawBar theme
hook and before ShouldDrawBar is asked. Flux's own handler works out the fill width of
the bar here (advancing its value animation) and converts its texts to upper case.
Parameters
- bar_info Map bar data
Called from
Call sites
Called on the client every time the info display is about to be drawn.
Parameters
- icons Map all of the registered icons by ID
Returns
- Any Return any non-nil value to prevent the info display from being drawn
Called from
Call sites
Called on the client before an icon of the info display is drawn, before the callback of the icon runs.
Parameters
- info Map icon data, as stored by
InfoDisplay:add
Returns
- Any Return any non-nil value to skip this icon
Called from
Call sites
Called on the client before the scoreboard builds its list of players. A handler can build the contents itself, for example to group the players.
Parameters
- panel Panel The
fl_scoreboardbeing rebuilt - w Number Width of the scoreboard
- h Number Height of the scoreboard
Returns
- Any Return anything but nil to skip the default player list and the
RebuildScoreboardhook
Called from
Call sites
Called on the client after the scoreboard has created the default player cards.
Not called when a PreRebuildScoreboard handler has built the list instead.
Parameters
- panel Panel The
fl_scoreboardthat has been rebuilt - w Number Width of the scoreboard
- h Number Height of the scoreboard
Called from
Call sites
Called on the client after a scoreboard player card has created its avatar, name and ping
labels (the avatar_panel, name_label and ping fields of the card), so that plugins
can add to the card or rearrange it.
Parameters
- card Panel The
fl_scoreboard_playercard - target Player The player the card shows
Called from
Call sites
Asks whether a HUD bar should be drawn. Called on the client by Flux.Bars:draw every
time a bar is drawn, and by Flux.Bars:prioritize for every registered bar when the top
bars are sorted. The bar is drawn unless a handler returns false. Flux's own handler
returns false while the value of the bar is above its display setting or not above
its min_display setting, and nothing otherwise, which leaves the decision to the
handlers that run after it.
Parameters
- bar_info Map bar data
Returns
- Boolean Return false to hide the bar
Called from
Call sites
Asks whether the fill of a bar should be drawn. Called on the client every time a bar is drawn, after its background. The fill is always drawn when the value of the bar is not 0.
Parameters
- bar_info Map bar data
Returns
- Boolean Return true to draw the fill even though the value of the bar is 0
Called from
Call sites
Asks whether the tab menu may close. Called on the client when the scoreboard key is released.
Returns
- Boolean Return false to keep the tab menu open
Called from
Call sites
Asks whether the tab menu may open. Called on the client when the scoreboard key is
pressed and when the menu is opened from code with Flux.TabMenu:open.
Returns
- Boolean Return false to keep the tab menu from opening
Called from
Call sites
Called on the client before the active theme creates a panel for Theme.create_panel.
Parameters
- panel_id String ID the panel was added to the theme with
- current_theme ThemeBase the active theme
Returns
- Boolean Return false to prevent the panel from being created
Called from
Call sites
Called on the client before a theme becomes the active one, which includes every reload of the active theme.
Parameters
- theme_table ThemeBase the theme that is about to be loaded
Returns
- Boolean Return false to prevent the theme from being loaded
Called from
Call sites
Called on the client before the active theme is reloaded with Theme.reload, which
happens when the code is refreshed. Not called for a theme that has should_reload set to
false.
Parameters
- current_theme ThemeBase the active theme
Returns
- Boolean Return false to prevent the theme from being reloaded
Called from
Call sites
Called on the client before the active theme is unloaded with Theme.unload_theme.
Parameters
- current_theme ThemeBase the active theme
Returns
- Boolean Return false to keep the theme loaded
Called from
Call sites
Defined in
- packages/active_ui/views/cl_tabmenu.lua
- packages/active_ui/lib/cl_bars.lua
- packages/active_ui/views/base/cl_textentry.lua
- packages/active_ui/lib/cl_font.lua
- packages/active_ui/views/cl_scoreboard.lua
- packages/active_ui/views/cl_intro.lua
- packages/active_ui/lib/sh_tab_menu.lua
- packages/active_ui/lib/cl_theme.lua
- packages/active_ui/hooks/cl_hooks.lua
- packages/active_ui/lib/cl_info_display.lua