You've already forked godot
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user