diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2018-05-26 10:28:28 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2018-05-29 20:26:41 +0200 |
commit | 4524153b6ece766e496d7b9c1a4f9216ea9e34cc (patch) | |
tree | 52b1f06af979cafe86dff346bcf10db4c981c1a5 /core/io/multiplayer_api.cpp | |
parent | 1400f6fdc444650ebf37c83bb4164e25e641bab1 (diff) |
New sync RPC modes to match all combinations
Diffstat (limited to 'core/io/multiplayer_api.cpp')
-rw-r--r-- | core/io/multiplayer_api.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index de98a195e4..846c89510e 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -42,6 +42,9 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas case MultiplayerAPI::RPC_MODE_REMOTE: { //do nothing also, no need to call local } break; + case MultiplayerAPI::RPC_MODE_REMOTESYNC: + case MultiplayerAPI::RPC_MODE_MASTERSYNC: + case MultiplayerAPI::RPC_MODE_SLAVESYNC: case MultiplayerAPI::RPC_MODE_SYNC: { //call it, sync always results in call return true; @@ -67,12 +70,15 @@ _FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, i case MultiplayerAPI::RPC_MODE_REMOTE: { return true; } break; + case MultiplayerAPI::RPC_MODE_REMOTESYNC: case MultiplayerAPI::RPC_MODE_SYNC: { return true; } break; + case MultiplayerAPI::RPC_MODE_MASTERSYNC: case MultiplayerAPI::RPC_MODE_MASTER: { return p_node->is_network_master(); } break; + case MultiplayerAPI::RPC_MODE_SLAVESYNC: case MultiplayerAPI::RPC_MODE_SLAVE: { return !p_node->is_network_master() && p_remote_id == p_node->get_network_master(); } break; @@ -797,6 +803,9 @@ void MultiplayerAPI::_bind_methods() { BIND_ENUM_CONSTANT(RPC_MODE_SYNC); BIND_ENUM_CONSTANT(RPC_MODE_MASTER); BIND_ENUM_CONSTANT(RPC_MODE_SLAVE); + BIND_ENUM_CONSTANT(RPC_MODE_REMOTESYNC); + BIND_ENUM_CONSTANT(RPC_MODE_MASTERSYNC); + BIND_ENUM_CONSTANT(RPC_MODE_SLAVESYNC); } MultiplayerAPI::MultiplayerAPI() { |