Sglunarthrall Plant Gestalt
Based on game build 722832 | Last updated: 2026-04-21
Overview
SGlunarthrall_plant_gestalt defines the state machine for lunar thrall plant gestalt entities. It manages spawning, idle, infestation, and movement states with synchronized animations, sound effects, and physics overrides. The stategraph integrates with the gestaltcapturable component to control capture eligibility during specific states and coordinates with world-level spawners for plant generation.
Usage example
local inst = CreateEntity()
inst:AddComponent("locomotor")
inst:AddComponent("gestaltcapturable")
inst:AddComponent("entitytracker")
inst:SetStateGraph("lunarthrall_plant_gestalt")
inst.sg:GoToState("spawn")
Dependencies & tags
External dependencies:
stategraphs/commonstates-- provides shared state definitions viaAddWalkStatesandAddPossessChassisState
Components used:
locomotor-- stopped during state transitions viaStop()gestaltcapturable-- enabled/disabled viaSetEnabled()during infestation statesentitytracker-- queried viaGetEntity("corpse")to track corpse targetslunarthrall_plantspawner(world) -- spawns plants viaSpawnPlant()during infestation timeline
Tags:
idle-- added in idle statecanrotate-- added in idle statebusy-- added in spawn, infest, infest_corpse, spawn_hail statesnoattack-- added in spawn, infest, infest_corpse, spawn_hail statesinfesting-- added in infest and infest_corpse statesmoving-- checked duringgestaltcapturable_targetedevent
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst.sg.statemem.corpse | entity | nil | Stores reference to corpse entity during infestation states. |
inst.sg.statemem.base_speed | number | --- | Base movement speed multiplier for spawn_hail state. |
inst.plant_target | entity | nil | Target entity for plant spawning during infestation. |
inst.persists | boolean | --- | Persistence flag; set to false during infestation timeline. |
inst._notrail | boolean | --- | If true, prevents trail prefab spawning during walk states. |
Main functions
GoToIdle(inst)
- Description: Transitions the entity to the idle state. Called when animation completes in states using
SimpleAnimoverHandler. - Parameters:
inst-- entity instance with stategraph - Returns: None
- Error states: None
Remove(inst)
- Description: Removes the entity from the world. Called on animation completion in
spawn_hailstate or viaRemoveOnAnimoverHandler. - Parameters:
inst-- entity instance to remove - Returns: None
- Error states: None
SpawnTrail(inst)
- Description: Spawns a
gestalt_trailprefab at the entity's position unless_notrailflag is set. Called during walk state timeline. - Parameters:
inst-- entity instance - Returns: None
- Error states: None
Events & listeners
- Listens to:
gestaltcapturable_targeted-- transitions towalk_stopstate if entity hasmovingtag - Listens to:
animover-- transitions toidlestate (viaSimpleAnimoverHandler) or removes entity (viaRemoveOnAnimoverHandler) - Listens to:
locomote-- handled viaCommonHandlers.OnLocomote - Listens to:
possesschassis-- handled viaCommonHandlers.OnPossessChassis - Pushes: None identified