GDScript: Fix incorrect default transfer_mode for @rpc annotation
The `@rpc` annotation was registered with "unreliable" as the default transfer_mode, but the runtime (SceneRPCInterface) defaults to TRANSFER_MODE_RELIABLE. This caused a mismatch between the documented default and the actual behavior when using Node.rpc_config(). Changed the parser default to "reliable" to match the runtime behavior and C# RpcAttribute. Added comments in all three locations to help prevent future drift. Fixes godotengine/godot-docs#8874 Related docs fix: godotengine/godot-docs#11554
This commit is contained in:
committed by
Rémi Verschelde
parent
7692a3d53b
commit
e304b4e43e
@@ -84,6 +84,7 @@ void SceneRPCInterface::_parse_rpc_config(const Variant &p_config, bool p_for_no
|
||||
ERR_CONTINUE(config[name].get_type() != Variant::DICTIONARY);
|
||||
ERR_CONTINUE(!config[name].operator Dictionary().has("rpc_mode"));
|
||||
Dictionary dict = config[name];
|
||||
// Default values should match GDScript `@rpc` annotation registration and `rpc_annotation()`.
|
||||
RPCConfig cfg;
|
||||
cfg.name = name;
|
||||
cfg.rpc_mode = ((MultiplayerAPI::RPCMode)dict.get("rpc_mode", MultiplayerAPI::RPC_MODE_AUTHORITY).operator int());
|
||||
|
||||
Reference in New Issue
Block a user