Teleportedoverride
Overview
This component enables an entity to customize its teleport destination by storing optional callback functions that determine either the target entity or the absolute position to which the entity should teleport. It does not perform teleportation itself, but serves as a data container for teleport override logic used elsewhere (e.g., by teleport logic in the Teleporter or Wormhole systems).
Dependencies & Tags
None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | nil (assigned via constructor) | Reference to the owner entity, passed during construction and stored as self.inst. |
target_fn | function? | nil | Optional callback that returns the target entity for teleportation (takes inst as argument). |
pos_fn | function? | nil | Optional callback that returns a Vector3 position for teleportation (takes inst as argument). |
Main Functions
GetDestTarget()
- Description: Returns the teleport target entity by invoking the stored
target_fn(if present); otherwise returnsnil. - Parameters: None.
SetDestTargetFn(fn)
- Description: Sets the callback function used to determine the teleport target entity. The function should accept the owner entity (
inst) as its sole argument and return either an entity ornil. - Parameters:
fn(function?) — Callback function for computing the teleport target.
GetDestPosition()
- Description: Returns the teleport position by invoking the stored
pos_fn(if present); otherwise returnsnil. - Parameters: None.
SetDestPositionFn(fn)
- Description: Sets the callback function used to determine the teleport position. The function should accept the owner entity (
inst) as its sole argument and return aVector3ornil. - Parameters:
fn(function?) — Callback function for computing the teleport position.
Events & Listeners
None.