fix: body/area_entered only registered if !ready

This commit is contained in:
Sara Gerretsen 2025-10-25 13:14:14 +02:00
parent 4efcf58a01
commit c66d6f56b4
2 changed files with 8 additions and 4 deletions

View file

@ -33,9 +33,11 @@ void DamageBox::_notification(int what) {
default: default:
return; return;
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
connect("body_entered", callable_mp(this, &self_type::on_body_entered)); if (!is_ready()) {
connect("area_entered", callable_mp(this, &self_type::on_body_entered)); connect("body_entered", callable_mp(this, &self_type::on_body_entered));
set_monitoring(false); connect("area_entered", callable_mp(this, &self_type::on_body_entered));
set_monitoring(false);
}
return; return;
} }
} }

View file

@ -33,7 +33,9 @@ void EnemyWretched::_notification(int what) {
default: default:
return; return;
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
connect("child_entered_tree", callable_mp(this, &self_type::on_child_entered)); if (!is_ready()) {
connect("child_entered_tree", callable_mp(this, &self_type::on_child_entered));
}
return; return;
case NOTIFICATION_READY: case NOTIFICATION_READY:
ready(); ready();