diff --git a/About/Manifest.xml b/About/Manifest.xml index 045f9d3..1febca6 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJWSexperience - 1.0.3.1 + 1.0.3.2
  • RimJobWorld >= 4.9.5.3
  • diff --git a/Assemblies/RJWSexperience.dll b/Assemblies/RJWSexperience.dll index c3e51c4..79c39b6 100644 Binary files a/Assemblies/RJWSexperience.dll and b/Assemblies/RJWSexperience.dll differ diff --git a/RJWSexperience/RJWSexperience/Configurations.cs b/RJWSexperience/RJWSexperience/Configurations.cs index c1362e5..c55dc98 100644 --- a/RJWSexperience/RJWSexperience/Configurations.cs +++ b/RJWSexperience/RJWSexperience/Configurations.cs @@ -23,6 +23,7 @@ namespace RJWSexperience public const float MinSexablePercentDefault = 0.2f; public const float VirginRatioDefault = 0.01f; public const bool selectionLockedDefault = false; + public const bool SexCanFillBucketsDefault = false; // Private attributes private float maxLustDeviation = MaxInitialLustDefault; @@ -55,6 +56,7 @@ namespace RJWSexperience public float MinSexablePercent => minSexablePercent; public float VirginRatio => virginRatio; public float MaxSingleLustChange => maxSingleLustChange; + public bool SexCanFillBuckets => sexCanFillBuckets; public Settings.SettingsTabDebug Debug => debug; [System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")] public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; } @@ -74,6 +76,7 @@ namespace RJWSexperience minSexableFromLifestage = MinSexableFromLifestageDefault; minSexablePercent = MinSexablePercentDefault; virginRatio = VirginRatioDefault; + sexCanFillBuckets = SexCanFillBucketsDefault; } public override void ExposeData() @@ -92,6 +95,7 @@ namespace RJWSexperience Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault); Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault); Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault); + Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault); Scribe_Deep.Look(ref debug, "Debug"); base.ExposeData(); @@ -144,6 +148,9 @@ namespace RJWSexperience listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc); + + listmain.CheckboxLabeled("SexCanFillBuckets".Translate(), ref sexCanFillBuckets, "SexCanFillBuckets_desc".Translate()); + if (listmain.ButtonText(Keyed.Button_ResetToDefault)) { ResetToDefault(); diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs index 4aa76c6..faec323 100644 --- a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs +++ b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -44,6 +44,68 @@ namespace RJWSexperience return null; } + public static IEnumerable GetAdjacentBuildings(this Pawn pawn) where T : Building + { + // This Method was introduced to fill multiple CumBuckets around a single pawn. + var results = new List(); + if (pawn.Spawned) + { + EdificeGrid edifice = pawn.Map.edificeGrid; + if (edifice[pawn.Position] is T) + results.Add((T)edifice[pawn.Position]); + IEnumerable adjcells = GenAdjFast.AdjacentCells8Way(pawn.Position); + foreach (IntVec3 pos in adjcells) + { + if (edifice[pos] is T) + results.Add((T)edifice[pos]); + } + } + return results; + } + + public static float GetCumVolume(this Pawn pawn) + { + List hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); + if (hediffs.NullOrEmpty()) return 0; + else return pawn.GetCumVolume(hediffs); + } + + public static float GetCumVolume(this Pawn pawn, List hediffs) + { + float cum_value = 0; + // Add Cum for every existing Penis at the pawn + foreach (var penis in hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis"))) + { + cum_value += pawn.GetCumVolume(penis.TryGetComp()); + } + // Look for more exotic parts - if any is found, add some more cum for the first special part found + CompHediffBodyPart special_part = null; + if (special_part == null) special_part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (special_part == null) special_part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (special_part == null) special_part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + + cum_value += pawn.GetCumVolume(special_part); + + return cum_value; + } + + public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part) + { + float res; + + try + { + res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f; + } + catch (NullReferenceException) + { + res = 0.0f; + } + if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f); + + return res; + } + /// /// If the pawn is virgin, return true. /// diff --git a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs index 1d86f31..e3eeddf 100644 --- a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs +++ b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs @@ -5,6 +5,7 @@ using rjw.Modules.Interactions.Enums; using RJWSexperience.Cum; using RJWSexperience.ExtensionMethods; using RJWSexperience.Logs; +using System.Collections.Generic; using UnityEngine; using Verse; using Verse.AI; @@ -62,6 +63,7 @@ namespace RJWSexperience { Pawn pawn = props.pawn; Pawn partner = props.partner; + xxx.rjwSextype sextype = props.sexType; UpdateLust(props, satisfaction); if (props.sexType == xxx.rjwSextype.Masturbation || partner == null) @@ -69,6 +71,25 @@ namespace RJWSexperience Building_CumBucket cumbucket = pawn.GetAdjacentBuilding(); cumbucket?.AddCum(CumUtility.GetCumVolume(pawn)); } + bool sexFillsCumbuckets = + // Base: Fill Cumbuckets on Masturbation. Having no partner means it must be masturbation too + sextype == xxx.rjwSextype.Masturbation || partner == null + // Depending on configuration, also fill cumbuckets when certain sextypes are matched + || (SexperienceMod.Settings.SexCanFillBuckets && (sextype == xxx.rjwSextype.Boobjob || sextype == xxx.rjwSextype.Footjob || sextype == xxx.rjwSextype.Handjob)); + + if (sexFillsCumbuckets) + { + IEnumerable buckets = pawn.GetAdjacentBuildings(); + + if (buckets != null && buckets.EnumerableCount() > 0) + { + var initial_Cum = pawn.GetCumVolume(); + foreach (Building_CumBucket b in buckets) + { + b.AddCum(initial_Cum / buckets.EnumerableCount()); + } + } + } RJWUtility.UpdateSatisfactionHIstory(pawn, partner, props, satisfaction); pawn.records?.Increment(VariousDefOf.OrgasmCount); diff --git a/changelogs.txt b/changelogs.txt index d30b16b..682f007 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,6 @@ +Version Beta 1.0.3.2 + - Fix repeated scroll sounds in mod settings + Version Beta 1.0.3.1 - Added ability to draw more quirks in Sex Status window - Added option to disable Bastard relation