Add guard to unbuckling to help it to not act upon terminating entities (#39410)

* Add guard to unbuckling to help it to not act upon terminating entities

* Refactor guard for unbuckling

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Revert "Refactor guard for unbuckling"

This reverts commit bf975fbd6f5cfac45324a3d5d74e592ad17ad291.

---------

Co-authored-by: Luxeator <Luxeator>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Luxeator
2025-08-05 19:15:16 -04:00
committed by GitHub
parent 7de5002123
commit 4a466c5dbe

View File

@@ -56,8 +56,13 @@ public abstract class SharedBedSystem : EntitySystem
private void OnUnstrapped(Entity<HealOnBuckleComponent> bed, ref UnstrappedEvent args)
{
_actionsSystem.RemoveAction(args.Buckle.Owner, bed.Comp.SleepAction);
_sleepingSystem.TryWaking(args.Buckle.Owner);
// If the entity being unbuckled is terminating, we shouldn't try to act upon it, as some components may be gone
if (!Terminating(args.Buckle.Owner))
{
_actionsSystem.RemoveAction(args.Buckle.Owner, bed.Comp.SleepAction);
_sleepingSystem.TryWaking(args.Buckle.Owner);
}
RemComp<HealOnBuckleHealingComponent>(bed);
}