Add EmoteOnDamage comp/system for zombies (#14371)
This commit is contained in:
@@ -26,8 +26,11 @@ using Content.Server.Humanoid;
|
||||
using Content.Server.IdentityManagement;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Systems;
|
||||
|
||||
namespace Content.Server.Zombies
|
||||
{
|
||||
@@ -47,6 +50,8 @@ namespace Content.Server.Zombies
|
||||
[Dependency] private readonly HumanoidAppearanceSystem _sharedHuApp = default!;
|
||||
[Dependency] private readonly IdentitySystem _identity = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
|
||||
[Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
|
||||
[Dependency] private readonly EmoteOnDamageSystem _emoteOnDamage = default!;
|
||||
[Dependency] private readonly IChatManager _chatMan = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
|
||||
@@ -65,7 +70,7 @@ namespace Content.Server.Zombies
|
||||
if (args.NewMobState == MobState.Dead ||
|
||||
args.NewMobState == MobState.Critical)
|
||||
{
|
||||
ZombifyEntity(uid);
|
||||
ZombifyEntity(uid, args.Component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,12 +86,15 @@ namespace Content.Server.Zombies
|
||||
/// rewrite this, but this is how it shall lie eternal. Turn back now.
|
||||
/// -emo
|
||||
/// </remarks>
|
||||
public void ZombifyEntity(EntityUid target)
|
||||
public void ZombifyEntity(EntityUid target, MobStateComponent? mobState = null)
|
||||
{
|
||||
//Don't zombfiy zombies
|
||||
if (HasComp<ZombieComponent>(target))
|
||||
return;
|
||||
|
||||
if (!Resolve(target, ref mobState, logMissing: false))
|
||||
return;
|
||||
|
||||
//you're a real zombie now, son.
|
||||
var zombiecomp = AddComp<ZombieComponent>(target);
|
||||
|
||||
@@ -117,6 +125,17 @@ namespace Content.Server.Zombies
|
||||
melee.Range = 1.5f;
|
||||
Dirty(melee);
|
||||
|
||||
if (mobState.CurrentState == MobState.Alive)
|
||||
{
|
||||
// Groaning when damaged
|
||||
EnsureComp<EmoteOnDamageComponent>(target);
|
||||
_emoteOnDamage.AddEmote(target, "Scream");
|
||||
|
||||
// Random groaning
|
||||
EnsureComp<AutoEmoteComponent>(target);
|
||||
_autoEmote.AddEmote(target, "ZombieGroan");
|
||||
}
|
||||
|
||||
//We have specific stuff for humanoid zombies because they matter more
|
||||
if (TryComp<HumanoidAppearanceComponent>(target, out var huApComp)) //huapcomp
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user