Class GridPlacementHost
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Host orchestrator for the Grid Building plugin.\n\nOne Node, one _unhandled_input, many RefCounted services. This is the 6.0.0-S Phase 2 host-collapse endpoint: PlacementSystem, ManipulationSystem, GridTargetingSystem, and the injector will all delegate here (or be replaced by this) in the host-collapse phases.\n\nCurrent scope (Phase 2, 2026-06-14): the host is INTRODUCED but does not yet replace any existing system node. It exists as a scene-free skeleton that: - Owns the service instances (RefCounted). - Has a single _unhandled_input routed through PlacementInputHandler. - Has leaf-adapter slots (@export Node vars) for the in-tree adapters that need the scene tree (positioner, shape cast, terrain preview, indicator manager). - Verifies via a unit test that the host constructs, configures, and survives a real InputEventAction dispatch.\n\nPhase 3 (separate task): wire the host into PlacementSystem, route PlacementSystem's _unhandled_input through the host, collapse the ManipulationSystem and GridTargetingSystem nodes, and add the per-controller session registry (split-screen contract).
class GridPlacementHost extends Node
Properties
dimensions
Grid dimension mode: Dimensions.DIMENSIONS_2D (default) or Dimensions.DIMENSIONS_3D (opt-in). When set to DIMENSIONS_3D the host routes targeting to [GridMap] instead of [TileMapLayer].
@export var dimensions: int = 0
selected_terrain_name
Currently selected terrain name for terrain-paint dispatch. Set by external code (e.g. PlacementSystem or UI) before the host dispatches PLACE_SINGLE_TERRAIN, START_TERRAIN_DRAG, etc. When empty, terrain dispatch is a no-op.
var selected_terrain_name: StringName = &""
positioner
var positioner = targeting.positioner
targeting_shape_cast
In-tree adapter: targeting shape cast for cursor hit-testing.
@export var targeting_shape_cast: TargetingShapeCast2D
terrain_preview
In-tree adapter: terrain preview (TileMapLayer overlay).
@export var terrain_preview: TerrainPreview
indicator_manager
In-tree adapter: indicator manager (child of ManipulationParent, hosts the RuleCheckIndicator pool).
@export var indicator_manager: IndicatorManager
keys_to_erase
var keys_to_erase: Array = []
controller
var controller: Node = ref.get_ref()
devices_to_erase
var devices_to_erase: Array = []
ref
var ref: WeakRef = _device_to_controller[device]
ref
var ref: WeakRef = _device_to_controller[device]
controller
var controller: Node = ref.get_ref()
sessions
var sessions: Array[PlacementSession] = []
keys_to_erase
var keys_to_erase: Array = []
devices_to_erase
var devices_to_erase: Array = []
ref
var ref: WeakRef = _device_to_controller[device]
targeting_settings
var targeting_settings: GridTargetingSettings = _get_targeting_settings()
path_manager
var path_manager: PlacementAStarPathManager
target_map
var target_map = targeting.target_map
manip_settings
var manip_settings: ManipulationSettings = _get_manipulation_settings()
actions
var actions: PlacementActions = _get_actions()
indicator_ctx
var indicator_ctx: IndicatorContext = _get_indicator_context()
drag_container
var drag_container = PlacementContainer.new()
actions
var actions: PlacementActions = _get_actions()
session
var session = _active_session if _active_session else get_session()
issues
var issues: Array[String] = []
session
var session = _active_session if _active_session else get_session()
targeting_issues
var targeting_issues: Array[String] = _grid_targeting_service.get_runtime_issues()
refund_issues
var refund_issues = _refund_service.get_runtime_issues()
drag_issues
var drag_issues = _drag_service.get_runtime_issues()
session
var session = _active_session if _active_session else get_session()
states
var states = session.states
pos
var pos: GridPositioner2D = states.targeting.positioner
building
var building = states.building if states else null
has_placeable
var has_placeable: bool = building != null and building.preview != null
has_terrain
var has_terrain: bool = _place_machine != null and _place_machine.is_painting_terrain()
mode
var mode: int = states.mode.current if states and states.mode else PlacementEnums.Mode.OFF
intent
var intent: PlacementInputHandler.InputIntent = _input_handler.resolve(
drag_cells
var drag_cells = _brush_coordinator.complete_terrain_brush_dry()
cell
var cell = _get_positioner_cell()
demolish_cell
var demolish_cell = _get_positioner_cell()
line_cell
var line_cell = _get_positioner_cell()
session
var session = _active_session if _active_session else get_session()
session
var session = _active_session if _active_session else get_session()
session
var session = _active_session if _active_session else get_session()
session
var session = _active_session if _active_session else get_session()
session
var session = _active_session if _active_session else get_session()
session
var session = _active_session if _active_session else get_session()
targeting
var targeting = session.states.targeting
target_map
var target_map = targeting.target_map
positioner
var positioner = targeting.positioner
Methods
register_session
func register_session(p_controller: Node, p_session: PlacementSession, p_device: int = -1) -> void:
Parameters
p_controllerp_sessionp_device
Returns
unregister_session
func unregister_session(p_controller: Node) -> void:
Parameters
p_controller
Returns
get_session_for_controller
func get_session_for_controller(p_controller: Node) -> PlacementSession:
Parameters
p_controller
Returns
get_active_sessions
func get_active_sessions() -> Array[PlacementSession]:
Returns
get_session_registry_count
func get_session_registry_count() -> int:
Returns
configure
func configure(p_session: PlacementSession) -> void:
Parameters
p_session
Returns
is_ready
func is_ready() -> bool:
Returns
get_runtime_issues
func get_runtime_issues() -> Array[String]:
Returns
get_session
func get_session() -> PlacementSession:
Returns
get_input_handler
func get_input_handler() -> PlacementInputHandler:
Returns
get_place_machine
func get_place_machine() -> PlaceModeMachine:
Returns
get_terrain_service
func get_terrain_service() -> TerrainPlacementService:
Returns
get_manipulation_service
func get_manipulation_service() -> ManipulationService:
Returns
get_grid_targeting_service
func get_grid_targeting_service() -> GridTargetingService:
Returns
get_brush_coordinator
func get_brush_coordinator() -> BrushCoordinator:
Returns
get_refund_service
func get_refund_service() -> RefundService:
Returns
get_drag_service
func get_drag_service() -> DragService: