@@ -849,8 +849,21 @@ void Node::rpc_config(const StringName &p_method, const Variant &p_config) {
849849 }
850850}
851851
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+ }
854867}
855868
856869/* **** RPC FUNCTIONS ********/
@@ -3980,7 +3993,7 @@ void Node::_bind_methods() {
39803993
39813994 ClassDB::bind_method (D_METHOD (" get_multiplayer" ), &Node::get_multiplayer);
39823995 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 ) );
39843997
39853998 ClassDB::bind_method (D_METHOD (" set_editor_description" , " editor_description" ), &Node::set_editor_description);
39863999 ClassDB::bind_method (D_METHOD (" get_editor_description" ), &Node::get_editor_description);
0 commit comments