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
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
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 “
format_tile_list
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
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
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
Flags: static
Format a Node or Object for logging.
obj The object to format.
[return] Formatted string like “name(class)” or “
format_visibility_context
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
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
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
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
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
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
Flags: static
Convenience negative predicate for offscreen detection
format_screen_state
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
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
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.