Audible emotes (#12708)

Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
This commit is contained in:
Alex Evgrashin
2023-01-25 17:29:41 +01:00
committed by GitHub
parent 7ec896543f
commit ef452b38a9
45 changed files with 794 additions and 169 deletions

View File

@@ -11,6 +11,9 @@ using Content.Server.Speech;
using Content.Shared.Bed.Sleep;
using Content.Shared.Chemistry.Components;
using Content.Server.Chat.Systems;
using Content.Server.Emoting.Systems;
using Content.Server.Speech.EntitySystems;
using Content.Shared.Movement.Systems;
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.Disease.Events;
@@ -30,7 +33,6 @@ namespace Content.Server.Zombies
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
[Dependency] private readonly ServerInventorySystem _inv = default!;
[Dependency] private readonly VocalSystem _vocal = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
@@ -40,6 +42,10 @@ namespace Content.Server.Zombies
{
base.Initialize();
SubscribeLocalEvent<ZombieComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ZombieComponent, EmoteEvent>(OnEmote, before:
new []{typeof(VocalSystem), typeof(BodyEmotesSystem)});
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
SubscribeLocalEvent<ZombieComponent, CloningEvent>(OnZombieCloning);
@@ -54,6 +60,21 @@ namespace Content.Server.Zombies
args.Cancelled = true;
}
private void OnStartup(EntityUid uid, ZombieComponent component, ComponentStartup args)
{
if (component.EmoteSoundsId == null)
return;
_protoManager.TryIndex(component.EmoteSoundsId, out component.EmoteSounds);
}
private void OnEmote(EntityUid uid, ZombieComponent component, ref EmoteEvent args)
{
// always play zombie emote sounds and ignore others
if (args.Handled)
return;
args.Handled = _chat.TryPlayEmoteSound(uid, component.EmoteSounds, args.Emote);
}
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
{
if (args.NewMobState == MobState.Alive)
@@ -155,7 +176,7 @@ namespace Content.Server.Zombies
// [automated maintainer groan]
_chat.TrySendInGameICMessage(uid, "[automated zombie groan]", InGameICChatType.Speak, false);
else
_vocal.TryScream(uid);
_chat.TryEmoteWithoutChat(uid, component.GroanEmoteId);
component.LastDamageGroanCooldown = component.GroanCooldown;
}