Cum fertility overhaul. Now track volume and fertility percentage instead of fertvolume.

This commit is contained in:
lutepickle 2022-07-07 12:14:47 -07:00
parent 24e7f93bcc
commit 8a048ea7e5
1 changed files with 10 additions and 13 deletions

View File

@ -11,8 +11,7 @@ namespace RJW_Menstruation
public Pawn pawn;
protected float volume; // ml
protected float fertvolume;
public float fertFactor = 1.0f;
public float fertility = 1.0f;
public bool notcum = false; // for other fluids
public string notcumLabel = "";
protected bool useCustomColor = false;
@ -32,7 +31,7 @@ namespace RJW_Menstruation
{
get
{
return fertvolume;
return volume * fertility;
}
}
@ -130,7 +129,7 @@ namespace RJW_Menstruation
{
this.pawn = pawn;
volume = 1.0f;
fertvolume = 1.0f;
fertility = 1.0f;
}
/// <summary>
@ -145,7 +144,7 @@ namespace RJW_Menstruation
{
this.pawn = pawn;
this.volume = volume;
this.fertvolume = volume;
this.fertility = 0f;
this.notcum = true;
this.notcumLabel = notcumlabel;
this.notcumthickness = decayresist;
@ -156,7 +155,7 @@ namespace RJW_Menstruation
{
this.pawn = pawn;
this.volume = volume;
this.fertvolume = volume * fertility;
this.fertility = fertility;
this.filthDef = filthDef;
}
@ -167,9 +166,8 @@ namespace RJW_Menstruation
Scribe_References.Look(ref pawn, "pawn", true);
Scribe_References.Look(ref internalThing, "internalThing", true);
Scribe_Values.Look(ref volume, "volume", volume, true);
Scribe_Values.Look(ref fertvolume, "fertvolume", fertvolume, true);
Scribe_Values.Look(ref fertility, "fertility", fertility, true);
Scribe_Values.Look(ref notcumthickness, "notcumthickness", notcumthickness, true);
Scribe_Values.Look(ref fertFactor, "fertFactor", fertFactor, true);
Scribe_Values.Look(ref notcum, "notcum", notcum, true);
Scribe_Values.Look(ref notcumLabel, "notcumLabel", notcumLabel, true);
Scribe_Values.Look(ref useCustomColor, "useCustomColor", useCustomColor, true);
@ -187,7 +185,7 @@ namespace RJW_Menstruation
{
if (updatefilthDef != null) filthDef = updatefilthDef;
volume += volumein;
fertvolume += volumein*fertility;
this.fertility = (this.volume * this.fertility + volumein * fertility) / (this.volume + volumein);
cumthickness = Mathf.Lerp(cumthickness, 1.0f, volumein / volume);
}
@ -195,12 +193,13 @@ namespace RJW_Menstruation
{
if (updatefilthDef != null) filthDef = updatefilthDef;
volume += volumein;
fertility = volume * fertility / (volume + volumein);
notcumthickness = Mathf.Lerp(notcumthickness, thickness, volumein / volume);
}
public bool ShouldRemove()
{
if ((notcum || fertvolume < 0.001f) && volume < 0.01f) return true;
if ((notcum || FertVolume < 0.001f) && volume < 0.01f) return true;
return false;
}
@ -209,7 +208,7 @@ namespace RJW_Menstruation
{
float totalleak = volume;
volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - DecayResist)) * leakfactor));
fertvolume *= Math.Max(0, 1 - (Configurations.CumFertilityDecayRatio * (1 - DecayResist) + antisperm));
fertility *= Math.Max(0, 1 - (Configurations.CumFertilityDecayRatio * (1 - DecayResist) + antisperm));
CutMinor();
totalleak -= volume;
return totalleak;
@ -219,7 +218,6 @@ namespace RJW_Menstruation
{
float totalleak = volume;
volume *= Math.Max(0, 1 - (portion * (1 - DecayResist/10)) * leakfactor);
fertvolume *= Math.Max(0, 1 - (portion * (1 - DecayResist)) * leakfactor);
CutMinor();
totalleak -= volume;
return totalleak;
@ -241,7 +239,6 @@ namespace RJW_Menstruation
protected void CutMinor()
{
if (volume < 0.01f) volume = 0f;
if (fertvolume < 0.001f) fertvolume = 0f;
}