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

[Net] Modularize multiplayer, expose MultiplayerAPI to extensions.

- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
This commit is contained in:
Fabio Alessandrelli
2022-07-12 23:12:42 +02:00
parent c3dc887c41
commit ca7d572908
80 changed files with 1819 additions and 1388 deletions

View File

@@ -76,11 +76,11 @@ GDScriptRPCCallable::GDScriptRPCCallable(Object *p_object, const StringName &p_m
ERR_FAIL_COND_MSG(!node, "RPC can only be defined on class that extends Node.");
}
void GDScriptRPCCallable::rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const {
Error GDScriptRPCCallable::rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const {
if (unlikely(!node)) {
r_call_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return;
return ERR_UNCONFIGURED;
}
r_call_error.error = Callable::CallError::CALL_OK;
node->rpcp(p_peer_id, method, p_arguments, p_argcount);
return node->rpcp(p_peer_id, method, p_arguments, p_argcount);
}