]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Block emotes for sleeping (#32779)
authorSkaldetSkaeg <impotekh@gmail.com>
Sun, 13 Oct 2024 08:22:05 +0000 (15:22 +0700)
committerGitHub <noreply@github.com>
Sun, 13 Oct 2024 08:22:05 +0000 (19:22 +1100)
* Block emotes

* typing issue

* Update Content.Shared/Bed/Sleep/SleepingSystem.cs

Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>
---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com>
Content.Shared/Bed/Sleep/SleepingSystem.cs

index 0e29fcd98ae0abcb50c1b4790fd91f46c5fb9b50..6a04bfe42df7bfc0a1f621ac0f56d742167606cf 100644 (file)
@@ -2,6 +2,7 @@ using Content.Shared.Actions;
 using Content.Shared.Buckle.Components;
 using Content.Shared.Damage;
 using Content.Shared.Damage.ForceSay;
+using Content.Shared.Emoting;
 using Content.Shared.Examine;
 using Content.Shared.Eye.Blinding.Systems;
 using Content.Shared.IdentityManagement;
@@ -61,6 +62,7 @@ public sealed partial class SleepingSystem : EntitySystem
 
         SubscribeLocalEvent<ForcedSleepingComponent, ComponentInit>(OnInit);
         SubscribeLocalEvent<SleepingComponent, UnbuckleAttemptEvent>(OnUnbuckleAttempt);
+        SubscribeLocalEvent<SleepingComponent, EmoteAttemptEvent>(OnEmoteAttempt);
     }
 
     private void OnUnbuckleAttempt(Entity<SleepingComponent> ent, ref UnbuckleAttemptEvent args)
@@ -310,6 +312,14 @@ public sealed partial class SleepingSystem : EntitySystem
         Wake((ent, ent.Comp));
         return true;
     }
+
+    /// <summary>
+    /// Prevents the use of emote actions while sleeping
+    /// </summary>
+    public void OnEmoteAttempt(Entity<SleepingComponent> ent, ref EmoteAttemptEvent args)
+    {
+        args.Cancel();
+    }
 }