rimworld-animations/1.4/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexB...

47 lines
1.4 KiB
C#
Raw Normal View History

2022-10-05 20:50:02 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using RimWorld;
using Verse;
using rjw;
using System.Reflection.Emit;
2022-10-25 00:50:20 +00:00
using Verse.AI;
2022-10-05 20:50:02 +00:00
namespace Rimworld_Animations
{
[HarmonyPatch(typeof(JobDriver_SexBaseRecieverLoved), "MakeSexToil")]
public static class HarmonyPatch_JobDriver_SexBaseReceiverLoved
{
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
{
var ins = codeInstructions.ToList();
for(int i = 0; i < ins.Count; i++)
{
2022-10-25 00:50:20 +00:00
if(i < ins.Count && ins[i].opcode == OpCodes.Call && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) {
2022-10-05 20:50:02 +00:00
2022-10-25 00:50:20 +00:00
ins[i].operand = AccessTools.DeclaredMethod(typeof(HarmonyPatch_JobDriver_SexBaseReceiverLoved), "DoNotLayDown");
yield return ins[i];
2022-10-05 20:50:02 +00:00
}
else
{
yield return ins[i];
}
}
}
2022-10-25 00:50:20 +00:00
public static Toil DoNotLayDown(TargetIndex bedOrRestSpotIndex, bool hasBed, bool lookForOtherJobs, bool canSleep = true, bool gainRestAndHealth = true, PawnPosture noBedLayingPosture = PawnPosture.LayingMask, bool deathrest = false)
{
return new Toil();
}
2022-10-05 20:50:02 +00:00
}
}