diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 4b52b5c1d16..3935f7137c3 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -172,6 +172,8 @@ void Script::_bind_methods() { ClassDB::bind_method(D_METHOD("is_tool"), &Script::is_tool); ClassDB::bind_method(D_METHOD("is_abstract"), &Script::is_abstract); + ClassDB::bind_method(D_METHOD("get_rpc_config"), &Script::_get_rpc_config_bind); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "source_code", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_source_code", "get_source_code"); } diff --git a/core/object/script_language.h b/core/object/script_language.h index 1e02de0f9db..6b606d6c676 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -135,6 +135,10 @@ protected: void _set_debugger_break_language(); + Variant _get_rpc_config_bind() const { + return get_rpc_config().duplicate(true); + } + public: virtual void reload_from_file() override; diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 18281ac0c62..4a5c3270dd8 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -495,6 +495,13 @@ Fetches a node by [NodePath]. Similar to [method get_node], but does not generate an error if [param path] does not point to a valid node. + + + + Returns a [Dictionary] mapping method names to their RPC configuration defined for this node using [method rpc_config]. + [b]Note:[/b] This method only returns the RPC configuration assigned via [method rpc_config]. See [method Script.get_rpc_config] to retrieve the RPCs defined by the [Script]. + + diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml index 45f0bbb8aac..80aad9d30d1 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -58,6 +58,12 @@ Returns the default value of the specified property. + + + + Returns a [Dictionary] mapping method names to their RPC configuration defined by this script. + + diff --git a/misc/extension_api_validation/4.4-stable.expected b/misc/extension_api_validation/4.4-stable.expected index 33e021c399a..3682f5b5540 100644 --- a/misc/extension_api_validation/4.4-stable.expected +++ b/misc/extension_api_validation/4.4-stable.expected @@ -251,3 +251,10 @@ Validate extension JSON: Error: Field 'classes/InputMap/methods/add_action/argum Validate extension JSON: Error: Field 'global_enums/KeyModifierMask/values/KEY_MODIFIER_MASK': value changed value in new API, from 532676600.0 to 2130706432. Precision of string-serialized Variant constants increased. + + +GH-106848 +--------- +Validate extension JSON: API was removed: classes/Node/methods/get_rpc_config + +Change Node `get_rpc_config` to `get_node_rpc_config`. Compatibility method registered. diff --git a/scene/main/node.compat.inc b/scene/main/node.compat.inc index 173fc227a49..27685d2260b 100644 --- a/scene/main/node.compat.inc +++ b/scene/main/node.compat.inc @@ -34,8 +34,13 @@ void Node::_set_name_bind_compat_76560(const String &p_name) { set_name(p_name); } +Variant Node::_get_rpc_config_bind_compat_106848() const { + return _get_node_rpc_config_bind(); +} + void Node::_bind_compatibility_methods() { ClassDB::bind_compatibility_method(D_METHOD("set_name", "name"), &Node::_set_name_bind_compat_76560); + ClassDB::bind_compatibility_method(D_METHOD("get_rpc_config"), &Node::_get_rpc_config_bind_compat_106848); } #endif diff --git a/scene/main/node.cpp b/scene/main/node.cpp index aeb1598a1b6..200b3ea8d7d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -3980,6 +3980,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("get_multiplayer"), &Node::get_multiplayer); ClassDB::bind_method(D_METHOD("rpc_config", "method", "config"), &Node::rpc_config); + ClassDB::bind_method(D_METHOD("get_node_rpc_config"), &Node::_get_node_rpc_config_bind); ClassDB::bind_method(D_METHOD("set_editor_description", "editor_description"), &Node::set_editor_description); ClassDB::bind_method(D_METHOD("get_editor_description"), &Node::get_editor_description); diff --git a/scene/main/node.h b/scene/main/node.h index 50176b09dd5..9791fede588 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -388,6 +388,10 @@ protected: void _validate_property(PropertyInfo &p_property) const; + Variant _get_node_rpc_config_bind() const { + return get_node_rpc_config().duplicate(true); + } + protected: virtual bool _uses_signal_mutex() const override { return false; } // Node uses thread guards instead. @@ -414,6 +418,7 @@ protected: #ifndef DISABLE_DEPRECATED void _set_name_bind_compat_76560(const String &p_name); + Variant _get_rpc_config_bind_compat_106848() const; static void _bind_compatibility_methods(); #endif