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

52 lines
1.5 KiB
C#
Raw Normal View History

2021-08-13 15:29:43 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
using RimWorld;
using HarmonyLib;
using UnityEngine;
using RJWSexperience;
namespace RJW_Menstruation.Sexperience
{
[HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
public class HumanlikeOrder_Patch
{
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{
var targets = GenUI.TargetsAt(clickPos, TargetingParameters.ForBuilding());
2021-09-26 09:19:24 +00:00
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
2021-08-13 15:29:43 +00:00
2021-09-26 09:19:24 +00:00
if (comp != null && comp.TotalCumPercent > 0.001f)
2021-08-13 15:29:43 +00:00
foreach (LocalTargetInfo t in targets)
{
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;
}
}
}
}
public static FloatMenuOption MakeMenu(Pawn pawn, LocalTargetInfo target)
{
2021-09-26 09:19:24 +00:00
FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Keyed.RS_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;
}
}
}