Deathgasp + last words / succumbing / fake deathgasp as crit actions (#18993)

This commit is contained in:
Kara
2023-08-11 22:56:34 -07:00
committed by GitHub
parent eff36d2fe9
commit 7b51cebfea
20 changed files with 459 additions and 35 deletions

View File

@@ -0,0 +1,40 @@
using Content.Server.Chat.Systems;
using Content.Shared.Mobs;
using Robust.Shared.Prototypes;
namespace Content.Server.Mobs;
/// <see cref="DeathgaspComponent"/>
public sealed class DeathgaspSystem: EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DeathgaspComponent, MobStateChangedEvent>(OnMobStateChanged);
}
private void OnMobStateChanged(EntityUid uid, DeathgaspComponent component, MobStateChangedEvent args)
{
// don't deathgasp if they arent going straight from crit to dead
if (args.NewMobState != MobState.Dead || args.OldMobState != MobState.Critical)
return;
Deathgasp(uid, component);
}
/// <summary>
/// Causes an entity to perform their deathgasp emote, if they have one.
/// </summary>
public bool Deathgasp(EntityUid uid, DeathgaspComponent? component = null)
{
if (!Resolve(uid, ref component, false))
return false;
_chat.TryEmoteWithChat(uid, component.Prototype, ignoreActionBlocker: true);
return true;
}
}