Skip to content
ct

Class

PlacementTelemetry

Generated GDScript class reference for GridPlacement.PlacementTelemetry.

Status
Draft
Version
v6.0
Updated
Development docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Read-only telemetry surface for placement/manipulation state. Centralizes "how do I read placement state for a test assertion?" into one place so tests and diagnostics do not reach into private fields or re-derive map math. Each reader returns an immutable snapshot struct; tests assert against the snapshot fields. The readers are null-safe: pass whatever you have (session and/or host) and the snapshot fields default to "empty" values when the underlying state is missing — so a test can distinguish "no manipulation active" from "rotation is zero" by checking [member ManipulationSnapshot.is_active]. Usage: [codeblock] var snap := PlacementTelemetry.read_manipulation(session) assert_int(snap.cardinal).is_equal(PlacementGridRotationUtils.CardinalDirection.EAST) var action := PlacementTelemetry.read_placement_action(session) assert_bool(action.last_report_success).is_true() [/codeblock] See the 6.0 testing-overhaul issue (#592) for the motivation: regressions like #584/#585/#586 slipped through because tests could not easily observe placement state. This class closes that gap.

Source: addons/grid_placement/telemetry/placement_telemetry.gd

Syntax

class PlacementTelemetry extends RefCounted

Members

NameKindSummary
is_activePropertySnapshot of the active manipulation transform (rotation, flip, target). Read via [method read_manipulation]. True when a [ManipulationParent] is wired and a target is under manipulation.
rotation_degreesPropertyLogical rotation in degrees (sprite-swap aware). 0.0 when inactive.
cardinalPropertyNearest cardinal facing derived from [member rotation_degrees].
flipped_horizontallyPropertyHorizontal mirror state (negative scale.x).
flipped_verticallyPropertyVertical mirror state (negative scale.y).
active_targetPropertyThe root node being manipulated, or null.
modePropertySnapshot of placement/build state for the current selection + last action. Read via [method read_placement_action]. Current placement mode (OFF/INFO/BUILD/MOVE/DEMOLISH/PLACE).
has_placeablePropertyTrue when a placeable is selected for building.
selected_placeable_idPropertyThe selected placeable's id, or an empty StringName.
has_terrainPropertyTrue when a terrain is selected for painting.
selected_terrain_namePropertyThe selected terrain's name, or an empty StringName.
has_previewPropertyTrue when a placement preview instance currently exists.
last_dispatchPropertyThe last host dispatch result, or null when no action has dispatched. This is the canonical "what just happened" surface — same object the host tests assert against via [method GridPlacementHost.get_last_dispatch_result].
last_action_successPropertyConvenience: True when [member last_dispatch] exists and reports success.
last_action_issuesPropertyConvenience: issues from [member last_dispatch], empty when no dispatch.
modePropertySnapshot of targeting/positioner state (current cell, map, manual targeting). Read via [method read_targeting]. Current placement mode.
positioner_cellPropertyThe 2D cell under the positioner, or [constant Vector2i.ZERO] when unresolved.
positioner_cell_3dPropertyThe 3D cell under the positioner, or [constant Vector3i.ZERO] when unresolved.
has_target_mapPropertyTrue when a 2D target map is wired.
is_manual_targetingPropertyTrue while a build preview / move copy is driving manual targeting.
read_manipulationMethod
snapProperty
manipProperty
parentProperty
read_placement_actionMethod
snapProperty
read_targetingMethod
snapProperty
targetingProperty
mode_stateProperty