Fix defibs not reviving (#17195)

* defib tweaks

* fix defibs not actually reviving
This commit is contained in:
Nemanja
2023-06-07 15:12:49 -04:00
committed by GitHub
parent d14bafce96
commit 19742f72b1
2 changed files with 4 additions and 5 deletions

View File

@@ -29,7 +29,6 @@ namespace Content.Server.Medical;
public sealed class DefibrillatorSystem : EntitySystem public sealed class DefibrillatorSystem : EntitySystem
{ {
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly ChatSystem _chatManager = default!; [Dependency] private readonly ChatSystem _chatManager = default!;
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!;
@@ -217,17 +216,16 @@ public sealed class DefibrillatorSystem : EntitySystem
} }
else else
{ {
_mobThreshold.SetAllowRevives(target, true, thresholds);
if (_mobState.IsDead(target, mob)) if (_mobState.IsDead(target, mob))
_damageable.TryChangeDamage(target, component.ZapHeal, true, origin: uid); _damageable.TryChangeDamage(target, component.ZapHeal, true, origin: uid);
_mobThreshold.SetAllowRevives(target, true, thresholds);
_mobState.ChangeMobState(target, MobState.Critical, mob, uid); _mobState.ChangeMobState(target, MobState.Critical, mob, uid);
_mobThreshold.SetAllowRevives(target, false, thresholds); _mobThreshold.SetAllowRevives(target, false, thresholds);
if (TryComp<MindComponent>(target, out var mindComp) && if (TryComp<MindComponent>(target, out var mindComp) &&
mindComp.Mind?.UserId != null && mindComp.Mind?.Session is { } playerSession)
_playerManager.TryGetSessionById(mindComp.Mind.UserId.Value, out session))
{ {
session = playerSession;
// notify them they're being revived. // notify them they're being revived.
if (mindComp.Mind.CurrentEntity != target) if (mindComp.Mind.CurrentEntity != target)
{ {

View File

@@ -289,6 +289,7 @@ public sealed class MobThresholdSystem : EntitySystem
return; return;
component.AllowRevives = val; component.AllowRevives = val;
Dirty(component); Dirty(component);
VerifyThresholds(uid, component);
} }
#endregion #endregion