Sgwave
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGwave defines a simple state graph for entities that exhibit a cyclic appearance behavior: rising up, remaining idle for a fixed duration, then lowering and disappearing. It uses animations (appear, idle, disappear) and timed events to control waveactive state and scheduling. This stategraph is intended for visual/environmental effects rather than interactive gameplay entities, as it does not maintain persistent logic beyond animation and timing.
Usage example
-- Typically assigned automatically to prefabs that use the SGwave stategraph.
-- Example for a custom spire prefab:
local inst = CreateEntity()
inst:AddTag("spire")
inst:AddTag("physics")
inst.sg = StateGraph("wave", { ... }, {}, "rise") -- internally handled via SGwave return
inst.idle_time = 10 -- optional override; defaults to 5 seconds
Dependencies & tags
Components used: None explicitly accessed via inst.components.X. Relies on built-in services: AnimState for animation control and sg for stategraph execution.
Tags: The stategraph assigns entity tags dynamically based on current state:
rising— active duringriseandinstant_risestates.idle— active during theidlestate.lowering— active during thelowerstate.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
idle_time | number? | 5 | Duration (in seconds) the entity remains in the idle state before initiating the lower sequence. Set via inst.idle_time on the owning entity. |
waveactive | boolean | true during rise, idle, and lower; false during lower's later phase | Indicates whether the wave entity is currently "active" (visually/potentially interactable). Controlled via timeline events. |
Main functions
Not applicable — SGwave is a stategraph definition, not a component with callable methods. Logic is expressed through state definitions (onenter, ontimeout, timeline, events).
Events & listeners
- Listens to:
animover— triggers transition to the next state (idle→lower) after animations complete. Handled bygo_to_idlehelper forrise/instant_rise, and inline function forlower.
- Pushes:
- None —
SGwavedoes not push custom events.
- None —