Merge pull request #96024 from Ryan-000/expose_get_rpc_config
Expose `get_rpc_config` and `get_node_rpc_config`
This commit is contained in:
commit
8ebfd89359
12 changed files with 25 additions and 10 deletions
|
@ -174,6 +174,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);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "source_code", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_source_code", "get_source_code");
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
virtual bool is_placeholder_fallback_enabled() const { return false; }
|
||||
|
||||
virtual const Variant get_rpc_config() const = 0;
|
||||
virtual Variant get_rpc_config() const = 0;
|
||||
|
||||
Script() {}
|
||||
};
|
||||
|
|
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
GDVIRTUAL0RC(Variant, _get_rpc_config)
|
||||
|
||||
virtual const Variant get_rpc_config() const override {
|
||||
virtual Variant get_rpc_config() const override {
|
||||
Variant ret;
|
||||
GDVIRTUAL_REQUIRED_CALL(_get_rpc_config, ret);
|
||||
return ret;
|
||||
|
|
|
@ -498,6 +498,12 @@
|
|||
Returns the time elapsed (in seconds) since the last process callback. This value is identical to [method _process]'s [code]delta[/code] parameter, and may vary from frame to frame. See also [constant NOTIFICATION_PROCESS].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rpc_config" qualifiers="const">
|
||||
<return type="Variant" />
|
||||
<description>
|
||||
Returns a [Dictionary] mapping method names to their RPC configuration defined for this node using [method rpc_config].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_scene_instance_load_placeholder" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
|
|
|
@ -58,6 +58,12 @@
|
|||
Returns the default value of the specified property.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rpc_config" qualifiers="const">
|
||||
<return type="Variant" />
|
||||
<description>
|
||||
Returns a [Dictionary] mapping method names to their RPC configuration defined by this script.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_script_constant_map">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
|
|
|
@ -911,7 +911,7 @@ void GDScript::get_members(HashSet<StringName> *p_members) {
|
|||
}
|
||||
}
|
||||
|
||||
const Variant GDScript::get_rpc_config() const {
|
||||
Variant GDScript::get_rpc_config() const {
|
||||
return rpc_config;
|
||||
}
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ public:
|
|||
virtual void get_constants(HashMap<StringName, Variant> *p_constants) override;
|
||||
virtual void get_members(HashSet<StringName> *p_members) override;
|
||||
|
||||
virtual const Variant get_rpc_config() const override;
|
||||
virtual Variant get_rpc_config() const override;
|
||||
|
||||
void unload_static() const;
|
||||
|
||||
|
|
|
@ -2717,7 +2717,7 @@ int CSharpScript::get_member_line(const StringName &p_member) const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
const Variant CSharpScript::get_rpc_config() const {
|
||||
Variant CSharpScript::get_rpc_config() const {
|
||||
return rpc_config;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ public:
|
|||
|
||||
int get_member_line(const StringName &p_member) const override;
|
||||
|
||||
const Variant get_rpc_config() const override;
|
||||
Variant get_rpc_config() const override;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
bool is_placeholder_fallback_enabled() const override {
|
||||
|
|
|
@ -118,7 +118,7 @@ const SceneRPCInterface::RPCConfigCache &SceneRPCInterface::_get_node_config(con
|
|||
return rpc_cache[oid];
|
||||
}
|
||||
RPCConfigCache cache;
|
||||
_parse_rpc_config(p_node->get_node_rpc_config(), true, cache);
|
||||
_parse_rpc_config(p_node->get_rpc_config(), true, cache);
|
||||
if (p_node->get_script_instance()) {
|
||||
_parse_rpc_config(p_node->get_script_instance()->get_rpc_config(), false, cache);
|
||||
}
|
||||
|
|
|
@ -757,7 +757,7 @@ void Node::rpc_config(const StringName &p_method, const Variant &p_config) {
|
|||
}
|
||||
}
|
||||
|
||||
const Variant Node::get_node_rpc_config() const {
|
||||
Variant Node::get_rpc_config() const {
|
||||
return data.rpc_config;
|
||||
}
|
||||
|
||||
|
@ -3638,6 +3638,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_rpc_config"), &Node::get_rpc_config);
|
||||
|
||||
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);
|
||||
|
|
|
@ -199,7 +199,7 @@ private:
|
|||
void *process_group = nullptr; // to avoid cyclic dependency
|
||||
|
||||
int multiplayer_authority = 1; // Server by default.
|
||||
Variant rpc_config;
|
||||
Variant rpc_config = Dictionary();
|
||||
|
||||
// Variables used to properly sort the node when processing, ignored otherwise.
|
||||
int process_priority = 0;
|
||||
|
@ -717,7 +717,7 @@ public:
|
|||
bool is_multiplayer_authority() const;
|
||||
|
||||
void rpc_config(const StringName &p_method, const Variant &p_config); // config a local method for RPC
|
||||
const Variant get_node_rpc_config() const;
|
||||
Variant get_rpc_config() const;
|
||||
|
||||
template <typename... VarArgs>
|
||||
Error rpc(const StringName &p_method, VarArgs... p_args);
|
||||
|
|
Loading…
Reference in a new issue