HUD¶
This page documents hooks in the hud category.
CanDrawEntityHoverInfo(e, category)View Source
Purpose
Determines whether hover information should be drawn after the entity category has been resolved.
Category
HUD
Realm
Client
Parameters
Entity e The entity being evaluated.
string category The resolved hover-info category for the entity.
Returns
boolean|nil Return true or false to override the hover info decision. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("CanDrawEntityHoverInfo", "liaExampleCanDrawEntityHoverInfo", function(e, category)
if category == "items" and e:getNetVar("hidden") then
return false
end
end)
DisplayPlayerHUDInformation(client, hudInfos)View Source
Purpose
Allows modules to append structured HUD panels for the local player during the main HUD paint pass.
Category
HUD
Realm
Client
Parameters
Player client The local player whose HUD is being drawn.
table hudInfos The mutable array of HUD panel definitions that the renderer will draw after this hook finishes.
Example Usage
hook.Add("DisplayPlayerHUDInformation", "liaExampleDisplayPlayerHUDInformation", function(client, hudInfos)
hudInfos[#hudInfos + 1] = {
text = "Example HUD",
position = {
x = ScrW() * 0.5,
y = 40
}
}
end)
DrawCharInfo(c, character, info)View Source
Purpose
Allows modules to append additional formatted lines to the hover-info panel for a player's active character.
Category
HUD
Realm
Client
Parameters
Player c The player whose hover information is being assembled.
Character character The player's active character object.
table info The mutable array of line entries that will be rendered in the hover-info panel.
Example Usage
hook.Add("DrawCharInfo", "liaExampleDrawCharInfo", function(c, character, info)
info[#info + 1] = {character:getFaction() or "Unknown", Color(200, 200, 255)}
end)
DrawEntityInfo(e, a, pos)View Source
Purpose
Draws hover information for entities or player ragdolls after the core hover system has decided they should be shown.
Category
HUD
Realm
Client
Parameters
Entity e The entity whose hover information is being drawn. This may be a player when a ragdoll resolves back to its owner.
number a The current fade alpha used for the hover info.
table pos optional An optional screen-position table with `x` and `y` fields. When nil, the hook should derive its own position from the entity.
Example Usage
hook.Add("DrawEntityInfo", "liaExampleDrawEntityInfo", function(e, a, pos)
if e:isDoor() then
local screenPos = pos or e:GetPos():ToScreen()
draw.SimpleText("Door", "DermaDefault", screenPos.x, screenPos.y, Color(255, 255, 255, a), TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
end
end)
DrawPlayerInfoBackground(e, panelX, panelY, panelWidth, panelHeight, a)View Source
Purpose
Allows plugins or modules to override the background drawing pass for player hover info panels.
Category
HUD
Realm
Client
Parameters
Player e The player whose info panel is being drawn.
number panelX The left coordinate of the info panel.
number panelY The top coordinate of the info panel.
number panelWidth The width of the info panel.
number panelHeight The height of the info panel.
number a The current alpha value used for the panel fade.
Returns
boolean|nil Return false to suppress the default background drawing. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("DrawPlayerInfoBackground", "liaExampleDrawPlayerInfoBackground", function(e, panelX, panelY, panelWidth, panelHeight, a)
if e:isStaffOnDuty() then
surface.SetDrawColor(0, 0, 0, a)
surface.DrawOutlinedRect(panelX, panelY, panelWidth, panelHeight)
return false
end
end)
GetInjuredText(c)View Source
Purpose
Allows plugins or modules to override the injury text tuple added to character info panels.
Category
HUD
Realm
Client
Parameters
Player c The player whose health text is being resolved.
Returns
table|nil Return a table containing the localized text key and color to display. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetInjuredText", "liaExampleGetInjuredText", function(c)
if c:Health() > c:GetMaxHealth() * 0.9 then
return {"healthyStatus", Color(46, 204, 113)}
end
end)
LiliaModelPanelPostDrawModel(panel, ent)View Source
Purpose
Runs after a Lilia model panel finishes drawing its entity so modules can perform cleanup or post-draw effects.
Category
HUD
Realm
Client
Parameters
Panel panel The `liaModelPanel` instance that rendered the entity.
Entity ent The clientside entity drawn by the panel.
Example Usage
hook.Add("LiliaModelPanelPostDrawModel", "liaExampleLiliaModelPanelPostDrawModel", function(panel, ent)
if IsValid(ent) then
ent:SetNoDraw(false)
end
end)
OnModelPanelSetup(panel)View Source
Purpose
Runs after a Lilia model panel chooses an idle sequence so modules can finish configuring the panel before rendering.
Category
HUD
Realm
Client
Parameters
Panel panel The `liaModelPanel` instance that just set up its entity.
Example Usage
hook.Add("OnModelPanelSetup", "liaExampleOnModelPanelSetup", function(panel)
panel.enableHook = true
end)
ShouldDrawAmmo(wpn)View Source
Purpose
Determines whether the custom ammo HUD should be drawn for the active weapon.
Category
HUD
Realm
Client
Parameters
Weapon wpn The active weapon being evaluated for ammo drawing.
Returns
boolean|nil Return true or false to override the ammo HUD decision. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("ShouldDrawAmmo", "liaExampleShouldDrawAmmo", function(wpn)
if wpn:GetClass() == "weapon_physgun" then
return false
end
end)
ShouldDrawCrosshair(client, wpn)View Source
Purpose
Determines whether the custom crosshair should be drawn for the local player.
Category
HUD
Realm
Client
Parameters
Player client The local player whose crosshair is being evaluated.
Weapon wpn The active weapon being checked.
Returns
boolean|nil Return true or false to override the crosshair decision. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("ShouldDrawCrosshair", "liaExampleShouldDrawCrosshair", function(client, wpn)
if client:Crouching() and wpn:GetClass() == "weapon_pistol" then
return false
end
end)
ShouldDrawEntityInfo(e)View Source
Purpose
Determines whether the hovered entity should start rendering hover information.
Category
HUD
Realm
Client
Parameters
Entity e The entity currently being considered for hover info drawing.
Returns
boolean|nil Return true or false to override entity info visibility. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("ShouldDrawEntityInfo", "liaExampleShouldDrawEntityInfo", function(e)
if e:GetClass() == "prop_ragdoll" then
return false
end
end)
ShouldDrawPlayerInfo(e)View Source
Purpose
Determines whether character hover info should be drawn for a player entity.
Category
HUD
Realm
Client
Parameters
Player e The player whose hover info is being evaluated.
Returns
boolean|nil Return false to hide the player info panel. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("ShouldDrawPlayerInfo", "liaExampleShouldDrawPlayerInfo", function(e)
if e == LocalPlayer() then
return false
end
end)