server: edited lobby leaving logic slightly
This commit is contained in:
@@ -57,7 +57,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _listen_for_data() -> void:
|
||||
while not _stop_thread:
|
||||
while not _stop_thread and not _tcp.get_status() == StreamPeerTCP.Status.STATUS_ERROR:
|
||||
#received_data += String.chr(_tcp.get_data(1)[0])
|
||||
received_data += _tcp.get_utf8_string(1)
|
||||
print(received_data)
|
||||
@@ -78,6 +78,13 @@ func _handle_response(response: String) -> void:
|
||||
connection_status_changed.emit.call_deferred(ConnectionStatus.JOINED)
|
||||
"client_joined_lobby":
|
||||
client_joined_lobby.emit.call_deferred(data["new_client_name"])
|
||||
"leave_lobby_request":
|
||||
leave_lobby()
|
||||
"leave_lobby":
|
||||
if data["status"] == "ok":
|
||||
print(data["client_id"] + " left")
|
||||
#if data["client_id"] == _client_id:
|
||||
#connection_status_changed.emit.call_deferred(ConnectionStatus.LOBBYLESS)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
disconnect_from_server()
|
||||
|
||||
Reference in New Issue
Block a user