Multiplayer networking renames/simplification

Removes _networking_ prefix from some methods and members, now that multiplayer has been largely moved out of Node and SceneTree and is seperated into its own set of classes.
This commit is contained in:
Max Hilbrunner 2021-09-07 23:35:19 +02:00
parent 43c896ac6a
commit 5b25457794
17 changed files with 193 additions and 193 deletions

View file

@ -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);