Class PlacementBuildOrchestrator
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Scene-free orchestration for the build/place flow.\n\nExtracted from PlacementSystem to: - Reduce the god-class footprint of PlacementSystem (~1,192 lines) - Centralize the build validation + report + signal emission flow - Enable per-game validation policy injection (different games want different validation strictness, error messages, telemetry hooks)\n\nThe orchestrator owns the [method run_build] flow as a pure coordination function: it takes all dependencies via [PlacementBuildContext], runs validation, builds the instance via a callback, and emits signals via a callback. It does NOT hold any state itself.\n\nAll public methods take a focused context object ([PlacementReadinessContext], [PlacementFailureContext], or [PlacementBuildContext]) so the API style is consistent across the orchestrator.
class PlacementBuildOrchestrator extends RefCounted
Properties
states
Context for [method is_ready_to_place] and [method is_ready_to_paint_terrain]. Bundles everything the readiness predicates need: the shared states, the indicator context (place-only), the selected placeable (place-only), and the selected terrain name (terrain-only). Fields not relevant to a particular check are simply ignored. Shared states for plugin systems. Required.
var states: PlacementStates
settings
Settings for grid building system operation. Required.
var settings: PlacementSettings
indicator_context
Context for indicator manager lookup. Required for [method is_ready_to_place].
var indicator_context: IndicatorContext
selected_placeable
Currently selected placeable resource. Required for [method is_ready_to_place].
var selected_placeable: ScenePlacementEntry
preview
Preview instance from the lazy preview builder. Required.
var preview: Node2D
previous_report
Previous build report (for indicator chain). May be null.
var previous_report: PlacementReport
build_instance
Callback: (ScenePlacementEntry, bool) -> Node2D — builds the scene instance. Receives the placeable and the attach_placeable_instance flag. Returns the placed Node2D, or null on failure.
var build_instance: Callable
emit_signal
Callback: (PlacementReport, int, bool) -> void — emits the build result. Receives the report, the build type, and a success flag.
var emit_signal: Callable
states
Context for [method is_ready_to_place] and [method is_ready_to_paint_terrain]. Bundles everything the readiness predicates need: the shared states, the indicator context (place-only), the selected placeable (place-only), and the selected terrain name (terrain-only). Fields not relevant to a particular check are simply ignored. Shared states for plugin systems. Required.
var states: PlacementStates
indicator_context
Context for indicator manager lookup. Required for [method is_ready_to_place].
var indicator_context: IndicatorContext
selected_placeable
Currently selected placeable resource. Required for [method is_ready_to_place].
var selected_placeable: ScenePlacementEntry
selected_terrain_name
Currently selected terrain name. Required for [method is_ready_to_paint_terrain].
var selected_terrain_name: StringName
builder_owner
var builder_owner: PlacementOwner = _get_builder_owner(p_ctx.states)
type
Build type (SINGLE, DRAG, AREA, TERRAIN).
var type: PlacementEnums.PlacementType
message
Human-readable failure message.
var message: String
target_map
Target TileMapLayer (may be null).
var target_map: TileMapLayer = null
issues
var issues: Array[String] = []
issues
var issues: Array[String] = []
report
var report = PlacementReport.new(builder_owner, p_ctx.preview, previous_indicators, PlacementEnums.Action.BUILD)
manager
var manager: IndicatorManager = p_ctx.indicator_context.get_manager() if p_ctx.indicator_context else null
builder_owner
var builder_owner: PlacementOwner = _get_builder_owner(p_ctx.states)
previous_indicators
var previous_indicators = p_ctx.previous_report.indicators_report if p_ctx.previous_report != null else null
report
var report = PlacementReport.new(builder_owner, p_ctx.preview, previous_indicators, PlacementEnums.Action.BUILD)
placement_validation
var placement_validation: ValidationResults = manager.validate_placement()
diag_errors
var diag_errors = placement_validation.get_errors()
validation_issues
var validation_issues = placement_validation.get_issues()
fail_msg
var fail_msg = "[PlacementBuildOrchestrator] _build_instance returned null for selected_placeable=%s" % str(p_ctx.selected_placeable)
Methods
is_ready_to_place
static func is_ready_to_place(p_ctx: PlacementReadinessContext) -> bool:
Parameters
p_ctx
Returns
is_ready_to_paint_terrain
static func is_ready_to_paint_terrain(p_ctx: PlacementReadinessContext) -> bool:
Parameters
p_ctx
Returns
report_precondition_failure
static func report_precondition_failure(p_ctx: PlacementFailureContext) -> PlacementReport:
Parameters
p_ctx
Returns
run_build
static func run_build( p_ctx: PlacementBuildContext,