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

43 lines
1.5 KiB
C#
Raw Normal View History

using HarmonyLib;
using RimWorld;
using RJWSexperience;
2021-08-13 15:29:43 +00:00
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
2021-08-13 15:29:43 +00:00
namespace RJW_Menstruation.Sexperience
{
[HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
public class HumanlikeOrder_Patch
{
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{
IEnumerable<LocalTargetInfo> targets = GenUI.TargetsAt(clickPos, TargetingParameters.ForBuilding());
2021-08-13 15:29:43 +00:00
2022-07-11 18:52:27 +00:00
if (pawn.GetMenstruationComps().Any(comp => comp.TotalCumPercent > 0.001f))
foreach (LocalTargetInfo t in targets)
2021-08-13 15:29:43 +00:00
{
if (t.Thing is Building building)
2021-08-13 15:29:43 +00:00
{
if (building is Building_CumBucket)
{
opts.AddDistinct(MakeMenu(pawn, building));
break;
}
2021-08-13 15:29:43 +00:00
}
}
}
public static FloatMenuOption MakeMenu(Pawn pawn, LocalTargetInfo target)
{
FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Translations.Gizmo_GatherCum, delegate ()
2021-08-13 15:29:43 +00:00
{
pawn.jobs.TryTakeOrderedJob(new Verse.AI.Job(VariousDefOf.VaginaWashingwithBucket, null, target, target.Cell));
}, MenuOptionPriority.Low), pawn, target);
return option;
}
}
}