2021-03-06 13:32:33 +00:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using HugsLib;
|
|
|
|
|
using RimWorld;
|
2021-02-03 05:20:03 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2021-02-13 09:45:22 +00:00
|
|
|
|
using UnityEngine;
|
2021-02-03 05:20:03 +00:00
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace RJW_Menstruation
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[HarmonyPatch(typeof(Pawn), "SpawnSetup")]
|
|
|
|
|
public class Pawn_Patch
|
|
|
|
|
{
|
|
|
|
|
public static void Postfix(Map map, bool respawningAfterLoad, Pawn __instance)
|
|
|
|
|
{
|
2021-02-03 05:54:25 +00:00
|
|
|
|
//Log.Message("Initialize on spawnsetup");
|
2021-03-01 14:40:50 +00:00
|
|
|
|
HediffComp_Menstruation comp = __instance.GetMenstruationComp();
|
2021-02-03 05:20:03 +00:00
|
|
|
|
if (comp != null)
|
|
|
|
|
{
|
|
|
|
|
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(comp.actionref);
|
|
|
|
|
comp.Initialize();
|
|
|
|
|
}
|
2021-06-10 12:06:05 +00:00
|
|
|
|
HediffComp_Breast bcomp = __instance.GetBreastComp();
|
|
|
|
|
if (bcomp != null)
|
|
|
|
|
{
|
|
|
|
|
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(bcomp.action);
|
|
|
|
|
bcomp.Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-02-03 05:20:03 +00:00
|
|
|
|
}
|
2021-02-13 09:45:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
|
|
|
|
|
public class HumanlikeOrder_Patch
|
|
|
|
|
{
|
|
|
|
|
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
|
|
|
|
|
{
|
|
|
|
|
var selftargets = GenUI.TargetsAt_NewTemp(clickPos, TargetingParameters.ForSelf(pawn));
|
|
|
|
|
|
|
|
|
|
foreach (LocalTargetInfo t in selftargets)
|
|
|
|
|
{
|
2021-02-25 09:09:24 +00:00
|
|
|
|
if (pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t));
|
2021-02-19 06:42:08 +00:00
|
|
|
|
break;
|
2021-02-13 09:45:22 +00:00
|
|
|
|
}
|
2021-03-06 13:32:33 +00:00
|
|
|
|
|
|
|
|
|
|
2021-02-13 09:45:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-03-06 13:32:33 +00:00
|
|
|
|
|
2021-02-13 09:45:22 +00:00
|
|
|
|
public static FloatMenuOption MakeSelfMenu(Pawn pawn, LocalTargetInfo target)
|
|
|
|
|
{
|
2021-02-22 10:51:41 +00:00
|
|
|
|
FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Translations.FloatMenu_CleanSelf, delegate ()
|
2021-02-13 09:45:22 +00:00
|
|
|
|
{
|
|
|
|
|
pawn.jobs.TryTakeOrderedJob_NewTemp(new Verse.AI.Job(VariousDefOf.VaginaWashing, null, null, target.Cell));
|
|
|
|
|
}, MenuOptionPriority.Low), pawn, target);
|
|
|
|
|
|
|
|
|
|
return option;
|
|
|
|
|
}
|
2021-02-03 05:20:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-03-06 13:32:33 +00:00
|
|
|
|
|
2021-03-01 14:40:50 +00:00
|
|
|
|
//[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffListing")]
|
|
|
|
|
//public class DrawHediffListing_Patch
|
|
|
|
|
//{
|
|
|
|
|
// public const float buttonWidth = 80f;
|
|
|
|
|
// public const float buttonHeight = 20f;
|
|
|
|
|
//
|
|
|
|
|
// public static void Postfix(Rect rect, Pawn pawn, bool showBloodLoss)
|
|
|
|
|
// {
|
|
|
|
|
// if (Configurations.EnableButtonInHT && pawn.HasMenstruationComp())
|
|
|
|
|
// {
|
|
|
|
|
// Rect buttonrect = new Rect(rect.xMax - buttonWidth, rect.yMax - buttonHeight, buttonWidth, buttonHeight);
|
|
|
|
|
// if (Widgets.ButtonText(buttonrect, "Status"))
|
|
|
|
|
// {
|
|
|
|
|
// Dialog_WombStatus.ToggleWindow(pawn,pawn.GetMenstruationComp());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffRow")]
|
|
|
|
|
public class DrawHediffRow_Patch
|
|
|
|
|
{
|
|
|
|
|
public const float buttonWidth = 50f;
|
|
|
|
|
public const float buttonHeight = 20f;
|
|
|
|
|
|
|
|
|
|
public static void Prefix(Rect rect, Pawn pawn, IEnumerable<Hediff> diffs, ref float curY)
|
|
|
|
|
{
|
|
|
|
|
if (Configurations.EnableButtonInHT && pawn.ShowStatus())
|
|
|
|
|
{
|
|
|
|
|
HediffComp_Menstruation comp = diffs.First().GetMenstruationComp();
|
|
|
|
|
if (comp != null)
|
|
|
|
|
{
|
|
|
|
|
Rect buttonrect = new Rect((rect.xMax) / 2 - 5f, curY + 2f, buttonWidth, buttonHeight);
|
|
|
|
|
if (Widgets.ButtonText(buttonrect, Translations.Button_HealthTab))
|
|
|
|
|
{
|
|
|
|
|
Dialog_WombStatus.ToggleWindow(pawn, comp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-02-22 10:51:41 +00:00
|
|
|
|
//[HarmonyPatch(typeof(JobGiver_OptimizeApparel), "ApparelScoreGain_NewTmp")]
|
|
|
|
|
//public class OptimizeApparel_Patch
|
|
|
|
|
//{
|
|
|
|
|
// public static bool Prefix(ref float __result, Pawn pawn, Apparel ap, List<float> wornScoresCache)
|
|
|
|
|
// {
|
|
|
|
|
// if (ap is Absorber)
|
|
|
|
|
// {
|
|
|
|
|
// __result = -1000f;
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//}
|
2021-02-13 09:45:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-03 05:20:03 +00:00
|
|
|
|
}
|