diff options
| author | Max Hilbrunner | 2018-05-29 11:47:52 +0200 |
|---|---|---|
| committer | GitHub | 2018-05-29 11:47:52 +0200 |
| commit | 4c69a495c948b1698a1634b506bf660bd49cdd76 (patch) | |
| tree | 76f810cefb7542fc4e3040d52810899a5e4ea40c /scene/main/node.h | |
| parent | d0b62ce1558766134ea2fc6bcf912e837d0ae40b (diff) | |
| download | godot-4c69a495c948b1698a1634b506bf660bd49cdd76.tar.gz godot-4c69a495c948b1698a1634b506bf660bd49cdd76.tar.zst godot-4c69a495c948b1698a1634b506bf660bd49cdd76.zip | |
Revert "RPCMode refactor, more sync modes"
Diffstat (limited to '')
| -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 341349de7..540f34cba 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(); |
