API ReferenceGE Extensionsflowgraphnodesmission
Lights Controller (Flowgraph Node)
- **Node Name:** `Lights Controller`
Overview
- Node Name:
Lights Controller - Category:
repeat_instant - File:
extensions/flowgraph/nodes/mission/lightsController.lua - Icon: AI icon
- Color: AI color
Controls the Christmas-tree countdown light sequence for drag-race missions. Supports both Pro Tree (all ambers flash simultaneously) and Sportsman Tree (ambers illuminate sequentially). Also detects jump starts and triggers disqualification.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
flow | flow | - | Inflow for this node |
reset | flow (impulse) | - | Resets the countdown state and hides all lights |
proTree | bool | true | Use Pro Tree (simultaneous amber) vs Sportsman Tree (sequential) |
velocity | number | - | Current velocity of the player's vehicle |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Always-on outflow |
disqualified | flow | Active if the player jump-started |
started | flow | Active once the green light is shown |
Internals
self.lights- table of scene-tree light objects, split intostageLights(pre-stage / stage) andcountDownLights(amber 1-3, green, red, left + right).self.starttimer- elapsed simulation time since the sequence began (incremented byself.mgr.dtSim).self.jumpStarted- bool, set when the player moves (velocity > 0.5) before green.self.started- bool, set when the green light appears.
initLights()
Looks up all scene-tree objects by name (e.g. "Prestagelight_l", "Amberlight1_R", "Greenlight_L").
How It Works
- Reset - When the
resetimpulse fires, all lights are hidden, timers and flags are zeroed. - Pro Tree sequence (all ambers at once):
t > 2.0s→ Show all six amber lights (L + R).t > 2.4s→ Hide ambers, show green. If no jump start, markstarted = true.
- Sportsman Tree sequence (sequential):
t > 1.0s→ Amber 1t > 1.5s→ Amber 2 (hide amber 1)t > 2.0s→ Amber 3 (hide amber 2)t > 2.5s→ Green (hide amber 3), markstarted = true.
- Jump start detection - If the player's velocity exceeds 0.5 before the green light,
jumpStartedis set. Right-side lights stay amber, the red light is shown, anddisqualifiedfires. The left-side sequence continues normally butstartedis never set.
Lua Code Example
-- Typical flowgraph wiring:
-- 1. Connect vehicle velocity sensor → lightsController.velocity
-- 2. Connect a trigger zone → lightsController.reset (to begin countdown)
-- 3. lightsController.started → race timer / checkpoint system
-- 4. lightsController.disqualified → fail state / restart promptKey Dependencies
scenetree.findObject(name)- requires named light objects in the scene (e.g."Amberlight1_L")self.mgr.dtSim- simulation delta time from the flowgraph manager
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:work()
Main work function called each frame/tick when the node is active.
See Also
- ARunForLife (Flowgraph Node) - Related reference
- Update Display Drag Race (Flowgraph Node) - Related reference
- Clear Lights Drag Race (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide