summaryrefslogtreecommitdiff
path: root/scene/main/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/node.h')
-rw-r--r--scene/main/node.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/scene/main/node.h b/scene/main/node.h
index 6f5544d654..02c828e8ff 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -85,6 +85,11 @@ private:
GroupData() { persistent = false; }
};
+ struct NetData {
+ StringName name;
+ MultiplayerAPI::RPCMode mode;
+ };
+
struct Data {
String filename;
@@ -118,8 +123,8 @@ private:
Node *pause_owner;
int network_master;
- Map<StringName, MultiplayerAPI::RPCMode> rpc_methods;
- Map<StringName, MultiplayerAPI::RPCMode> rpc_properties;
+ Vector<NetData> rpc_methods;
+ Vector<NetData> rpc_properties;
// variables used to properly sort the node when processing, ignored otherwise
//should move all the stuff below to bits
@@ -427,8 +432,8 @@ public:
int get_network_master() const;
bool is_network_master() const;
- void rpc_config(const StringName &p_method, MultiplayerAPI::RPCMode p_mode); // config a local method for RPC
- void rset_config(const StringName &p_property, MultiplayerAPI::RPCMode p_mode); // config a local property for RPC
+ uint16_t rpc_config(const StringName &p_method, MultiplayerAPI::RPCMode p_mode); // config a local method for RPC
+ uint16_t rset_config(const StringName &p_property, MultiplayerAPI::RPCMode p_mode); // config a local property for RPC
void rpc(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
void rpc_unreliable(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
@@ -446,8 +451,22 @@ public:
Ref<MultiplayerAPI> get_multiplayer() const;
Ref<MultiplayerAPI> get_custom_multiplayer() const;
void set_custom_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
- const Map<StringName, MultiplayerAPI::RPCMode>::Element *get_node_rpc_mode(const StringName &p_method);
- const Map<StringName, MultiplayerAPI::RPCMode>::Element *get_node_rset_mode(const StringName &p_property);
+
+ /// Returns the rpc method ID, otherwise UINT32_MAX
+ uint16_t get_node_rpc_method_id(const StringName &p_method) const;
+ StringName get_node_rpc_method(const uint16_t p_rpc_method_id) const;
+ MultiplayerAPI::RPCMode get_node_rpc_mode_by_id(const uint16_t p_rpc_method_id) const;
+ MultiplayerAPI::RPCMode get_node_rpc_mode(const StringName &p_method) const;
+
+ /// Returns the rpc property ID, otherwise UINT32_MAX
+ uint16_t get_node_rset_property_id(const StringName &p_property) const;
+ StringName get_node_rset_property(const uint16_t p_rset_property_id) const;
+ MultiplayerAPI::RPCMode get_node_rset_mode_by_id(const uint16_t p_rpc_method_id) const;
+ MultiplayerAPI::RPCMode get_node_rset_mode(const StringName &p_property) const;
+
+ /// Can be used to check if the rpc methods and the rset properties are the
+ /// same across the peers.
+ String get_rpc_md5() const;
Node();
~Node();