Core Classes

Core API reference for core classes in GridBuilding v5-0

Core Classes

This section contains the API reference for all core classes in the GridBuilding v5-0 plugin.

GBAStarPathManager

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

GBActionBar

NOTE: Script now expected to be attached to the internal Buttons HBox inside a PanelContainer wrapper. Root PanelContainer provides background; this HBox preserves previous API assumptions.

GBActionButton

Validates button configuration and dependencies. Returns list of validation issues found.[br][br] [code]return[/code]: [i]Array[String][/i] - List of validation issues (empty if valid)

GBActionLog

Handles mode change events and outputs to action log if enabled

GBActions

Make sure each action is set in the input map

GBAssetResolver

Gets diagnostic information about a folder’s contents

GBCamera2DValidator

Runtime validation for game startup Call this during game initialization to verify setup

GBCameraUtils

Helper to get the center of the camera’s viewport rectangle

GBCollisionTileFilter

[b]Circle tile pruning[/b] Generic pruning based on the distance of the tile center from the circle center. Excludes extreme corner tiles whose centers lie beyond [code]radius + half_tile[/code] allowance. [b]Returns[/b]: bool – [code]true[/code] if the tile is allowed.

GBCompositionContainer

Internal helper to get debug settings without logging (for logger initialization)

GBConfig

Lazy inits sub resources that have not been defined in the Godot inspector.

GBConfigurationValidator

Highly recommended to call this deferred on ready for your main gameplay scene to allow all nodes to be properly added to the scene AND injected by the GBInjectorSystem before validation

GBContexts

Validates editor configuration before nodes are set up. This should be called during the editor setup phase.[br] Returns:[br] [b]Array[String][/b] - List of editor configuration issues (empty if valid)

GBControl

Injectable control for display grid building related information for the owning object.

GBCursorChanger

Optional component for changing the cursors when the grid builder mode state changes.

GBDebugSettings

Get any runtime issues detected for this resource.

GBDiagnostics

Safe wrapper for getting tile position from global position. Handles both TileMapLayer and test objects with duck-typed interface. [param global_position] The world position to convert. [param map] The map object (TileMapLayer or duck-typed equivalent). [return] The tile coordinate as Vector2i, or Vector2i.ZERO if conversion fails.

GBEnums

Convert ProjectionMethod enum to string

GBGameNode

Base class for a node that is attached to gameplay objects for grid building operations

GBGeometryMath

Fallback for square tiles, uses bounding box intersection

GBGeometryUtils

Checks if a tile is covered by a CollisionPolygon2D (using Geometry2D intersection) Returns true if a tile is covered by a CollisionPolygon2D, using intersection area (with epsilon threshold). Useful for strict collision checks between tiles and collision polygons. tile_type: TileSet.TileShape (required) epsilon: minimum intersection area to count as covered (default 0.01)

GBGridRotationUtils

Helper function to set a node’s rotation to achieve a target global rotation [param node] Node2D to rotate [param target_global_rotation] Desired global rotation in radians

GBInjectable

Helper method to manually inject dependencies into this object. Useful when creating RefCounted objects that need injection outside of the normal flow.[br][br] [code]container[/code]: [i]GBCompositionContainer[/i] - The dependency container

GBInjectableFactory

Creates and injects any RefCounted object that implements resolve_gb_dependencies. Generic factory method for objects that follow the injection pattern.[br][br] [code]constructor_args[/code]: [i]Array[/i] - Arguments to pass to the constructor (optional)

GBInjectorSystem

[b]Private helper: Report warnings through direct print or push_warning.[/b][br]

GBLevelContext

Validate setup and return a list of issues with the current object

GBLogger

Change the level of the GBDebugSettings to change how much information is logged

GBManipulationCopyUtils

[code]p_target[/code]: [i]Node[/i] - The node to re-enable

GBMouseInputStatus

Holds the last mouse input gate/projection snapshot for grid-based input systems Provides typed properties and a convenience serializer to Dictionary

GBNode

Abstract method to resolve dependencies for a given GBCompositionContainer. This method should be overridden in derived classes to implement specific dependency resolution logic.

GBNode2D

Use this base for Node2D-derived components that are part of plugin systems, so they receive consistent DI and lifecycle behavior expected across the project.

GBObjectUtils

Gets a readable display name for a Node, with optional fallback and custom callable. [code]node[/code]: [i]Node[/i] - Node to get display name for (can be null) [code]missing_name[/code]: [i]String[/i] - Value to return when node is null or name missing [code]custom_callable[/code]: [i]Callable[/i] - Optional callable that receives the node and returns a String

GBOwner

Validates that all required dependencies and properties are properly set. Returns validation issues if dependencies are missing, empty array if valid.[br][br] [code]return[/code]: [i]Array[String][/i] - List of validation issues (empty if valid)

GBOwnerContext

Validates the runtime configuration after nodes are set up. [code]@return[/code]: [i]Array[String][/i] - List of runtime validation issues.

GBPositioning2DUtils

Convert an arbitrary direction vector into an 8-direction tile delta (-1/0/1 per axis). Perfect for 2D grid-based movement systems supporting 8-directional input (WASD + diagonals). Cardinal and diagonal directions are supported; tiny components are snapped to 0 by threshold. [param direction] The input direction from joystick, keyboard, or mouse (any Vector2). [param threshold] Components with absolute value below this are treated as 0 (default 0.33). [return] Vector2i with components in {-1, 0, 1} representing tile movement direction. [b]Example:[/b] Vector2(0.8, -0.2) becomes Vector2i(1, 0) for rightward movement.

GBResource

Get a string identifying name for the resource for debugging purposes

GBRuntimeChecks

Require Camera2D node present in the viewport for positioning utilities

GBSearchUtils

Returns true if a visual node exists under root and is currently visible.

GBSettings

Settings concerning debugging GridBuilder plugin issues

GBStates

State of manipulation actions (move, demolish, etc).

GBString

Gets the separator string for the given enum value.[br][br] [code]p_seperator_enum[/code]: [i]int[/i] - The separator enum value from project settings

GBSystem

Validates that all required dependencies are properly set. Returns list of validation issue messages (empty if valid). Fail-fast abstract.

GBSystemsComponent

Base category for a Node class that serves as an dependency injectable child of a GBSystem

GBSystemsContext

Recursively search for Camera2D in a node tree

GBTemplates

Overlay object for validating tile placement rules on an individual tile or region.[br][br] [code]rule_check_indicator[/code]: [i]PackedScene[/i] - Template scene for visual placement validation feedback

GBValidation

Checks that the property values of each property name are not null. Returns an array of issues found.[br][br] [code]p_obj[/code]: [i]Object[/i] - Object to validate properties on[br] [code]p_property_names[/code]: [i]Array[String][/i] - Array of property names to check for null values

GBVisualSettings

Settings for highlighting targets in the game world during building, move, demolish, etc. This includes colors for valid and invalid moves, as well as reset colors

GridBuilding

GridBuilding class for GridBuilding

GridBuildingAnalyzer

Analyzes a scene for grid building system components and configuration issues