@tool
extends Interactable3D
class_name ArtefactDisplayer

@export var artefact : Artefact : set = set_artefact

func _ready():
    set_artefact()

func set_artefact(a := artefact):
    if is_node_ready():
        for c in %Model.get_children():
            c.queue_free()
        
        if a:
            var new_model = a.get_3d_scene().instantiate()
            %Model.add_child(new_model)
    artefact = a

func card_info() -> CardInfo:
    if artefact:
        return artefact.card_info()
    return null
