PreviewBuilder

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

PreviewBuilder

Source File: addons/grid_building/systems/building/components/preview_builder.gd

Extends: GBInjectable

Private Properties

  • Property: _preview_factory: [PreviewFactory](./preview-factory/) (private)
  • Property: _current_preview: Node2D = null (private)
  • Property: _building_state : [BuildingState](./building-state/) (private)
  • Property: _targeting_state : [GridTargetingState](./grid-targeting-state/) (private)
  • Property: _logger: [GBLogger](./gb-logger/) (private)
  • Property: _building_settings: [BuildingSettings](./building-settings/) (private)

Public Methods

from_container

1
from_container(container: GBCompositionContainer) -> PreviewBuilder

Flags: static

Factory: Create a PreviewBuilder from a composition container. This provides a DRY creation path used by systems/tests that have a GBCompositionContainer holding the required runtime objects.

Args: p_building_settings: BuildingSettings - required settings (not always in container) container: GBCompositionContainer - used to resolve targeting_state, building_state, logger

Returns: PreviewBuilder - constructed and wired, or null on failure


resolve_gb_dependencies

1
resolve_gb_dependencies(container: GBCompositionContainer) -> bool

Refresh/resolve dependencies from the composition container. Returns: bool - True if dependencies were found, false otherwise.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

Validates that all required dependencies are properly set. Returns: Array[String] - List of validation issues (empty if valid)


initialize

1
2
3
4
5
6
initialize(
    p_building_settings: BuildingSettings,
    p_targeting_state: GridTargetingState,
    p_building_state : BuildingState,
    p_logger: GBLogger
) -> void

create_preview

1
create_preview(p_placeable: Placeable) -> Node2D

Spawns a new preview for the given placeable. Clears the previous one if active.


get_preview

1
get_preview() -> Node2D

Get the object current previewed for placement


clear_preview

1
clear_preview()

Frees the active preview node.


align_to_grid

1
align_to_grid(collision_shape_global_position : Vector2)

update_position

1
update_position(p_position: Vector2)

Repositions the preview in world space.


has_active_preview

1
has_active_preview() -> bool

Optional: Check if a preview is currently being shown.


Private Methods

_init

1
2
3
4
5
6
_init(
    p_building_settings: BuildingSettings,
    p_targeting_state: GridTargetingState,
    p_building_state : BuildingState,
    p_logger: GBLogger
) -> void

Flags: private