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

41 lines
1.2 KiB
C#
Raw Normal View History

using HarmonyLib;
using rjwcum;
using RJWSexperience;
2021-09-12 15:31:27 +00:00
using System.Linq;
using Verse;
2021-09-26 09:19:24 +00:00
using Verse.AI;
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, ref bool __result)
2021-09-26 09:19:24 +00:00
{
2022-08-23 15:17:41 +00:00
if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f) && (pawn.Map?.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket) ?? false))
2021-09-26 09:19:24 +00:00
{
__result = true;
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch("JobOnThing")]
public static void JobOnThing(Pawn pawn, ref Job __result)
2021-09-26 09:19:24 +00:00
{
2022-07-11 18:52:27 +00:00
if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f))
2021-09-26 09:19:24 +00:00
{
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
}
}