Add defib event, add fields to be able to disable crit defib and do after movement (#28174)

* Add defib event, add fields to be able to disable crit defib and do after movement

* Fix check
This commit is contained in:
DrSmugleaf
2024-05-21 05:11:49 -07:00
committed by GitHub
parent 68a0e568e4
commit dbb7dcd16d
3 changed files with 19 additions and 1 deletions

View File

@@ -162,6 +162,9 @@ public sealed class DefibrillatorSystem : EntitySystem
if (_mobState.IsAlive(target, mobState))
return false;
if (!component.CanDefibCrit && _mobState.IsCritical(target, mobState))
return false;
return true;
}
@@ -179,7 +182,8 @@ public sealed class DefibrillatorSystem : EntitySystem
{
BlockDuplicate = true,
BreakOnHandChange = true,
NeedHand = true
NeedHand = true,
BreakOnMove = !component.AllowDoAfterMovement
});
}
@@ -254,6 +258,10 @@ public sealed class DefibrillatorSystem : EntitySystem
// if we don't have enough power left for another shot, turn it off
if (!_powerCell.HasActivatableCharge(uid))
TryDisable(uid, component);
// TODO clean up this clown show above
var ev = new TargetDefibrillatedEvent(user, (uid, component));
RaiseLocalEvent(target, ref ev);
}
public override void Update(float frameTime)