]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add guard to unbuckling to help it to not act upon terminating entities (#39410)
authorLuxeator <derkerl1@gmail.com>
Tue, 5 Aug 2025 23:15:16 +0000 (19:15 -0400)
committerGitHub <noreply@github.com>
Tue, 5 Aug 2025 23:15:16 +0000 (01:15 +0200)
* 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>
Content.Shared/Bed/SharedBedSystem.cs

index 7e798111cfd87f16d1c49a6413fd05d6b89b0df7..0518f05fdff3fd23ac5e636b91d84c7af2ff8508 100644 (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);
     }