Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.
Primary composition-root for the Grid Building placement system. PlacementSession is a Resource that holds all states, contexts, settings, and the entry catalog in a single object. It maps 1:1 onto the C# [code]IPlacementSession[/code] surface, enabling:
- Scene-free, code-driven testing (construct a Session, pass it to systems)
- Code-built placement without a scene tree injector
- Single-source-of-truth composition for both the injector path (scene-composed games) and the explicit path (libraries/tools) Usage: [codeblock] # Explicit path (code-built, no injector): var session := PlacementSession.new() session.catalog = preload("res://catalog.tres") session.settings = preload("res://settings.tres") var system := PlacementSystem.create_with_session(session) # Injector path (scene-composed, existing flow): container.session = session # container delegates to session [/codeblock]
Source: addons/grid_placement/resources/placement_session.gd
Syntax
class PlacementSession extends ResourceMembers
| Name | Kind | Summary |
|---|---|---|
grid_placement_bundle | Property | Configuration resource for the grid building system. When set, [method get_settings], [method get_templates], [method get_actions], [method get_debug_settings], [method get_runtime_checks], and other config-layer accessors read through this resource. This is the scene-composed on-ramp: editor-authored [code].tres[/code] files assign a [GridPlacementBundle] here. |
settings | Property | Main settings configuration resource. When null, [method get_settings] falls back to [member grid_placement_bundle].settings. |
actions | Property | Input action definitions used by host, input, manipulation, and drag services. When null, [method get_actions] falls back to [member grid_placement_bundle].actions. |
catalog | Property | Catalog of available placement entries (objects + terrains). |
states | Property | Shared states for plugin systems. |
contexts | Property | Context for resolving references to current objects. |
terrain_selected | Event | Emitted when [member selected_terrain_name] changes. The host connects to this signal in [method GridPlacementHost.configure] to enter terrain paint mode automatically when the UI selects a terrain. |
placeable_selected | Event | Emitted when [member selected_placeable] changes. The host connects to this signal for parity with [signal terrain_selected] — drag service, preview builder, and host observers all react to per-session placeable changes without polling the field. |
selected_terrain_name | Property | Runtime terrain selection for this session (NOT serialized — transient per-player state). The terrain palette UI writes the user's pick here; [GridPlacementHost] reads it from the device-resolved active session when dispatching PLACE_SINGLE_TERRAIN / terrain-brush paint. Empty means no terrain is selected and terrain dispatch is a no-op. Keeping it on the session (the one object both the UI and the host already hold) is what lets split-screen sessions each carry their own selection. |
selected_placeable | Property | Runtime placeable selection for this session (NOT serialized — transient per-player state). The placeable UI writes the user's pick here; [GridPlacementHost] reads it from the device-resolved active session when dispatching PLACE_SINGLE_OBJECT / object-drag intents. Null means no placeable is selected and object dispatch is a no-op. Symmetric to [member selected_terrain_name] — this is the object-mode counterpart that fixes the terrain/object cross-leak where a smithy pick drove fence placement. |
logger | Property | Centralized logger instance. Lazily initialized from config.debug when first accessed, so .tres-loaded sessions get the correct log level after [member grid_placement_bundle] is deserialized. |
from_container | Method | |
session | Property | |
get_contexts | Method | |
get_states | Method | |
get_logger | Method | |
ds | Property | |
get_mode_state | Method | |
get_targeting_state | Method | |
get_building_state | Method | |
get_manipulation_state | Method | |
get_placement_rules | Method | |
s | Property | |
get_runtime_issues | Method | |
issues | Property | |
active_states | Property | |
active_contexts | Property | |
get_settings | Method | |
get_actions | Method | |
get_templates | Method | |
get_visual_settings | Method | |
s | Property | |
get_manipulation_settings | Method | |
s | Property | |
get_debug_settings | Method | |
s | Property | |
get_runtime_checks | Method | |
get_indicator_context | Method | |
get_action_history | Method | |
building_state | Property | |
manipulation_state_ref | Property | |
s | Property | |
dump_action_history | Method | |
set_logger | Method | |
set_states | Method | |
ds | Property |
Source
addons/grid_placement/resources/placement_session.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs