Keep a running total of fluid leaked and emit a filth every 5 ml

This commit is contained in:
lutepickle 2023-04-15 08:30:39 -07:00
parent 89a7d410df
commit 80243c78f1
3 changed files with 15 additions and 13 deletions

Binary file not shown.

View file

@ -171,7 +171,6 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref useCustomColor, "useCustomColor", false);
Scribe_Values.Look(ref customColor, "customColor", default);
Scribe_Defs.Look(ref filthDef, "filthDef");
}
public void MakeThinner(float speed)

View file

@ -66,6 +66,7 @@ namespace RJW_Menstruation
const float minmakefilthvalue = 1.0f;
const int maxImplantDelayHours = 30 * GenDate.HoursPerDay;
const int minImplantAgeHours = 3 * GenDate.HoursPerDay;
const float fluidLeakThreshold = 5.0f;
const float pulloutSuccessRate = 0.8f;
const float fetishPulloutSuccessModifier = 0.25f;
@ -116,6 +117,7 @@ namespace RJW_Menstruation
protected float cycleVariability = -1;
protected int currentIntervalTicks = -1; // Actual number of ticks equals this / cycleAcceleration
protected float crampPain = -1;
protected float fluidToLeak = 0;
protected Need sexNeed = null;
protected string customwombtex = null;
protected string customvagtex = null;
@ -641,6 +643,7 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref cycleVariability, "cycleVariability", cycleVariability, true);
Scribe_Values.Look(ref currentIntervalTicks, "currentIntervalTicks", currentIntervalTicks, true);
Scribe_Values.Look(ref crampPain, "crampPain", crampPain, true);
Scribe_Values.Look(ref fluidToLeak, "fluidToLeak", 0);
Scribe_Values.Look(ref ovarypower, "ovarypower", ovarypower, true);
Scribe_Values.Look(ref eggstack, "eggstack", 0);
Scribe_Values.Look(ref estrusflag, "estrusflag", false);
@ -991,9 +994,15 @@ namespace RJW_Menstruation
/// <summary>
/// For natural leaking
/// </summary>
protected virtual void AfterCumOut()
protected virtual void AfterCumOut(float amount, List<string> filthlabels)
{
Pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(VariousDefOf.LeakingFluids);
fluidToLeak += amount;
if (fluidToLeak > fluidLeakThreshold) Pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(VariousDefOf.LeakingFluids);
for (; fluidToLeak > fluidLeakThreshold; fluidToLeak -= fluidLeakThreshold)
{
if (cums.Count > 1) MakeCumFilthMixture(fluidLeakThreshold, filthlabels);
else if (cums.Count == 1) MakeCumFilth(cums.First(), fluidLeakThreshold);
}
}
/// <summary>
@ -1013,11 +1022,9 @@ namespace RJW_Menstruation
/// </summary>
public void CumOut()
{
const float mlPerFilth = 5.0f;
float leakfactor = 1.0f;
float totalleak = 0f;
float cumd = TotalCumPercent;
int preCumAmount = Mathf.CeilToInt(TotalCum / mlPerFilth);
List<string> filthlabels = new List<string>();
BeforeCumOut(out Absorber absorber);
if (cums.NullOrEmpty()) return;
@ -1033,17 +1040,11 @@ namespace RJW_Menstruation
string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString());
filthlabels.Add(tmp.Replace(" x1", ""));
}
int postCumAmount = Mathf.CeilToInt(TotalCum / mlPerFilth);
for (int i = 0; i < preCumAmount - postCumAmount; i++) // Emit a filth every time the integer cum amount drops
{
if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels);
else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak);
}
AfterCumOut(totalleak, filthlabels);
cums.RemoveAll(cum => cum.ShouldRemove());
if (cums.NullOrEmpty()) fluidToLeak = 0;
cumd = TotalCumPercent - cumd;
if (totalleak >= 1.0f) AfterCumOut();
AfterFluidOut(cumd);
}
/// <summary>
@ -1073,6 +1074,7 @@ namespace RJW_Menstruation
if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels);
else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak);
cums.RemoveAll(cum => removecums.Contains(cum));
if (cums.NullOrEmpty()) fluidToLeak = 0;
cumd = TotalCumPercent - cumd;
AfterFluidOut(cumd);
return outcum;
@ -1102,6 +1104,7 @@ namespace RJW_Menstruation
if (cum.notcum) pure = false;
}
cums.RemoveAll(cum => removecums.Contains(cum));
if (cums.NullOrEmpty()) fluidToLeak = 0;
return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure);
}