using Audio; using HarmonyLib; using Platform; using System; using UnityEngine; using static ItemActionUseOther; namespace Harmony.ItemActionEatPatches { [HarmonyPatch(typeof(ItemActionEat))] [HarmonyPatch("ExecuteAction")] public class ExecuteActionPatch { public static bool Prefix(ItemActionEat __instance, ItemActionData _actionData, bool _bReleased) { //Log.Out("ItemActionEatPatches-ExecuteAction START"); if (_actionData.invData.itemValue.ItemClass != null) { if (_actionData.invData.item.HasAnyTags(FastTags.Parse("medical"))) { //Log.Out("ItemActionEatPatches-ExecuteAction MEDICAL"); global::EntityAlive holdingEntity = _actionData.invData.holdingEntity; string itemName = _actionData.invData.itemValue.ItemClass.GetItemName(); if (!RebirthUtilities.CanHeal(itemName, _actionData.invData.holdingEntity, _actionData.invData.holdingEntity)) { //Log.Out("ItemActionEatPatches-ExecuteAction Cannot heal"); return false; } } } return true; } } }