Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript: Subclass overwrites rpc info #68291

Closed
rune-scape opened this issue Nov 5, 2022 · 0 comments · Fixed by #68374
Closed

GDScript: Subclass overwrites rpc info #68291

rune-scape opened this issue Nov 5, 2022 · 0 comments · Fixed by #68374

Comments

@rune-scape
Copy link
Contributor

Godot version

6882890

System information

Windows 10 x64

Issue description

Functions in a subclass with the same name as a func in its outer class will overwrite its rpc info, also i think rpc info for subclasses dont get made at all?

Steps to reproduce

Run the project, it spits out 0 instead of printing an error.
Here the rpc info are being overwritten by subclasses info, and subclass info is not getting populated as far as i can tell.

void GDScript::_init_rpc_methods_properties() {
// Copy the base rpc methods so we don't mask their IDs.
rpc_config.clear();
if (base.is_valid()) {
rpc_config = base->rpc_config.duplicate();
}
GDScript *cscript = this;
HashMap<StringName, Ref<GDScript>>::Iterator sub_E = subclasses.begin();
while (cscript) {
// RPC Methods
for (KeyValue<StringName, GDScriptFunction *> &E : cscript->member_functions) {
Variant config = E.value->get_rpc_config();
if (config.get_type() != Variant::NIL) {
rpc_config[E.value->get_name()] = config;
}
}
if (cscript != this) {
++sub_E;
}
if (sub_E) {
cscript = sub_E->value.ptr();
} else {
cscript = nullptr;
}
}
}

Minimal reproduction project

godot-phantom-rpc-call.zip

@Chaosus Chaosus added this to the 4.0 milestone Nov 9, 2022
@Chaosus Chaosus moved this to To Assess in 4.x Priority Issues Nov 9, 2022
@Chaosus Chaosus moved this from To Assess to Todo in 4.x Priority Issues Nov 9, 2022
Repository owner moved this from Todo to Done in 4.x Priority Issues Nov 14, 2022
Repository owner moved this from Todo to Done in GDScript Stabilization Tasks Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants