diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-09-08 14:20:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 14:20:58 +0200 |
commit | fd0a2b6cde85d737dbe9155b84c363732b8274e6 (patch) | |
tree | 70a33f1f8144039bd837be0f11cbe2ba495b594a /scene | |
parent | 321ee7bda11bf452616e98df4f1989ed29b5016a (diff) | |
parent | 5b25457794d3a6935d4c144b277cd963649e6818 (diff) |
Merge pull request #52480 from mhilbrunner/network-rename
Multiplayer networking renames/simplification
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/node.cpp | 20 | ||||
-rw-r--r-- | scene/main/node.h | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 6ffc8475f5..05409b7bfe 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -516,24 +516,24 @@ void Node::_propagate_process_owner(Node *p_owner, int p_pause_notification, int } } -void Node::set_network_authority(int p_peer_id, bool p_recursive) { - data.network_authority = p_peer_id; +void Node::set_multiplayer_authority(int p_peer_id, bool p_recursive) { + data.multiplayer_authority = p_peer_id; if (p_recursive) { for (int i = 0; i < data.children.size(); i++) { - data.children[i]->set_network_authority(p_peer_id, true); + data.children[i]->set_multiplayer_authority(p_peer_id, true); } } } -int Node::get_network_authority() const { - return data.network_authority; +int Node::get_multiplayer_authority() const { + return data.multiplayer_authority; } -bool Node::is_network_authority() const { +bool Node::is_multiplayer_authority() const { ERR_FAIL_COND_V(!is_inside_tree(), false); - return get_multiplayer()->get_network_unique_id() == data.network_authority; + return get_multiplayer()->get_unique_id() == data.multiplayer_authority; } /***** RPC CONFIG ********/ @@ -2737,10 +2737,10 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("request_ready"), &Node::request_ready); - ClassDB::bind_method(D_METHOD("set_network_authority", "id", "recursive"), &Node::set_network_authority, DEFVAL(true)); - ClassDB::bind_method(D_METHOD("get_network_authority"), &Node::get_network_authority); + ClassDB::bind_method(D_METHOD("set_multiplayer_authority", "id", "recursive"), &Node::set_multiplayer_authority, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("get_multiplayer_authority"), &Node::get_multiplayer_authority); - ClassDB::bind_method(D_METHOD("is_network_authority"), &Node::is_network_authority); + ClassDB::bind_method(D_METHOD("is_multiplayer_authority"), &Node::is_multiplayer_authority); ClassDB::bind_method(D_METHOD("get_multiplayer"), &Node::get_multiplayer); ClassDB::bind_method(D_METHOD("get_custom_multiplayer"), &Node::get_custom_multiplayer); diff --git a/scene/main/node.h b/scene/main/node.h index 27d6958140..198501eeac 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -127,7 +127,7 @@ private: ProcessMode process_mode = PROCESS_MODE_INHERIT; Node *process_owner = nullptr; - int network_authority = 1; // Server by default. + int multiplayer_authority = 1; // Server by default. Vector<Multiplayer::RPCConfig> rpc_methods; // Variables used to properly sort the node when processing, ignored otherwise. @@ -462,9 +462,9 @@ public: bool is_displayed_folded() const; /* NETWORK */ - void set_network_authority(int p_peer_id, bool p_recursive = true); - int get_network_authority() const; - bool is_network_authority() const; + void set_multiplayer_authority(int p_peer_id, bool p_recursive = true); + int get_multiplayer_authority() const; + bool is_multiplayer_authority() const; uint16_t rpc_config(const StringName &p_method, Multiplayer::RPCMode p_rpc_mode, Multiplayer::TransferMode p_transfer_mode, int p_channel = 0); // config a local method for RPC Vector<Multiplayer::RPCConfig> get_node_rpc_methods() const; |