@tool
extends Node3D
class_name Incubator

const INCUBATOR_SCENE = preload("res://stages/3d_scenes/astra_base/assets/3d/astra_base_incubator.blend")
const INCUBATOR_USED_SCENE = preload("res://stages/3d_scenes/astra_base/assets/3d/astra_base_used_incubator.blend")

@export var used := false : set = set_used

# Called when the node enters the scene tree for the first time.
func _ready():
    set_used()


# Called every frame. 'delta' is the elapsed time since the previous frame.
func set_used(_used := used):
    used = _used
    if is_node_ready():
        for c in %Model.get_children():
            c.queue_free()
        
        if used:
            %Model.add_child(INCUBATOR_USED_SCENE.instantiate())
        else:
            %Model.add_child(INCUBATOR_SCENE.instantiate())


