Skip to main content

Ghostgestalter

Overview

The Ghostgestalter component manages activation-related tags (e.g., standingactivation, quickactivation, activatable_forceright, activatable_forcenopickup) for an entity, enabling dynamic control over how the entity responds to interaction types (e.g., standing, quick, right-click, or force-pickup activation). It also supports optional mutation logic via a customizable function (domutatefn) and ensures proper cleanup of tags upon removal.

Dependencies & Tags

Dependencies:

  • None identified (relies only on standard engine APIs: inst:AddOrRemoveTag, inst:RemoveTag, Class framework).

Tags Added/Removed:

  • standingactivation
  • quickactivation
  • activatable_forceright
  • activatable_forcenopickup

Properties

PropertyTypeDefault ValueDescription
instEntityReference to the owning entity instance.
OnActivatefunction?nilCallback function invoked on activation; provided at construction.
standingactionbooleanfalseWhether the entity supports standing activation.
quickactionbooleanfalseWhether the entity supports quick activation.
forcerightclickactionbooleanfalseWhether the entity requires force-right-click activation.
forcenopickupactionbooleanfalseWhether the entity is non-pickupable (requires force activation).
domutatefnfunction?nilOptional mutation function accepting (inst, doer) and returning a value.

Main Functions

OnRemoveFromEntity()

  • Description: Removes all activation-related tags from the entity when the component is removed (e.g., on entity destruction or component unregistration).
  • Parameters: None.

DoMutate(doer)

  • Description: Executes the optional domutatefn mutation callback (if set) with the entity and activator as arguments. Returns the result of the callback.
  • Parameters:
    • doer: The entity performing the mutation (e.g., player).

Events & Listeners

  • Listens for changes to standingaction, quickaction, forcerightclickaction, and forcenopickupaction via direct function hooks defined in the class metatable (not ListenForEvent). These are property setters—when assigned (e.g., component.standingaction = true), the corresponding callback (onstandingaction, etc.) runs, updating the relevant tag.