BuildingInstantiator

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Responsible for instantiating and setting up a placed building object in the world. This component handles the creation of a building instance, assigning its transform, and attaching necessary components like PlaceableInstance.

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

Extends: GBSystemsComponent

Private Properties

  • Property: _indicator_context: [IndicatorContext](./indicator-context/) (private)
  • Property: _building_state: [BuildingState](./building-state/) (private)
  • Property: _building_settings: [BuildingSettings](./building-settings/) (private)

Constants

  • Constant: DEFAULT_NAME = "BuildingInstantiator"
  • Constant: WARNING_INVALID_PLACEABLE = "Invalid placeable resource. Can't instantiate. [%s]"
  • Constant: WARNING_NO_PREVIEW = "No preview instance provided to instantiate from. Returning null."

Public Methods

resolve_gb_dependencies

1
resolve_gb_dependencies(p_container: GBCompositionContainer) -> void

Resolve dependencies from the composition container.

p_container: GBCompositionContainer - Container with system dependencies


instantiate_building

1
2
3
4
instantiate_building(
    p_placeable: Placeable,
    p_preview: Node2D
) -> Node2D

Instantiates a Placeable’s scene, sets its properties, and adds it to the world. Returns the instantiated Node2D if successful, otherwise null.

p_placeable: Placeable - The Placeable resource to instantiate

p_preview: Node2D - The preview node that holds the desired global_transform