aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/game.gd2
-rw-r--r--client/multiplayer.gd7
2 files changed, 5 insertions, 4 deletions
diff --git a/client/game.gd b/client/game.gd
index 62a25f18..2c65138d 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -387,6 +387,8 @@ func handle_packet(p):
$Environment.update(p.effects)
"redirect":
get_parent().replace_menu("res://gui/menus/game.tscn", p.uri[0])
+ "disconnect":
+ get_parent().replace_menu("res://gui/menus/error.tscn", [tr(p.reason.translation.id), menu.data])
"replay_start":
is_replay = true
"replay_stop":
diff --git a/client/multiplayer.gd b/client/multiplayer.gd
index 3ee303ee..aa9c2c75 100644
--- a/client/multiplayer.gd
+++ b/client/multiplayer.gd
@@ -49,10 +49,9 @@ func _process(_delta):
if connected:
socket.poll()
var state = socket.get_ready_state()
- if state == WebSocketPeer.STATE_OPEN:
- while socket.get_available_packet_count():
- handle_packet(socket.get_packet())
- elif state == WebSocketPeer.STATE_CLOSED:
+ while socket.get_available_packet_count():
+ handle_packet(socket.get_packet())
+ if state == WebSocketPeer.STATE_CLOSED:
var code = socket.get_close_code()
var reason = socket.get_close_reason() if code == socket.STATE_CLOSED else tr("c.error.websocket.unavailable")
connection_closed.emit(tr("c.error.websocket").format([code, reason, code != -1]))