Fix defibs resetting rot timer + slimes not having perishable (#23340)
* Fix defibs resetting rot timer + slimes not having perishable * fix the sound too
This commit is contained in:
@@ -214,6 +214,7 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
|
||||
ICommonSession? session = null;
|
||||
|
||||
var dead = true;
|
||||
if (_rotting.IsRotten(target))
|
||||
{
|
||||
_chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-rotten"),
|
||||
@@ -223,9 +224,16 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
{
|
||||
if (_mobState.IsDead(target, mob))
|
||||
_damageable.TryChangeDamage(target, component.ZapHeal, true, origin: uid);
|
||||
_mobState.ChangeMobState(target, MobState.Critical, mob, uid);
|
||||
|
||||
if (_mind.TryGetMind(target, out var mindId, out var mind) &&
|
||||
if (_mobThreshold.TryGetThresholdForState(target, MobState.Dead, out var threshold) &&
|
||||
TryComp<DamageableComponent>(target, out var damageableComponent) &&
|
||||
damageableComponent.TotalDamage < threshold)
|
||||
{
|
||||
_mobState.ChangeMobState(target, MobState.Critical, mob, uid);
|
||||
dead = false;
|
||||
}
|
||||
|
||||
if (_mind.TryGetMind(target, out _, out var mind) &&
|
||||
mind.Session is { } playerSession)
|
||||
{
|
||||
session = playerSession;
|
||||
@@ -242,7 +250,7 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
var sound = _mobState.IsDead(target, mob) || session == null
|
||||
var sound = dead || session == null
|
||||
? component.FailureSound
|
||||
: component.SuccessSound;
|
||||
_audio.PlayPvs(sound, uid);
|
||||
|
||||
Reference in New Issue
Block a user