diff options
Diffstat (limited to 'scene/main/node.h')
-rw-r--r-- | scene/main/node.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/scene/main/node.h b/scene/main/node.h index 341349de79..540f34cba7 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -65,6 +65,15 @@ public: #endif }; + enum RPCMode { + + RPC_MODE_DISABLED, //no rpc for this method, calls to this will be blocked (default) + RPC_MODE_REMOTE, // using rpc() on it will call method / set property in all other peers + RPC_MODE_SYNC, // using rpc() on it will call method / set property in all other peers and locally + RPC_MODE_MASTER, // usinc rpc() on it will call method on wherever the master is, be it local or remote + RPC_MODE_SLAVE, // usinc rpc() on it will call method for all slaves, be it local or remote + }; + struct Comparator { bool operator()(const Node *p_a, const Node *p_b) const { return p_b->is_greater_than(p_a); } @@ -111,8 +120,8 @@ private: Node *pause_owner; int network_master; - Map<StringName, MultiplayerAPI::RPCMode> rpc_methods; - Map<StringName, MultiplayerAPI::RPCMode> rpc_properties; + Map<StringName, RPCMode> rpc_methods; + Map<StringName, RPCMode> rpc_properties; // variables used to properly sort the node when processing, ignored otherwise //should move all the stuff below to bits @@ -395,8 +404,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 + void rpc_config(const StringName &p_method, RPCMode p_mode); // config a local method for RPC + void rset_config(const StringName &p_property, 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 @@ -414,8 +423,11 @@ 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); + 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); + + bool can_call_rpc(const StringName &p_method, int p_from) const; + bool can_call_rset(const StringName &p_property, int p_from) const; Node(); ~Node(); |