Grid Placement

GridTargetingState

AUTO-GENERATED FILE — DO NOT EDIT MANUALLY

Source: systems/grid_targeting/grid_targeting_state.gd

Version: 5.0

class_name: GridTargetingState extends: GBResource

Summary

State for targeting objects within the Grid Building System.

Signals

  • ready_changed
    • Emitted when the readiness status of the state has changed - usually after successful validation.
  • target_changed
    • Emitted when the target node for the state is changed.

NOTE: Typically target is set by a TargetingShapeCast2D or similar casting node from the runtime scene

  • positioner_changed
    • Emitted when the node responsible for positioning grid building placement objects and indicators is changed on the BuildingState.
  • target_map_changed
    • Emitted when the targeted map node is changed. This represents the main target TileMapLayer node on the state.
  • maps_changed
    • Emitted when the list of known maps is changed.[br][br] This is a list of maps that can be accessed without the need for any collision check calls.

Exports

(none)

Methods

  • _init()
  • is_ready()
    • Returns true if the targeting state has all runtime requirements met for operation
  • clear_collision_exclusions()
    • Clears the collision exclusion list. This is called automatically when the target changes (and manipulation is not active), but can also be called manually when ending manipulation operations.
  • set_manual_target()
    • Sets a manual target and prevents automatic targeting updates. This prevents automatic targeting systems (like TargetingShapeCast2D) from overwriting the manually-set target. Used during:
  • BUILD mode: Locks preview as target
  • MOVE mode: Locks manipulation copy as target

If p_target is null, clears manual targeting mode (equivalent to clear_manual_target()). Otherwise, enables manual targeting and assigns the target.

[param p_target] The node to manually target, or null to clear manual targeting

  • clear_manual_target()
    • Clears manual targeting mode and resumes automatic targeting. Call this when BUILD or MOVE mode ends to allow TargetingShapeCast2D to automatically update the target again. Note: Does NOT clear the target node itself - only disables the manual targeting flag.
  • set_map_objects()
    • Sets the target map and maps array for this targeting state
  • get_target_map_tile_shape()
    • Get the shape of the currently targeted TileMapLayer’s tileset tiles
  • get_target_map_tile_set()
    • Gets the tileset of the currently targeted TileMapLayer
  • get_tile_size()
    • Gets the tile size from the target map’s tile set
  • set_tile_size()
    • Sets the tile size on the target map’s tile set
  • validate_runtime()
    • Ensures that the targeting state is ready for runtime operation and logs any issues found
  • get_owner()
  • get_owner_root()
  • get_origin()
    • Returns the origin node associated with this targeting state. [return] The origin node provided by the owner context or null when unavailable.
  • _revalidate_on_change()
    • Internal: Re-validate when critical properties change so ‘ready’ flips to true at the right time.
  • get_editor_issues()
    • Returns an array of issues found during editor validation
  • get_runtime_issues()
    • Should be called AFTER necessary properties on the state have been set Checks the minimum setup dependencies for the state.
  • _disconnect_target_signal()
    • Disconnects the tree_exiting signal from the current target (if connected)
  • _on_target_tree_exiting()
    • Called when the current target is about to exit the scene tree
  • _is_same_context_update()
    • 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