Follower Replica
Overview
This component acts as a lightweight network replica for followers (e.g., pets or summons), managing two synchronized networked references—_leader and _itemowner—and providing a unified getter that prioritizes _itemowner as the effective leader when present.
Dependencies & Tags
- Relies on the
net_entityhelper (internal to DST) to manage synchronized entity references across clients and server. - Does not add or remove any standard component tags.
- Requires the
inst.GUIDto be valid fornet_entityto function.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | (passed to constructor) | The entity instance this component is attached to. |
_leader | net_entity | nil (initialized lazily) | Networked reference to the entity’s primary leader. |
_itemowner | net_entity | nil (initialized lazily) | Networked reference to the entity’s item owner (e.g., a player holding its item form). |
Main Functions
SetLeader(leader)
- Description: Sets the primary leader entity reference (
_leader) to the provided entity. - Parameters:
leader: AnEntityinstance (ornil), passed toself._leader:set().
SetItemOwner(owner)
- Description: Sets the item owner entity reference (
_itemowner) to the provided entity. This typically reflects ownership when the follower is in item form (e.g., held by a player). - Parameters:
owner: AnEntityinstance (ornil), passed toself._itemowner:set().
GetLeader()
- Description: Returns the effective leader. If
_itemowneris set (non-nil), it takes precedence; otherwise,_leaderis returned. - Parameters: None.
- Returns:
Entity?— Either the item owner or leader entity, ornilif neither is set.
Events & Listeners
None.