diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index f1b519e876b050..2f3cc207753ee4 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -127,14 +127,8 @@ public bool TryStartZap(EntityUid uid, EntityUid target, EntityUid user, Defibri }); } - public void Zap(EntityUid uid, - EntityUid target, - EntityUid user, - DefibrillatorComponent? component = null, - MobStateComponent? mob = null, - MobThresholdsComponent? thresholds = null) + public void Zap(EntityUid uid, EntityUid target, EntityUid user, DefibrillatorComponent? component = null, MobStateComponent? mob = null, MobThresholdsComponent? thresholds = null) { - var revive = true; if (!Resolve(uid, ref component) || !Resolve(target, ref mob, ref thresholds, false)) return; @@ -167,37 +161,33 @@ public void Zap(EntityUid uid, Loc.GetString("defibrillator-rotten"), InGameICChatType.Speak, true); - revive = false; + return; } - if (HasComp(target) && revive) + if (HasComp(target)) { _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-unrevivable"), InGameICChatType.Speak, true); - revive = false; + return; } - if (revive && HasComp(target)) + if (HasComp(target)) { var dnrComponent = Comp(target); - if (dnrComponent.Chance > _random.NextDouble()) + if (dnrComponent.Chance < _random.NextDouble()) { - _chatManager.TrySendInGameICMessage(uid, - Loc.GetString("defibrillator-unrevivable"), - InGameICChatType.Speak, - true); - - dnrComponent.Chance = 0.0f; - revive = false; + _chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-unrevivable"), InGameICChatType.Speak, true); + dnrComponent.Chance = 0f; + AddComp(target); + return; + } + else + { + dnrComponent.Chance -= 0.1f; } - } - - if (!revive) - { - return; } if (_mobState.IsDead(target, mob))