Added Cum-Per-Penis, Multifilling Cumbuckets, Cumbucket per Sex as Flag

This commit is contained in:
Vegapnk 2022-04-30 16:35:32 +02:00
parent ae6f8b1359
commit bab2413a2f
3 changed files with 62 additions and 10 deletions

View file

@ -19,6 +19,7 @@ namespace RJWSexperience
public const bool MinSexableFromLifestageDefault = true;
public const float MinSexablePercentDefault = 0.2f;
public const float VirginRatioDefault = 0.01f;
public const bool SexCanFillBucketsDefault = false;
private float maxLustDeviation = MaxInitialLustDefault;
private float avgLust = AvgLustDefault;
@ -33,6 +34,7 @@ namespace RJWSexperience
private float minSexablePercent = MinSexablePercentDefault;
private float virginRatio = VirginRatioDefault;
private float maxSingleLustChange = MaxSingleLustChangeDefault;
private bool sexCanFillBuckets = SexCanFillBucketsDefault;
public float MaxLustDeviation { get => maxLustDeviation; }
public float AvgLust { get => avgLust; }
@ -47,6 +49,7 @@ namespace RJWSexperience
public float MinSexablePercent { get => minSexablePercent; }
public float VirginRatio { get => virginRatio; }
public float MaxSingleLustChange { get => maxSingleLustChange; }
public bool SexCanFillBuckets { get => sexCanFillBuckets; }
private bool selectionLocked = false;
@ -68,6 +71,7 @@ namespace RJWSexperience
minSexableFromLifestage = MinSexableFromLifestageDefault;
minSexablePercent = MinSexablePercentDefault;
virginRatio = VirginRatioDefault;
sexCanFillBuckets = SexCanFillBucketsDefault;
}
public override void ExposeData()
@ -86,6 +90,7 @@ namespace RJWSexperience
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault, true);
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault, true);
Scribe_Values.Look(ref selectionLocked, "SelectionLocked");
Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault, true);
base.ExposeData();
}
@ -128,6 +133,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();

View file

@ -46,6 +46,25 @@ namespace RJWSexperience
return null;
}
public static IEnumerable<T> GetAdjacentBuildings<T>(this Pawn pawn) where T : Building
{
// This Method was introduced to fill multiple CumBuckets around a single pawn.
var results = new List<T>();
if (pawn.Spawned)
{
EdificeGrid edifice = pawn.Map.edificeGrid;
if (edifice[pawn.Position] is T)
results.Add((T)edifice[pawn.Position]);
IEnumerable<IntVec3> 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<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
@ -55,12 +74,21 @@ namespace RJWSexperience
public static float GetCumVolume(this Pawn pawn, List<Hediff> hediffs)
{
CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
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<CompHediffBodyPart>());
}
// 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<CompHediffBodyPart>();
if (special_part == null) special_part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (special_part == null) special_part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
return pawn.GetCumVolume(part);
cum_value += pawn.GetCumVolume(special_part);
return cum_value;
}
public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part)

View file

@ -3,6 +3,7 @@ using RimWorld;
using rjw;
using rjw.Modules.Interactions.Enums;
using RJWSexperience.ExtensionMethods;
using System.Collections.Generic;
using UnityEngine;
using Verse;
using Verse.AI;
@ -60,13 +61,28 @@ 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)
{
Building_CumBucket cumbucket = pawn.GetAdjacentBuilding<Building_CumBucket>();
cumbucket?.AddCum(pawn.GetCumVolume());
}
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<Building_CumBucket> buckets = pawn.GetAdjacentBuildings<Building_CumBucket>();
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);