about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-04-13 21:23:41 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-04-13 21:23:41 -0400
commit380a2b49eb2c2687a6fda1099d8b9d1be92c0e32 (patch)
treebdb54386b7803897991c1b72d1a0eecbe77d826b /Archipelago/client.gd
parent617e31fce21eb18d1ffccdc9c377d25535157351 (diff)
downloadlingo-archipelago-380a2b49eb2c2687a6fda1099d8b9d1be92c0e32.tar.gz
lingo-archipelago-380a2b49eb2c2687a6fda1099d8b9d1be92c0e32.tar.bz2
lingo-archipelago-380a2b49eb2c2687a6fda1099d8b9d1be92c0e32.zip
Location checks are held while the map is loading
The map load sends out a lot of checks at once if a file is being loaded, so we hold them until the map finishes loading and then send them out together.
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd18
1 files changed, 15 insertions, 3 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index cbddf89..0f121a1 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -31,6 +31,7 @@ var _panel_ids_by_location = {}
31 31
32var _map_loaded = false 32var _map_loaded = false
33var _held_items = [] 33var _held_items = []
34var _held_locations = []
34 35
35signal client_connected 36signal client_connected
36 37
@@ -130,6 +131,8 @@ func _on_data():
130 if _slot_data.has("panel_ids_by_location_id"): 131 if _slot_data.has("panel_ids_by_location_id"):
131 _panel_ids_by_location = _slot_data["panel_ids_by_location_id"] 132 _panel_ids_by_location = _slot_data["panel_ids_by_location_id"]
132 133
134 requestSync()
135
133 emit_signal("client_connected") 136 emit_signal("client_connected")
134 137
135 elif cmd == "ConnectionRefused": 138 elif cmd == "ConnectionRefused":
@@ -205,18 +208,27 @@ func connectToRoom():
205 ) 208 )
206 209
207 210
211func requestSync():
212 sendMessage([{"cmd": "Sync"}])
213
214
208func sendLocation(loc_id): 215func sendLocation(loc_id):
209 sendMessage([{"cmd": "LocationChecks", "locations": [loc_id]}]) 216 if _map_loaded:
217 sendMessage([{"cmd": "LocationChecks", "locations": [loc_id]}])
218 else:
219 _held_locations.append(loc_id)
210 220
211 221
212func mapFinishedLoading(): 222func mapFinishedLoading():
213 if !_map_loaded: 223 if !_map_loaded:
214 _map_loaded = true
215
216 for item in _held_items: 224 for item in _held_items:
217 processItem(item) 225 processItem(item)
218 226
227 sendMessage([{"cmd": "LocationChecks", "locations": _held_locations}])
228
229 _map_loaded = true
219 _held_items = [] 230 _held_items = []
231 _held_locations = []
220 232
221 233
222func processItem(item): 234func processItem(item):