TinyAdventure/objects/actionable.gd

23 lines
761 B
GDScript

class_name ConversationActionable
extends Area3D
signal conversation_started
@export var quest_dialogue_resource: DialogueResource
@export var default_dialogue_resource: DialogueResource
@export var dialogue_start: String = "start"
@onready var builder_missing_tool:QuestBuilderMissingTool = %BuilderMissingTool
func action() -> void:
var balloon = load("res://ui/dialogue/balloon.tscn").instantiate() as DialogueBaloon
get_tree().current_scene.add_child(balloon)
var quest_states = get_tree().get_nodes_in_group("quest_state")
if not builder_missing_tool.is_completed:
balloon.start(quest_dialogue_resource, dialogue_start, quest_states)
else:
balloon.start(default_dialogue_resource, dialogue_start, quest_states)
conversation_started.emit()