From 711d326fa4585031b9d623541624826558bdf547 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 21 May 2023 13:12:50 -0400 Subject: Report achievements to AP using data storage (for tracker) --- Archipelago/client.gd | 6 ++++++ Archipelago/load.gd | 12 +++++++++++- Archipelago/notifier.gd | 14 ++++++++++++++ data/LL1.yaml | 24 ++++++++++++++++++++++++ util/generate_gamedata.rb | 3 +++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Archipelago/notifier.gd diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 0326ffb..d7074f5 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -540,6 +540,12 @@ func sendLocation(loc_id): _held_locations.append(loc_id) +func setValue(key, value): + sendMessage( + [{"cmd": "Set", "key": key, "operations": [{"operation": "replace", "value": value}]}] + ) + + func completedGoal(): sendMessage([{"cmd": "StatusUpdate", "status": 30}]) # CLIENT_GOAL diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 9568f69..052aa84 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -267,12 +267,22 @@ func _load(): painting_node.move_to_z = painting_node.translation.z painting_node.translation.x = 88 painting_node.translation.z = 39 - + var fearless_door = get_node("Doors/Naps Room Doors/Door_hider_5").duplicate() fearless_door.name = "Door_hider_new1" fearless_door.translation.y = 5 get_node("Doors/Naps Room Doors").add_child(fearless_door) + # Set up notifiers for each achievement panel, for the tracker. + var notifier_script = ResourceLoader.load("user://maps/Archipelago/notifier.gd") + for panel in gamedata.panels: + if "achievement" in panel: + var panel_node = panels_parent.get_node(panel["id"]) + var script_instance = notifier_script.new() + script_instance.name = "Achievement_Notifier" + script_instance.key = "Achievement|%s" % panel["achievement"] + panel_node.add_child(script_instance) + # Attach a script to every panel so that we can do things like conditionally # disable them. var panel_script = ResourceLoader.load("user://maps/Archipelago/panel.gd") diff --git a/Archipelago/notifier.gd b/Archipelago/notifier.gd new file mode 100644 index 0000000..57d6564 --- /dev/null +++ b/Archipelago/notifier.gd @@ -0,0 +1,14 @@ +extends Node + +var key + + +func _ready(): + self.get_parent().get_node("Viewport/GUI/Panel/TextEdit").connect( + "answer_correct", self, "handle_correct" + ) + + +func handle_correct(): + var apclient = global.get_node("Archipelago") + apclient.setValue(key, true) diff --git a/data/LL1.yaml b/data/LL1.yaml index 268fb59..b8c1ef4 100644 --- a/data/LL1.yaml +++ b/data/LL1.yaml @@ -1104,6 +1104,7 @@ - id: Countdown Panels/Panel_1234567890_wanderlust color: orange tag: midorange + achievement: The Wanderer - id: Tower Room/Panel_wanderlust_1234567890 color: orange tag: midorange @@ -2636,75 +2637,98 @@ - id: Countdown Panels/Panel_traveled_traveled color: white tag: forbid + achievement: The Traveled - id: Countdown Panels/Panel_disagreeable_agreeable color: black tag: forbid + achievement: The Agreeable - id: Countdown Panels/Panel_seeker_seeker color: white tag: forbid + achievement: The Seeker - id: Countdown Panels/Panel_tenacious_tenacious color: white tag: forbid + achievement: The Tenacious - id: Countdown Panels/Panel_perceptive_perceptive color: white tag: forbid + achievement: The Perceptive - id: Countdown Panels/Panel_emboldened_bold color: red tag: forbid + achievement: The Bold - id: Countdown Panels/Panel_deterred_undeterred color: blue tag: forbid + achievement: The Undeterred - id: Countdown Panels/Panel_illuminated_initiated color: purple tag: forbid + achievement: The Initiated - id: Countdown Panels/Panel_discerning_scramble color: yellow tag: forbid + achievement: The Discerning - id: Countdown Panels/Panel_intelligent_wise color: brown tag: forbid + achievement: The Wise - id: Countdown Panels/Panel_optimistic_optimistic color: white tag: forbid + achievement: The Optimistic - id: Countdown Panels/Panel_wondrous_wondrous color: white tag: forbid + achievement: The Wondrous - id: Countdown Panels/Panel_steady_steady color: white tag: forbid + achievement: The Steady - id: Countdown Panels/Panel_bearer_bearer color: white tag: forbid + achievement: The Bearer - id: Countdown Panels/Panel_colorful_colorful color: white tag: forbid + achievement: The Colorful - id: Countdown Panels/Panel_observant_observant color: white tag: forbid + achievement: The Observant - id: Countdown Panels/Panel_master_master color: white tag: forbid - id: Countdown Panels/Panel_grandfathered_red color: red tag: forbid + achievement: The Red - id: Countdown Panels/Panel_ecstatic_ecstatic color: yellow tag: forbid + achievement: The Ecstatic - id: Countdown Panels/Panel_artistic_artistic color: blue tag: forbid + achievement: The Artistic - id: Countdown Panels/Panel_incomparable_incomparable color: white tag: forbid + achievement: The Incomparable - id: Countdown Panels/Panel_fearless_fearless color: white tag: forbid + achievement: The Fearless - id: Countdown Panels/Panel_scientific_scientific color: purple tag: forbid + achievement: The Scientific - id: Countdown Panels/Panel_challenged_unchallenged color: black tag: forbid + achievement: The Unchallenged - id: Master Room/Panel_mastery_mastery color: white tag: midwhite diff --git a/util/generate_gamedata.rb b/util/generate_gamedata.rb index 5940480..3b57f76 100644 --- a/util/generate_gamedata.rb +++ b/util/generate_gamedata.rb @@ -29,6 +29,9 @@ end.map do |panel| copytos = panel["copy_to_sign"] end ret["copy_to_sign"] = "[\"" + copytos.join("\",\"") + "\"]" + end + if panel.include? "achievement" + ret["achievement"] = "\"#{panel["achievement"]}\"" end ret end.map do |panel| -- cgit 1.4.1