1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[Net] Move multiplayer to core subdir, split RPCManager.

Move multiplayer classes to "core/multiplayer" subdir.

Move the RPCConfig and enums (TransferMode, RPCMode) to a separate
file (multiplayer.h), and bind them to the global namespace.

Move the RPC handling code to its own class (RPCManager).

Renames "get_rpc_sender_id" to "get_remote_sender_id".
This commit is contained in:
Fabio Alessandrelli
2021-09-03 19:40:47 +02:00
parent b0b30aaf41
commit bf9aae09ba
57 changed files with 976 additions and 767 deletions

View File

@@ -900,7 +900,7 @@ void GDScript::get_members(Set<StringName> *p_members) {
}
}
const Vector<MultiplayerAPI::RPCConfig> GDScript::get_rpc_methods() const {
const Vector<Multiplayer::RPCConfig> GDScript::get_rpc_methods() const {
return rpc_functions;
}
@@ -1164,8 +1164,8 @@ void GDScript::_init_rpc_methods_properties() {
while (cscript) {
// RPC Methods
for (Map<StringName, GDScriptFunction *>::Element *E = cscript->member_functions.front(); E; E = E->next()) {
MultiplayerAPI::RPCConfig config = E->get()->get_rpc_config();
if (config.rpc_mode != MultiplayerAPI::RPC_MODE_DISABLED) {
Multiplayer::RPCConfig config = E->get()->get_rpc_config();
if (config.rpc_mode != Multiplayer::RPC_MODE_DISABLED) {
config.name = E->get()->get_name();
if (rpc_functions.find(config) == -1) {
rpc_functions.push_back(config);
@@ -1185,7 +1185,7 @@ void GDScript::_init_rpc_methods_properties() {
}
// Sort so we are 100% that they are always the same.
rpc_functions.sort_custom<MultiplayerAPI::SortRPCConfig>();
rpc_functions.sort_custom<Multiplayer::SortRPCConfig>();
}
GDScript::~GDScript() {
@@ -1541,7 +1541,7 @@ ScriptLanguage *GDScriptInstance::get_language() {
return GDScriptLanguage::get_singleton();
}
const Vector<MultiplayerAPI::RPCConfig> GDScriptInstance::get_rpc_methods() const {
const Vector<Multiplayer::RPCConfig> GDScriptInstance::get_rpc_methods() const {
return script->get_rpc_methods();
}