GridTargetingState
Checks if the new target...
Checks if the new target is part of the same object tree as any exclusion Returns true if new_target is a child/descendant of an excluded node This helps detect when TargetingShapeCast2D detects a different node of the same logical object
Version: v5.0.0
Inherits: GBResource
Source: grid_targeting_state.gd
Parsing: AST-based for maximum accuracy with symbol typing
Variables
_owner_context: GBOwnerContext
References the user root that serves as the origin for this targeting state
Type: GBOwnerContext
target: Node2D
The placed node currently being targeted
Type: Node2D
positioner: Node2D
Parent node for positioning grid building objects onto the game world.
Type: Node2D
target_map: TileMapLayer
You could think of this as the main map node usually where characters stand on
Type: TileMapLayer
maps: Array[TileMapLayer]:
You can exclude any purely cosmetic maps that shouldn’t have gameplay impacts.
Type: Array[TileMapLayer]:
tile_size:
Tile size property that delegates to the target map’s tile set
collision_exclusions:
auto-clear when manipulation ends.
is_manual_targeting_active:
Set via set_manual_target() and cleared via clear_manual_target().
_target_signal_connected: bool
This avoids warnings during dependency injection timing when target_map is set but positioner isn’t yet
Type: bool
Default: false
Signals
ready_changed(value : bool: Variant)
Emitted when the readiness status of the state has changed - usually after successful validation.
Parameters:
value : bool: Variant
target_changed(new : Node2D: Variant, old : Node2D: Variant)
NOTE: Typically target is set by a TargetingShapeCast2D or similar casting node from the runtime scene
Parameters:
new : Node2D: Variantold : Node2D: Variant
positioner_changed(positioner : Node2D: Variant)
Emitted when the node responsible for positioning grid building placement objects and indicators is changed on the BuildingState.
Parameters:
positioner : Node2D: Variant
target_map_changed(target_map : TileMapLayer: Variant)
This represents the main target TileMapLayer node on the state.
Parameters:
target_map : TileMapLayer: Variant
maps_changed(maps : Array[TileMapLayer]: Variant)
for any collision check calls.
Parameters:
maps : Array[TileMapLayer]: Variant
Methods
_init
Signature: _init(p_owner_context : GBOwnerContext: Variant) -> void
Returns: void
Parameters:
p_owner_context : GBOwnerContext: Variant
is_ready
Signature: is_ready() -> bool
Returns true if the targeting state has all runtime requirements met for operation
Returns: bool
clear_collision_exclusions
Signature: clear_collision_exclusions() -> void
but can also be called manually when ending manipulation operations.
Returns: void
set_manual_target
Signature: set_manual_target(p_target: Node2D) -> void
[param p_target] The node to manually target, or null to clear manual targeting
Returns: void
Parameters:
p_target: Node2D
clear_manual_target
Signature: clear_manual_target() -> void
Note: Does NOT clear the target node itself - only disables the manual targeting flag.
Returns: void
set_map_objects
Signature: set_map_objects(p_target_map: TileMapLayer, p_maps: Array[TileMapLayer]: Variant) -> void
Sets the target map and maps array for this targeting state
Returns: void
Parameters:
p_target_map: TileMapLayerp_maps: Array[TileMapLayer]: Variant
get_target_map_tile_shape
Signature: get_target_map_tile_shape() -> TileSet
Get the shape of the currently targeted TileMapLayer’s tileset tiles
Returns: TileSet
get_target_map_tile_set
Signature: get_target_map_tile_set() -> TileSet
Gets the tileset of the currently targeted TileMapLayer
Returns: TileSet
get_tile_size
Signature: get_tile_size() -> Vector2i
Gets the tile size from the target map’s tile set
Returns: Vector2i
set_tile_size
Signature: set_tile_size(size: Vector2i) -> void
Sets the tile size on the target map’s tile set
Returns: void
Parameters:
size: Vector2i
validate_runtime
Signature: validate_runtime(logger: GBLogger = null) -> bool
and logs any issues found
Returns: bool
Parameters:
logger: GBLogger(optional, default:null)
get_owner
Signature: get_owner() -> Node
Returns: Node
get_owner_root
Signature: get_owner_root() -> Node
Returns: Node
get_origin
Signature: get_origin() -> Node
[return] The origin node provided by the owner context or null when unavailable.
Returns: Node
_revalidate_on_change
Signature: _revalidate_on_change() -> void
Internal: Re-validate when critical properties change so ‘ready’ flips to true at the right time.
Returns: void
get_editor_issues
Signature: get_editor_issues() -> Array
Returns an array of issues found during editor validation
Returns: Array
get_runtime_issues
Signature: get_runtime_issues() -> Array
Checks the minimum setup dependencies for the state.
Returns: Array
_disconnect_target_signal
Signature: _disconnect_target_signal() -> void
Disconnects the tree_exiting signal from the current target (if connected)
Returns: void
_on_target_tree_exiting
Signature: _on_target_tree_exiting() -> void
Called when the current target is about to exit the scene tree
Returns: void
_is_same_context_update
Signature: _is_same_context_update(new_target: Node2D) -> bool
This helps detect when TargetingShapeCast2D detects a different node of the same logical object
Returns: bool
Parameters:
new_target: Node2D