diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index bca31ba..afd18e9 100644 Binary files a/1.3/Assemblies/RJW_Menstruation.dll and b/1.3/Assemblies/RJW_Menstruation.dll differ diff --git a/1.3/Patches/Hediffs_PrivateParts_Breasts.xml b/1.3/Patches/Hediffs_PrivateParts_Breasts.xml index 58c8141..b3b514b 100644 --- a/1.3/Patches/Hediffs_PrivateParts_Breasts.xml +++ b/1.3/Patches/Hediffs_PrivateParts_Breasts.xml @@ -19,7 +19,7 @@
  • - Breasts/Breasts_Artificial + Breasts_Artificial/Breast (255,255,255)
  • @@ -31,7 +31,7 @@
  • - Breasts/Breasts_Artificial + Breasts_Artificial/Breast (255,255,255)
  • diff --git a/1.3/SexperienceModule/Assemblies/SexperienceModule.dll b/1.3/SexperienceModule/Assemblies/SexperienceModule.dll index 1c1516e..8a20772 100644 Binary files a/1.3/SexperienceModule/Assemblies/SexperienceModule.dll and b/1.3/SexperienceModule/Assemblies/SexperienceModule.dll differ diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Cum.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Cum.cs index 288120c..b3304e2 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Cum.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Cum.cs @@ -195,12 +195,12 @@ namespace RJW_Menstruation { if (updatefilthDef != null) filthDef = updatefilthDef; volume += volumein; - cumthickness = Mathf.Lerp(cumthickness, thickness, volumein / volume); + notcumthickness = Mathf.Lerp(notcumthickness, thickness, volumein / volume); } public bool ShouldRemove() { - if (fertvolume < 0.001f && volume < 0.001f) return true; + if ((notcum || fertvolume < 0.001f) && volume < 0.01f) return true; return false; } @@ -218,7 +218,7 @@ namespace RJW_Menstruation public float DismishForce(float portion, float leakfactor = 1.0f) { float totalleak = volume; - volume *= Math.Max(0, 1 - (portion * (1 - decayresist)) * leakfactor); + volume *= Math.Max(0, 1 - (portion * (1 - decayresist/10)) * leakfactor); fertvolume *= Math.Max(0, 1 - (portion * (1 - decayresist)) * leakfactor); CutMinor(); totalleak -= volume; diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index cbd81b1..c221951 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -148,9 +148,17 @@ namespace RJW_Menstruation public override void CompPostPostRemoved() { - HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(action); - ModLog.Message(parent.pawn.Label + "breast tick scheduler removed"); - base.CompPostPostRemoved(); + + if (parent?.pawn?.GetBreastComp() == this) + { + Log.Warning("Something tried to remove hediff with wrong way."); + } + else + { + HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(action); + Log.Message(parent.pawn.Label + "breast tick scheduler removed"); + base.CompPostPostRemoved(); + } } public void Initialize() diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 88b43f7..729752b 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -529,9 +529,16 @@ namespace RJW_Menstruation public override void CompPostPostRemoved() { - HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref); - Log.Message(parent.pawn.Label + "tick scheduler removed"); - base.CompPostPostRemoved(); + if (parent?.pawn?.GetMenstruationComp() == this) + { + Log.Warning("Something tried to remove hediff with wrong way."); + } + else + { + HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref); + Log.Message(parent.pawn.Label + "tick scheduler removed"); + base.CompPostPostRemoved(); + } } @@ -759,7 +766,7 @@ namespace RJW_Menstruation /// /// /// - /// + /// Amount of target cum public float CumOut(Cum targetcum, float portion = 0.1f) { if (cums.NullOrEmpty()) return 0; @@ -869,12 +876,21 @@ namespace RJW_Menstruation InitOvary(parent.pawn.ageTracker.AgeBiologicalYears); - if (parent.pawn.IsPregnant()) + Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy(); + if (pregnancy != null) { - Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn); - currentIntervalhours = (int)(hediff?.GestationHours()); - curStage = Stage.Pregnant; + Hediff hediff = PregnancyHelper.GetPregnancy(parent.pawn); + if (hediff != null) + { + if (hediff is Hediff_BasePregnancy) + { + Hediff_BasePregnancy preg = (Hediff_BasePregnancy)hediff; + currentIntervalhours = (int)(preg.GestationHours()); + curStage = Stage.Pregnant; + } + } } + if (parent.pawn.IsAnimal()) { if (Configurations.EnableAnimalCycle) @@ -884,7 +900,7 @@ namespace RJW_Menstruation } else { - if (!parent.pawn.IsPregnant() && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Young), tickInterval, parent.pawn, false); + if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Young), tickInterval, parent.pawn, false); else HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), tickInterval, parent.pawn, false); } } @@ -1044,7 +1060,28 @@ namespace RJW_Menstruation if (!egg.fertilized || egg.fertstage < 168) continue; else if (Rand.Range(0.0f, 1.0f) <= Configurations.ImplantationChance * Props.baseImplantationChanceFactor * ImplantFactor * InterspeciesImplantFactor(egg.fertilizer)) { - if (!parent.pawn.IsPregnant()) + Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy(); + if (pregnancy != null) + { + if (Configurations.UseMultiplePregnancy && Configurations.EnableHeteroOvularTwins) + { + if (pregnancy is Hediff_MultiplePregnancy) + { + Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)pregnancy; + h.AddNewBaby(parent.pawn, egg.fertilizer); + } + pregnant = true; + deadeggs.Add(egg); + } + else + { + pregnant = true; + break; + } + + + } + else { if (!Configurations.UseMultiplePregnancy) { @@ -1064,22 +1101,7 @@ namespace RJW_Menstruation deadeggs.Add(egg); } } - else if (Configurations.UseMultiplePregnancy && Configurations.EnableHeteroOvularTwins) - { - Hediff hediff = PregnancyHelper.GetPregnancy(parent.pawn); - if (hediff is Hediff_MultiplePregnancy) - { - Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff; - h.AddNewBaby(parent.pawn, egg.fertilizer); - } - pregnant = true; - deadeggs.Add(egg); - } - else - { - pregnant = true; - break; - } + } else deadeggs.Add(egg); } @@ -1342,7 +1364,7 @@ namespace RJW_Menstruation Implant(); } - if (parent.pawn.IsPregnant()) + if (parent.pawn.GetRJWPregnancy() != null) { curStageHrs += 1; StayCurrentStageConst(Stage.Pregnant); diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index feea23d..6e0e55a 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -309,7 +309,6 @@ namespace RJW_Menstruation public Pawn GenerateBaby(PawnGenerationRequest request, Pawn mother, Pawn father) { - Pawn baby = PawnGenerator.GeneratePawn(request); if (baby != null) { @@ -356,6 +355,7 @@ namespace RJW_Menstruation } } } + else Log.Error("Baby not generated. Request: " + request.ToString()); return baby; } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/IngestionOutcomeDoers.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/IngestionOutcomeDoers.cs new file mode 100644 index 0000000..46fdd2a --- /dev/null +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/IngestionOutcomeDoers.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; +using rjw; + +namespace RJW_Menstruation +{ + public class IngestionOutcomeDoer_GiveHediff_StackCount : IngestionOutcomeDoer_GiveHediff + { + private bool divideByBodySize = false; + + protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) + { + Hediff hediff = HediffMaker.MakeHediff(hediffDef, pawn); + float effect = ((!(severity > 0f)) ? hediffDef.initialSeverity : severity) * ingested.stackCount; + if (divideByBodySize) + { + effect /= pawn.BodySize; + } + AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize(pawn, toleranceChemical, ref effect); + hediff.Severity = effect; + pawn.health.AddHediff(hediff); + } + + + } +} diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs index 69ad681..d15e1aa 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs @@ -11,6 +11,7 @@ namespace RJW_Menstruation { var har = new Harmony("RJW_Menstruation"); har.PatchAll(Assembly.GetExecutingAssembly()); + } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index cf1ab42..343a63c 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -122,7 +122,6 @@ namespace RJW_Menstruation float morph = Mathf.Max(baby.BodySize - Mathf.Pow(vagina.Severity * mother.BodySize,2), 0f); vagina.Severity += morph * Configurations.VaginaMorphPower; } - } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 8cd3b19..23232ae 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -61,6 +61,7 @@ + diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index b2d914c..ff87cf3 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -179,6 +179,10 @@ namespace RJW_Menstruation return null; } + public static Hediff_BasePregnancy GetRJWPregnancy(this Pawn pawn) + { + return (Hediff_BasePregnancy)pawn.health.hediffSet.hediffs.FirstOrDefault(x => x is Hediff_BasePregnancy); + } public static void DrawBreastIcon(this Pawn pawn, Rect rect , bool drawOrigin = false) { diff --git a/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs b/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs index b980b83..4e7a176 100644 --- a/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs +++ b/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs @@ -25,10 +25,10 @@ namespace RJW_Menstruation.Sexperience { HediffComp_Menstruation Comp = pawn.GetMenstruationComp(); - this.FailOn(delegate - { - return !(Comp.TotalCumPercent > 0.001); - }); + //this.FailOn(delegate + //{ + // return !(Comp.TotalCumPercent > 0.001); + //}); yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch); Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of @@ -38,18 +38,22 @@ namespace RJW_Menstruation.Sexperience { initAction = delegate () { - CumMixture mixture = Comp.MixtureOut(RJWSexperience.VariousDefOf.GatheredCum, 0.5f); - float amount = mixture.Volume; - if (mixture.ispurecum) + if (Comp.TotalCumPercent > 0.001) { - Bucket.AddCum(amount); - } - else - { - GatheredCumMixture cummixture = (GatheredCumMixture)ThingMaker.MakeThing(VariousDefOf.GatheredCumMixture); - cummixture.InitwithCum(mixture); - Bucket.AddCum(amount, cummixture); + CumMixture mixture = Comp.MixtureOut(RJWSexperience.VariousDefOf.GatheredCum, 0.5f); + float amount = mixture.Volume; + if (mixture.ispurecum) + { + Bucket.AddCum(amount); + } + else + { + GatheredCumMixture cummixture = (GatheredCumMixture)ThingMaker.MakeThing(VariousDefOf.GatheredCumMixture); + cummixture.InitwithCum(mixture); + Bucket.AddCum(amount, cummixture); + } } + else ReadyForNextToil(); if (Comp.TotalCumPercent > 0.001) JumpToToil(excreting); } }; diff --git a/About/Manifest.xml b/About/Manifest.xml index e635859..fb61331 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,11 +1,17 @@ RJW Menstruation - 1.0.5.8 + 1.0.5.9 +
  • UnlimitedHugs.HugsLib
  • +
  • brrainz.harmony
  • +
  • rim.job.world
  • +
  • Abraxas.RJW.RaceSupport
  • +
  • rjw.milk.humanoid
  • +
  • rjw.sexperience
  • diff --git a/changelogs.txt b/changelogs.txt index 7f27e7d..aa837ad 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,6 @@ +Version 1.0.5.9 + - minor bug fixes + Version 1.0.5.8 - requires RJW 4.8.1 or later - added toggle for gather cums in womb into a cum bucket