1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +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

@@ -6,7 +6,7 @@
<description>
This class constructs a full mesh of [WebRTCPeerConnection] (one connection for each peer) that can be used as a [member MultiplayerAPI.multiplayer_peer].
You can add each [WebRTCPeerConnection] via [method add_peer] or remove them via [method remove_peer]. Peers must be added in [constant WebRTCPeerConnection.STATE_NEW] state to allow it to create the appropriate channels. This class will not create offers nor set descriptions, it will only poll them, and notify connections and disconnections.
[signal MultiplayerPeer.connection_succeeded] and [signal MultiplayerPeer.server_disconnected] will not be emitted unless the peer is created using [method create_client]. Beside that data transfer works like in a [MultiplayerPeer].
When creating the peer via [method create_client] or [method create_server] the [method MultiplayerPeer.is_server_relay_supported] method will return [code]true[/code] enabling peer exchange and packet relaying when supported by the [MultiplayerAPI] implementation.
[b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
</description>
<tutorials>

View File

@@ -341,11 +341,6 @@ void WebRTCMultiplayerPeer::remove_peer(int p_peer_id) {
peer->connected = false;
emit_signal(SNAME("peer_disconnected"), p_peer_id);
if (network_mode == MODE_CLIENT && p_peer_id == TARGET_PEER_SERVER) {
if (connection_status == CONNECTION_CONNECTING) {
emit_signal(SNAME("connection_failed"));
} else {
emit_signal(SNAME("server_disconnected"));
}
connection_status = CONNECTION_DISCONNECTED;
}
}