Sgcarnivalgame Memory Card
Based on game build 714014 | Last updated: 2026-03-08
Overview
This state graph (SGcarnivalgame_memory_card) controls the behavior of a memory card prop used in a carnival minigame. It defines a set of states that govern animation playback, sound effects, and state transitions triggered by external game events (e.g., round start, card reveal, turn-on/off). It interfaces with the inspectable component for entity inspection capabilities and responds to events like carnivalgame_turnon, carnivalgame_memory_cardstartround, and carnivalgame_memory_revealcard.
Usage example
local inst = CreateEntity()
inst:AddTag("memory_card")
inst:AddComponent("inspectable")
inst.sg = StateGraph("carnivalgame_memory_card", inst, states, events, "idle_off")
-- After setup, trigger states via:
inst:PushEvent("carnivalgame_turnon")
inst:PushEvent("carnivalgame_memory_cardstartround", { isgood = true })
Dependencies & tags
Components used: inspectable (added conditionally on entering idle_off state if not present)
Tags: off (applied to idle_off and turn_off states)
Properties
No public properties
Main functions
Not applicable
Events & listeners
-
Listens to:
carnivalgame_turnon: Transitions toturn_onstate.carnivalgame_memory_cardstartround: Evaluatesdata.isgood; transitions tohint_goodorhint_bad, unless_shouldturnoffis true.carnivalgame_memory_revealcard: Transitions toreveal_goodorreveal_baddepending oninst.sg.mem.isgood, unless_shouldturnoffis true.animover: Used internally in multiple states to transition to next state after animation completes.carnivalgame_endofround: Triggers post-reveal state transition in reveal states.carnivalgame_turnoff: Triggersturn_offor post-reveal state in multiple states.
-
Pushes:
carnivalgame_memory_cardrevealed: Fired duringreveal_good(after 10 frames) andreveal_bad(after 20 frames) states to signal card reveal completion.