Upload from upload_mods.ps1
This commit is contained in:
37
Harmony/Inactive/Harmony_ItemActionEat.cs
Normal file
37
Harmony/Inactive/Harmony_ItemActionEat.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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<TagGroup.Global>.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user