diff options
Diffstat (limited to 'client/Archipelago/client.gd')
| -rw-r--r-- | client/Archipelago/client.gd | 23 |
1 files changed, 21 insertions, 2 deletions
| diff --git a/client/Archipelago/client.gd b/client/Archipelago/client.gd index 52ce047..843647d 100644 --- a/client/Archipelago/client.gd +++ b/client/Archipelago/client.gd | |||
| @@ -41,9 +41,14 @@ signal connect_status | |||
| 41 | signal client_connected(slot_data) | 41 | signal client_connected(slot_data) |
| 42 | signal item_received(item_id, index, player, flags, amount) | 42 | signal item_received(item_id, index, player, flags, amount) |
| 43 | signal message_received(message) | 43 | signal message_received(message) |
| 44 | signal location_scout_received(item_id, location_id, player, flags) | ||
| 44 | 45 | ||
| 45 | 46 | ||
| 46 | func _init(): | 47 | func _init(): |
| 48 | set_process_mode(Node.PROCESS_MODE_ALWAYS) | ||
| 49 | |||
| 50 | _ws.inbound_buffer_size = 8388608 | ||
| 51 | |||
| 47 | global._print("Instantiated APClient") | 52 | global._print("Instantiated APClient") |
| 48 | 53 | ||
| 49 | # Read AP datapackages from file, if there are any | 54 | # Read AP datapackages from file, if there are any |
| @@ -222,7 +227,7 @@ func _process(_delta): | |||
| 222 | error_message = "Unknown error." | 227 | error_message = "Unknown error." |
| 223 | 228 | ||
| 224 | _initiated_disconnect = true | 229 | _initiated_disconnect = true |
| 225 | _ws.disconnect_from_host() | 230 | _ws.close() |
| 226 | 231 | ||
| 227 | emit_signal("could_not_connect", error_message) | 232 | emit_signal("could_not_connect", error_message) |
| 228 | global._print("Connection to AP refused") | 233 | global._print("Connection to AP refused") |
| @@ -255,6 +260,16 @@ func _process(_delta): | |||
| 255 | elif cmd == "PrintJSON": | 260 | elif cmd == "PrintJSON": |
| 256 | emit_signal("message_received", message) | 261 | emit_signal("message_received", message) |
| 257 | 262 | ||
| 263 | elif cmd == "LocationInfo": | ||
| 264 | for loc in message["locations"]: | ||
| 265 | emit_signal( | ||
| 266 | "location_scout_received", | ||
| 267 | int(loc["item"]), | ||
| 268 | int(loc["location"]), | ||
| 269 | int(loc["player"]), | ||
| 270 | int(loc["flags"]) | ||
| 271 | ) | ||
| 272 | |||
| 258 | elif state == WebSocketPeer.STATE_CLOSED: | 273 | elif state == WebSocketPeer.STATE_CLOSED: |
| 259 | if _has_connected: | 274 | if _has_connected: |
| 260 | _closed() | 275 | _closed() |
| @@ -296,7 +311,7 @@ func connectToServer(server, un, pw): | |||
| 296 | % err | 311 | % err |
| 297 | ) | 312 | ) |
| 298 | ) | 313 | ) |
| 299 | global._print("Could not connect to AP: " + err) | 314 | global._print("Could not connect to AP: %d" % err) |
| 300 | return | 315 | return |
| 301 | _should_process = true | 316 | _should_process = true |
| 302 | 317 | ||
| @@ -390,6 +405,10 @@ func completedGoal(): | |||
| 390 | sendMessage([{"cmd": "StatusUpdate", "status": 30}]) # CLIENT_GOAL | 405 | sendMessage([{"cmd": "StatusUpdate", "status": 30}]) # CLIENT_GOAL |
| 391 | 406 | ||
| 392 | 407 | ||
| 408 | func scoutLocations(loc_ids): | ||
| 409 | sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) | ||
| 410 | |||
| 411 | |||
| 393 | func hasItem(item_id): | 412 | func hasItem(item_id): |
| 394 | return _received_items.has(item_id) | 413 | return _received_items.has(item_id) |
| 395 | 414 | ||
