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
Flags: static
Creates a GridTargetingSystem with dependency injection from container.
get_runtime_issues
Validates that all required dependencies are properly set. Returns list of validation issues (empty if valid).
get_state
Compatibility accessor for older tests expecting get_state(). Returns the underlying GridTargetingState used by this system.
resolve_gb_dependencies
move_node_to_closest_valid_tile
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
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
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
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
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
get_targeting_issues
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
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
Flags: private
_on_mode_changed
Flags: private
_subscribe_targeting_settings
Flags: private
Subscribe to all needed signals
_on_settings_changed
Flags: private
_unsubscribe_targeting_settings
Flags: private
_get_target_map
Flags: private
_are_dependencies_resolved
Flags: private
Private helper to check if all required dependencies are resolved.
return: bool - True if dependencies are available, false otherwise