[Fix] CPR fix (#109)

This commit is contained in:
HitPanda
2023-05-25 21:01:07 +03:00
committed by Aviu00
parent 6a07238ffe
commit e968fb695b

View File

@@ -12,7 +12,8 @@ using Content.Shared.Atmos;
using Content.Shared.Body.Components;
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.DoAfter; // WD
using Content.Shared.DoAfter;
using Content.Shared.Humanoid; // WD
using Content.Shared.IdentityManagement; // WD
using Content.Shared.Interaction; // WD
using Content.Shared.Inventory; // WD
@@ -234,10 +235,10 @@ namespace Content.Server.Body.Systems
// WD start
private void OnHandInteract(EntityUid uid, RespiratorComponent component, InteractHandEvent args)
{
args.Handled = true;
if (CanCPR(uid, component, args.User))
DoCPR(uid, component, args.User);
args.Handled = true;
}
private bool CanCPR(EntityUid target, RespiratorComponent comp, EntityUid user)
@@ -251,10 +252,7 @@ namespace Content.Server.Body.Systems
if (comp.CPRPerformedBy != null && comp.CPRPerformedBy != user)
return false;
if (!TryComp<BodyComponent>(target, out var body))
return false;
if (body.Prototype?.Id is not ("Human" or "Diona" or "Slime" or "Dwarf" or "Reptilian" or "Skrell" or "Arachnid"))
if (!TryComp<HumanoidAppearanceComponent>(target, out _))
return false;
if (!TryComp(target, out MobStateComponent? targetState))