rjw_menstruation/1.3/source/RJW_Menstruation/SexperienceModule/Patch/RJW_Patch.cs

53 lines
1.5 KiB
C#
Raw Normal View History

2021-09-12 15:31:27 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
2021-09-26 09:19:24 +00:00
using Verse.AI;
2021-09-12 15:31:27 +00:00
using rjw;
using RJW_Menstruation;
2021-09-26 09:19:24 +00:00
using HarmonyLib;
using RJWSexperience;
2021-09-12 15:31:27 +00:00
namespace RJW_Menstruation.Sexperience
{
2021-09-26 09:19:24 +00:00
[HarmonyPatch(typeof(WorkGiver_CleanSelf))]
public static class RJW_Patch_WorkGiver_CleanSelf
2021-09-12 15:31:27 +00:00
{
2021-09-26 09:19:24 +00:00
[HarmonyPrefix]
[HarmonyPatch("HasJobOnThing")]
public static bool HasJobOnThing(Pawn pawn, Thing t, bool forced, ref bool __result)
{
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (comp != null && comp.DoCleanWomb && comp.TotalCumPercent > 0.001f && pawn.Map.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket))
2021-09-26 09:19:24 +00:00
{
__result = true;
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch("JobOnThing")]
public static void JobOnThing(Pawn pawn, Thing t, bool forced, ref Job __result)
{
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (comp != null && comp.DoCleanWomb && comp.TotalCumPercent > 0.001f)
{
Building_CumBucket bucket = pawn.FindClosestBucket();
if (bucket != null)
{
__result = JobMaker.MakeJob(VariousDefOf.VaginaWashingwithBucket, null, bucket, bucket.Position);
}
}
}
2021-09-12 15:31:27 +00:00
}
}