using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Server.Emoting.Systems;
-using Content.Server.GameTicking.Rules.Components;
using Content.Server.Speech.EntitySystems;
using Content.Server.Roles;
using Content.Shared.Anomaly.Components;
{
base.Initialize();
- SubscribeLocalEvent<ZombieComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ZombieComponent, EmoteEvent>(OnEmote, before:
new[] { typeof(VocalSystem), typeof(BodyEmotesSystem) });
args.Unrevivable = 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);
+
+ _protoManager.TryIndex(component.EmoteSoundsId, out var sounds);
+
+ args.Handled = _chat.TryPlayEmoteSound(uid, sounds, args.Emote);
}
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
[DataField("beforeZombifiedEyeColor")]
public Color BeforeZombifiedEyeColor;
- [DataField("emoteId", customTypeSerializer: typeof(PrototypeIdSerializer<EmoteSoundsPrototype>))]
- public string? EmoteSoundsId = "Zombie";
-
- public EmoteSoundsPrototype? EmoteSounds;
+ [DataField("emoteId")]
+ public ProtoId<EmoteSoundsPrototype>? EmoteSoundsId = "Zombie";
[DataField("nextTick", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextTick;