mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Rename source folder
This commit is contained in:
parent
0a412a0060
commit
a4c046a841
55 changed files with 0 additions and 0 deletions
43
Source/RJWSexperience/Patches/Rimworld_Patch.cs
Normal file
43
Source/RJWSexperience/Patches/Rimworld_Patch.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", new Type[] { typeof(PawnGenerationRequest) })]
|
||||
public static class Rimworld_Patch_GeneratePawn
|
||||
{
|
||||
public static void Postfix(PawnGenerationRequest request, ref Pawn __result)
|
||||
{
|
||||
if (__result == null)
|
||||
return;
|
||||
|
||||
bool doVirginTrait = true;
|
||||
|
||||
if (SexperienceMod.Settings.History.EnableRecordRandomizer && !request.Newborn && xxx.is_human(__result))
|
||||
doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
|
||||
|
||||
if (doVirginTrait)
|
||||
Virginity.TraitHandler.GenerateVirginTrait(__result);
|
||||
}
|
||||
}
|
||||
|
||||
[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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue