Files
tbd-station-14/Content.Shared/Traits/Assorted/PainNumbnessSystem.cs
Coolsurf6 012c835559 Added Pain Numbness Trait (#34538)
* added pain-numbness component and system

* added numb as a trait that pulls the pain numbness component

* removed new event as mob threshold event as already being fired

* checked for MobThresholdsComponent first before running VerifyThresholds

* refacted force say to using LocalizedDatasetPrototype and added numb messages

* added severity check alert

* added comment for BeforeForceSayEvent

* removed space formatting

* changed Cancelled to CancelUpdate, fixed spacing and added two more damage-force-say-numb

* changed prefix damage-force-say-numb to 5 (whoops)
2025-01-27 11:34:20 +01:00

47 lines
1.6 KiB
C#

using Content.Shared.Damage.Events;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Events;
using Content.Shared.Mobs.Systems;
namespace Content.Shared.Traits.Assorted;
public sealed class PainNumbnessSystem : EntitySystem
{
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
public override void Initialize()
{
SubscribeLocalEvent<PainNumbnessComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<PainNumbnessComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<PainNumbnessComponent, BeforeForceSayEvent>(OnChangeForceSay);
SubscribeLocalEvent<PainNumbnessComponent, BeforeAlertSeverityCheckEvent>(OnAlertSeverityCheck);
}
private void OnComponentRemove(EntityUid uid, PainNumbnessComponent component, ComponentRemove args)
{
if (!HasComp<MobThresholdsComponent>(uid))
return;
_mobThresholdSystem.VerifyThresholds(uid);
}
private void OnComponentInit(EntityUid uid, PainNumbnessComponent component, ComponentInit args)
{
if (!HasComp<MobThresholdsComponent>(uid))
return;
_mobThresholdSystem.VerifyThresholds(uid);
}
private void OnChangeForceSay(Entity<PainNumbnessComponent> ent, ref BeforeForceSayEvent args)
{
args.Prefix = ent.Comp.ForceSayNumbDataset;
}
private void OnAlertSeverityCheck(Entity<PainNumbnessComponent> ent, ref BeforeAlertSeverityCheckEvent args)
{
if (args.CurrentAlert == "HumanHealth")
args.CancelUpdate = true;
}
}