]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove stun and knockdown status effects before applying sleep (#15460)
authorjicksaw <jicksaw@pm.me>
Sat, 22 Apr 2023 11:06:45 +0000 (14:06 +0300)
committerGitHub <noreply@github.com>
Sat, 22 Apr 2023 11:06:45 +0000 (21:06 +1000)
Content.Server/Bed/Sleep/SleepingSystem.cs

index c52bd480ecb44bf2a062f00e8a1f7cbd43498c1d..b349b02065419f5d52de6ca035bd8f7f11b1187b 100644 (file)
@@ -10,6 +10,7 @@ using Content.Shared.IdentityManagement;
 using Content.Shared.Interaction;
 using Content.Shared.Mobs;
 using Content.Shared.Mobs.Components;
+using Content.Shared.StatusEffect;
 using Content.Shared.Slippery;
 using Content.Shared.Stunnable;
 using Content.Shared.Verbs;
@@ -29,6 +30,7 @@ namespace Content.Server.Bed.Sleep
         [Dependency] private readonly ActionsSystem _actionsSystem = default!;
         [Dependency] private readonly PopupSystem _popupSystem = default!;
         [Dependency] private readonly SharedAudioSystem _audio = default!;
+        [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
 
         public override void Initialize()
         {
@@ -53,6 +55,10 @@ namespace Content.Server.Bed.Sleep
             _prototypeManager.TryIndex<InstantActionPrototype>("Wake", out var wakeAction);
             if (args.FellAsleep)
             {
+                // Expiring status effects would remove the components needed for sleeping
+                _statusEffectsSystem.TryRemoveStatusEffect(uid, "Stun");
+                _statusEffectsSystem.TryRemoveStatusEffect(uid, "KnockedDown");
+
                 EnsureComp<StunnedComponent>(uid);
                 EnsureComp<KnockedDownComponent>(uid);