diff options
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 18 |
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 | ||
32 | var _map_loaded = false | 32 | var _map_loaded = false |
33 | var _held_items = [] | 33 | var _held_items = [] |
34 | var _held_locations = [] | ||
34 | 35 | ||
35 | signal client_connected | 36 | signal 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 | ||
211 | func requestSync(): | ||
212 | sendMessage([{"cmd": "Sync"}]) | ||
213 | |||
214 | |||
208 | func sendLocation(loc_id): | 215 | func 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 | ||
212 | func mapFinishedLoading(): | 222 | func 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 | ||
222 | func processItem(item): | 234 | func processItem(item): |