Class PlaceModeMachine
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Manages placement mode state as a proper state machine.\n\nReplaces the overlapping BuildMode and PlaceSubmode enums in PlacementSystem, eliminating the mode-flap bug class caused by inconsistent state combinations and the "no place-pending value" hack.\n\n[b]States:[/b] IDLE — Not placing anything. Maps to ModeState.OFF ROUTER — PLACE mode active, waiting for tool/category selection OBJECT — Actively placing an object (placeable selected) TERRAIN — Actively painting terrain (terrain name selected)\n\n[b]Two-way sync with ModeState:[/b] Out: IDLE → OFF, all others → PLACE (canonical) In: non-PLACE/BUILD modes force IDLE (MOVE/DEMOLISH/INFO/OFF)\n\nScene-free (extends RefCounted). Directly unit-testable.
class PlaceModeMachine extends RefCounted
Properties
current_state
var current_state: State = State.IDLE
old_state
var old_state = current_state
Methods
set_mode_state
func set_mode_state(mode_state: ModeState) -> void:
Parameters
mode_state
Returns
enter_idle
func enter_idle() -> void:
Returns
enter_router
func enter_router() -> void:
Returns
enter_object
func enter_object() -> void:
Returns
enter_terrain
func enter_terrain() -> void:
Returns
is_active
func is_active() -> bool:
Returns
is_router
func is_router() -> bool:
Returns
is_placing_object
func is_placing_object() -> bool:
Returns
is_painting_terrain
func is_painting_terrain() -> bool:
Returns
Events
state_changed
Placement mode states. Emitted when placement state changes.
signal state_changed(new_state: State, old_state: State)