UI¶
This page documents hooks in the ui category.
AddBarField(sectionName, fieldName, labelText, minFunc, maxFunc, valueFunc, icon)View Source
Purpose
Adds a progress-bar field definition to an existing F1 character information section when that field name has not already been registered.
Category
UI
Realm
Client
Parameters
string sectionName The section identifier or localized display name that should receive the bar field.
string fieldName The unique field key stored on the section definition.
string labelText The label shown beside the progress bar.
function|number minFunc optional A callback or numeric value that supplies the bar minimum.
function|number maxFunc optional A callback or numeric value that supplies the bar maximum.
function|number valueFunc optional A callback or numeric value that supplies the current bar value.
string|IMaterial icon optional Optional material path or material displayed beside the bar. No icon is drawn when omitted.
Example Usage
hook.Add("AddBarField", "liaExampleAddBarField", function(sectionName, fieldName, labelText, minFunc, maxFunc, valueFunc, icon)
if sectionName == L("attributesModuleName") and fieldName == "stm" then
print(labelText, minFunc(), maxFunc(), valueFunc())
end
end)
AddSection(sectionName, color, priority, location)View Source
Purpose
Registers or updates a character information section in the F1 menu before fields are inserted into it.
Category
UI
Realm
Client
Parameters
string sectionName The section identifier or localized display name used as the section key.
Color color optional The color stored with the section data.
number priority optional The sort priority used when the F1 menu orders sections.
number location optional The stored location value for the section entry.
Example Usage
hook.Add("AddSection", "liaExampleAddSection", function(sectionName, color, priority, location)
if sectionName == "Example" then
print(sectionName, priority, location)
end
end)
AddTextField(sectionName, fieldName, labelText, valueFunc, icon)View Source
Purpose
Adds a text field definition to an existing F1 character information section when that field name has not already been registered.
Category
UI
Realm
Client
Parameters
string sectionName The section identifier or localized display name that should receive the field.
string fieldName The unique field key stored on the section definition.
string labelText The label shown beside the text entry.
function valueFunc A callback that returns the current string value for the field.
string|IMaterial icon optional Optional material path or material displayed beside the field. No icon is drawn when omitted.
Example Usage
hook.Add("AddTextField", "liaExampleAddTextField", function(sectionName, fieldName, labelText, valueFunc, icon)
if sectionName == L("generalInfo") and fieldName == "name" then
print(labelText, valueFunc())
end
end)
CanDisplayCharInfo(name)View Source
Purpose
Allows the F1 character information panel to veto specific character information fields before they are shown.
Category
UI
Realm
Client
Parameters
string name The field identifier being considered for display.
Returns
boolean|nil Return false to hide the named field. Return nil or true to leave the field available.
Example Usage
hook.Add("CanDisplayCharInfo", "liaExampleCanDisplayCharInfo", function(name)
if name == "class" then return false end
end)
CreateInformationButtons(pages)View Source
Purpose
Allows modules to register information-tab pages for the F1 menu before they are filtered, sorted, and rendered.
Category
UI
Realm
Client
Parameters
table pages The mutable array of page definitions consumed by the information tab builder.
Example Usage
hook.Add("CreateInformationButtons", "liaExampleCreateInformationButtons", function(pages)
pages[#pages + 1] = {
name = "exampleInfo",
drawFunc = function(parent)
parent:Clear()
end
}
end)
DrawLiliaModelView(client, entity)View Source
Purpose
Runs during the custom model panel draw pass so plugins or modules can render extra clientside attachments.
Category
UI
Realm
Client
Parameters
Panel client The model panel requesting the draw pass.
Entity entity The clientside model entity being rendered.
Example Usage
hook.Add("DrawLiliaModelView", "liaExampleDrawLiliaModelView", function(client, entity)
if IsValid(entity.weapon) then
entity.weapon:SetNoDraw(false)
end
end)
LoadCharInformation()View Source
Purpose
Runs while the F1 character information panel is being initialized so modules can register sections and fields before the UI is generated.
Category
UI
Realm
Client
Example Usage
hook.Add("LoadCharInformation", "liaExampleLoadCharInformation", function()
hook.Run("AddSection", "Example", Color(255, 255, 255), 10, 1)
hook.Run("AddTextField", "Example", "exampleField", "Example Field", function()
return "Example Value"
end)
end)
PopulateConfigurationButtons(pages)View Source
Purpose
Allows modules to register settings pages for the F1 configuration tab before the menu filters, sorts, and renders them.
Category
UI
Realm
Client
Parameters
table pages The mutable array of configuration page definitions that the settings tab consumes.
Example Usage
hook.Add("PopulateConfigurationButtons", "liaExamplePopulateConfigurationButtons", function(pages)
pages[#pages + 1] = {
name = "Example Settings",
drawFunc = function(parent)
parent:Clear()
end
}
end)
TooltipInitialize(var, panel)View Source
Purpose
Runs when the custom tooltip panel is initialized for an item tooltip.
Category
UI
Realm
Client
Parameters
Panel var The tooltip panel being initialized.
Panel panel The source panel that requested the tooltip.
Example Usage
hook.Add("TooltipInitialize", "liaExampleTooltipInitialize", function(var, panel)
var:SetMouseInputEnabled(false)
end)
TooltipLayout(var)View Source
Purpose
Allows plugins or modules to signal that a tooltip should use the custom item-tooltip layout path.
Category
UI
Realm
Client
Parameters
Panel var The tooltip panel being laid out.
Returns
boolean|nil Return true to use the custom layout handling. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("TooltipLayout", "liaExampleTooltipLayout", function(var)
if var.isItemTooltip then
return true
end
end)
TooltipPaint(var, w, h)View Source
Purpose
Allows plugins or modules to override the tooltip paint pass for item tooltips.
Category
UI
Realm
Client
Parameters
Panel var The tooltip panel being painted.
number w The current tooltip width.
number h The current tooltip height.
Returns
boolean|nil Return true to signal that the tooltip paint was handled. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("TooltipPaint", "liaExampleTooltipPaint", function(var, w, h)
if var.isItemTooltip then
surface.SetDrawColor(255, 255, 255, 10)
surface.DrawOutlinedRect(0, 0, w, h)
end
end)