feat: added configuration warnings to player body

This commit is contained in:
Sara 2025-07-25 21:06:59 +02:00
parent 4bec0ed5fc
commit 69daecea06
2 changed files with 16 additions and 1 deletions

View file

@ -84,6 +84,20 @@ void PlayerBody::_notification(int what) {
}
}
PackedStringArray PlayerBody::get_configuration_warnings() const {
PackedStringArray warnings{ super_type::get_configuration_warnings() };
if (find_children("*", HealthStatus::get_class_static()).is_empty()) {
warnings.push_back("This node has no health status and will cause crashes.\nConsider adding HealthStatus node as a child.");
}
if (find_children("*", PlayerInput::get_class_static()).is_empty()) {
warnings.push_back("This node has no input dispatcher and will cause crashes.\nConsider adding a PlayerInput node as a child.");
}
if (find_children("*", WeaponInventory::get_class_static()).is_empty()) {
warnings.push_back("This node has no inventory and will cause crashes.\nConsider adding a WeaponInventory node as a child.");
}
return warnings;
}
PlayerBody *PlayerBody::get_singleton() {
return singleton_instance;
}