Block emotes for sleeping (#32779)

* 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>
This commit is contained in:
SkaldetSkaeg
2024-10-13 15:22:05 +07:00
committed by GitHub
parent 52937a2e64
commit 8093a49943

View 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();
}
}