1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

[MP] Remove connection state signals from MultiplayerPeer.

Now handled directly by the MultiplayerAPI implementation.
This commit is contained in:
Fabio Alessandrelli
2022-10-31 14:18:22 +01:00
parent 9773803e4e
commit 33dda2e68a
8 changed files with 21 additions and 68 deletions

View File

@@ -159,10 +159,7 @@ void ENetMultiplayerPeer::_disconnect_inactive_peers() {
if (hosts.has(P)) {
hosts.erase(P);
}
if (active_mode == MODE_CLIENT) {
ERR_CONTINUE(P != TARGET_PEER_SERVER);
emit_signal(SNAME("server_disconnected"));
}
ERR_CONTINUE(active_mode == MODE_CLIENT && P != TARGET_PEER_SERVER);
emit_signal(SNAME("peer_disconnected"), P);
}
}
@@ -186,14 +183,10 @@ void ENetMultiplayerPeer::poll() {
if (ret == ENetConnection::EVENT_CONNECT) {
connection_status = CONNECTION_CONNECTED;
emit_signal(SNAME("peer_connected"), 1);
emit_signal(SNAME("connection_succeeded"));
} else if (ret == ENetConnection::EVENT_DISCONNECT) {
if (connection_status == CONNECTION_CONNECTED) {
// Client just disconnected from server.
emit_signal(SNAME("server_disconnected"));
emit_signal(SNAME("peer_disconnected"), 1);
} else {
emit_signal(SNAME("connection_failed"));
}
close();
} else if (ret == ENetConnection::EVENT_RECEIVE) {