Hudindicatable
Based on game build 714014 | Last updated: 2026-03-03
Overview
The hudindicatable component enables an entity to be tracked by the HUD system via the hudindicatablemanager component on the TheWorld entity. It provides a mechanism to control whether and how the entity should be displayed on the HUD (e.g., minimap indicators, icons) through a configurable tracking function. It automatically registers or unregisters itself with the world manager when added to or removed from the entity.
Usage example
local inst = CreateEntity()
inst:AddTag("hudindicatable")
inst:AddComponent("hudindicatable")
-- Optional: customize when the entity should be tracked
inst.components.hudindicatable:SetShouldTrackFunction(function(self, viewer)
return viewer:HasTag("player") and not viewer:HasTag("ghost")
end)
Dependencies & tags
Components used: hudindicatablemanager (on TheWorld)
Tags: None added or checked; relies on tag hudindicatable being added externally (e.g., during prefab definition).
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
shouldtrackfn | function | function() return true end | Function (entity, viewer) -> boolean determining if this entity should be visible on the HUD for a given viewer. |
Main functions
SetShouldTrackFunction(fn)
- Description: Sets the function used to determine whether this entity should be tracked by the HUD for a given viewer.
- Parameters:
fn(function) — A function taking two arguments (self,viewer) and returning a boolean. - Returns: Nothing.
ShouldTrack(viewer)
- Description: Evaluates whether this entity should be tracked for the specified viewer using the configured
shouldtrackfn. - Parameters:
viewer(Entity) — The entity (typically a player) for whom tracking is being evaluated. - Returns:
boolean—trueif the entity should be tracked, otherwisefalse.
RegisterWithWorldComponent()
- Description: Registers this entity with the
hudindicatablemanagercomponent in the world if it exists. - Parameters: None.
- Returns: Nothing.
UnRegisterWithWorldComponent()
- Description: Unregisters this entity from the
hudindicatablemanagerand fires the"unregister_hudindicatable"event. - Parameters: None.
- Returns: Nothing.
OnRemoveFromEntity()
- Description: Cleanup callback called when the component is removed from its entity; triggers unregistration.
- Parameters: None.
- Returns: Nothing.
Events & listeners
- Listens to:
onremove— triggersUnRegisterWithWorldComponent. - Pushes:
unregister_hudindicatable— fired when unregistered (e.g., on entity removal).