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 Node2DMembers
| Name | Kind | Summary |
|---|---|---|
session | Property | Host 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_PREFIX | Field | |
set_targeting_state | Method | |
cursor_source | Property | Injected 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_enabled | Property | Public flag & API for enabling/disabling input processing (used by tests) |
expected_vis | Property | |
mode_now | Property | |
reconcile | Property | |
tick_res | Property | |
set_input_processing_enabled | Method | |
was_enabled | Property | |
is_input_processing_enabled | Method | |
is_input_ready | Method | |
are_dependencies_ready | Method | |
resolve_placement_dependencies | Method | |
host | Property | |
parent | Property | |
found | Property | |
ancestor | Property | |
result | Property | |
motion | Property | |
current_mode | Property | |
key_event | Property | |
tile_change | Property | |
input_allowed | Property | |
vis_result | Property | |
world_pos | Property | |
target_tile | Property | |
viewport | Property | |
map | Property | |
cached_tile | Property | |
vp | Property | |
mouse_screen_pos | Property | |
vp_rect | Property | |
mouse_allowed | Property | |
disabled_in_off_mode | Property | |
viewport_available | Property | |
decision | Property | |
input_ready | Property | |
mouse_global | Property | |
vp | Property | |
screen_pos | Property | |
target_tile | Property | |
map | Property | |
current_tile | Property | |
target_tile | Property | |
move_to_viewport_center_tile | Method | |
vp | Property | |
result_tile | Property | |
fallback_tile | Property | |
result_tile | Property | |
move_to_cursor_center_tile | Method | |
world_position | Property | |
vp | Property | |
screen_pos | Property | |
target_tile | Property | |
result_tile | Property | |
mode | Property | |
get_last_manual_recenter_mode | Method | |
host | Property | |
remove_self_as_positioner | Method | |
update_visibility | Method | |
should_be_visible | Method | |
set_dependencies | Method | |
was_input_enabled | Property | |
get_runtime_issues | Method | |
issues | Property | |
validate_dependencies | Method | |
issues | Property | |
get_visual_node | Method | |
is_visual_visible | Method | |
old_self | Property | |
visual | Property | |
had_visual | Property | |
old_visual_visible_str | Property | |
stack | Property | |
stack_summary | Property | |
trace | Property | |
last_mouse | Property | |
mouse_info | Property |
Source
addons/grid_placement/systems/grid_targeting/grid_positioner/grid_positioner_2d.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs