GBAStarPathManager

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Manage configuration and path queries for AStarGrid2D instances used by grid targeting.

Source File: addons/grid_building/systems/grid_targeting/runtime/gb_astar_path_manager.gd

Extends: RefCounted

Private Properties

  • Property: _grid: AStarGrid2D = AStarGrid2D.new() (private)
  • Property: _settings: [GridTargetingSettings](./grid-targeting-settings/) (private)
  • Property: _last_region: Rect2i = Rect2i() (private)

Public Methods

get_grid

1
get_grid() -> AStarGrid2D

Return the managed AStarGrid2D instance. [return] The active AStarGrid2D.


set_grid

1
set_grid(grid: AStarGrid2D) -> bool

Replace the managed AStarGrid2D instance. grid Grid to adopt; when null, a new AStarGrid2D is allocated.


configure

1
configure(settings: GridTargetingSettings) -> void

Configure the manager using targeting settings and optional logger. settings Targeting settings that drive grid configuration.


on_region_size_changed

1
on_region_size_changed(size: Vector2i) -> void

Respond to a region size change event from GridTargetingSettings. size New region size to apply.


on_diagonal_mode_changed

1
on_diagonal_mode_changed(mode: AStarGrid2D.DiagonalMode) -> void

Respond to a diagonal mode change. mode New diagonal mode.


on_default_compute_heuristic_changed

1
on_default_compute_heuristic_changed(heuristic: AStarGrid2D.Heuristic) -> void

Respond to a compute heuristic change. heuristic New compute heuristic.


on_default_estimate_heuristic_changed

1
on_default_estimate_heuristic_changed(heuristic: AStarGrid2D.Heuristic) -> void

Respond to an estimate heuristic change. heuristic New estimate heuristic.


on_cell_shape_changed

1
on_cell_shape_changed(shape: AStarGrid2D.CellShape) -> void

Respond to a cell shape change. shape New cell shape.


update_region

1
update_region(map: TileMapLayer) -> void

Update the cached region bounds from the provided map. map Tile map the positioner operates on.


update_if_dirty

1
update_if_dirty() -> void

Update the managed grid when marked dirty.


resolve_target_tile

1
2
3
4
5
6
resolve_target_tile(
    source: Node2D,
    target_tile: Vector2i,
    map: TileMapLayer,
    settings_override: GridTargetingSettings = null
) -> Vector2i

Resolve the desired target tile by applying region refresh and limiting rules. source Node whose tile acts as the origin for adjacency limits. target_tile Desired destination tile. map Tile map providing region bounds. settings_override Optional settings override used during limiting. [return] Tile clamped to region and adjacency limits.


get_closest_valid_tile

1
2
3
4
5
6
get_closest_valid_tile(
    requested_tile: Vector2i,
    source: Node2D,
    map: TileMapLayer,
    settings_override: GridTargetingSettings = null
) -> Vector2i

Public facade: return the closest valid tile given a requested tile and a source node. This consolidates adjacency & region logic in one place for callers.


limit_tile_to_max_distance

1
2
3
4
5
6
limit_tile_to_max_distance(
    source: Node2D,
    target_tile: Vector2i,
    map: TileMapLayer,
    settings_override: GridTargetingSettings = null
) -> Vector2i

Limit the desired tile so it does not exceed the configured max distance from the source node. source Node whose tile is used as the origin for distance checks. target_tile Desired tile to clamp. map Map used for conversions and fallback region data. settings_override Optional override for targeting settings. [return] Tile respecting adjacency and region limits.


Private Methods

_init

1
2
3
4
_init(
    settings: GridTargetingSettings,
    p_target_map: TileMapLayer
) -> void

Flags: private

Optionally configure dependencies during construction. settings Targeting settings to apply immediately.


_apply_settings

1
_apply_settings() -> void

Flags: private

Apply the current settings to the managed grid, updating key heuristics and region.


_update_region_from_settings

1
_update_region_from_settings() -> void

Flags: private

Update the grid region using the targeting settings region_size.


_limit_using_astar

1
2
3
4
5
6
_limit_using_astar(
    source_tile: Vector2i,
    target_tile: Vector2i,
    max_steps: int,
    region: Rect2i
) -> Variant

Flags: private


_limit_via_step

1
2
3
4
5
6
7
_limit_via_step(
    current_tile: Vector2i,
    target_tile: Vector2i,
    max_steps: int,
    diagonal_mode: int,
    region: Rect2i
) -> Vector2i

Flags: private


_step_toward

1
2
3
4
5
_step_toward(
    current: Vector2i,
    target: Vector2i,
    diagonal_mode: int
) -> Vector2i

Flags: private


_sample_tile_from_node

1
2
3
4
_sample_tile_from_node(
    node: Node2D,
    map: TileMapLayer
) -> Vector2i

Flags: private