GBDiagnostics

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

GBDiagnostics — runtime/shared diagnostics helpers

Source File: addons/grid_building/utils/gb_diagnostics.gd

Extends: RefCounted

Public Methods

format_debug

1
2
3
4
5
format_debug(
    message: String,
    suite: String = "",
    file_path: String = ""
) -> String

Flags: static

Format a debug message string, optionally including suite and file path if verbose mode is enabled. message The core message to format. suite Optional suite name to prefix in brackets. file_path Optional file path to append in parentheses. [return] Formatted string, enhanced if verbose mode is on.


format_indicator

1
format_indicator(indicator: Object) -> String

Flags: static

Format an indicator object into a human-readable string for diagnostics. indicator The indicator object to format (can be RuleCheckIndicator, Node, or generic Object). [return] Formatted string like “name@position (extra_info)” or “” if null.


format_tile_list

1
format_tile_list(tile_list: Array) -> String

Flags: static

Format a list of tile coordinates into a compact string. @param tile_list Array of tile coordinates (e.g., Vector2i). @return String like “[tile1, tile2, …]” or “[]” if null.


format_indicator_list

1
2
3
4
5
6
format_indicator_list(
    prefix: String,
    indicators: Array,
    _cls_name: String = "",
    _file_path: String = ""
) -> String

Flags: static

Format a list of indicators into a multi-line string with a prefix. prefix String to prepend to the list. indicators Array of indicator objects. _cls_name Unused parameter (for future extension). _file_path Unused parameter (for future extension). [return] Multi-line string with prefix and indented indicator details.


format_stack_summary

1
2
3
4
format_stack_summary(
    stack: Array,
    max_entries: int = 6
) -> String

Flags: static

Format a compact stack summary string from get_stack() output. stack Array returned by get_stack() (array of Dictionary/Frame objects) max_entries maximum number of stack entries to include (default 6) [return] a short string like: “[file1.gd:123:func1, file2.gd:45:func2, …]”. This is intentionally lightweight and side-effect free so callers can log it.


format_node_label

1
format_node_label(obj: Object) -> String

Flags: static

Format a Node or Object for logging. obj The object to format. [return] Formatted string like “name(class)” or “” etc.


format_visibility_context

1
2
3
4
5
6
format_visibility_context(
    node: Node,
    visual: CanvasItem,
    vp: Viewport,
    cam: Camera2D
) -> String

Flags: static

Build a visibility context string similar to GridPositioner2D._visibility_context node The GridPositioner2D (or any CanvasItem/Node) providing context visual The visual CanvasItem associated with the node (may be null) vp Active Viewport (optional) cam Active Camera2D (optional)


describe_collision_layers

1
describe_collision_layers(obj: Object) -> Array[int]

Flags: static

Describe collision layers of a CollisionObject2D. obj The object to check (should be CollisionObject2D). [return] Array of active collision layer indices (1-32).


format_shape_cast_collisions

1
format_shape_cast_collisions(shape_cast: ShapeCast2D) -> String

Flags: static

Format current collisions of a ShapeCast2D for diagnostics. shape_cast The ShapeCast2D to inspect. [return] Formatted string like “colliding count=X -> collider1, collider2, …”.


format_canvas_item_state

1
format_canvas_item_state(ci: CanvasItem) -> String

Flags: static

Format a CanvasItem’s render-related state (modulate, self_modulate, z_index, position, scale, texture info). ci CanvasItem (Sprite2D, AnimatedSprite2D, etc.) or null. [return] String with key properties for diagnosing visibility without relying solely on .visible.


camera_world_bounds

1
2
3
4
camera_world_bounds(
    cam: Camera2D,
    vp: Viewport
) -> Dictionary

Flags: static

Compute world bounds rectangle for the active camera & viewport. cam Active Camera2D (may be null) vp Viewport owning the camera (may be null) [return] Dictionary with keys: has(bool), center(Vector2), world_min(Vector2), world_max(Vector2), zoom(Vector2)


is_inside_camera_bounds

1
2
3
4
is_inside_camera_bounds(
    bounds: Dictionary,
    pos: Vector2
) -> bool

Flags: static

Determine if a world position is inside provided camera world bounds bounds Result from camera_world_bounds pos World position to test [return] true if inside or bounds invalid (fail open for safety)


is_offscreen

1
2
3
4
is_offscreen(
    bounds: Dictionary,
    pos: Vector2
) -> bool

Flags: static

Convenience negative predicate for offscreen detection


format_screen_state

1
2
3
4
5
6
7
8
format_screen_state(
    cam: Camera2D,
    vp: Viewport,
    positioner_pos: Vector2,
    has_mouse: bool,
    mouse_world: Vector2,
    map: Object
) -> String

Flags: static

Format screen & mouse diagnostic state (formerly in GridPositioner2D) cam Active camera vp Active viewport positioner_pos World position of positioner has_mouse Whether we have cached mouse world position mouse_world Last cached mouse world (ignored if has_mouse false) map Tile map / target map providing coordinate -> tile projection (expects get_tile_from_global_position via GBPositioning2DUtils) [return] Formatted string matching prior screen_state log output


Private Methods

_is_verbose

1
_is_verbose() -> bool

Flags: static, private

Check if verbose diagnostics mode is enabled via environment variable. [return] true if GB_VERBOSE_TESTS is set to “1”, “true”, or “TRUE”.


_safe_get_tile_from_global_position

1
2
3
4
_safe_get_tile_from_global_position(
    global_position: Vector2,
    map: Object
) -> Vector2i

Flags: static, private

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