Skip to main content

Module interaction

Module interaction 

Source
Expand description

Puzzle building blocks that need no code: Switch (button, lever, pressure plate) and Slider (door, lift, gate). They talk through a shared channel name: a slider opens while any switch on its channel is active. Scripts press buttons with press().

Structs§

Slider
Moves its entity between its start position and start + open_offset while its channel is active. A door with collision needs a Kinematic RigidBody so physics follows it.
Switch
Button: active for hold_time seconds after being pressed. Toggle: flips on every press. Plate: active while a physics object (a crate, the player) stands on it.

Enums§

SwitchKind
Momentary Button, persistent Toggle, or body-detecting pressure Plate.

Functions§

press
Presses a button / flips a toggle (what the player does with the use key).
update
Advances every switch and slider by dt seconds. Invalid or negative deltas are ignored.