coffees-rjw-ideology-addons/CRIALactation/Source/HarmonyPatches/HarmonyPatch_FoodUtility.cs

55 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using RimWorld;
using Verse;
namespace CRIALactation
{
[HarmonyPatch]
public static class HarmonyPatch_FoodUtility
{
[HarmonyReversePatch(HarmonyReversePatchType.Snapshot)]
[HarmonyPatch(typeof(FoodUtility), "AddThoughtsFromIdeo")]
public static void AddThoughtsFromIdeo_Patch(HistoryEventDef eventDef, Pawn ingester, ThingDef foodDef, MeatSourceCategory meatSourceCategory)
{
throw new NotImplementedException("thoughts from ideo wasn't implemented!");
}
[HarmonyPatch(typeof(FoodUtility), "ThoughtsFromIngesting")]
public static void Postfix(ref List<FoodUtility.ThoughtFromIngesting> __result, Pawn ingester, Thing foodSource, ThingDef foodDef)
{
if (ingester.Ideo != null)
{
if (foodDef == ThingDefOf_Milk.HumanMilk || foodDef == ThingDefOf_Milk.HumanoidMilk)
{
AddThoughtsFromIdeo_Patch(HistoryEventDefOf_Milk.DrankMilkRaw, ingester, foodDef, FoodUtility.GetMeatSourceCategory(foodDef));
}
}
}
[HarmonyPatch(typeof(FoodUtility), "AddIngestThoughtsFromIngredient")]
public static void Postfix(ThingDef ingredient, Pawn ingester) {
MeatSourceCategory meatSourceCategory = FoodUtility.GetMeatSourceCategory(ingredient);
if(ingredient == ThingDefOf_Milk.HumanoidMilk || ingredient == ThingDefOf_Milk.HumanMilk)
{
AddThoughtsFromIdeo_Patch(HistoryEventDefOf_Milk.DrankMilkMeal, ingester, ingredient, meatSourceCategory);
}
}
}
}