Skip to content

Class

BrushState

Generated GDScript class reference for GridPlacement.BrushState.

Status
Draft
Version
v6.0
Updated
Development docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

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

Members

NameKindSummary
activePropertyMutually exclusive lifecycle state for the brush. Stored in [_current_lifecycle]; all is_() getters derive from this single field. Pending multi-cell shape (see PendingShapePlacement inner class below).
shapeProperty
cellsProperty
is_activeMethod
anchorMethod
clearMethod
brush_shapeProperty-- Brush shape ------------------------------------------------
get_brush_shapeMethod
set_brush_shapeMethod
is_terrain_draggingMethod
is_object_line_draggingMethod
is_pendingMethod
is_demolish_box_activeMethod
is_demolish_draggingMethod
is_new_demolish_drag_cellMethod
mark_demolish_drag_cellMethod
is_any_drag_activeMethod
is_idleMethod
start_terrain_dragMethod
complete_terrain_dragMethod
get_drag_startMethod
start_object_line_dragMethod
complete_object_line_dragMethod
get_object_line_drag_startMethod
start_demolish_dragMethod
end_demolish_dragMethod
start_demolish_boxMethod
update_demolish_boxMethod
complete_demolish_boxMethod
get_demolish_rectMethod
anchor_pendingMethod
get_pending_cellsMethod
commit_pendingMethod
cancel_pendingMethod
stamp_commitMethod
clear_commit_stampMethod
has_commit_stampMethod
get_commit_stamp_cellsMethod
get_commit_stamp_terrainMethod
cancel_allMethod