Table of Contents

Class BrushCoordinator

Namespace
GridPlacement.GDScript
Assembly
MoonBark.GridPlacement.GDScript.dll

Scene-free brush lifecycle coordinator. Extracted from PlacementSystem (P4 god-class refactor) to give the brush coordination concern its own single-responsibility home.\n\nOwns the [BrushState] instance (so PlacementSystem no longer holds it directly) and coordinates the start/complete/anchor/commit/cancel/paint sequence for terrain brushes. Mirrors the pattern of [TerrainPlacementService] (instance + configure) and [PlacementInputHandler] (instance + configure) so the brush behavior is swappable per-game by subclassing.\n\nSignal emission is intentionally NOT done here — the coordinator returns a [PlacementReport] for every paint attempt, and PlacementSystem's thin delegator emits the appropriate success/failed signal. This keeps the coordinator pure (no side effects beyond state mutation in [BrushState]).\n\nUsage: var coord := BrushCoordinator.new() coord.configure(states, terrain_service) coord.set_brush_shape(PlacementEnums.ObjectTool.LINE) coord.start_terrain_brush_drag() var report := coord.complete_terrain_brush()

class BrushCoordinator extends RefCounted
BrushCoordinator

Properties

brush_state

The brush state this coordinator owns. Exposed for [PlacementInputHandler], which needs to read [member BrushState.is_terrain_dragging] etc. to resolve InputIntents.

var brush_state: BrushState

positioner

var positioner: Node2D = _get_positioner()

target_map

var target_map: TileMapLayer = _get_target_map()

cell

var cell: Vector2i = target_map.local_to_map(target_map.to_local(positioner.global_position))

positioner

var positioner: Node2D = _get_positioner()

target_map

var target_map: TileMapLayer = _get_target_map()

current_cell

var current_cell: Vector2i = target_map.local_to_map(target_map.to_local(positioner.global_position))

cells

var cells: Array[Vector2i] = BrushShapeGenerator.generate(

target_map

var target_map: TileMapLayer = _get_target_map()

positioner

var positioner: Node2D = _get_positioner()

target_map

var target_map: TileMapLayer = _get_target_map()

positioner

var positioner: Node2D = _get_positioner()

anchor_cell

var anchor_cell: Vector2i = target_map.local_to_map(target_map.to_local(positioner.global_position))

cells

var cells: Array[Vector2i] = BrushShapeGenerator.generate(

cells

var cells: Array[Vector2i] = BrushShapeGenerator.generate(

terrain_name

var terrain_name: StringName = _get_selected_terrain_name()

target_map

var target_map: TileMapLayer = _get_target_map()

target_map

var target_map: TileMapLayer = _get_target_map()

positioner

var positioner: Node2D = _get_positioner()

current_cell

var current_cell: Vector2i = target_map.local_to_map(target_map.to_local(positioner.global_position))

cells

var cells: Array[Vector2i] = BrushShapeGenerator.generate(

f_ctx

var f_ctx = PlacementBuildOrchestrator.PlacementFailureContext.new()

Methods

configure

func configure(p_states: PlacementStates, p_terrain_service: TerrainPlacementService) -> void:

Parameters

p_states
p_terrain_service

Returns

set_states

func set_states(p_states: PlacementStates) -> void:

Parameters

p_states

Returns

set_brush_shape

func set_brush_shape(p_shape: int) -> void:

Parameters

p_shape

Returns

start_terrain_brush_drag

func start_terrain_brush_drag() -> void:

Returns

complete_terrain_brush

func complete_terrain_brush() -> PlacementReport:

Returns

complete_terrain_brush_dry

func complete_terrain_brush_dry() -> Array[Vector2i]:

Returns

complete_terrain_brush_immediate

func complete_terrain_brush_immediate() -> PlacementReport:

Returns

complete_terrain_drag_only

func complete_terrain_drag_only() -> void:

Returns

anchor_pending_terrain

func anchor_pending_terrain() -> void:

Returns

commit_pending

func commit_pending() -> PlacementReport:

Returns

cancel_pending

func cancel_pending() -> void:

Returns

start_object_line_drag

func start_object_line_drag(p_cell: Vector2i) -> void:

Parameters

p_cell

Returns

complete_object_line_drag

func complete_object_line_drag() -> void:

Returns

is_object_line_dragging

func is_object_line_dragging() -> bool:

Returns

cancel_all

func cancel_all() -> void:

Returns

is_terrain_dragging

func is_terrain_dragging() -> bool:

Returns

is_pending

func is_pending() -> bool:

Returns

get_brush_shape

func get_brush_shape() -> int:

Returns

get_drag_start

func get_drag_start() -> Vector2i:

Returns

get_pending_cells

func get_pending_cells() -> Array[Vector2i]:

Returns

get_object_line_drag_start

func get_object_line_drag_start() -> Vector2i:

Returns

get_brush_state

func get_brush_state() -> BrushState:

Returns

paint_with_current_brush

func paint_with_current_brush() -> PlacementReport:

Returns

set_terrain_name_provider

func set_terrain_name_provider(p_provider: Callable) -> void:

Parameters

p_provider

Returns

set_terrain_entry_provider

func set_terrain_entry_provider(p_provider: Callable) -> void:

Parameters

p_provider

Returns

set_terrain_palette_provider

func set_terrain_palette_provider(p_provider: Callable) -> void:

Parameters

p_provider

Returns