Touchstonetracker
Based on game build 714014 | Last updated: 2026-03-03
Overview
TouchStoneTracker maintains a record of touchstones used by the player entity within the current game shard, and preserves usage data from previous shards for cross-session continuity. It listens for usedtouchstone events, updates the networked player_classified component with the list of used touchstones, and handles saving/loading of usage data via session identifiers.
Usage example
local inst = ThePlayer
inst:AddComponent("touchstonetracker")
-- Automatically activated by the game on player spawn.
-- When a touchstone is used, the game calls:
inst:PushEvent("usedtouchstone", { touchstone = some_touchstone_prefab })
-- Later, check if a touchstone was used:
if not inst.components.touchstonetracker:IsUsed(some_touchstone) then
-- perform logic
end
Dependencies & tags
Components used: player_classified
Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
used | table | {} | A map of touchstone IDs (number) → true for touchstones used in the current session/shard. |
used_foreign | table | {} | A map of session IDs (string) → array of touchstone IDs used in previous sessions. |
Main functions
GetDebugString()
- Description: Returns a human-readable string listing all used touchstone IDs in the current session.
- Parameters: None.
- Returns: string — formatted as
"Used: id1, id2, id3"where IDs are space-separated. - Error states: Returns empty string if no touchstones have been used.
IsUsed(touchstone)
- Description: Checks whether the given touchstone prefab has been used in the current session.
- Parameters:
touchstone(entity) — a touchstone entity with aGetTouchStoneID()method. - Returns: boolean —
trueif the touchstone's ID is inself.used, otherwisefalse.
OnSave()
- Description: Serializes the used touchstone data for persistence. Includes both current session data and foreign (previously saved) session data.
- Parameters: None.
- Returns: table —
{ usedinsessions = { [session_id] = {id1, id2, ...}, ... } }.
OnLoad(data)
- Description: Loads previously saved touchstone usage data. Separates data by session ID: current session data populates
self.used, while other sessions populateself.used_foreign. - Parameters:
data(table or nil) — serialized data returned byOnSave(). - Returns: Nothing.
- Error states: Silently ignores malformed or missing data (e.g.,
data == nilordata.usedinsessions == nil).
OnRemoveFromEntity()
- Description: Cleans up before component removal. Clears
player_classified's used touchstones and unregisters theusedtouchstonelistener. - Parameters: None.
- Returns: Nothing.
TransferComponent(newinst)
- Description: Copies all used touchstone data (current and foreign) from this component instance to a new component on a different entity (e.g., during character transfer).
- Parameters:
newinst(entity) — the destination entity whosetouchstonetrackercomponent will receive the data. - Returns: Nothing.
- Error states: Assumes
newinst.components.touchstonetrackerexists and is valid.
Events & listeners
- Listens to:
usedtouchstone— triggersOnUsedTouchStone, which in turn callsOnUsedTouchStoneIDto record the touchstone as used. - Pushes: None.