Merge pull request #70721 from Faless/mp/4.x_fix_relay_option

[MP] Fix server_relay being unsettable.
This commit is contained in:
Rémi Verschelde 2023-01-09 23:09:53 +01:00
commit 4d4fcd0a6f
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 1 additions and 1 deletions

View File

@ -79,6 +79,7 @@
</member> </member>
<member name="server_relay" type="bool" setter="set_server_relay_enabled" getter="is_server_relay_enabled" default="true"> <member name="server_relay" type="bool" setter="set_server_relay_enabled" getter="is_server_relay_enabled" default="true">
Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is [code]false[/code], clients won't be automatically notified of other peers and won't be able to send them packets through the server. Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is [code]false[/code], clients won't be automatically notified of other peers and won't be able to send them packets through the server.
[b]Note:[/b] Changing this option while other peers are connected may lead to unexpected behaviors.
[b]Note:[/b] Support for this feature may depend on the current [MultiplayerPeer] configuration. See [method MultiplayerPeer.is_server_relay_supported]. [b]Note:[/b] Support for this feature may depend on the current [MultiplayerPeer] configuration. See [method MultiplayerPeer.is_server_relay_supported].
</member> </member>
</members> </members>

View File

@ -610,7 +610,6 @@ Error SceneMultiplayer::object_configuration_remove(Object *p_obj, Variant p_con
} }
void SceneMultiplayer::set_server_relay_enabled(bool p_enabled) { void SceneMultiplayer::set_server_relay_enabled(bool p_enabled) {
ERR_FAIL_COND_MSG(multiplayer_peer.is_valid() && multiplayer_peer->get_connection_status() != MultiplayerPeer::CONNECTION_DISCONNECTED, "Cannot change the server relay option while the multiplayer peer is active.");
server_relay = p_enabled; server_relay = p_enabled;
} }