From 380a2b49eb2c2687a6fda1099d8b9d1be92c0e32 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 13 Apr 2023 21:23:41 -0400 Subject: 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. --- Archipelago/client.gd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Archipelago/client.gd') 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 = {} var _map_loaded = false var _held_items = [] +var _held_locations = [] signal client_connected @@ -130,6 +131,8 @@ func _on_data(): if _slot_data.has("panel_ids_by_location_id"): _panel_ids_by_location = _slot_data["panel_ids_by_location_id"] + requestSync() + emit_signal("client_connected") elif cmd == "ConnectionRefused": @@ -205,18 +208,27 @@ func connectToRoom(): ) +func requestSync(): + sendMessage([{"cmd": "Sync"}]) + + func sendLocation(loc_id): - sendMessage([{"cmd": "LocationChecks", "locations": [loc_id]}]) + if _map_loaded: + sendMessage([{"cmd": "LocationChecks", "locations": [loc_id]}]) + else: + _held_locations.append(loc_id) func mapFinishedLoading(): if !_map_loaded: - _map_loaded = true - for item in _held_items: processItem(item) + sendMessage([{"cmd": "LocationChecks", "locations": _held_locations}]) + + _map_loaded = true _held_items = [] + _held_locations = [] func processItem(item): -- cgit 1.4.1