Skip to main content

Gravedigger

Overview

The Gravedigger component is a lightweight callback handler attached to entities (typically graves) that need to respond when they are used—commonly by a player. It stores and invokes an optional onused function callback, passing the entity instance, the user, and the target of the use action.

Dependencies & Tags

None identified.

Properties

PropertyTypeDefault ValueDescription
instEntitynil (assigned by constructor)Reference to the entity the component is attached to.

Note: The constructor accepts inst as its sole parameter and stores it in self.inst. No other public properties are explicitly initialized. The commented-out self.onused = nil line indicates that external code is expected to assign the callback manually.

Main Functions

OnUsed(user, target)

  • Description: Invokes the onused callback (if set), forwarding the entity instance, the entity that performed the use (user), and the target of the use (e.g., the object interacted with).
  • Parameters:
    • user: The entity performing the use action (typically a player).
    • target: The target of the use action (often the same as self.inst, but may differ in chained interactions).