meat_madness_redux/godot/saved_dialogue_progress.gd

32 lines
988 B
GDScript3
Raw Permalink Normal View History

2022-12-28 16:53:17 -07:00
extends Node
var found_blackbox_count = 0
var found_blackboxes = []
var blackbox_dialogues = []
func find_blackbox(id: int):
if found_blackboxes.size() < (id+1):
found_blackboxes.resize(id+1)
blackbox_dialogues.resize(id+1)
if not found_blackboxes[id]:
found_blackboxes[id] = true
found_blackbox_count += 1
2023-01-03 18:45:00 -07:00
Dialogic.set_variable("meat_creek_tutorial_given", true)
2022-12-28 16:53:17 -07:00
var dialog
if blackbox_dialogues[id] == null or blackbox_dialogues[id].get_ref() == null:
dialog = Dialogic.start("blackbox_" + str(id))
blackbox_dialogues[id] = weakref(dialog)
else:
dialog = blackbox_dialogues[id].get_ref()
get_tree().root.add_child(dialog)
2023-01-02 17:16:32 -07:00
Dialogic.set_variable("bb_counter", found_blackbox_count)
2022-12-28 16:53:17 -07:00
func hide_blackbox_dialogue(id: int):
if blackbox_dialogues[id] == null or blackbox_dialogues[id].get_ref() == null:
return
var dialog = blackbox_dialogues[id].get_ref()
if get_tree().root.is_a_parent_of(dialog):
2023-01-04 20:04:33 -07:00
get_tree().root.call_deferred("remove_child", dialog)