This commit is contained in:
moreoreganostodump 2021-07-17 18:15:56 +09:00
parent 4b4a54c11b
commit 81e845b2b6
21 changed files with 377 additions and 237 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RJW Menstruation</identifier>
<version>1.0.4.3</version>
<version>1.0.4.4</version>
<dependencies>
</dependencies>
<incompatibleWith />

Binary file not shown.

View File

@ -4,7 +4,7 @@
<ThingDef ParentName="MakeableDrugPillBase">
<defName>OvaryRegenerationPill</defName>
<label>Ovary regeneration pill</label>
<description>Recovers ovary's health.&#10;Less effective on unhealthy ovary.&#10;Does not relieve climacteric symptoms.</description>
<description>Recovers ovary's health.&#10;Less effective on unhealthy ovary.&#10;Does not recover menopause.</description>
<graphicData>
<texPath>Things/Item/ORPill</texPath>
<graphicClass>Graphic_StackCount</graphicClass>

View File

@ -37,7 +37,7 @@
<Option5_Label>cum decay ratio per hour</Option5_Label>
<Option5_Desc>cum will decrease about this ratio&#10;this value affects on the fertility chacne indirectly</Option5_Desc>
<Option6_Label>cum fertility decay ratio per hour</Option6_Label>
<Option6_Desc>cum will lose fertility about this ratio&#10;this value affects on the fertility chance indirectly</Option6_Desc>
<Option6_Desc>cum will lose fertility about this ratio&#10;this value affects on the fertility chance indirectly&#10;estimated sperm lifespan: cum lose most of fertility at this time.</Option6_Desc>
<Option7_Label>cycle accelerate</Option7_Label>
<Option7_Desc>accelerate menstrution cycle</Option7_Desc>
<Option8_Label>Debug</Option8_Label>
@ -92,7 +92,8 @@
<Option28_Tooltip>Open custom hybrid editor.&#10;This will overrides hybrid definitions of XML files.</Option28_Tooltip>
<Option29_Label>Allow shrink icon</Option29_Label>
<Option29_Desc>Let icon become smaller If needed.</Option29_Desc>
<EstimatedCumLifespan>estimated sperm lifespan</EstimatedCumLifespan>
<FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf>
<CustomHybrid_List_Title>Custom Hybrid Editor</CustomHybrid_List_Title>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<Surgery_ExpandAreola.label>유륜확대 수술</Surgery_ExpandAreola.label>
<Surgery_ExpandAreola.description>유륜을 크게만듭니다.</Surgery_ExpandAreola.description>
<Surgery_ExpandAreola.jobString>유륜확대 수술중</Surgery_ExpandAreola.jobString>
<Surgery_ContractAreola.label>유륜축소 수술</Surgery_ContractAreola.label>
<Surgery_ContractAreola.description>유륜을 작게만듭니다.</Surgery_ContractAreola.description>
<Surgery_ContractAreola.jobString>유륜축소 수술중</Surgery_ContractAreola.jobString>
<Surgery_ExpandNipple.label>유두확대 수술</Surgery_ExpandNipple.label>
<Surgery_ExpandNipple.description>유두를 크게만듭니다.</Surgery_ExpandNipple.description>
<Surgery_ExpandNipple.jobString>유두확대 수술중</Surgery_ExpandNipple.jobString>
<Surgery_ContractNipple.label>유두축소 수술</Surgery_ContractNipple.label>
<Surgery_ContractNipple.description>유두를 작게만듭니다.</Surgery_ContractNipple.description>
<Surgery_ContractNipple.jobString>유두축소 수술중</Surgery_ContractNipple.jobString>
</LanguageData>

View File

@ -9,7 +9,7 @@
<Absorber_Pad_Dirty.label>젖은 생리대</Absorber_Pad_Dirty.label>
<Absorber_Pad_Dirty.description>사용된 축축한 생리대입니다.</Absorber_Pad_Dirty.description>
<OvaryRegenerationPill.label>난소 재생약</OvaryRegenerationPill.label>
<OvaryRegenerationPill.description>난소를 재생시켜 배출할수있는 난자의 양을 증가시킵니다.&#10;난자 소모량이 클수록 효과가 줄어듭니다.&#10;갱년기 증상을 완화시키지 않습니다.</OvaryRegenerationPill.description>
<OvaryRegenerationPill.description>난소를 재생시켜 배출할수있는 난자의 양을 증가시킵니다.&#10;난자 소모량이 클수록 효과가 줄어듭니다.&#10;폐경을 회복시키지 않습니다.</OvaryRegenerationPill.description>
<SuperovulationInducingAgent.label>과배란 유도제</SuperovulationInducingAgent.label>
<SuperovulationInducingAgent.description>과배란을 유도하는 약물입니다.&#10;조기폐경을 초래할수도 있습니다.</SuperovulationInducingAgent.description>
<PainReliever.label>진통제</PainReliever.label>

View File

@ -37,7 +37,7 @@
<Option5_Label>시간당 정액배출비율</Option5_Label>
<Option5_Desc>이 비율만큼 매 시간마다 정액이 배출됩니다.</Option5_Desc>
<Option6_Label>시간당 정자 사망비율</Option6_Label>
<Option6_Desc>이 비율만큼 매 시간마다 정자가 사망해 정액이 생식능력을 잃습니다.</Option6_Desc>
<Option6_Desc>이 비율만큼 매 시간마다 정자가 사망해 정액이 생식능력을 잃습니다.&#10;정자 예상수명: 정액이 대부분의 생식능력을 잃는 시간입니다.</Option6_Desc>
<Option7_Label>주기 가속</Option7_Label>
<Option7_Desc>월경주기를 더 빠르게합니다.</Option7_Desc>
<Option8_Label>Debug</Option8_Label>
@ -92,6 +92,7 @@
<Option28_Tooltip>사용자 지정 잡종 편집기를 엽니다.&#10;이 설정은 XML파일의 잡종 정의를 대체합니다.</Option28_Tooltip>
<Option29_Label>아이콘 축소 허용</Option29_Label>
<Option29_Desc>아이콘 축소를 허용합니다.</Option29_Desc>
<EstimatedCumLifespan>정자 예상수명</EstimatedCumLifespan>
<FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf>

Binary file not shown.

View File

@ -1,3 +1,10 @@
Version 1.0.4.4
- ovary regeneration pill can restore climacteric (not menopause)
- menstrual blood uses race's blood def
- added estimated sperm lifespan in modsetting
- fixed errors on pregnancy
- changed cum calculation method
Version 1.0.4.3
- fixed errors on pregnancy
- added surgeries for nipple/areola

View File

@ -177,6 +177,7 @@ namespace RJW_Menstruation
base.ExposeData();
}
}
@ -243,6 +244,7 @@ namespace RJW_Menstruation
{
wombsection.CheckboxLabeled(Translations.Option18_Label, ref Configurations.DrawEggOverlay, Translations.Option18_Desc);
}
wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc);
wombsection.CheckboxLabeled(Translations.Option29_Label, ref Configurations.AllowShrinkIcon, Translations.Option29_Desc);
if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.InfoDetail)))
@ -333,7 +335,17 @@ namespace RJW_Menstruation
Configurations.CumDecayRatioAdjust = (int)listmain.Slider(Configurations.CumDecayRatioAdjust, 0, 1000);
Configurations.CumDecayRatio = (float)Configurations.CumDecayRatioAdjust / 1000;
listmain.Label(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", -1, Translations.Option6_Desc);
int semenlifespan = (int)(-5 / ((float)Math.Log10((1 - Configurations.CumFertilityDecayRatio)*10) - 1)) + 1;
string estimatedlifespan;
if (semenlifespan < 0)
{
estimatedlifespan = String.Format(": Infinite", semenlifespan);
}
else
{
estimatedlifespan = String.Format(": {0:0}h", semenlifespan);
}
listmain.LabelDouble(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", Translations.EstimatedCumLifespan + estimatedlifespan, Translations.Option6_Desc);
Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000);
Configurations.CumFertilityDecayRatio = (float)Configurations.CumFertilityDecayRatioAdjust / 1000;

View File

@ -1,5 +1,6 @@
using RimWorld;
using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
@ -147,7 +148,7 @@ namespace RJW_Menstruation
public void ExposeData()
public virtual void ExposeData()
{
Scribe_References.Look(ref pawn, "pawn", true);
Scribe_Values.Look(ref volume, "volume", volume, true);
@ -158,6 +159,7 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref notcumLabel, "notcumLabel", notcumLabel, true);
Scribe_Values.Look(ref useCustomColor, "useCustomColor", useCustomColor, true);
Scribe_Values.Look(ref customColor, "customColor", customColor, true);
Scribe_Defs.Look(ref filthDef, "filthDef");
}
@ -222,8 +224,51 @@ namespace RJW_Menstruation
}
public class CumMixture : Cum, IDisposable
{
protected List<string> cums;
public CumMixture()
{
notcum = true;
cums = new List<string>();
}
public CumMixture(Pawn pawn, float volume, List<string> cums, Color color, ThingDef mixtureDef)
{
this.pawn = pawn;
this.volume = volume;
this.cums = cums;
this.customColor = color;
this.useCustomColor = true;
}
public void Dispose()
{
cums.Clear();
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Collections.Look(ref cums, "cumslabel", LookMode.Value, new object[0]);
}
public string GetIngredients()
{
string res = "";
if (!cums.NullOrEmpty()) for(int i=0; i<cums.Count; i++)
{
res += cums[i];
if (i < cums.Count - 1) res += ", ";
}
return res;
}
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using rjw;
@ -9,7 +10,7 @@ namespace RJW_Menstruation
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular)
@ -31,10 +32,10 @@ namespace RJW_Menstruation
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
if (comp != null)
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (Configurations.EnableMenopause && comp != null)
{
comp.ovarypower = (int)(comp.ovarypower * (1 + effectOffset));
comp.RecoverOvary(1 + effectOffset);
}
@ -45,7 +46,7 @@ namespace RJW_Menstruation
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (comp != null)
{
comp.eggstack += Rand.Range(1, 4);

View File

@ -60,12 +60,6 @@ namespace RJW_Menstruation
}
}
public class HediffComp_Menstruation : HediffComp
{
const float minmakefilthvalue = 1.0f;
@ -444,7 +438,11 @@ namespace RJW_Menstruation
public override void CompPostPostAdd(DamageInfo? dinfo)
{
if (!loaded) Initialize();
if (!loaded)
{
InitOvary((int)Utility.RandGaussianLike(18,40));
Initialize();
}
}
public override void CompPostTick(ref float severityAdjustment)
@ -458,9 +456,8 @@ namespace RJW_Menstruation
public override void CompPostPostRemoved()
{
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref);
ModLog.Message(parent.pawn.Label + "tick scheduler removed");
Log.Message(parent.pawn.Label + "tick scheduler removed");
base.CompPostPostRemoved();
}
@ -715,8 +712,37 @@ namespace RJW_Menstruation
return outcum;
}
/// <summary>
/// Force excrete cums in womb and get mixture of cum.
/// </summary>
/// <param name="mixtureDef"></param>
/// <param name="portion"></param>
/// <returns></returns>
public Cum MixtureOut(ThingDef mixtureDef ,float portion = 0.1f)
{
if (cums.NullOrEmpty()) return null;
Color color = GetCumMixtureColor;
float totalleak = 0;
List<string> cumlabels = new List<string>();
float cumd = TotalCumPercent;
List<Cum> removecums = new List<Cum>();
foreach (Cum cum in cums)
{
float vd = cum.DismishForce(portion);
string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString());
cumlabels.Add(tmp.Replace(" x1", ""));
totalleak += vd;
if (cum.ShouldRemove()) removecums.Add(cum);
}
foreach (Cum cum in removecums)
{
cums.Remove(cum);
}
removecums.Clear();
return new CumMixture(parent.pawn, totalleak, cumlabels, color, mixtureDef);
}
/// <summary>
/// Fertilize eggs and return the result
/// </summary>
@ -761,43 +787,7 @@ namespace RJW_Menstruation
if (eggs == null) eggs = new List<Egg>();
if (!Configurations.EnableMenopause)
{
RemoveClimactericEffect();
}
else if (ovarypower < -50000)
{
if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower;
else
{
float avglittersize;
try
{
avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve);
}
catch (NullReferenceException)
{
avglittersize = 1;
}
ovarypower = (int)(((Props.ovaryPower * Rand.Range(0.7f, 1.3f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)
- (Math.Max(0, parent.pawn.ageTracker.AgeBiologicalYears - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy))
* (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize);
if (ovarypower < 1)
{
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
hediff.Severity = 0.2f;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
curStage = Stage.Young;
}
else if (ovarypower < ovarypowerthreshold)
{
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn);
hediff.Severity = 0.008f * (ovarypowerthreshold - ovarypower);
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
}
}
}
InitOvary(parent.pawn.ageTracker.AgeBiologicalYears);
if (parent.pawn.IsPregnant()) curStage = Stage.Pregnant;
if (parent.pawn.IsAnimal())
@ -823,6 +813,57 @@ namespace RJW_Menstruation
loaded = true;
}
protected void InitOvary(int ageYear)
{
if (!Configurations.EnableMenopause)
{
RemoveClimactericEffect();
}
else if (ovarypower < -50000)
{
if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower;
else
{
float avglittersize;
try
{
avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve);
}
catch (NullReferenceException)
{
avglittersize = 1;
}
ovarypower = (int)(((Props.ovaryPower * Utility.RandGaussianLike(0.70f, 1.30f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)
- (Math.Max(0, ageYear - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy))
* (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize);
if (ovarypower < 1)
{
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
hediff.Severity = 0.2f;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
curStage = Stage.Young;
}
else if (ovarypower < ovarypowerthreshold)
{
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn);
hediff.Severity = 0.008f * (ovarypowerthreshold - ovarypower);
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
}
}
}
}
public void RecoverOvary(float multiply = 0.2f)
{
ovarypower = Math.Max(0, (int)(ovarypower * multiply));
if (ovarypower >= ovarypowerthreshold)
{
RemoveClimactericEffect();
}
}
protected void AfterSimulator()
{
if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold)
@ -969,7 +1010,7 @@ namespace RJW_Menstruation
protected void BleedOut()
{
//FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, ThingDefOf.Filth_Blood,parent.pawn.Label);
CumIn(parent.pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, ThingDefOf.Filth_Blood);
CumIn(parent.pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, parent.pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood);
GetNotCum(Translations.Menstrual_Blood).color = BloodColor;
}
@ -1116,6 +1157,7 @@ namespace RJW_Menstruation
hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
hediff.Severity = 0.2f;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
ovarypower = 0;
GoNextStage(Stage.Young);
}
else if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold)
@ -1215,7 +1257,14 @@ namespace RJW_Menstruation
protected virtual void YoungAction()
{
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) StayCurrentStageConst(Stage.Young);
if (!Configurations.EnableMenopause && ovarypower < 0 && ovarypower > -10000)
{
RemoveClimactericEffect();
}
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0)
{
StayCurrentStageConst(Stage.Young);
}
else GoNextStage(Stage.Follicular);
}
@ -1277,10 +1326,6 @@ namespace RJW_Menstruation
}
}
protected virtual void ThoughtCummer()
{
}
private Action PeriodSimulator(Stage targetstage)

View File

@ -5,18 +5,161 @@ using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using rjw;
using UnityEngine;
namespace RJW_Menstruation
{
public static class MenstruationUtility
{
public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn)
{
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
HediffComp_Menstruation result;
if (hedifflist.NullOrEmpty()) return null;
else
{
foreach (Hediff h in hedifflist)
{
result = h.TryGetComp<HediffComp_Menstruation>();
if (result != null) return result;
}
}
return null;
}
public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff)
{
if (hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical)
{
return hediff.TryGetComp<HediffComp_Menstruation>();
}
return null;
}
public static float GetFertilityChance(this HediffComp_Menstruation comp)
{
return comp.TotalFertCum * Configurations.FertilizeChance;
}
public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn)
{
return GetMenstruationComp(pawn)?.curStage ?? HediffComp_Menstruation.Stage.Bleeding;
}
public static Texture2D GetPregnancyIcon(this HediffComp_Menstruation comp, Hediff hediff)
{
string icon = "";
Texture2D result = null;
int babycount = 1;
if (hediff is Hediff_MechanoidPregnancy)
{
return ContentFinder<Texture2D>.Get(("Womb/Mechanoid_Fluid"), true);
}
else if (hediff is Hediff_BasePregnancy)
{
Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff;
babycount = h.babies.Count;
string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension<PawnDNAModExtension>()?.fetusTexPath ?? "Fetus/Fetus_Default";
if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted";
else if (h.GestationProgress < 0.3f)
{
if (h.babies?.First()?.def?.race?.FleshType == FleshTypeDefOf.Insectoid) icon += "Fetus/Insects/Insect_Early00";
else icon += "Fetus/Fetus_Early00";
}
else if (h.GestationProgress < 0.4f) icon += fetustex + "00";
else if (h.GestationProgress < 0.5f) icon += fetustex + "01";
else if (h.GestationProgress < 0.6f) icon += fetustex + "02";
else if (h.GestationProgress < 0.7f) icon += fetustex + "03";
else if (h.GestationProgress < 0.8f) icon += fetustex + "04";
else icon += fetustex + "05";
}
else icon = "Fetus/Slime_Abomi02";
result = TryGetTwinsIcon(icon, babycount);
if (result == null) result = ContentFinder<Texture2D>.Get((icon), true);
return result;
}
public static Texture2D TryGetTwinsIcon(string path, int babycount)
{
Texture2D result = null;
for (int i = babycount; i > 1; i--)
{
result = ContentFinder<Texture2D>.Get((path + "_Multiplet_" + i), false);
if (result != null) return result;
}
return null;
}
public static Texture2D GetCumIcon(this HediffComp_Menstruation comp)
{
string icon = comp.wombTex;
float cumpercent = comp.TotalCumPercent;
if (cumpercent < 0.001f) return ContentFinder<Texture2D>.Get("Womb/Empty", true);
else if (cumpercent < 0.01f) icon += "_Cum_00";
else if (cumpercent < 0.05f) icon += "_Cum_01";
else if (cumpercent < 0.11f) icon += "_Cum_02";
else if (cumpercent < 0.17f) icon += "_Cum_03";
else if (cumpercent < 0.23f) icon += "_Cum_04";
else if (cumpercent < 0.29f) icon += "_Cum_05";
else if (cumpercent < 0.35f) icon += "_Cum_06";
else if (cumpercent < 0.41f) icon += "_Cum_07";
else if (cumpercent < 0.47f) icon += "_Cum_08";
else if (cumpercent < 0.53f) icon += "_Cum_09";
else if (cumpercent < 0.59f) icon += "_Cum_10";
else if (cumpercent < 0.65f) icon += "_Cum_11";
else if (cumpercent < 0.71f) icon += "_Cum_12";
else if (cumpercent < 0.77f) icon += "_Cum_13";
else if (cumpercent < 0.83f) icon += "_Cum_14";
else if (cumpercent < 0.89f) icon += "_Cum_15";
else if (cumpercent < 0.95f) icon += "_Cum_16";
else icon += "_Cum_17";
Texture2D cumtex = ContentFinder<Texture2D>.Get((icon), true);
return cumtex;
}
public static Texture2D GetWombIcon(this HediffComp_Menstruation comp)
{
if (comp.Pawn.health.hediffSet.GetHediffs<Hediff_InsectEgg>().FirstOrDefault() != null) return ContentFinder<Texture2D>.Get(("Womb/Womb_Egged"), true);
string icon = comp.wombTex;
HediffComp_Menstruation.Stage stage = comp.curStage;
if (stage == HediffComp_Menstruation.Stage.Bleeding) icon += "_Bleeding";
Texture2D wombtex = ContentFinder<Texture2D>.Get((icon), true);
return wombtex;
}
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp)
{
if (comp.parent.pawn.IsPregnant())
{
if (comp.parent.pawn.GetPregnancyProgress() < 0.2f) return ContentFinder<Texture2D>.Get("Eggs/Egg_Implanted00", true);
else return ContentFinder<Texture2D>.Get("Womb/Empty", true);
}
else if (!comp.IsEggExist) return ContentFinder<Texture2D>.Get("Womb/Empty", true);
else
{
int fertstage = comp.IsFertilized;
if (fertstage >= 0)
{
if (fertstage < 1) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true);
else if (fertstage < 24) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
}
else if (comp.IsEggFertilizing) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg", true);
}
}
public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect)
{
Rect rect = new Rect(wombRect.xMax - wombRect.width / 3, wombRect.y, wombRect.width / 3, wombRect.width / 3);
GUI.color = Color.white;
GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit);
}
}
}

View File

@ -206,12 +206,12 @@ namespace RJW_Menstruation
{
if (xxx.is_human(father))
{
melanin = (mother.story.melanin + father.story.melanin) / 2;
melanin = (mother.story?.melanin ?? 0f + father.story?.melanin ?? 0f) / 2;
lastname = NameTriple.FromString(father.Name.ToStringFull).Last;
}
else
{
melanin = mother.story.melanin;
melanin = mother.story?.melanin ?? 0f;
lastname = NameTriple.FromString(mother.Name.ToStringFull).Last;
}
@ -220,7 +220,7 @@ namespace RJW_Menstruation
{
if (xxx.is_human(father))
{
melanin = father.story.melanin;
melanin = father.story?.melanin ?? 0f;
lastname = NameTriple.FromString(father.Name.ToStringFull).Last;
}
else
@ -410,10 +410,10 @@ namespace RJW_Menstruation
string MotherRaceName = "";
string FatherRaceName = "";
MotherRaceName = mother.kindDef.race.defName;
MotherRaceName = mother.kindDef?.race?.defName;
PawnKindDef tmp = spawn_kind_def;
if (father != null)
FatherRaceName = father.kindDef.race.defName;
FatherRaceName = father.kindDef?.race?.defName;
if (FatherRaceName != "" && Configurations.UseHybridExtention)
@ -458,7 +458,7 @@ namespace RJW_Menstruation
}
else if (!Configurations.UseHybridExtention || spawn_kind_def == null)
{
spawn_kind_def = mother.RaceProps.AnyPawnKind;
spawn_kind_def = mother.RaceProps?.AnyPawnKind ?? mother.kindDef;
}
if (spawn_kind_def.defName.Contains("Nymph"))
@ -476,7 +476,7 @@ namespace RJW_Menstruation
if (spawn_kind_def_list.NullOrEmpty())
spawn_kind_def = PawnKindDefOf.Colonist;
spawn_kind_def = spawn_kind_def_list.RandomElement();
if (!spawn_kind_def_list.NullOrEmpty()) spawn_kind_def = spawn_kind_def_list.RandomElement();
}

View File

@ -17,7 +17,7 @@ namespace RJW_Menstruation
protected override IEnumerable<Toil> MakeNewToils()
{
HediffComp_Menstruation Comp = Utility.GetMenstruationComp(pawn);
HediffComp_Menstruation Comp = pawn.GetMenstruationComp();
this.FailOn(delegate
{
return !(Comp.TotalCumPercent > 0.001);

View File

@ -56,7 +56,7 @@ namespace RJW_Menstruation
Hediff hediff = PregnancyHelper.GetPregnancy(pawn);
if (Utility.ShowFetusImage((Hediff_BasePregnancy)hediff))
{
icon = Utility.GetPregnancyIcon(comp, hediff);
icon = comp.GetPregnancyIcon(hediff);
if (hediff is Hediff_BasePregnancy)
{
Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff;

View File

@ -35,7 +35,7 @@ namespace RJW_Menstruation
else return true;
if (female.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = Utility.GetMenstruationComp(female);
HediffComp_Menstruation comp = female.GetMenstruationComp();
if (comp != null)
{
if (Genital_Helper.has_penis_fertile(male, maleparts) && PregnancyHelper.CanImpregnate(male, female, sextype))
@ -47,10 +47,9 @@ namespace RJW_Menstruation
{
comp.CumIn(male, Rand.Range(0.5f,3.0f) * RJWSettings.cum_on_body_amount_adjust * male.BodySize, 1.0f);
}
else comp.CumIn(male, male.GetCumVolume(), 0);
else comp.CumIn(male, male.GetCumVolume(maleparts), 0);
}
//if (Genital_Helper.has_vagina(partner, partnerparts))
//{
// if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;

View File

@ -99,6 +99,8 @@ namespace RJW_Menstruation
public static readonly string Option29_Label = "Option29_Label".Translate();
public static readonly string Option29_Desc = "Option29_Desc".Translate();
public static readonly string EstimatedCumLifespan = "EstimatedCumLifespan".Translate();
public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate();
public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".Translate();

View File

@ -44,7 +44,7 @@ namespace RJW_Menstruation
get
{
float width = 450f + 2 * windowMargin;
float height = 820f;
float height = 780f + 2 * windowMargin;
if (!Configurations.DrawWombStatus) height -= wombRectHeight;
if (!Configurations.DrawVaginaStatus || pawn.IsAnimal()) width -= 150f;
return new Vector2(width, height);
@ -132,7 +132,7 @@ namespace RJW_Menstruation
Hediff hediff = PregnancyHelper.GetPregnancy(pawn);
if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff))
{
womb = Utility.GetPregnancyIcon(comp, hediff);
womb = comp.GetPregnancyIcon(hediff);
if (hediff is Hediff_MultiplePregnancy)
{
Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff;
@ -297,6 +297,7 @@ namespace RJW_Menstruation
//Widgets.DrawTextureFitted(wombRect, cum,1.0f);
GUI.DrawTexture(rect, womb, ScaleMode.ScaleToFit, true, 0, Color.white, 0, 0);
GUI.DrawTexture(rect, cum, ScaleMode.ScaleToFit, true, 0, cumcolor, 0, 0);
GUI.color = Color.white;
@ -378,12 +379,11 @@ namespace RJW_Menstruation
statvalue = pawn.records.GetValue(xxx.CountOfWhore);
if (statvalue > 0)
{
FillableBarLabeled(lineRect, " " + xxx.CountOfWhore.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 500, TextureCache.slaaneshTexture, Texture2D.blackTexture);
FillableBarLabeled(lineRect, " " + xxx.CountOfWhore.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 50, TextureCache.slaaneshTexture, Texture2D.blackTexture);
statvalue = pawn.records.GetValue(xxx.EarnedMoneyByWhore);
lineRect.y += height;
FillableBarLabeled(lineRect, " " + VariousDefOf.RJW_EarnedMoneyByWhore.label.CapitalizeFirst() + " " + statvalue, statvalue / 10000, TextureCache.ghalmarazTexture, Texture2D.blackTexture);
lineRect.y += height;
}
else

View File

@ -56,15 +56,30 @@ namespace RJW_Menstruation
public static float GetCumVolume(this Pawn pawn)
{
CompHediffBodyPart part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
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)
{
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 pawn.GetCumVolume(part);
}
public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part)
{
float res;
float res = 0;
try
{
res = part.FluidAmmount * part.FluidModifier * pawn.BodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f;
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)
{
@ -76,30 +91,6 @@ namespace RJW_Menstruation
}
public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn)
{
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
HediffComp_Menstruation result;
if (hedifflist.NullOrEmpty()) return null;
else
{
foreach (Hediff h in hedifflist)
{
result = h.TryGetComp<HediffComp_Menstruation>();
if (result != null) return result;
}
}
return null;
}
public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff)
{
if (hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical)
{
return hediff.TryGetComp<HediffComp_Menstruation>();
}
return null;
}
public static HediffComp_Breast GetBreastComp(this Pawn pawn)
{
@ -158,12 +149,6 @@ namespace RJW_Menstruation
}
public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn)
{
return GetMenstruationComp(pawn)?.curStage ?? HediffComp_Menstruation.Stage.Bleeding;
}
public static float GetPregnancyProgress(this Pawn pawn)
{
Hediff hediff = PregnancyHelper.GetPregnancy(pawn);
@ -194,93 +179,6 @@ namespace RJW_Menstruation
return null;
}
public static Texture2D GetPregnancyIcon(HediffComp_Menstruation comp, Hediff hediff)
{
string icon = "";
Texture2D result = null;
int babycount = 1;
if (hediff is Hediff_MechanoidPregnancy)
{
return ContentFinder<Texture2D>.Get(("Womb/Mechanoid_Fluid"), true);
}
else if (hediff is Hediff_BasePregnancy)
{
Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff;
babycount = h.babies.Count;
string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension<PawnDNAModExtension>()?.fetusTexPath ?? "Fetus/Fetus_Default";
if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted";
else if (h.GestationProgress < 0.3f)
{
if (h.babies?.First()?.def?.race?.FleshType == FleshTypeDefOf.Insectoid) icon += "Fetus/Insects/Insect_Early00";
else icon += "Fetus/Fetus_Early00";
}
else if (h.GestationProgress < 0.4f) icon += fetustex + "00";
else if (h.GestationProgress < 0.5f) icon += fetustex + "01";
else if (h.GestationProgress < 0.6f) icon += fetustex + "02";
else if (h.GestationProgress < 0.7f) icon += fetustex + "03";
else if (h.GestationProgress < 0.8f) icon += fetustex + "04";
else icon += fetustex + "05";
}
else icon = "Fetus/Slime_Abomi02";
result = TryGetTwinsIcon(icon, babycount);
if (result == null) result = ContentFinder<Texture2D>.Get((icon), true);
return result;
}
public static Texture2D TryGetTwinsIcon(string path, int babycount)
{
Texture2D result = null;
for (int i = babycount; i>1; i--)
{
result = ContentFinder<Texture2D>.Get((path + "_Multiplet_" + i), false);
if (result != null) return result;
}
return null;
}
public static Texture2D GetCumIcon(this HediffComp_Menstruation comp)
{
string icon = comp.wombTex;
float cumpercent = comp.TotalCumPercent;
if (cumpercent < 0.001f) return ContentFinder<Texture2D>.Get("Womb/Empty", true);
else if (cumpercent < 0.01f) icon += "_Cum_00";
else if (cumpercent < 0.05f) icon += "_Cum_01";
else if (cumpercent < 0.11f) icon += "_Cum_02";
else if (cumpercent < 0.17f) icon += "_Cum_03";
else if (cumpercent < 0.23f) icon += "_Cum_04";
else if (cumpercent < 0.29f) icon += "_Cum_05";
else if (cumpercent < 0.35f) icon += "_Cum_06";
else if (cumpercent < 0.41f) icon += "_Cum_07";
else if (cumpercent < 0.47f) icon += "_Cum_08";
else if (cumpercent < 0.53f) icon += "_Cum_09";
else if (cumpercent < 0.59f) icon += "_Cum_10";
else if (cumpercent < 0.65f) icon += "_Cum_11";
else if (cumpercent < 0.71f) icon += "_Cum_12";
else if (cumpercent < 0.77f) icon += "_Cum_13";
else if (cumpercent < 0.83f) icon += "_Cum_14";
else if (cumpercent < 0.89f) icon += "_Cum_15";
else if (cumpercent < 0.95f) icon += "_Cum_16";
else icon += "_Cum_17";
Texture2D cumtex = ContentFinder<Texture2D>.Get((icon), true);
return cumtex;
}
public static Texture2D GetWombIcon(this HediffComp_Menstruation comp)
{
if (comp.Pawn.health.hediffSet.GetHediffs<Hediff_InsectEgg>().FirstOrDefault() != null) return ContentFinder<Texture2D>.Get(("Womb/Womb_Egged"), true);
string icon = comp.wombTex;
HediffComp_Menstruation.Stage stage = comp.curStage;
if (stage == HediffComp_Menstruation.Stage.Bleeding) icon += "_Bleeding";
Texture2D wombtex = ContentFinder<Texture2D>.Get((icon), true);
return wombtex;
}
public static Texture2D GetGenitalIcon(this Pawn pawn)
{
var hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.Find((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
@ -543,35 +441,6 @@ namespace RJW_Menstruation
}
}
public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect)
{
Rect rect = new Rect(wombRect.xMax - wombRect.width / 3, wombRect.y, wombRect.width / 3, wombRect.width / 3);
GUI.color = Color.white;
GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit);
}
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp)
{
if (comp.parent.pawn.IsPregnant())
{
if (comp.parent.pawn.GetPregnancyProgress() < 0.2f) return ContentFinder<Texture2D>.Get("Eggs/Egg_Implanted00", true);
else return ContentFinder<Texture2D>.Get("Womb/Empty", true);
}
else if (!comp.IsEggExist) return ContentFinder<Texture2D>.Get("Womb/Empty", true);
else
{
int fertstage = comp.IsFertilized;
if (fertstage >= 0)
{
if (fertstage < 1) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true);
else if (fertstage < 24) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
}
else if (comp.IsEggFertilizing) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg", true);
}
}
public static float RandGaussianLike(float min, float max, int iterations = 3)
{
double res = 0;