Skip to content

get_rpc_config() can't get config of RPCs defined with @rpc #105675

Open
@dragonhunt02

Description

@dragonhunt02

Tested versions

  • Reproducible in v4.5.dev2

System information

Ubuntu 24.04 Godot v4.5.dev2

Issue description

get_rpc_config() returns empty dictionary if RPC functions are defined with @rpc annotation.
Configuring function with rpc_config() works as expected (dictionary is returned with methods)

- Test project
https://github.com/dragonhunt02/godot-rpc-get

Here are some rpc code sections I didn't check yet

bool GDScriptParser::rpc_annotation(AnnotationNode *p_annotation, Node *p_target, ClassNode *p_class) {
ERR_FAIL_COND_V_MSG(p_target->type != Node::FUNCTION, false, vformat(R"("%s" annotation can only be applied to functions.)", p_annotation->name));
FunctionNode *function = static_cast<FunctionNode *>(p_target);
if (function->rpc_config.get_type() != Variant::NIL) {
push_error(R"(RPC annotations can only be used once per function.)", p_annotation);

case GDScriptParser::ClassNode::Member::FUNCTION: {
const GDScriptParser::FunctionNode *function_n = member.function;
Variant config = function_n->rpc_config;
if (config.get_type() != Variant::NIL) {
p_script->rpc_config[function_n->identifier->name] = config;
}

Steps to reproduce

  1. Write function with @rpc annotation
  2. Call get_rpc_config() in class _ready method
  3. Print return value

Minimal reproduction project (MRP)

https://github.com/dragonhunt02/godot-rpc-get/archive/refs/heads/main.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions