Groundcreep
Overview
This component implements serialization and deserialization logic for the GroundCreep object associated with an entity. It ensures that the state of the GroundCreep—typically representing persistent environmental creep effects like rot or sludge—is properly saved and restored across sessions. It does not define or manage the creep behavior itself, but acts as a conduit between the game’s save/load system and the GroundCreep instance.
Dependencies & Tags
- Component Dependency: Assumes that
inst.GroundCreepexists as a valid object with methodsGetAsString(),SetFromString(string), andFastForward(). - Event Listener: Listens for
"playeractivated"to trigger fast-forwarding of creep state for newly activated players. - No tags are added, removed, or checked.
Properties
No public properties are initialized directly in this component’s constructor. The only stored reference is:
self.inst— the owning entity instance (assigned automatically in theClassframework).
Main Functions
OnSave()
- Description: Serializes the GroundCreep state by calling
GetAsString()on the associatedinst.GroundCreepobject. Only active on the master simulation. - Parameters: None (method uses
selfandinst).
OnLoad(data)
- Description: Deserializes the GroundCreep state by calling
SetFromString(data)oninst.GroundCreep. Only active on the master simulation. - Parameters:
data(string): The serialized GroundCreep state string obtained fromOnSave().
Events & Listeners
- Listens for
"playeractivated": Triggersinst.GroundCreep:FastForward()to ensure creep state is up-to-date when a player becomes active (e.g., upon rejoining or initial spawn).