summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/main/node.cpp32
-rw-r--r--scene/main/node.h8
-rw-r--r--scene/main/scene_tree.cpp62
-rw-r--r--scene/main/scene_tree.h6
4 files changed, 54 insertions, 54 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 67ee246252..e6ea4e4b4a 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -477,7 +477,7 @@ bool Node::is_network_master() const {
ERR_FAIL_COND_V(!is_inside_tree(), false);
- return get_multiplayer_api()->get_network_unique_id() == data.network_master;
+ return get_multiplayer()->get_network_unique_id() == data.network_master;
}
/***** RPC CONFIG ********/
@@ -668,12 +668,12 @@ Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Va
void Node::rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) {
ERR_FAIL_COND(!is_inside_tree());
- get_multiplayer_api()->rpcp(this, p_peer_id, p_unreliable, p_method, p_arg, p_argcount);
+ get_multiplayer()->rpcp(this, p_peer_id, p_unreliable, p_method, p_arg, p_argcount);
}
void Node::rsetp(int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {
ERR_FAIL_COND(!is_inside_tree());
- get_multiplayer_api()->rsetp(this, p_peer_id, p_unreliable, p_property, p_value);
+ get_multiplayer()->rsetp(this, p_peer_id, p_unreliable, p_property, p_value);
}
/******** RSET *********/
@@ -698,21 +698,21 @@ void Node::rset_unreliable_id(int p_peer_id, const StringName &p_property, const
}
//////////// end of rpc
-Ref<MultiplayerAPI> Node::get_multiplayer_api() const {
- if (multiplayer_api.is_valid())
- return multiplayer_api;
+Ref<MultiplayerAPI> Node::get_multiplayer() const {
+ if (multiplayer.is_valid())
+ return multiplayer;
if (!is_inside_tree())
return Ref<MultiplayerAPI>();
- return get_tree()->get_multiplayer_api();
+ return get_tree()->get_multiplayer();
}
-Ref<MultiplayerAPI> Node::get_custom_multiplayer_api() const {
- return multiplayer_api;
+Ref<MultiplayerAPI> Node::get_custom_multiplayer() const {
+ return multiplayer;
}
-void Node::set_custom_multiplayer_api(Ref<MultiplayerAPI> p_multiplayer_api) {
+void Node::set_custom_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
- multiplayer_api = p_multiplayer_api;
+ multiplayer = p_multiplayer;
}
const Map<StringName, Node::RPCMode>::Element *Node::get_node_rpc_mode(const StringName &p_method) {
@@ -2748,9 +2748,9 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_network_master"), &Node::is_network_master);
- ClassDB::bind_method(D_METHOD("get_multiplayer_api"), &Node::get_multiplayer_api);
- ClassDB::bind_method(D_METHOD("get_custom_multiplayer_api"), &Node::get_custom_multiplayer_api);
- ClassDB::bind_method(D_METHOD("set_custom_multiplayer_api", "api"), &Node::set_custom_multiplayer_api);
+ ClassDB::bind_method(D_METHOD("get_multiplayer"), &Node::get_multiplayer);
+ ClassDB::bind_method(D_METHOD("get_custom_multiplayer"), &Node::get_custom_multiplayer);
+ ClassDB::bind_method(D_METHOD("set_custom_multiplayer", "api"), &Node::set_custom_multiplayer);
ClassDB::bind_method(D_METHOD("rpc_config", "method", "mode"), &Node::rpc_config);
ClassDB::bind_method(D_METHOD("rset_config", "property", "mode"), &Node::rset_config);
@@ -2830,8 +2830,8 @@ void Node::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "name", PROPERTY_HINT_NONE, "", 0), "set_name", "get_name");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "filename", PROPERTY_HINT_NONE, "", 0), "set_filename", "get_filename");
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_owner", "get_owner");
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "multiplayer_api", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "", "get_multiplayer_api");
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "custom_multiplayer_api", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_custom_multiplayer_api", "get_custom_multiplayer_api");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "", "get_multiplayer");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "custom_multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_custom_multiplayer", "get_custom_multiplayer");
BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta")));
BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta")));
diff --git a/scene/main/node.h b/scene/main/node.h
index b5a956116d..4ff1247e14 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -151,7 +151,7 @@ private:
NAME_CASING_SNAKE_CASE
};
- Ref<MultiplayerAPI> multiplayer_api;
+ Ref<MultiplayerAPI> multiplayer;
void _print_tree_pretty(const String prefix, const bool last);
void _print_tree(const Node *p_node);
@@ -419,9 +419,9 @@ public:
void rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
void rsetp(int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value);
- Ref<MultiplayerAPI> get_multiplayer_api() const;
- Ref<MultiplayerAPI> get_custom_multiplayer_api() const;
- void set_custom_multiplayer_api(Ref<MultiplayerAPI> p_multiplayer_api);
+ Ref<MultiplayerAPI> get_multiplayer() const;
+ Ref<MultiplayerAPI> get_custom_multiplayer() const;
+ void set_custom_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
const Map<StringName, RPCMode>::Element *get_node_rpc_mode(const StringName &p_method);
const Map<StringName, RPCMode>::Element *get_node_rset_mode(const StringName &p_property);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 011087b487..607dbebf6c 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -485,7 +485,7 @@ bool SceneTree::idle(float p_time) {
idle_process_time = p_time;
- multiplayer_api->poll();
+ multiplayer->poll();
emit_signal("idle_frame");
@@ -1668,70 +1668,70 @@ void SceneTree::_server_disconnected() {
emit_signal("server_disconnected");
}
-Ref<MultiplayerAPI> SceneTree::get_multiplayer_api() const {
- return multiplayer_api;
+Ref<MultiplayerAPI> SceneTree::get_multiplayer() const {
+ return multiplayer;
}
-void SceneTree::set_multiplayer_api(Ref<MultiplayerAPI> p_multiplayer_api) {
- ERR_FAIL_COND(!p_multiplayer_api.is_valid());
+void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
+ ERR_FAIL_COND(!p_multiplayer.is_valid());
- if (multiplayer_api.is_valid()) {
- multiplayer_api->disconnect("network_peer_connected", this, "_network_peer_connected");
- multiplayer_api->disconnect("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer_api->disconnect("connected_to_server", this, "_connected_to_server");
- multiplayer_api->disconnect("connection_failed", this, "_connection_failed");
- multiplayer_api->disconnect("server_disconnected", this, "_server_disconnected");
+ if (multiplayer.is_valid()) {
+ multiplayer->disconnect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->disconnect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->disconnect("connected_to_server", this, "_connected_to_server");
+ multiplayer->disconnect("connection_failed", this, "_connection_failed");
+ multiplayer->disconnect("server_disconnected", this, "_server_disconnected");
}
- multiplayer_api = p_multiplayer_api;
- multiplayer_api->set_root_node(root);
+ multiplayer = p_multiplayer;
+ multiplayer->set_root_node(root);
- multiplayer_api->connect("network_peer_connected", this, "_network_peer_connected");
- multiplayer_api->connect("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer_api->connect("connected_to_server", this, "_connected_to_server");
- multiplayer_api->connect("connection_failed", this, "_connection_failed");
- multiplayer_api->connect("server_disconnected", this, "_server_disconnected");
+ multiplayer->connect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->connect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->connect("connected_to_server", this, "_connected_to_server");
+ multiplayer->connect("connection_failed", this, "_connection_failed");
+ multiplayer->connect("server_disconnected", this, "_server_disconnected");
}
void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) {
- multiplayer_api->set_network_peer(p_network_peer);
+ multiplayer->set_network_peer(p_network_peer);
}
Ref<NetworkedMultiplayerPeer> SceneTree::get_network_peer() const {
- return multiplayer_api->get_network_peer();
+ return multiplayer->get_network_peer();
}
bool SceneTree::is_network_server() const {
- return multiplayer_api->is_network_server();
+ return multiplayer->is_network_server();
}
bool SceneTree::has_network_peer() const {
- return multiplayer_api->has_network_peer();
+ return multiplayer->has_network_peer();
}
int SceneTree::get_network_unique_id() const {
- return multiplayer_api->get_network_unique_id();
+ return multiplayer->get_network_unique_id();
}
Vector<int> SceneTree::get_network_connected_peers() const {
- return multiplayer_api->get_network_connected_peers();
+ return multiplayer->get_network_connected_peers();
}
int SceneTree::get_rpc_sender_id() const {
- return multiplayer_api->get_rpc_sender_id();
+ return multiplayer->get_rpc_sender_id();
}
void SceneTree::set_refuse_new_network_connections(bool p_refuse) {
- multiplayer_api->set_refuse_new_network_connections(p_refuse);
+ multiplayer->set_refuse_new_network_connections(p_refuse);
}
bool SceneTree::is_refusing_new_network_connections() const {
- return multiplayer_api->is_refusing_new_network_connections();
+ return multiplayer->is_refusing_new_network_connections();
}
void SceneTree::_bind_methods() {
@@ -1800,8 +1800,8 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene);
- ClassDB::bind_method(D_METHOD("set_multiplayer_api", "multiplayer_api"), &SceneTree::set_multiplayer_api);
- ClassDB::bind_method(D_METHOD("get_multiplayer_api"), &SceneTree::get_multiplayer_api);
+ ClassDB::bind_method(D_METHOD("set_multiplayer", "multiplayer"), &SceneTree::set_multiplayer);
+ ClassDB::bind_method(D_METHOD("get_multiplayer"), &SceneTree::get_multiplayer);
ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer);
ClassDB::bind_method(D_METHOD("get_network_peer"), &SceneTree::get_network_peer);
ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server);
@@ -1829,7 +1829,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer_api", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_multiplayer_api", "get_multiplayer_api");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_multiplayer", "get_multiplayer");
ADD_SIGNAL(MethodInfo("tree_changed"));
ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node")));
@@ -1934,7 +1934,7 @@ SceneTree::SceneTree() {
root->set_world(Ref<World>(memnew(World)));
// Initialize network state
- set_multiplayer_api(Ref<MultiplayerAPI>(memnew(MultiplayerAPI)));
+ set_multiplayer(Ref<MultiplayerAPI>(memnew(MultiplayerAPI)));
//root->set_world_2d( Ref<World2D>( memnew( World2D )));
root->set_as_audio_listener(true);
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 9c06e4ded3..6e0156546e 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -185,7 +185,7 @@ private:
///network///
- Ref<MultiplayerAPI> multiplayer_api;
+ Ref<MultiplayerAPI> multiplayer;
void _network_peer_connected(int p_id);
void _network_peer_disconnected(int p_id);
@@ -410,8 +410,8 @@ public:
//network API
- Ref<MultiplayerAPI> get_multiplayer_api() const;
- void set_multiplayer_api(Ref<MultiplayerAPI> p_multiplayer_api);
+ Ref<MultiplayerAPI> get_multiplayer() const;
+ void set_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer);
Ref<NetworkedMultiplayerPeer> get_network_peer() const;
bool is_network_server() const;