API ReferenceGE Extensionsflowgraphnodesutil
On Menu (Flowgraph Node)
- **Node Name:** `On Menu`
Overview
- Node Name:
On Menu - Category:
repeat_instant - File:
extensions/flowgraph/nodes/util/onMenu.lua
Detects when the ESC/pause menu is open or closed, providing both continuous state and one-shot impulse outputs.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
reset | flow (impulse) | Resets the impulse output pins |
Output Pins
| Pin | Type | Description |
|---|---|---|
open | flow | Active while the menu is open |
close | flow | Active while the menu is closed |
onOpened | flow (impulse, hidden) | Fires once when the menu opens |
onClosed | flow (impulse, hidden) | Fires once when the menu closes |
openOrClosed | bool (hidden) | Boolean reflecting the open state |
Internals
Key Methods
| Method | Description |
|---|---|
reset() | Resets lastState to "none" |
_executionStarted() | Calls reset() |
work() | Checks menu state each frame, updates outputs and fires impulses on transitions |
Menu Detection
Uses core_input_bindings.getMenuActionMapEnabled() combined with a not core_gamestate.loading() check to determine if the ESC menu is open.
How It Works
- Each frame, checks if the menu action map is enabled and the game is not in a loading state.
- Sets
open/closeflow pins and theopenOrClosedboolean to reflect current state. - Compares against
lastStateto detect transitions:"none"→"opened": firesonOpenedimpulse"opened"→"closed": firesonClosedimpulse
- Impulse pins are reset to false on the next frame after firing.
- The
resetinput pin allows manually resetting the state tracking.
Usage Example
-- Pause game systems when menu opens:
-- [On Menu] → onOpened → [Pause Timer]
-- → onClosed → [Resume Timer]
-- Block input while menu is active:
-- [On Menu] → open → [Disable Player Controls]
-- → close → [Enable Player Controls]Key Dependencies
core_input_bindings.getMenuActionMapEnabled()- checks if the menu action map is activecore_gamestate.loading()- checks if the game is in a loading state
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide