Fix dead mobs sneezing and coughing (#12919)
* Fix dead mobs sneezing and coughing * SneezeCough update * Streamlined Event code, moved dead-check * cleanup * I can has merge? * Shared event for SharedMobStateSystem
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Alert;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Disease.Events;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Emoting;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -58,6 +59,7 @@ namespace Content.Shared.MobState.EntitySystems
|
||||
SubscribeLocalEvent<MobStateComponent, UpdateCanMoveEvent>(OnMoveAttempt);
|
||||
SubscribeLocalEvent<MobStateComponent, StandAttemptEvent>(OnStandAttempt);
|
||||
SubscribeLocalEvent<MobStateComponent, TryingToSleepEvent>(OnSleepAttempt);
|
||||
SubscribeLocalEvent<MobStateComponent, AttemptSneezeCoughEvent>(OnSneezeAttempt);
|
||||
SubscribeLocalEvent<MobStateChangedEvent>(OnStateChanged);
|
||||
// Note that there's no check for Down attempts because if a mob's in crit or dead, they can be downed...
|
||||
}
|
||||
@@ -68,6 +70,12 @@ namespace Content.Shared.MobState.EntitySystems
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnSneezeAttempt(EntityUid uid, MobStateComponent component, ref AttemptSneezeCoughEvent args)
|
||||
{
|
||||
if(IsDead(uid, component))
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnGettingStripped(EntityUid uid, MobStateComponent component, BeforeGettingStrippedEvent args)
|
||||
{
|
||||
// Incapacitated or dead targets get stripped two or three times as fast. Makes stripping corpses less tedious.
|
||||
|
||||
Reference in New Issue
Block a user