Highlight Effect Handler

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:32, 2 October 2026 by TiMan (talk | contribs) (Expand the practical source walkthrough and clarify how to use the handler.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


The Highlight Effect Handler briefly sweeps a glow across eligible nearby objects. It scans active physics bodies, checks selected script classes and calls each entity’s _Global_CanBeHighlighted function. The response must supply a Boolean result and the entity ID in global argument 0. On-screen visibility and a minimum light level are also checked.

The stock tool script reads the HighlightActive instance variable. Its _Global_CanBeHighlighted returns that flag and supplies mBaseObj.GetID(); disabling that flag prevents this tool from being accepted by the handler.

Trace a tool’s highlight setting

  1. Find HighlightActive in editor/userclasses/EntityClasses.def. The tool instance variable is a Boolean with a declared default of true; its description says it controls the highlight effect when the tool is looked at.
  2. Open script/props/Prop_Tool.hps. The tool reads that instance variable into mbHighlightActive and returns it through the callback below.
  3. Follow UpdateAddObjects in script/modules/HighlightEffectHandler.hps. It filters for selected stock script classes, requires a mesh and an on-screen entity, and skips entities whose measured light level is below 0.1. A true tool flag therefore supplies eligibility; the handler still applies those additional checks.

Stock tool eligibility callback

void _Global_CanBeHighlighted()
{
    cScript_SetGlobalReturnBool(mbHighlightActive);
    cScript_SetGlobalArgID(0,mBaseObj.GetID());
}

See also