GridTargetingSystem

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Orchestrates grid targeting dependencies (state, settings, path manager, position mover).

Source File: addons/grid_building/systems/grid_targeting/grid_targeting_system.gd

Extends: GBSystem

Signals

  • Signal: astar_grid_changed(astar_grid : AStarGrid2D) - Emitted when the AStarGrid2D used by the Grid Targeting System is created or changes

Properties

  • Property: target_tile : Vector2 - The tile location where the mouse is currently hovering over represented as X / Y values of the _targeting_state.target_map
  • Property: ui_mouse_handled : bool = false - Whether the mouse input was consumed by GUI already or not (renamed from mouse_handled)
  • Property: astar_grid : AStarGrid2D = null

Private Properties

  • Property: _logger: [GBLogger](./gb-logger/) (private)
  • Property: _path_manager: [GBAStarPathManager](./gba-star-path-manager/) (private)
  • Property: _systems_context : [GBSystemsContext](./gb-systems-context/) (private) - Contains the current values for targeting _targeting_state related properties
  • Property: _targeting_state : [GridTargetingState](./grid-targeting-state/) (private)
  • Property: _targeting_settings : [GridTargetingSettings](./grid-targeting-settings/) (private)
  • Property: _mode_state : [ModeState](./mode-state/) (private)

Public Methods

create_with_injection

1
2
3
4
create_with_injection(
    p_parent : Node,
    container: GBCompositionContainer
) -> GridTargetingSystem

Flags: static

Creates a GridTargetingSystem with dependency injection from container.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

Validates that all required dependencies are properly set. Returns list of validation issues (empty if valid).


get_state

1
get_state() -> GridTargetingState

Compatibility accessor for older tests expecting get_state(). Returns the underlying GridTargetingState used by this system.


resolve_gb_dependencies

1
resolve_gb_dependencies(p_container : GBCompositionContainer) -> void

move_node_to_closest_valid_tile

1
2
3
4
5
move_node_to_closest_valid_tile(
    p_target_tile : Vector2i,
    p_positioner : Node2D,
    p_source : Node2D
) -> Error

Move the positioner to adjust the shown position of any visual _targeting_settings elements. If limit_to_adjacent setting is on, the closest valid target will be limited by the p_source position and the max_tiles_distance.

p_target_tile: Vector2i - Desired tile location to move to

p_positioner: Node2D - Node to move to the target position

p_source: Node2D - Source node for distance calculations when limit_to_adjacent is enabled


move_to_tile

1
2
3
4
move_to_tile(
    p_node : Node2D,
    p_tile : Vector2
) -> Error

Moves a target node to the center snapped position of a p_tile on the _targeting_state.target_map.

p_node: Node2D - Node to move to the tile position

p_tile: Vector2 - Tile coordinates to move to


get_tile_from_global_position

1
2
3
4
get_tile_from_global_position(
    p_global_position : Vector2,
    p_map : Node2D
)

Returns the tile on the p_tile_map where the mouse is currently hovering over.

p_global_position: Vector2 - Global position to convert to tile coordinates

p_map: Node2D - TileMap or TileMapLayer to use for coordinate conversion


update_astar_grid_2d

1
2
3
4
update_astar_grid_2d(
    p_astar : AStarGrid2D,
    p_targeting_settings : GridTargetingSettings
)

Updates an AStarGrid2D according to a set of GridTargetingSettings.

p_astar: AStarGrid2D - AStar grid to configure

p_targeting_settings: GridTargetingSettings - Settings to apply to the AStar grid


validate_and_log_issues

1
validate_and_log_issues() -> Array[String]

Public manual validation entry point for host projects. Runs get_runtime_issues() and logs issues without relying on timed warnings. Returns the list of issues (empty when valid).


validate_ready

1
validate_ready() -> bool

get_targeting_issues

1
get_targeting_issues() -> Array[String]

Gets issues that would prevent the targeting_system from being able to target. This should be called after grid targeting state properties have all been defined


Private Methods

_input

1
_input(event: InputEvent) -> void

Flags: private

Move the positioner to the center of the mouse tile over where the mouse is

NOTE: Positioner updates are now handled by GridPositioner2D


_on_validator_valid_changed

1
_on_validator_valid_changed(is_valid : bool)

Flags: private


_on_mode_changed

1
_on_mode_changed(p_mode : GBEnums.Mode)

Flags: private


_subscribe_targeting_settings

1
_subscribe_targeting_settings()

Flags: private

Subscribe to all needed signals


_on_settings_changed

1
_on_settings_changed() -> void

Flags: private


_unsubscribe_targeting_settings

1
_unsubscribe_targeting_settings()

Flags: private


_get_target_map

1
_get_target_map() -> TileMapLayer

Flags: private


_are_dependencies_resolved

1
_are_dependencies_resolved() -> bool

Flags: private

Private helper to check if all required dependencies are resolved.

return: bool - True if dependencies are available, false otherwise