Chris' Tutorials
Docs/Grid Placement

Class

GridPositioner2D

Generated GDScript class reference for GridPlacement.GridPositioner2D.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

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

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.

Controls the on-grid cursor used by building/interaction systems. Responsibilities:

  • Recenter according to GridTargetingSettings policy when input/mode is enabled
  • Follow mouse/keyboard input to update on-grid position
  • STRICTLY for tile center targeting
  • does NOT handle rotation or manipulation Targeting separation: Target acquisition/collision detection is handled by dedicated components (e.g., TargetingShapeCast2D). GridPositioner2D no longer depends on or manages any shapecast component. Manipulation separation: Object rotation, flipping, and manipulation are handled by ManipulationParent. GridPositioner2D focuses solely on positioning the targeting cursor at tile centers. Dependency Injection: resolve_placement_dependencies(container) is the standard method called by PlacementInjectorSystem to inject dependencies. This is the primary integration pattern for runtime use. set_dependencies(...) is an internal helper for testing and advanced use cases.

Source: addons/grid_placement/systems/grid_targeting/grid_positioner/grid_positioner_2d.gd

Syntax

class GridPositioner2D extends Node2D

Members

NameKindSummary
sessionPropertyHost pattern (canonical): the [PlacementSession] this positioner pulls its dependencies from. When set, [method _ready] self-configures and registers with the nearest [GridPlacementHost] for input routing. Leave null to use the deprecated injector pattern.
LOG_PREFIXField
set_targeting_stateMethod
cursor_sourcePropertyInjected cursor-source callable. Returns a [Vector2] screen position. If the callable returns [code]null[/code], or if [member cursor_source] is not set, falls back to the real viewport mouse position. Tests inject a callable that returns a fixed Vector2 for deterministic positioning. Usage in tests: positioner.cursor_source = func(): return Vector2(100, 100)
input_processing_enabledPropertyPublic flag & API for enabling/disabling input processing (used by tests)
expected_visProperty
mode_nowProperty
reconcileProperty
tick_resProperty
set_input_processing_enabledMethod
was_enabledProperty
is_input_processing_enabledMethod
is_input_readyMethod
are_dependencies_readyMethod
resolve_placement_dependenciesMethod
hostProperty
parentProperty
foundProperty
ancestorProperty
resultProperty
motionProperty
current_modeProperty
key_eventProperty
tile_changeProperty
input_allowedProperty
vis_resultProperty
world_posProperty
target_tileProperty
viewportProperty
mapProperty
cached_tileProperty
vpProperty
mouse_screen_posProperty
vp_rectProperty
mouse_allowedProperty
disabled_in_off_modeProperty
viewport_availableProperty
decisionProperty
input_readyProperty
mouse_globalProperty
vpProperty
screen_posProperty
target_tileProperty
mapProperty
current_tileProperty
target_tileProperty
move_to_viewport_center_tileMethod
vpProperty
result_tileProperty
fallback_tileProperty
result_tileProperty
move_to_cursor_center_tileMethod
world_positionProperty
vpProperty
screen_posProperty
target_tileProperty
result_tileProperty
modeProperty
get_last_manual_recenter_modeMethod
hostProperty
remove_self_as_positionerMethod
update_visibilityMethod
should_be_visibleMethod
set_dependenciesMethod
was_input_enabledProperty
get_runtime_issuesMethod
issuesProperty
validate_dependenciesMethod
issuesProperty
get_visual_nodeMethod
is_visual_visibleMethod
old_selfProperty
visualProperty
had_visualProperty
old_visual_visible_strProperty
stackProperty
stack_summaryProperty
traceProperty
last_mouseProperty
mouse_infoProperty

Source

addons/grid_placement/systems/grid_targeting/grid_positioner/grid_positioner_2d.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs