about summary refs log tree commit diff stats
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
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.
-rw-r--r--Archipelago/client.gd18
-rw-r--r--Archipelago/load.gd7
2 files changed, 19 insertions, 6 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):
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index b0ccafc..cb592ff 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -28,9 +28,10 @@ func _load():
28 "answer_correct", location, "handle_correct" 28 "answer_correct", location, "handle_correct"
29 ) 29 )
30 30
31 # Process any items received while the map was loading.
32 apclient.mapFinishedLoading()
33
34 # Proceed with the rest of the load. 31 # Proceed with the rest of the load.
35 global._print("Hooked Load End") 32 global._print("Hooked Load End")
36 ._load() 33 ._load()
34
35 # Process any items received while the map was loading, and send the checks
36 # from the save load.
37 apclient.mapFinishedLoading()