Class BrushState
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Owns all brush-shape, drag, and pending-shape state for PlacementSystem.\n\nExtracted from PlacementSystem (Phase 1 refactor) to reduce the god-class footprint. PlacementSystem delegates state queries and mutations to this class instead of tracking half a dozen raw boolean/Vector2i flags.\n\nLifecycle rules enforced here: - Setting a new brush shape cancels all pending/drag state. - Starting a drag cancels any pending state. - Committing or canceling clears the relevant state.
class BrushState extends RefCounted
BrushState
Properties
active
Pending multi-cell shape (see PendingShapePlacement inner class below).
var active: bool = false
shape
var shape: int = -1
cells
var cells: Array[Vector2i] = []
brush_shape
-- Brush shape ------------------------------------------------
var brush_shape: int = PlacementEnums.ObjectTool.SINGLE
Methods
is_active
func is_active() -> bool:
Returns
anchor
func anchor(p_shape: int, p_anchor: Vector2i, p_cells: Array[Vector2i]) -> void:
Parameters
p_shapep_anchorp_cells
Returns
clear
func clear() -> void:
Returns
get_brush_shape
func get_brush_shape() -> int:
Returns
set_brush_shape
func set_brush_shape(p_shape: int) -> void:
Parameters
p_shape
Returns
start_terrain_drag
func start_terrain_drag(p_cell: Vector2i) -> void:
Parameters
p_cell
Returns
is_terrain_dragging
func is_terrain_dragging() -> bool:
Returns
complete_terrain_drag
func complete_terrain_drag() -> void:
Returns
get_drag_start
func get_drag_start() -> Vector2i:
Returns
start_object_line_drag
func start_object_line_drag(p_cell: Vector2i) -> void:
Parameters
p_cell
Returns
is_object_line_dragging
func is_object_line_dragging() -> bool:
Returns
complete_object_line_drag
func complete_object_line_drag() -> void:
Returns
get_object_line_drag_start
func get_object_line_drag_start() -> Vector2i:
Returns
anchor_pending
func anchor_pending(p_shape: int, p_anchor: Vector2i, p_cells: Array[Vector2i]) -> void:
Parameters
p_shapep_anchorp_cells
Returns
is_pending
func is_pending() -> bool:
Returns
get_pending_cells
func get_pending_cells() -> Array[Vector2i]:
Returns
commit_pending
func commit_pending() -> void:
Returns
cancel_pending
func cancel_pending() -> void:
Returns
cancel_all
func cancel_all() -> void: