Hooks called by Active UI

Summary

Hooks

Called on the client every time the tab menu is opened, to collect its items.
Called on the client for every registered bar each LazyTick, after the callback of the bar has refreshed its value.
Lets plugins offset a top bar while the bars are being stacked.
Lets plugins move the buttons of the tab menu's button bar.
Lets plugins draw an fl_text_entry themselves.
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.
Called on the client when a player card of the scoreboard is clicked, to fill the menu of things to do with that player.
Called on the client after a HUD bar has been registered or overwritten with Flux.Bars:register.
Called on the client when the intro panel has been created and has started its animation.
Called on the client when the intro panel starts closing, one second before the panel itself is removed.
Called on the client when a panel of the tab menu is opened, after the panel has been created, sized and rebuilt.
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.
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).
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.
Called on the client after Theme.reload has loaded the active theme again and called its OnReloaded theme hook.
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.
Asks whether a player is listed on the scoreboard.
Called on the client after a bar has been drawn, before the PostDrawBar theme hook.
Called on the client for every bar that passes ShouldDrawBar, right before the bar is sorted into the prioritized list of top bars.
Called on the client when a bar is about to be drawn, before the PreDrawBar theme hook and before ShouldDrawBar is asked.
Called on the client every time the info display is about to be drawn.
Called on the client before an icon of the info display is drawn, before the callback of the icon runs.
Called on the client before the scoreboard builds its list of players.
Called on the client after the scoreboard has created the default player cards.
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.
Asks whether a HUD bar should be drawn.
Asks whether the fill of a bar should be drawn.
Asks whether the tab menu may close.
Asks whether the tab menu may open.
Called on the client before the active theme creates a panel for Theme.create_panel.
Called on the client before a theme becomes the active one, which includes every reload of the active theme.
Called on the client before the active theme is reloaded with Theme.reload, which happens when the code is refreshed.
Called on the client before the active theme is unloaded with Theme.unload_theme.

Hooks

AddTabMenuItems(self)

client packages/active_ui/views/cl_tabmenu.lua:84

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

Called from

Call sites

AdjustBarInfo(id, bar)

client packages/active_ui/lib/cl_bars.lua:335

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

AdjustBarPos(bar)

client packages/active_ui/lib/cl_bars.lua:226

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

AdjustMenuItemPositions(self)

client packages/active_ui/views/cl_tabmenu.lua:39

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

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

ChatboxEntryPaint(self, 0, 0, w, h)

client packages/active_ui/views/base/cl_textentry.lua:34

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:187

Called 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 DermaMenu to add options to
  • target Player The player the card shows
  • card Panel The fl_scoreboard_player card that was clicked

Returns

  • Any Return nothing, so that the other handlers can add their options as well

Called from

Call sites

OnBarRegistered(stored[id], id, force)

client packages/active_ui/lib/cl_bars.lua:111

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

OnIntroPanelCreated(self)

client packages/active_ui/views/cl_intro.lua:46

Called on the client when the intro panel has been created and has started its animation.

Parameters

Called from

Call sites

OnIntroPanelRemoved()

client packages/active_ui/views/cl_intro.lua:118

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

OnMenuPanelOpen(self, self.active_panel)

client packages/active_ui/views/cl_tabmenu.lua:145

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

OnTabMenuClosed(self)

client packages/active_ui/views/cl_tabmenu.lua:297

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

OnTabMenuOpened(menu)

client packages/active_ui/lib/sh_tab_menu.lua:79

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

OnThemeLoaded(current_theme)

client packages/active_ui/lib/cl_theme.lua:297

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

OnThemeReloaded(current_theme)

client packages/active_ui/lib/cl_theme.lua:352

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

OnThemeUnloaded(current_theme)

client packages/active_ui/lib/cl_theme.lua:324

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

PlayerShouldShowOnScoreboard(client)

client packages/active_ui/views/cl_scoreboard.lua:50

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

PostDrawBar(bar_info)

client packages/active_ui/lib/cl_bars.lua:285

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

PreBarPrioritized(bar)

client packages/active_ui/lib/cl_bars.lua:183

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

PreDrawBar(bar_info)

client packages/active_ui/lib/cl_bars.lua:250

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

PreDrawInfoDisplay(stored)

client packages/active_ui/lib/cl_info_display.lua:146

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

PreDrawInfoDisplayItem(info)

client packages/active_ui/lib/cl_info_display.lua:92

Called on the client before an icon of the info display is drawn, before the callback of the icon runs.

Parameters

Returns

  • Any Return any non-nil value to skip this icon

Called from

Call sites

PreRebuildScoreboard(self, w, h)

client packages/active_ui/views/cl_scoreboard.lua:90

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_scoreboard being 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 RebuildScoreboard hook

Called from

Call sites

RebuildScoreboard(self, w, h)

client packages/active_ui/views/cl_scoreboard.lua:127

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_scoreboard that has been rebuilt
  • w Number Width of the scoreboard
  • h Number Height of the scoreboard

Called from

Call sites

RebuildScoreboardPlayerCard(self, target)

client packages/active_ui/views/cl_scoreboard.lua:266

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

Called from

Call sites

ShouldDrawBar(bar)

client packages/active_ui/lib/cl_bars.lua:261

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

ShouldFillBar(bar_info)

client packages/active_ui/lib/cl_bars.lua:272

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

ShouldScoreboardHide()

client packages/active_ui/hooks/cl_hooks.lua:47

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

ShouldScoreboardShow()

client packages/active_ui/lib/sh_tab_menu.lua:61

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

ShouldThemeCreatePanel(panel_id, current_theme)

client packages/active_ui/lib/cl_theme.lua:80

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

ShouldThemeLoad(theme_table)

client packages/active_ui/lib/cl_theme.lua:270

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

ShouldThemeReload(current_theme)

client packages/active_ui/lib/cl_theme.lua:342

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

ShouldThemeUnload(current_theme)

client packages/active_ui/lib/cl_theme.lua:313

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