2022-03-02 13:15:22 +00:00
|
|
|
|
using HarmonyLib;
|
2022-06-23 16:57:22 +00:00
|
|
|
|
using RimWorld;
|
2021-09-24 15:14:02 +00:00
|
|
|
|
using rjw;
|
2022-03-02 13:15:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Verse;
|
2021-09-24 15:14:02 +00:00
|
|
|
|
|
|
|
|
|
namespace RJWSexperience
|
|
|
|
|
{
|
2022-03-02 13:15:22 +00:00
|
|
|
|
[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", new Type[] { typeof(PawnGenerationRequest) })]
|
|
|
|
|
public static class Rimworld_Patch_GeneratePawn
|
|
|
|
|
{
|
2022-10-27 16:25:40 +00:00
|
|
|
|
public static void Postfix(ref Pawn __result)
|
2022-03-02 13:15:22 +00:00
|
|
|
|
{
|
2022-05-24 15:50:50 +00:00
|
|
|
|
if (__result == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool doVirginTrait = true;
|
|
|
|
|
|
2022-10-27 16:25:40 +00:00
|
|
|
|
if (SexperienceMod.Settings.History.EnableRecordRandomizer && __result.DevelopmentalStage != DevelopmentalStage.Newborn && xxx.is_human(__result))
|
2022-06-13 05:51:09 +00:00
|
|
|
|
doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
|
2022-05-24 15:50:50 +00:00
|
|
|
|
|
|
|
|
|
if (doVirginTrait)
|
2022-06-17 14:16:31 +00:00
|
|
|
|
Virginity.TraitHandler.GenerateVirginTrait(__result);
|
2022-03-02 13:15:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-23 16:57:22 +00:00
|
|
|
|
|
|
|
|
|
[HarmonyPatch(typeof(ParentRelationUtility), nameof(ParentRelationUtility.SetMother))]
|
|
|
|
|
public static class Rimworld_Patch_RemoveVirginOnSetMother
|
|
|
|
|
{
|
|
|
|
|
public static void Postfix(Pawn pawn, Pawn newMother)
|
|
|
|
|
{
|
|
|
|
|
if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Trait virgin = newMother.story?.traits?.GetTrait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleVirgin);
|
|
|
|
|
if (virgin != null)
|
|
|
|
|
{
|
|
|
|
|
newMother.story.traits.RemoveTrait(virgin);
|
|
|
|
|
newMother.story.traits.GainTrait(new Trait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleAfterSurgery));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-24 15:14:02 +00:00
|
|
|
|
}
|