mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
changed initialize method
This commit is contained in:
parent
3201cc7328
commit
82570419a2
9 changed files with 109 additions and 20 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Manifest>
|
||||
<identifier>RJW Menstruation</identifier>
|
||||
<version>1.0.0.1</version>
|
||||
<version>1.0.0.3</version>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
<incompatibleWith />
|
||||
|
|
Binary file not shown.
|
@ -27,6 +27,48 @@
|
|||
</value>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationAdd">
|
||||
<xpath>Defs/rjw.HediffDef_PartBase[defName="DragonVagina"]</xpath>
|
||||
<value>
|
||||
<comps>
|
||||
<li Class="RJW_Menstruation.CompProperties_Menstruation">
|
||||
<maxCumCapacity>500</maxCumCapacity>
|
||||
<baseImplantationChanceFactor>0.5</baseImplantationChanceFactor>
|
||||
<basefertilizationChanceFactor>0.2</basefertilizationChanceFactor>
|
||||
<deviationFactor>0.05</deviationFactor>
|
||||
<folicularIntervalDays>30</folicularIntervalDays>
|
||||
<lutealIntervalDays>30</lutealIntervalDays>
|
||||
<bleedingIntervalDays>0</bleedingIntervalDays>
|
||||
<recoveryIntervalDays>10</recoveryIntervalDays>
|
||||
<eggLifespanDays>30</eggLifespanDays>
|
||||
<wombTex>Womb/Womb</wombTex>
|
||||
<vagTex>Genitals/Vagina</vagTex>
|
||||
</li>
|
||||
</comps>
|
||||
</value>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationAdd">
|
||||
<xpath>Defs/rjw.HediffDef_PartBase[defName="GenericVagina"]</xpath>
|
||||
<value>
|
||||
<comps>
|
||||
<li Class="RJW_Menstruation.CompProperties_Menstruation">
|
||||
<maxCumCapacity>500</maxCumCapacity>
|
||||
<baseImplantationChanceFactor>1.0</baseImplantationChanceFactor>
|
||||
<basefertilizationChanceFactor>1.0</basefertilizationChanceFactor>
|
||||
<deviationFactor>0.05</deviationFactor>
|
||||
<folicularIntervalDays>14</folicularIntervalDays>
|
||||
<lutealIntervalDays>14</lutealIntervalDays>
|
||||
<bleedingIntervalDays>6</bleedingIntervalDays>
|
||||
<recoveryIntervalDays>10</recoveryIntervalDays>
|
||||
<eggLifespanDays>3</eggLifespanDays>
|
||||
<wombTex>Womb/Womb</wombTex>
|
||||
<vagTex>Genitals/Vagina</vagTex>
|
||||
</li>
|
||||
</comps>
|
||||
</value>
|
||||
</Operation>
|
||||
|
||||
<Operation Class="PatchOperationAdd">
|
||||
<xpath>Defs/rjw.HediffDef_PartBase[defName="HydraulicVagina"]</xpath>
|
||||
<value>
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace RJW_Menstruation
|
|||
{
|
||||
AddWombGizmos(__instance, ref gizmoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +46,6 @@ namespace RJW_Menstruation
|
|||
|
||||
private static void AddWombGizmos(Pawn __instance, ref List<Gizmo> gizmoList)
|
||||
{
|
||||
//HediffComp_Menstruation comp = __instance.health.hediffSet.GetFirstHediffOfDef(Genital_Helper.average_vagina).TryGetComp<HediffComp_Menstruation>();
|
||||
HediffComp_Menstruation comp = Utility.GetMenstruationComp(__instance);
|
||||
|
||||
if (comp != null) gizmoList.Add(CreateGizmo_WombStatus(__instance, comp));
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public class CompProperties_Anus : HediffCompProperties
|
||||
{
|
||||
public string analTex = "Genitals/Anal";
|
||||
|
@ -57,6 +58,8 @@ namespace RJW_Menstruation
|
|||
public CompProperties_Menstruation Props;
|
||||
public Stage curStage = Stage.Follicular;
|
||||
public int curStageHrs = 0;
|
||||
public Action actionref;
|
||||
public bool loaded = false;
|
||||
|
||||
public enum Stage
|
||||
{
|
||||
|
@ -71,13 +74,11 @@ namespace RJW_Menstruation
|
|||
}
|
||||
|
||||
private List<Cum> cums;
|
||||
private bool loaded = false;
|
||||
private List<Egg> eggs;
|
||||
private int follicularIntervalhours = -1;
|
||||
private int lutealIntervalhours = -1;
|
||||
private int bleedingIntervalhours = -1;
|
||||
private int recoveryIntervalhours = -1;
|
||||
private Action actionref;
|
||||
|
||||
public float TotalCum
|
||||
{
|
||||
|
@ -267,22 +268,26 @@ namespace RJW_Menstruation
|
|||
|
||||
}
|
||||
|
||||
|
||||
public override void CompPostPostAdd(DamageInfo? dinfo)
|
||||
{
|
||||
Initialize();
|
||||
//initializer moved to SpawnSetup
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
|
||||
public override void CompPostTick(ref float severityAdjustment)
|
||||
{
|
||||
if (!loaded)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
//initializer moved to SpawnSetup
|
||||
//if (!loaded)
|
||||
//{
|
||||
// Initialize();
|
||||
//}
|
||||
}
|
||||
|
||||
public override void CompPostPostRemoved()
|
||||
{
|
||||
|
||||
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref);
|
||||
ModLog.Message(parent.pawn.Label + "tick scheduler removed");
|
||||
base.CompPostPostRemoved();
|
||||
|
@ -481,7 +486,7 @@ namespace RJW_Menstruation
|
|||
else return false;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
public void Initialize()
|
||||
{
|
||||
Props = (CompProperties_Menstruation)props;
|
||||
|
||||
|
@ -511,6 +516,7 @@ namespace RJW_Menstruation
|
|||
curStage = Stage.None;
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), tickInterval, parent.pawn, false);
|
||||
}
|
||||
Log.Message(parent.pawn.Label + " - Initialized menstruation comp");
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
|
@ -741,7 +747,7 @@ namespace RJW_Menstruation
|
|||
};
|
||||
|
||||
actionref = action;
|
||||
return action;
|
||||
return actionref;
|
||||
|
||||
void GoNextStage(Stage nextstage, float factor = 1.0f)
|
||||
{
|
||||
|
@ -843,4 +849,11 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
32
source/RJW_Menstruation/RJW_Menstruation/Pawn_Patch.cs
Normal file
32
source/RJW_Menstruation/RJW_Menstruation/Pawn_Patch.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using HugsLib;
|
||||
|
||||
|
||||
namespace RJW_Menstruation
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(Pawn), "SpawnSetup")]
|
||||
public class Pawn_Patch
|
||||
{
|
||||
public static void Postfix(Map map, bool respawningAfterLoad, Pawn __instance)
|
||||
{
|
||||
Log.Message("Initialize on spawnsetup");
|
||||
HediffComp_Menstruation comp = Utility.GetMenstruationComp(__instance);
|
||||
if (comp != null)
|
||||
{
|
||||
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(comp.actionref);
|
||||
comp.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -64,6 +64,7 @@
|
|||
<Compile Include="Gizmo_Womb.cs" />
|
||||
<Compile Include="Harmony.cs" />
|
||||
<Compile Include="HediffComp_Menstruation.cs" />
|
||||
<Compile Include="Pawn_Patch.cs" />
|
||||
<Compile Include="RJW_Patch.cs" />
|
||||
<Compile Include="Translations.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace RJW_Menstruation
|
|||
|
||||
if (Genital_Helper.has_vagina(partner, partnerparts))
|
||||
{
|
||||
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
|
||||
HediffComp_Menstruation comp = Utility.GetMenstruationComp(partner);
|
||||
if (comp != null)
|
||||
{
|
||||
|
@ -38,6 +39,7 @@ namespace RJW_Menstruation
|
|||
}
|
||||
else if (Genital_Helper.has_vagina(pawn, pawnparts))
|
||||
{
|
||||
if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
|
||||
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
|
||||
if (comp != null)
|
||||
{
|
||||
|
@ -61,6 +63,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
|
||||
{
|
||||
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
|
||||
HediffComp_Menstruation comp = Utility.GetMenstruationComp(partner);
|
||||
if (comp != null)
|
||||
{
|
||||
|
|
|
@ -21,17 +21,17 @@ namespace RJW_Menstruation
|
|||
|
||||
public static float GetCumVolume(Pawn pawn)
|
||||
{
|
||||
CompHediffBodyPart part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)).FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)).FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)).FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)).FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
CompHediffBodyPart part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault().TryGetComp<rjw.CompHediffBodyPart>();
|
||||
|
||||
return part?.FluidAmmount * part.FluidModifier * Rand.Range(0.8f, 1.2f) ?? 0.0f;
|
||||
}
|
||||
|
||||
public static HediffComp_Menstruation GetMenstruationComp(Pawn pawn)
|
||||
{
|
||||
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)).FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
|
||||
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
|
||||
HediffComp_Menstruation result;
|
||||
if (hedifflist.NullOrEmpty()) return null;
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue