RiftThrallType
Based on game build 714014 | Last updated: 2026-03-03
Overview
RiftThrallType is a simple component that stores and exposes the type classification of a rift thrall entity. It provides basic getter, setter, and equality-check functionality for the thrall_type value, and supports serialization via OnSave/OnLoad for network and savegame persistence. This component is intended for entities representing thralls spawned from rifts in the game.
Usage example
local inst = CreateEntity()
inst:AddComponent("riftthralltype")
inst.components.riftthralltype:SetThrallType("warrior")
assert(inst.components.riftthralltype:GetThrallType() == "warrior")
assert(inst.components.riftthralltype:IsThrallType("warrior") == true)
assert(inst.components.riftthralltype:IsThrallType("scout") == false)
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
thrall_type | string? | nil | The classification string assigned to the thrall (e.g., "warrior", "scout"). |
Main functions
SetThrallType(new_type)
- Description: Assigns a new type string to the thrall.
- Parameters:
new_type(string?) — the type identifier to store. May benil. - Returns: Nothing.
GetThrallType()
- Description: Returns the currently stored thrall type.
- Parameters: None.
- Returns:
string?— the stored type, ornilif unset.
IsThrallType(check_type)
- Description: Compares the stored type to the given type.
- Parameters:
check_type(string?) — the type to compare against. - Returns:
boolean—trueif equal,falseotherwise (including when either value isnil). - Error states: Returns
falsewhenthrall_typeisnil, unlesscheck_typeis alsonil.
OnSave()
- Description: Prepares the component's state for serialization.
- Parameters: None.
- Returns:
{ thrall_type: string }?— a table containingthrall_typeif set; otherwisenil.
OnLoad(data)
- Description: Restores component state from serialized data.
- Parameters:
data({ thrall_type: string }?) — the saved data table. - Returns: Nothing.
- Error states: Silently ignores missing or invalid
data.
GetDebugString()
- Description: Returns a human-readable representation of the thrall type for debugging.
- Parameters: None.
- Returns:
string— the stored type or"NONE"ifnil.
Events & listeners
None identified