Glorfcode (force say on damage/stun/crit) (#20562)

This commit is contained in:
Kara
2023-09-28 18:05:36 -07:00
committed by GitHub
parent 6c8e79adfa
commit 80f36ea6d4
10 changed files with 321 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage.ForceSay;
using Content.Shared.Emoting;
using Content.Shared.Hands;
using Content.Shared.Interaction;
@@ -27,7 +28,7 @@ public partial class MobStateSystem
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, InteractionAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, ThrowAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, SpeakAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<MobStateComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
SubscribeLocalEvent<MobStateComponent, EmoteAttemptEvent>(CheckAct);
SubscribeLocalEvent<MobStateComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
@@ -116,6 +117,17 @@ public partial class MobStateSystem
args.Multiplier /= 2;
}
private void OnSpeakAttempt(EntityUid uid, MobStateComponent component, SpeakAttemptEvent args)
{
if (HasComp<AllowNextCritSpeechComponent>(uid))
{
RemCompDeferred<AllowNextCritSpeechComponent>(uid);
return;
}
CheckAct(uid, component, args);
}
private void CheckAct(EntityUid target, MobStateComponent component, CancellableEntityEventArgs args)
{
switch (component.CurrentState)