Disallow bible healing if target is dead (#8999)

This commit is contained in:
Kara
2022-06-21 09:44:02 -07:00
committed by GitHub
parent 4c6b017b01
commit e01728c0ab

View File

@@ -92,7 +92,9 @@ namespace Content.Server.Bible
{
return;
}
if (args.Target == null || args.Target == args.User || !HasComp<MobStateComponent>(args.Target))
if (args.Target == null || args.Target == args.User || !TryComp<MobStateComponent>(args.Target, out var mobState)
|| mobState.IsDead())
{
return;
}
@@ -112,7 +114,7 @@ namespace Content.Server.Bible
}
// This only has a chance to fail if the target is not wearing anything on their head and is not a familiar.
if (!_invSystem.TryGetSlotEntity(args.Target.Value, "head", out var entityUid) && !HasComp<FamiliarComponent>(args.Target.Value))
if (!_invSystem.TryGetSlotEntity(args.Target.Value, "head", out var _) && !HasComp<FamiliarComponent>(args.Target.Value))
{
if (_random.Prob(component.FailChance))
{