diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 65b1373..031e4cd 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Defs/HediffDef/Hediffs_Menstruation.xml b/1.4/Defs/HediffDef/Hediffs_Menstruation.xml index 375d63d..e8cb984 100644 --- a/1.4/Defs/HediffDef/Hediffs_Menstruation.xml +++ b/1.4/Defs/HediffDef/Hediffs_Menstruation.xml @@ -83,7 +83,14 @@ 1.5 - + + +
  • + 0.5 + 6 + 1 +
  • +
    @@ -113,6 +120,52 @@ + + HediffWithComps + Hediff_AffectedByPheromones + + A condition caused by being around someone in estrus. Sex drive and satisfaction is increased by the scent of heat. + (1.00,0.60,0.75) + false + false + false + false + 1.0 + + true + + +
  • + + + 1.1 + 1.0 + +
  • +
  • + 0.4 + + + 1.4 + 1.1 + +
  • +
  • + 0.8 + + + 2.0 + 1.2 + +
  • +
    + +
  • + -1.0 +
  • +
    +
    + HediffWithComps diff --git a/1.4/Languages/English/Keyed/RJW_Menstruation.xml b/1.4/Languages/English/Keyed/RJW_Menstruation.xml index 18611bd..b3a8734 100644 --- a/1.4/Languages/English/Keyed/RJW_Menstruation.xml +++ b/1.4/Languages/English/Keyed/RJW_Menstruation.xml @@ -74,7 +74,9 @@ Show only image of a fetus after discovered pregnancy. Do not show any information about a fetus. Enable menopause - Enable menopause effect that makes pawn infertile when they run out of eggs If you have problems with long lived races, turn off this option. + Enable menopause effect that makes pawn infertile when they run out of eggs. If you have problems with long lived races, turn off this option. + Enable pheromones + Allow humanlikes in visible estrus to increase the sex drive of nearby humanlike males. Use multiple pregnancy Use multiple pregnancy instead RJW's default pregnancy Disable this option if you are in trouble with impregnation RJW pregnancy should be turned on. Enable hetero ovular twins diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 07fd58f..c761378 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -18,9 +18,9 @@ namespace RJW_Menstruation public const float CumFertilityDecayRatioDefault = 0.05f; public const int CumFertilityDecayRatioAdjustDefault = 50; public const int CycleAccelerationDefault = 6; - public const int ColonistTickIntervalDefault = 2500; // 1 hour - public const int NonColonistTickIntervalDefault = 2500; - public const int AnimalTickIntervalDefault = 2500; + public const int ColonistTickIntervalDefault = GenDate.TicksPerHour; + public const int NonColonistTickIntervalDefault = GenDate.TicksPerHour; + public const int AnimalTickIntervalDefault = GenDate.TicksPerHour; public const int TickIntervalMinimum = 20; public const float EnzygoticTwinsChanceDefault = 0.002f; public const int EnzygoticTwinsChanceAdjustDefault = 2; @@ -57,6 +57,7 @@ namespace RJW_Menstruation public static bool DrawEggOverlay = true; public static bool Debug = false; public static bool EnableMenopause = true; + public static bool EnablePheromones = true; public static DetailLevel InfoDetail => infoDetail; public static bool EstrusOverridesHookupSettings = false; public static float EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup; @@ -74,7 +75,6 @@ namespace RJW_Menstruation public static bool EnableGatherCumGizmo = true; public static PawnFlags ShowFlag = PawnFlags.Colonist | PawnFlags.Prisoner; public static bool UseHybridExtention = true; - public static bool MotherFirst = false; public static bool AllowShrinkIcon = false; public static float EggLifespanMultiplier = EggLifespanMultiplierDefault; public static bool EnableBirthVaginaMorph = false; @@ -92,6 +92,8 @@ namespace RJW_Menstruation EnableDraftedIcon = true; EnableGatherCumGizmo = true; EnableAnimalCycle = false; + EnableMenopause = true; + EnablePheromones = true; CycleAcceleration = CycleAccelerationDefault; ColonistTickInterval = ColonistTickIntervalDefault; NonColonistTickInterval = NonColonistTickIntervalDefault; @@ -107,7 +109,6 @@ namespace RJW_Menstruation PregnancySource = PregnancyType.MultiplePregnancy; MaxEnzygoticTwins = MaxEnzygoticTwinsDefault; BleedingAmount = BleedingAmountDefault; - MotherFirst = false; MaxBreastIncrementFactor = MaxBreastIncrementFactorDefault; MaxNippleIncrementFactor= MaxNippleIncrementFactorDefault; PermanentNippleChange = PermanentNippleChangeDefault; @@ -211,6 +212,7 @@ namespace RJW_Menstruation Scribe_Values.Look(ref Debug, "Debug", false); Scribe_Values.Look(ref infoDetail, "InfoDetail", DetailLevel.All); Scribe_Values.Look(ref EnableMenopause, "EnableMenopause", true); + Scribe_Values.Look(ref EnablePheromones, "EnablePheromones", true); Scribe_Values.Look(ref EstrusOverridesHookupSettings, "EstrusOverridesHookupSettings", false); Scribe_Values.Look(ref EstrusFuckabilityToHookup, "EstrusFuckabilityToHookup", EstrusFuckabilityToHookup, true); Scribe_Values.Look(ref EstrusAttractivenessToHookup, "EstrusAttractivenessToHookup", EstrusAttractivenessToHookup, true); @@ -227,7 +229,6 @@ namespace RJW_Menstruation Scribe_Values.Look(ref EnableGatherCumGizmo, "EnableGatherCumGizmo", true); Scribe_Values.Look(ref ShowFlag, "ShowFlag", PawnFlags.Colonist | PawnFlags.Prisoner); Scribe_Values.Look(ref UseHybridExtention, "UseHybridExtention", true); - Scribe_Values.Look(ref MotherFirst, "MotherFirst", false); Scribe_Values.Look(ref MaxBreastIncrementFactor, "MaxBreastIncrementFactor", MaxBreastIncrementFactorDefault); Scribe_Values.Look(ref MaxNippleIncrementFactor, "MaxNippleIncrementFactor", MaxNippleIncrementFactorDefault); Scribe_Values.Look(ref PermanentNippleChange, "PermanentNippleChange", PermanentNippleChangeDefault); @@ -393,6 +394,8 @@ namespace RJW_Menstruation listmain.CheckboxLabeled(Translations.Option12_Label, ref Configurations.EnableMenopause, Translations.Option12_Desc); + listmain.CheckboxLabeled(Translations.Option_EnablePheromones_Label, ref Configurations.EnablePheromones, Translations.Option_EnablePheromones_Desc); + listmain.Label(Translations.Option3_Label + " " + Configurations.ImplantationChance * 100 + "%", -1, Translations.Option3_Desc); Configurations.ImplantationChanceAdjust = (int)listmain.Slider(Configurations.ImplantationChanceAdjust, 0, 1000); Configurations.ImplantationChance = (float)Configurations.ImplantationChanceAdjust / 100; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index f726878..70072b0 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1524,8 +1524,8 @@ namespace RJW_Menstruation /// protected void MakeCumFilth(Cum cum, float amount) { - if (Pawn.Map == null) return; - if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(Pawn.Position, Pawn.Map, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown"); + if (Pawn.MapHeld == null) return; + if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(Pawn.PositionHeld, Pawn.MapHeld, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown"); } /// @@ -1563,10 +1563,10 @@ namespace RJW_Menstruation protected float MakeCumFilthMixture(float amount, List cumlabels) { - if (Pawn.Map == null) return 0; + if (Pawn.MapHeld == null) return 0; if (amount >= minmakefilthvalue) { - FilthMaker_Colored.TryMakeFilth(Pawn.Position, Pawn.Map, VariousDefOf.FilthMixture, cumlabels, GetCumMixtureColor, false); + FilthMaker_Colored.TryMakeFilth(Pawn.PositionHeld, Pawn.MapHeld, VariousDefOf.FilthMixture, cumlabels, GetCumMixtureColor, false); } return amount; } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs index 017a6ed..ab5b2e2 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs @@ -77,6 +77,13 @@ namespace RJW_Menstruation else return base.TicksToNextStage(); } + protected override void LutealAction() + { + base.LutealAction(); + if (curStage == Stage.Follicular) + GoNextStage(Stage.Anestrus); + } + protected override void BleedingAction() { base.BleedingAction(); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs new file mode 100644 index 0000000..0330905 --- /dev/null +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs @@ -0,0 +1,103 @@ + + +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using Verse; + +namespace RJW_Menstruation +{ + public class CompProperties_Pheromones : HediffCompProperties + { + public float daysToMaxSeverity; + public float range; + public float intensity = 1.0f; + + public CompProperties_Pheromones() + { + compClass = typeof(HediffComp_Pheromones); + } + } + + public class HediffComp_Pheromones : HediffComp + { + public CompProperties_Pheromones Props => (CompProperties_Pheromones)props; + public const int emitInterval = GenTicks.TickRareInterval; + public float emitRatio => (float)emitInterval / GenDate.TicksPerDay; + + public override void CompPostTick(ref float severityAdjustment) + { + try + { + if (!Configurations.EnablePheromones) return; + if (!Pawn.RaceProps.Humanlike) return; + if (!Pawn.IsHashIntervalTick(emitInterval)) return; + if (!Pawn.SpawnedOrAnyParentSpawned) return; + + foreach (Pawn pawn in AffectedPawns()) + ApplyEffectToPawn(pawn); + } + catch (Exception ex) + { + Log.Error($"Error when trying to emit pheromones: {ex}"); + } + } + + protected IEnumerable AffectedPawns() + { + Map mapHeld = Pawn.MapHeld; + if (mapHeld == null) yield break; + foreach (Pawn pawn in mapHeld.mapPawns.AllPawnsSpawned) + { + if (pawn == Pawn) continue; + if (!pawn.RaceProps.Humanlike) continue; + if (Pawn.PositionHeld.InHorDistOf(pawn.PositionHeld, Props.range) && Pawn.GetRoom() == pawn.GetRoom()) + yield return pawn; + } + } + + protected float GetEffectOnPawn(Pawn target) + { + if (target.Suspended || target.Dead) return 0.0f; + if (target.needs?.TryGetNeed(VariousDefOf.SexNeed) == null) return 0.0f; + if (!xxx.can_do_loving(target)) return 0.0f; + if (target.story?.traits.HasTrait(TraitDefOf.Asexual) ?? true) return 0.0f; + float penisEffect; + if (Genital_Helper.has_penis_fertile(target)) penisEffect = 1.0f; + else if (target.gender == Gender.Male) penisEffect = 0.25f; + else return 0.0f; + + BodyDef body = target.RaceProps.body; + if (!PawnCapacityUtility.BodyCanEverDoCapacity(body, PawnCapacityDefOf.Breathing)) return 0.0f; + HediffSet hediffs = target.health.hediffSet; + float breathingEffect = PawnCapacityUtility.CalculateCapacityLevel(hediffs, PawnCapacityDefOf.Breathing); + float noseEffect = 1.0f; + List noses = body.GetPartsWithDef(BodyPartDefOf.Nose); + if (noses.Any()) // if the body doesn't have a nose but still breathes, then let it be affected + noseEffect = noses.Average(nose => PawnCapacityUtility.CalculatePartEfficiency(hediffs, nose)); + + return penisEffect * breathingEffect * noseEffect; + } + + protected void ApplyEffectToPawn(Pawn target) + { + float intensity = Props.intensity * GetEffectOnPawn(target); + if (intensity <= 0.0f) return; + Hediff pheromones = target.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_AffectedByPheromones); + float decay = VariousDefOf.Hediff_AffectedByPheromones.CompProps().severityPerDay; + float raiseSeverityPerDay = intensity / Props.daysToMaxSeverity - decay; // Desired increase plus enough to overcome pheromone decay + float amountToApply = emitRatio * raiseSeverityPerDay; + if (pheromones != null) + pheromones.Severity += amountToApply; + else + { + pheromones = HediffMaker.MakeHediff(VariousDefOf.Hediff_AffectedByPheromones, target); + pheromones.Severity = amountToApply; + target.health.AddHediff(pheromones); + } + return; + } + } +} diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index f2f1834..0c4aa45 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -69,6 +69,7 @@ + diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index dd2982f..ec1c46d 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -79,6 +79,8 @@ namespace RJW_Menstruation public static readonly string Option11_Desc_4 = "Option11_Desc_4".Translate(); public static readonly string Option12_Label = "Option12_Label".Translate(); public static readonly string Option12_Desc = "Option12_Desc".Translate(); + public static readonly string Option_EnablePheromones_Label = "Option_EnablePheromones_Label".Translate(); + public static readonly string Option_EnablePheromones_Desc = "Option_EnablePheromones_Desc".Translate(); public static readonly string Option13_Label = "Option13_Label".Translate(); public static readonly string Option13_Desc = "Option13_Desc".Translate(); public static readonly string Option14_Label = "Option14_Label".Translate(); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 6d307cf..2fc4f47 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -1,7 +1,5 @@ using RimWorld; using rjw; -using rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation; -using System; using System.Collections.Generic; using System.Linq; using Verse; @@ -20,6 +18,7 @@ namespace RJW_Menstruation public static readonly HediffDef Hediff_MenstrualCramp = DefDatabase.GetNamed("Hediff_MenstrualCramp"); public static readonly HediffDef Hediff_Estrus = DefDatabase.GetNamed("Hediff_Estrus"); public static readonly HediffDef Hediff_Estrus_Concealed = DefDatabase.GetNamed("Hediff_Estrus_Concealed"); + public static readonly HediffDef Hediff_AffectedByPheromones = DefDatabase.GetNamed("Hediff_AffectedByPheromones"); public static readonly HediffDef Hediff_ASA = DefDatabase.GetNamed("Hediff_ASA"); public static readonly StatDef MaxAbsorbable = DefDatabase.GetNamed("MaxAbsorbable"); public static readonly NeedDef SexNeed = DefDatabase.GetNamed("Sex"); diff --git a/About/Manifest.xml b/About/Manifest.xml index 3299391..028cc7b 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.9.0 + 1.0.9.1 diff --git a/changelogs.txt b/changelogs.txt index 04c373b..1d24789 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,6 +1,8 @@ Version 1.0.9.1 - Add new ideology-related thoughts with the sexperience-ideology mod. + - New pheromone system: Pawns in visible estrus will increase the sex drive of nearby males. Can be disabled in the options. - Using the egg restoration biosculptor cycle will give a small mood buff. + - Periodic ovulators that don't bleed will properly enter anestrus after their luteal stage. Version 1.0.9.0 - Fix errors when opening the womb dialog of some low fertility pawns.