Cleanup after merge
This commit is contained in:
parent
770798c4cc
commit
bc5b9c00b5
|
@ -91,6 +91,8 @@
|
|||
<RSOption_MaxSingleLustChange_Desc>Set how much lust can change from a single sex act</RSOption_MaxSingleLustChange_Desc>
|
||||
<RSOption_EnableBastardRelation_Label>Enable Bastard relation</RSOption_EnableBastardRelation_Label>
|
||||
<RSOption_EnableBastardRelation_Desc>Child is marked as a bastard if they have only one parent or their parents are (or was) married</RSOption_EnableBastardRelation_Desc>
|
||||
<RSOption_SexCanFillBuckets_Label>Sex can fill buckets</RSOption_SexCanFillBuckets_Label>
|
||||
<RSOption_SexCanFillBuckets_Desc>If enabled, boobjobs, footjobs and handjobs that happens near cum bucket will fill it</RSOption_SexCanFillBuckets_Desc>
|
||||
<RSOption_Debug_Label>Debug</RSOption_Debug_Label>
|
||||
<RSOption_Debug_Desc>Enable debug logs</RSOption_Debug_Desc>
|
||||
<Button_ResetToDefault>Reset to default</Button_ResetToDefault>
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace RJWSexperience
|
|||
public const bool MinSexableFromLifestageDefault = true;
|
||||
public const float MinSexablePercentDefault = 0.2f;
|
||||
public const float VirginRatioDefault = 0.01f;
|
||||
public const bool SexCanFillBucketsDefault = false;
|
||||
public const bool selectionLockedDefault = false;
|
||||
public const bool SexCanFillBucketsDefault = false;
|
||||
|
||||
// Private attributes
|
||||
private float maxLustDeviation = MaxInitialLustDefault;
|
||||
|
@ -39,6 +39,7 @@ namespace RJWSexperience
|
|||
private float minSexablePercent = MinSexablePercentDefault;
|
||||
private float virginRatio = VirginRatioDefault;
|
||||
private float maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||
private bool sexCanFillBuckets = SexCanFillBucketsDefault;
|
||||
private bool selectionLocked = selectionLockedDefault;
|
||||
private Settings.SettingsTabDebug debug;
|
||||
|
||||
|
@ -56,7 +57,7 @@ namespace RJWSexperience
|
|||
public float MinSexablePercent => minSexablePercent;
|
||||
public float VirginRatio => virginRatio;
|
||||
public float MaxSingleLustChange => maxSingleLustChange;
|
||||
public bool SexCanFillBuckets => sexCanFillBuckets;
|
||||
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; }
|
||||
|
@ -147,9 +148,7 @@ namespace RJWSexperience
|
|||
}
|
||||
|
||||
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
|
||||
|
||||
|
||||
listmain.CheckboxLabeled("SexCanFillBuckets".Translate(), ref sexCanFillBuckets, "SexCanFillBuckets_desc".Translate());
|
||||
listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, ref sexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
|
||||
|
||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||
{
|
||||
|
|
|
@ -9,22 +9,32 @@ namespace RJWSexperience.Cum
|
|||
{
|
||||
public static class CumUtility
|
||||
{
|
||||
private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("CumUtility");
|
||||
|
||||
public static float GetOnePartCumVolume(Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty())
|
||||
return 0f;
|
||||
|
||||
float result = GetCumVolume(pawn, GetOneBodyPartComp(hediffs));
|
||||
log.Message($"GetOnePartCumVolume({pawn.NameShortColored}) = {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty()) return 0f;
|
||||
else return GetCumVolume(pawn, hediffs);
|
||||
if (hediffs.NullOrEmpty())
|
||||
return 0f;
|
||||
float result = GetCumVolume(pawn, GetAllBodyPartComps(hediffs));
|
||||
log.Message($"GetCumVolume({pawn.NameShortColored}) = {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn, List<Hediff> hediffs)
|
||||
public static float GetCumVolume(Pawn pawn, List<CompHediffBodyPart> parts)
|
||||
{
|
||||
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>();
|
||||
if (part == null) return 0f;
|
||||
|
||||
return GetCumVolume(pawn, part);
|
||||
return parts.Select(part => GetCumVolume(pawn, part)).Aggregate((sum, x) => sum + x);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn, CompHediffBodyPart part)
|
||||
|
@ -44,13 +54,35 @@ namespace RJWSexperience.Cum
|
|||
return res;
|
||||
}
|
||||
|
||||
public static List<CompHediffBodyPart> GetAllBodyPartComps(List<Hediff> hediffs)
|
||||
{
|
||||
List<CompHediffBodyPart> bodyPartComps = new List<CompHediffBodyPart>();
|
||||
|
||||
foreach (Hediff bodyPart in hediffs)
|
||||
{
|
||||
CompHediffBodyPart bodyPartComp = bodyPart.TryGetComp<CompHediffBodyPart>();
|
||||
if (bodyPartComp != null)
|
||||
bodyPartComps.Add(bodyPartComp);
|
||||
}
|
||||
|
||||
return bodyPartComps;
|
||||
}
|
||||
|
||||
public static CompHediffBodyPart GetOneBodyPartComp(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>();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
public static void FeedCum(Pawn pawn, float amount)
|
||||
{
|
||||
const float allOf = 1000f;
|
||||
|
||||
var log = LogManager.GetLogger<DebugLogProvider>("PawnExtensions");
|
||||
log.Message($"AteCum({pawn.NameShortColored}, {amount})");
|
||||
|
||||
log.Message($"FeedCum({pawn.NameShortColored}, {amount})");
|
||||
Thing cum = ThingMaker.MakeThing(VariousDefOf.GatheredCum);
|
||||
cum.stackCount = (int)Math.Ceiling(amount);
|
||||
log.Message($"Created a stack of {cum.stackCount} cum");
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace RJWSexperience
|
|||
}
|
||||
|
||||
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)
|
||||
|
@ -63,49 +63,6 @@ namespace RJWSexperience
|
|||
return results;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(this Pawn pawn)
|
||||
{
|
||||
List<Hediff> 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<Hediff> 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<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>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the pawn is virgin, return true.
|
||||
/// </summary>
|
||||
|
|
|
@ -92,6 +92,8 @@ namespace RJWSexperience
|
|||
public static readonly string Option_MaxSingleLustChange_Desc = "RSOption_MaxSingleLustChange_Desc".Translate();
|
||||
public static readonly string Option_EnableBastardRelation_Label = "RSOption_EnableBastardRelation_Label".Translate();
|
||||
public static readonly string Option_EnableBastardRelation_Desc = "RSOption_EnableBastardRelation_Desc".Translate();
|
||||
public static readonly string Option_SexCanFillBuckets_Label = "RSOption_SexCanFillBuckets_Label".Translate();
|
||||
public static readonly string Option_SexCanFillBuckets_Desc = "RSOption_SexCanFillBuckets_Desc".Translate();
|
||||
public static readonly string Option_Debug_Label = "RSOption_Debug_Label".Translate();
|
||||
public static readonly string Option_Debug_Desc = "RSOption_Debug_Desc".Translate();
|
||||
public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
|
||||
|
|
|
@ -62,37 +62,35 @@ namespace RJWSexperience
|
|||
public static void Postfix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
Pawn pawn = props.pawn;
|
||||
Pawn partner = props.partner;
|
||||
xxx.rjwSextype sextype = props.sexType;
|
||||
UpdateLust(props, satisfaction);
|
||||
FillCumBuckets(props);
|
||||
RJWUtility.UpdateSatisfactionHIstory(pawn, props.partner, props, satisfaction);
|
||||
pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||
}
|
||||
|
||||
private static void FillCumBuckets(SexProps props)
|
||||
{
|
||||
xxx.rjwSextype sextype = props.sexType;
|
||||
|
||||
if (props.sexType == xxx.rjwSextype.Masturbation || partner == null)
|
||||
{
|
||||
Building_CumBucket cumbucket = pawn.GetAdjacentBuilding<Building_CumBucket>();
|
||||
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
|
||||
sextype == xxx.rjwSextype.Masturbation || props.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>();
|
||||
IEnumerable<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>();
|
||||
|
||||
if (buckets != null && buckets.EnumerableCount() > 0)
|
||||
if (buckets?.EnumerableCount() > 0)
|
||||
{
|
||||
var initial_Cum = pawn.GetCumVolume();
|
||||
foreach (Building_CumBucket b in buckets)
|
||||
var initialCum = CumUtility.GetCumVolume(props.pawn);
|
||||
foreach (Building_CumBucket bucket in buckets)
|
||||
{
|
||||
b.AddCum(initial_Cum / buckets.EnumerableCount());
|
||||
bucket.AddCum(initialCum / buckets.EnumerableCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RJWUtility.UpdateSatisfactionHIstory(pawn, partner, props, satisfaction);
|
||||
pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||
}
|
||||
|
||||
private static void UpdateLust(SexProps props, float satisfaction)
|
||||
|
@ -146,7 +144,7 @@ namespace RJWSexperience
|
|||
if (!PawnsPenisIsInPartnersMouth(props))
|
||||
return;
|
||||
|
||||
CumUtility.FeedCum(props.partner, CumUtility.GetCumVolume(props.pawn));
|
||||
CumUtility.FeedCum(props.partner, CumUtility.GetOnePartCumVolume(props.pawn));
|
||||
}
|
||||
|
||||
private static bool PawnsPenisIsInPartnersMouth(SexProps props)
|
||||
|
|
Loading…
Reference in New Issue