1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add Script::inherits_script()

Partial cherry-pick of 5d4dc2d45c.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
This commit is contained in:
Pedro J. Estébanez
2021-08-02 04:48:17 +02:00
parent 504f47eaec
commit 7426b3fa91
11 changed files with 54 additions and 0 deletions

View File

@@ -815,6 +815,24 @@ Ref<GDScript> GDScript::get_base() const {
return base;
}
bool GDScript::inherits_script(const Ref<Script> &p_script) const {
Ref<GDScript> gd = p_script;
if (gd.is_null()) {
return false;
}
const GDScript *s = this;
while (s) {
if (s == p_script.ptr()) {
return true;
}
s = s->_base;
}
return false;
}
bool GDScript::has_script_signal(const StringName &p_signal) const {
if (_signals.has(p_signal)) {
return true;