<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using System.Data;
using HealthV2;
using Items;
using UnityEngine;

public class DefibrillatorPaddles : MonoBehaviour, ICheckedInteractable<HandApply>
{
	public ItemTrait DefibrillatorTrait;

	public StandardProgressActionConfig StandardProgressActionConfig;

	public float Time;

	public bool WillInteract(HandApply interaction, NetworkSide side)
	{
		if (DefaultWillInteract.Default(interaction,side) == false) return false;
		if (interaction.HandObject != this.gameObject) return false;
		var Healthv2 = interaction.TargetObject.GetComponent<LivingHealthMasterBase>();
		if (Healthv2 == null) return false;
		var equipment = interaction.Performer.GetComponent<Equipment>();
		if (equipment == null) return false;
		var ObjectInSlot = equipment.GetClothingItem(NamedSlot.back).GameObjectReference;
		if (ObjectInSlot == null) return false;
		if (Validations.HasItemTrait(ObjectInSlot, DefibrillatorTrait) == false) return false;
		return true;
	}

	public void ServerPerformInteraction(HandApply interaction)
	{
		void Perform()
		{
			var LHMB = interaction.TargetObject.GetComponent<LivingHealthMasterBase>();
			if (LHMB.brain == null || LHMB.brain?.RelatedPart?.Health < -100)
			{
				Chat.AddExamineMsgFromServer(interaction.Performer, "It appears they're missing their brain or Their brain is too damaged");
			}

			foreach (var BodyPart in LHMB.BodyPartList)
			{
				foreach (var organ in BodyPart.OrganList)
				{
					if (organ is Heart heart)
					{
						heart.HeartAttack = false;
						heart.CanTriggerHeartAttack = false;
						heart.CurrentPulse = 0;
					}
				}

			}
		}
		var bar = StandardProgressAction.Create(new StandardProgressActionConfig(StandardProgressActionType.CPR, false, false, true), Perform);
		bar.ServerStartProgress(interaction.Performer.RegisterTile(), Time, interaction.Performer);
	}
}
<commit_msg>Fixes belt defibrillator not working. (#7349)<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using System.Data;
using HealthV2;
using Items;
using UnityEngine;

public class DefibrillatorPaddles : MonoBehaviour, ICheckedInteractable<HandApply>
{
	public ItemTrait DefibrillatorTrait;

	public StandardProgressActionConfig StandardProgressActionConfig;

	public float Time;

	public bool WillInteract(HandApply interaction, NetworkSide side)
	{
		if (DefaultWillInteract.Default(interaction,side) == false)
			return false;
		if (interaction.TargetObject.GetComponent<LivingHealthMasterBase>() == null)
			return false;
		var equipment = interaction.Performer.GetComponent<Equipment>();
		var ObjectInSlot = equipment.GetClothingItem(NamedSlot.back).GameObjectReference;
		if (Validations.HasItemTrait(ObjectInSlot, DefibrillatorTrait) == false)
		{
			ObjectInSlot = equipment.GetClothingItem(NamedSlot.belt).GameObjectReference;
			if (Validations.HasItemTrait(ObjectInSlot, DefibrillatorTrait) == false)
			{
				return false;
			}
		}
		return true;
	}

	public void ServerPerformInteraction(HandApply interaction)
	{
		void Perform()
		{
			var LHMB = interaction.TargetObject.GetComponent<LivingHealthMasterBase>();
			if (LHMB.brain == null || LHMB.brain?.RelatedPart?.Health < -100)
			{
				Chat.AddExamineMsgFromServer(interaction.Performer, "It appears they're missing their brain or Their brain is too damaged");
			}

			foreach (var BodyPart in LHMB.BodyPartList)
			{
				foreach (var organ in BodyPart.OrganList)
				{
					if (organ is Heart heart)
					{
						heart.HeartAttack = false;
						heart.CanTriggerHeartAttack = false;
						heart.CurrentPulse = 0;
					}
				}
			}

			LHMB.CalculateOverallHealth();
		}
		var bar = StandardProgressAction.Create(new StandardProgressActionConfig(StandardProgressActionType.CPR, false, false, true), Perform);
		bar.ServerStartProgress(interaction.Performer.RegisterTile(), Time, interaction.Performer);
	}
}

{'fraction_non_alphanumeric': 0.09341500765696784, 'fraction_numerical': 0.00408371618172537, 'mean_word_length': 4.955927051671733, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3834666', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1145, 'n_words': 260}