Grid Placement

PreviewBuilder

AUTO-GENERATED FILE — DO NOT EDIT MANUALLY

Source: systems/building/components/preview_builder.gd

Version: 5.0

class_name: PreviewBuilder extends: GBInjectable

Summary

PreviewBuilder

Purpose Manages the visual preview instance used during building placement. The class requires the core runtime objects up-front: BuildingSettings, the GridTargetingState, BuildingState, and a GBLogger. These are accepted in the constructor so the caller is explicit about required dependencies.

In addition, resolve_gb_dependencies(container) exists to refresh or update dependencies from a GBCompositionContainer if the container changes during runtime (rare for tests but supported). The GridTargetingState is treated as the single source of truth for the positioner — the preview will always query the latest positioner when creating the preview.

Signals

(none)

Exports

(none)

Methods

  • _init()
  • resolve_gb_dependencies()
    • Refresh/resolve dependencies from the composition container. Returns: bool - True if dependencies were found, false otherwise.
  • get_runtime_issues()
    • Validates that all required dependencies are properly set. Returns: Array[String] - List of validation issues (empty if valid)
  • initialize()
  • create_preview()
    • Spawns a new preview for the given placeable. Clears the previous one if active.
  • get_preview()
    • Get the object current previewed for placement
  • clear_preview()
    • Frees the active preview node.
  • align_to_grid()
  • update_position()
    • Repositions the preview in world space.
  • has_active_preview()
    • Optional: Check if a preview is currently being shown.