GridTargetingSystem
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/grid_targeting/grid_targeting_system.gd
Version: 5.0
class_name: GridTargetingSystem
extends: GBSystem
Summary
Orchestrates grid targeting dependencies (state, settings, path manager, position mover).
Provides a single injection point for GridTargeting/Settings/PathManager, owns the shared AStar grid manager, and exposes runtime APIs for other systems (placement, manipulation) to validate targeting readiness or request tile movements. Scene nodes such as GridPositioner2D focus on visuals/input, while this system keeps configuration, validation, and helper delegation centralized.
Signals
astar_grid_changed- Emitted when the AStarGrid2D used by the Grid Targeting System is created or changes
Exports
(none)
Methods
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.
_init()_input()- Move the positioner to the center of the mouse tile over where the mouse is [br][br]
NOTE: Positioner updates are now handled by GridPositioner2D
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.[br][br] [code]p_target_tile[/code]: [i]Vector2i[/i] - Desired tile location to move to[br] [code]p_positioner[/code]: [i]Node2D[/i] - Node to move to the target position[br] [code]p_source[/code]: [i]Node2D[/i] - 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.[br][br] [code]p_node[/code]: [i]Node2D[/i] - Node to move to the tile position[br] [code]p_tile[/code]: [i]Vector2[/i] - 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.[br][br] [code]p_global_position[/code]: [i]Vector2[/i] - Global position to convert to tile coordinates[br] [code]p_map[/code]: [i]Node2D[/i] - TileMap or TileMapLayer to use for coordinate conversion
update_astar_grid_2d()- Updates an AStarGrid2D according to a set of GridTargetingSettings.[br][br] [code]p_astar[/code]: [i]AStarGrid2D[/i] - AStar grid to configure[br] [code]p_targeting_settings[/code]: [i]GridTargetingSettings[/i] - Settings to apply to the AStar grid
_on_validator_valid_changed()_on_mode_changed()_subscribe_targeting_settings()- Subscribe to all needed signals
_on_settings_changed()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).
_unsubscribe_targeting_settings()_get_target_map()_are_dependencies_resolved()- Private helper to check if all required dependencies are resolved.[br][br] [code]return[/code]: [i]bool[/i] - True if dependencies are available, false otherwise
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