TinyAdventure/objects/actionable.gd

26 lines
821 B
GDScript
Raw Permalink Normal View History

class_name ConversationActionable
extends Area3D
2024-11-01 18:07:23 +01:00
@export var dialogue_start: String = "start"
@export var related_quest_path: NodePath
@export var quest_dialogue_resource: DialogueResource
@export var default_dialogue_resource: DialogueResource
2024-11-01 18:07:23 +01:00
var related_quest:QuestBase = null
func _ready():
if not related_quest_path.is_empty():
related_quest = get_node(related_quest_path)
func action() -> void:
var balloon = load("res://ui/dialogue/balloon.tscn").instantiate() as DialogueBaloon
2024-07-12 14:32:33 +02:00
get_tree().current_scene.add_child(balloon)
var quest_states = get_tree().get_nodes_in_group("quest_state")
2024-11-01 18:07:23 +01:00
if related_quest != null and not related_quest.is_completed:
balloon.start(quest_dialogue_resource, dialogue_start, quest_states)
else:
balloon.start(default_dialogue_resource, dialogue_start, quest_states)