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 RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
is_active | Property | Snapshot 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_degrees | Property | Logical rotation in degrees (sprite-swap aware). 0.0 when inactive. |
cardinal | Property | Nearest cardinal facing derived from [member rotation_degrees]. |
flipped_horizontally | Property | Horizontal mirror state (negative scale.x). |
flipped_vertically | Property | Vertical mirror state (negative scale.y). |
active_target | Property | The root node being manipulated, or null. |
mode | Property | Snapshot 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_placeable | Property | True when a placeable is selected for building. |
selected_placeable_id | Property | The selected placeable's id, or an empty StringName. |
has_terrain | Property | True when a terrain is selected for painting. |
selected_terrain_name | Property | The selected terrain's name, or an empty StringName. |
has_preview | Property | True when a placement preview instance currently exists. |
last_dispatch | Property | The 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_success | Property | Convenience: True when [member last_dispatch] exists and reports success. |
last_action_issues | Property | Convenience: issues from [member last_dispatch], empty when no dispatch. |
mode | Property | Snapshot of targeting/positioner state (current cell, map, manual targeting). Read via [method read_targeting]. Current placement mode. |
positioner_cell | Property | The 2D cell under the positioner, or [constant Vector2i.ZERO] when unresolved. |
positioner_cell_3d | Property | The 3D cell under the positioner, or [constant Vector3i.ZERO] when unresolved. |
has_target_map | Property | True when a 2D target map is wired. |
is_manual_targeting | Property | True while a build preview / move copy is driving manual targeting. |
read_manipulation | Method | |
snap | Property | |
manip | Property | |
parent | Property | |
read_placement_action | Method | |
snap | Property | |
read_targeting | Method | |
snap | Property | |
targeting | Property | |
mode_state | Property |