@@ -849,8 +849,21 @@ void Node::rpc_config(const StringName &p_method, const Variant &p_config) {
849
849
}
850
850
}
851
851
852
- Variant Node::get_rpc_config () const {
853
- return data.rpc_config ;
852
+ Variant Node::get_rpc_config (bool script_rpc_get) const {
853
+ const Dictionary node_config = data.rpc_config ;
854
+ if (script_rpc_get && get_script_instance ()) { // return attached GDScript RPC configs too
855
+ const Dictionary script_config = get_script_instance ()->get_rpc_config ();
856
+ const Array script_names = script_config.keys ();
857
+ Dictionary merged_config = node_config;
858
+ for (int i = 0 ; i < script_names.size (); i++) {
859
+ const auto name = script_names[i];
860
+ ERR_FAIL_COND_V_MSG (merged_config.has (name) == true , node_config, " Detected GDScript function RPC name collision. Only Node RPC configuration will be returned." );
861
+ merged_config[name] = script_config[name];
862
+ }
863
+ return merged_config;
864
+ } else {
865
+ return node_config;
866
+ }
854
867
}
855
868
856
869
/* **** RPC FUNCTIONS ********/
@@ -3980,7 +3993,7 @@ void Node::_bind_methods() {
3980
3993
3981
3994
ClassDB::bind_method (D_METHOD (" get_multiplayer" ), &Node::get_multiplayer);
3982
3995
ClassDB::bind_method (D_METHOD (" rpc_config" , " method" , " config" ), &Node::rpc_config);
3983
- ClassDB::bind_method (D_METHOD (" get_rpc_config" ), &Node::get_rpc_config);
3996
+ ClassDB::bind_method (D_METHOD (" get_rpc_config" , " script_rpc_get " ), &Node::get_rpc_config, DEFVAL ( true ) );
3984
3997
3985
3998
ClassDB::bind_method (D_METHOD (" set_editor_description" , " editor_description" ), &Node::set_editor_description);
3986
3999
ClassDB::bind_method (D_METHOD (" get_editor_description" ), &Node::get_editor_description);
0 commit comments