Skip to content

Class

PlacementBuildOrchestrator

Generated GDScript class reference for GridPlacement.PlacementBuildOrchestrator.

Status
Current
Version
v6.0
Source updated
Active v6.0 guide line from Grid Placement repo
Generated on
2026-09-01

Scene-free orchestration for the build/place flow. Extracted to:

  • Reduce the god-class footprint of the building system (~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) The 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. All public methods take a focused context object ([PlacementReadinessContext], [PlacementFailureContext], or [PlacementBuildContext]) so the API style is consistent across the orchestrator.

Source: addons/grid_placement/systems/building/placement_build_orchestrator.gd

Syntax

class PlacementBuildOrchestrator extends RefCounted

Members

NameKindSummary
ProviderTransformPolicyField
statesPropertyContext object bundling all dependencies needed for a build attempt. Caller populates these fields before invoking [method PlacementBuildOrchestrator.run_build]. Shared states for plugin systems. Required.
settingsPropertySettings for grid building system operation. Required.
indicator_contextPropertyContext for resolving references to current objects. Required.
selected_placeablePropertyCurrently selected placeable resource. Required. The currently-selected placeable for the build. Typed Variant deliberately: in the blacksmith freed-ref lifecycle race (see AGENTS.md), the slot can become a freed Object between the caller populating it and the orchestrator running. The orchestrator's guard then short-circuits with a clean "No placeable selected for build" issue BEFORE `_build_instance.call` runs, so `_build_instance` itself only ever sees a valid ScenePlacementEntry. Callers building the context should still pass a ScenePlacementEntry in practice, but the Variant type lets the regression test deterministically reproduce the freed variant.
previewPropertyPreview instance from the lazy preview builder. Required.
previous_reportPropertyPrevious build report (for indicator chain). May be null.
build_instancePropertyCallback: (ScenePlacementEntry, bool) -> Node2D — builds the scene instance. Receives the placeable and the attach_placeable_instance flag. Returns the placed Node2D, or null on failure.
emit_signalPropertyCallback: (PlacementReport, int, bool) -> void — emits the build result. Receives the report, the build type, and a success flag.
statesPropertyContext 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.
indicator_contextPropertyContext for indicator manager lookup. Required for [method is_ready_to_place].
selected_placeablePropertyCurrently selected placeable resource. Required for [method is_ready_to_place].
selected_terrain_namePropertyCurrently selected terrain name. Required for [method is_ready_to_paint_terrain].
builder_ownerPropertyContext for [method report_precondition_failure]. Bundles the report's owner, the build type, the failure message, and the target TileMapLayer so the failure-report factory has a single argument. Owner for the report (PlacementOwner or null).
typePropertyBuild type (SINGLE, DRAG, AREA, TERRAIN).
messagePropertyHuman-readable failure message.
target_mapPropertyTarget TileMapLayer (may be null).
is_ready_to_placeMethod
is_ready_to_paint_terrainMethod
report_precondition_failureMethod
run_buildMethod
managerProperty
builder_ownerProperty
previous_indicatorsProperty
reportProperty
provider_issueProperty
provider_lifecycleProperty
projection_errorProperty
lifecycleProperty
safe_strProperty
placement_validationProperty
diag_errorsProperty
validation_issuesProperty
safe_strProperty
fail_msgProperty