diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-17 16:33:46 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-17 16:33:46 -0500 |
commit | 2e5238dcdda8a9cf3ad0a434e090e8e3bee4ba37 (patch) | |
tree | 4da42919993d5e008454a0ef8e7e238eaa09e500 | |
parent | 1bdfb112b659a6e4447ae8ed02c452bf12d8700a (diff) | |
download | lingo-archipelago-2e5238dcdda8a9cf3ad0a434e090e8e3bee4ba37.tar.gz lingo-archipelago-2e5238dcdda8a9cf3ad0a434e090e8e3bee4ba37.tar.bz2 lingo-archipelago-2e5238dcdda8a9cf3ad0a434e090e8e3bee4ba37.zip |
Add solve tracking over IPC
-rw-r--r-- | Archipelago/panelInput.gd | 4 | ||||
-rw-r--r-- | 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(): | |||
24 | 24 | ||
25 | var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") | 25 | var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") |
26 | effects_node.hide_puzzle_skip_message() | 26 | effects_node.hide_puzzle_skip_message() |
27 | |||
28 | var autotracker_node = get_tree().get_root().get_node("Spatial/AP_Tracker") | ||
29 | var real_panel = get_parent().get_parent().get_parent().get_parent(); | ||
30 | 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): | |||
40 | 40 | ||
41 | var packet_text = peer.get_packet().get_string_from_utf8() | 41 | var packet_text = peer.get_packet().get_string_from_utf8() |
42 | global._print("Got data from tracker: " + packet_text) | 42 | global._print("Got data from tracker: " + packet_text) |
43 | var msg = JSON.parse(packet_text) | 43 | var data = JSON.parse(packet_text) |
44 | if msg.error != OK: | 44 | if data.error != OK: |
45 | global._print("Error parsing packet from Tracker: " + msg.error_string) | 45 | global._print("Error parsing packet from Tracker: " + data.error_string) |
46 | return | 46 | return |
47 | 47 | ||
48 | var apclient = global.get_node("Archipelago") | 48 | var apclient = global.get_node("Archipelago") |
49 | var msg = data.result | ||
49 | 50 | ||
50 | if msg["cmd"] == "Sync": | 51 | if msg["cmd"] == "Sync": |
51 | var resp = {} | 52 | var resp = {} |
52 | 53 | ||
54 | var panels = [] | ||
55 | var panels_node = self.get_node("../Panels") | ||
56 | for group in panels_node.get_children(): | ||
57 | for panel in group.get_children(): | ||
58 | if panel.is_complete: | ||
59 | panels.append("%s/%s" % [group.name, panel.name]) | ||
60 | if !panels.empty(): | ||
61 | resp = {"cmd": "SolvePanels", "panels": panels} | ||
62 | |||
63 | peer.put_packet(JSON.print(resp).to_utf8()) | ||
64 | |||
53 | if apclient.track_player: | 65 | if apclient.track_player: |
54 | var player = get_tree().get_root().get_node("Spatial/player") | 66 | var player = get_tree().get_root().get_node("Spatial/player") |
55 | resp = { | 67 | resp = { |
@@ -82,3 +94,7 @@ func has_connection(): | |||
82 | 94 | ||
83 | func update_position(x, z): | 95 | func update_position(x, z): |
84 | _broadcast({"cmd": "UpdatePosition", "position": {"x": x, "z": z}}) | 96 | _broadcast({"cmd": "UpdatePosition", "position": {"x": x, "z": z}}) |
97 | |||
98 | |||
99 | func solve_panel(name): | ||
100 | _broadcast({"cmd": "SolvePanels", "panels": [name]}) | ||