From 2e5238dcdda8a9cf3ad0a434e090e8e3bee4ba37 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 17 Dec 2024 16:33:46 -0500 Subject: Add solve tracking over IPC --- Archipelago/panelInput.gd | 4 ++++ Archipelago/tracker.gd | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Archipelago/panelInput.gd b/Archipelago/panelInput.gd index 346dccb..a9f4303 100644 --- a/Archipelago/panelInput.gd +++ b/Archipelago/panelInput.gd @@ -24,3 +24,7 @@ func complete(): var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") effects_node.hide_puzzle_skip_message() + + var autotracker_node = get_tree().get_root().get_node("Spatial/AP_Tracker") + var real_panel = get_parent().get_parent().get_parent().get_parent(); + autotracker_node.solve_panel("%s/%s" % [real_panel.get_parent().name, real_panel.name]) diff --git a/Archipelago/tracker.gd b/Archipelago/tracker.gd index 798721d..1c05fe4 100644 --- a/Archipelago/tracker.gd +++ b/Archipelago/tracker.gd @@ -40,16 +40,28 @@ func _data_received(id): var packet_text = peer.get_packet().get_string_from_utf8() global._print("Got data from tracker: " + packet_text) - var msg = JSON.parse(packet_text) - if msg.error != OK: - global._print("Error parsing packet from Tracker: " + msg.error_string) + var data = JSON.parse(packet_text) + if data.error != OK: + global._print("Error parsing packet from Tracker: " + data.error_string) return var apclient = global.get_node("Archipelago") + var msg = data.result if msg["cmd"] == "Sync": var resp = {} + var panels = [] + var panels_node = self.get_node("../Panels") + for group in panels_node.get_children(): + for panel in group.get_children(): + if panel.is_complete: + panels.append("%s/%s" % [group.name, panel.name]) + if !panels.empty(): + resp = {"cmd": "SolvePanels", "panels": panels} + + peer.put_packet(JSON.print(resp).to_utf8()) + if apclient.track_player: var player = get_tree().get_root().get_node("Spatial/player") resp = { @@ -82,3 +94,7 @@ func has_connection(): func update_position(x, z): _broadcast({"cmd": "UpdatePosition", "position": {"x": x, "z": z}}) + + +func solve_panel(name): + _broadcast({"cmd": "SolvePanels", "panels": [name]}) -- cgit 1.4.1