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)
This commit is contained in:
Coolsurf6
2025-01-27 20:34:20 +10:00
committed by GitHub
parent 1b9d84a16e
commit 012c835559
14 changed files with 174 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.Damage.Events;
using Content.Shared.Damage.ForceSay;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs;
@@ -47,7 +48,7 @@ public sealed class DamageForceSaySystem : EntitySystem
}
}
private void TryForceSay(EntityUid uid, DamageForceSayComponent component, bool useSuffix=true, string? suffixOverride = null)
private void TryForceSay(EntityUid uid, DamageForceSayComponent component, bool useSuffix=true)
{
if (!TryComp<ActorComponent>(uid, out var actor))
return;
@@ -57,7 +58,13 @@ public sealed class DamageForceSaySystem : EntitySystem
_timing.CurTime < component.NextAllowedTime)
return;
var suffix = Loc.GetString(suffixOverride ?? component.ForceSayStringPrefix + _random.Next(1, component.ForceSayStringCount));
var ev = new BeforeForceSayEvent(component.ForceSayStringDataset);
RaiseLocalEvent(uid, ev);
if (!_prototype.TryIndex(ev.Prefix, out var prefixList))
return;
var suffix = Loc.GetString(_random.Pick(prefixList.Values));
// set cooldown & raise event
component.NextAllowedTime = _timing.CurTime + component.Cooldown;
@@ -80,7 +87,7 @@ public sealed class DamageForceSaySystem : EntitySystem
if (!args.FellAsleep)
return;
TryForceSay(uid, component, true, "damage-force-say-sleep");
TryForceSay(uid, component);
AllowNextSpeech(uid);
}