Owns all brush-shape, drag, and pending-shape state for the building system. Extracted from the building system to reduce the god-class footprint. The building system delegates state queries and mutations to this class instead of tracking half a dozen raw boolean/Vector2i flags. Lifecycle invariants: Only one of (TERRAIN_DRAG, OBJECT_LINE_DRAG, PENDING_SHAPE, DEMOLISH_BOX) can be active at a time. The previous design tracked independent booleans which made impossible composite states observable. This file now derives all is_() queries from a single [_current_lifecycle] enum. Lifecycle rules enforced here:
- Setting a new brush shape cancels all pending/drag state (IDLE).
- Starting a drag cancels any pending state and enters TERRAIN_DRAG.
- Starting an object LINE drag cancels any pending state and enters OBJECT_LINE_DRAG.
- Anchoring a pending shape cancels any drag/state and enters PENDING_SHAPE.
- Starting an object demolish box cancels any drag/state and enters DEMOLISH_BOX.
- Committing or canceling clears the relevant state and returns to IDLE.
Source: addons/grid_placement/systems/building/brush_state.gd
Syntax
class BrushState extends RefCounted