about summary refs log tree commit diff stats
path: root/Archipelago/tracker.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/tracker.gd')
-rw-r--r--Archipelago/tracker.gd22
1 files changed, 19 insertions, 3 deletions
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
83func update_position(x, z): 95func update_position(x, z):
84 _broadcast({"cmd": "UpdatePosition", "position": {"x": x, "z": z}}) 96 _broadcast({"cmd": "UpdatePosition", "position": {"x": x, "z": z}})
97
98
99func solve_panel(name):
100 _broadcast({"cmd": "SolvePanels", "panels": [name]})