This commit is contained in:
moreoreganostodump 2021-03-06 22:32:33 +09:00
parent 8d75d7aac1
commit a4e1be39f2
38 changed files with 1266 additions and 1171 deletions

View File

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

Binary file not shown.

View File

@ -60,7 +60,7 @@
</tags> </tags>
</apparel> </apparel>
<modExtensions> <modExtensions>
<li Class="RJW_Menstruation.AbsorberModExtention"> <li Class="RJW_Menstruation.AbsorberModExtension">
<leakAfterDirty>false</leakAfterDirty> <leakAfterDirty>false</leakAfterDirty>
<effectsAfterDirty>true</effectsAfterDirty> <effectsAfterDirty>true</effectsAfterDirty>
<minHourstoDirtyEffect>8</minHourstoDirtyEffect> <minHourstoDirtyEffect>8</minHourstoDirtyEffect>
@ -113,7 +113,7 @@
</tags> </tags>
</apparel> </apparel>
<modExtensions> <modExtensions>
<li Class="RJW_Menstruation.AbsorberModExtention"> <li Class="RJW_Menstruation.AbsorberModExtension">
<leakAfterDirty>false</leakAfterDirty> <leakAfterDirty>false</leakAfterDirty>
<effectsAfterDirty>true</effectsAfterDirty> <effectsAfterDirty>true</effectsAfterDirty>
<minHourstoDirtyEffect>8</minHourstoDirtyEffect> <minHourstoDirtyEffect>8</minHourstoDirtyEffect>
@ -181,7 +181,7 @@
</tags> </tags>
</apparel> </apparel>
<modExtensions> <modExtensions>
<li Class="RJW_Menstruation.AbsorberModExtention"> <li Class="RJW_Menstruation.AbsorberModExtension">
<leakAfterDirty>true</leakAfterDirty> <leakAfterDirty>true</leakAfterDirty>
<effectsAfterDirty>false</effectsAfterDirty> <effectsAfterDirty>false</effectsAfterDirty>
<dirtyDef>Absorber_Pad_Dirty</dirtyDef> <dirtyDef>Absorber_Pad_Dirty</dirtyDef>
@ -233,7 +233,7 @@
</tags> </tags>
</apparel> </apparel>
<modExtensions> <modExtensions>
<li Class="RJW_Menstruation.AbsorberModExtention"> <li Class="RJW_Menstruation.AbsorberModExtension">
<leakAfterDirty>true</leakAfterDirty> <leakAfterDirty>true</leakAfterDirty>
<effectsAfterDirty>false</effectsAfterDirty> <effectsAfterDirty>false</effectsAfterDirty>
<dirtyDef>Absorber_Pad_Dirty</dirtyDef> <dirtyDef>Absorber_Pad_Dirty</dirtyDef>

View File

@ -74,6 +74,11 @@
<Option20_Label_5>Hostile Faction</Option20_Label_5> <Option20_Label_5>Hostile Faction</Option20_Label_5>
<Option21_Label>target pawns</Option21_Label> <Option21_Label>target pawns</Option21_Label>
<Option21_Desc>the gizmo and button will appear for these pawns</Option21_Desc> <Option21_Desc>the gizmo and button will appear for these pawns</Option21_Desc>
<Option22_Label>use hybrid extension</Option22_Label>
<Option22_Desc>overrides RJW and RaceSupport's hybrid definition&#10;Dominant hybrid extension determines whose definition used first. Not recommended to change this</Option22_Desc>
<Option23_Label>Dominant hybrid extension</Option23_Label>
<Option23_Label_1>Mother</Option23_Label_1>
<Option23_Label_2>Father</Option23_Label_2>
<FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf> <FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf>

View File

@ -74,6 +74,11 @@
<Option20_Label_5>적대관계</Option20_Label_5> <Option20_Label_5>적대관계</Option20_Label_5>
<Option21_Label>표시 대상</Option21_Label> <Option21_Label>표시 대상</Option21_Label>
<Option21_Desc>아이콘과 버튼을 표시할 대상입니다.</Option21_Desc> <Option21_Desc>아이콘과 버튼을 표시할 대상입니다.</Option21_Desc>
<Option22_Label>잡종 정의 대체</Option22_Label>
<Option22_Desc>RJW와 RaceSupport의 잡종정의를 대체합니다.&#10;우선순위는 누구의 잡종 정의를 우선으로 사용할지 정합니다. 변경하지 않는것을 추천합니다.</Option22_Desc>
<Option23_Label>우선순위</Option23_Label>
<Option23_Label_1></Option23_Label_1>
<Option23_Label_2></Option23_Label_2>
<FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf> <FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf>

View File

@ -4,10 +4,22 @@
<Operation Class="PatchOperationAddModExtension"> <Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[defName="Race's defName"]</xpath> <xpath>Defs/ThingDef[defName="Race's defName"]</xpath>
<value> <value>
<li Class="RJW_Menstruation.PawnDNAModExtention"> <li Class="RJW_Menstruation.PawnDNAModExtension">
<fetusTexPath>Fetus/Fetus_Default</fetusTexPath> <fetusTexPath>Fetus/Fetus_Default</fetusTexPath>
<cumColor>(255,255,255,255)</cumColor> <cumColor>(255,255,255,255)</cumColor>
<cumThickness>0.2</cumThickness> <cumThickness>0.2</cumThickness>
<hybridExtension>
<Other Race's defName>
<Race or PawnKind defName>1.0</Race or PawnKind defName>
<Race or PawnKind defName>5.0</Race or PawnKind defName>
<Race or PawnKind defName>7.0</Race or PawnKind defName>
<Race or PawnKind defName>2.0</Race or PawnKind defName>
</Other Race's defName>
<Other Race's defName>
<Race or PawnKind defName>98.0</Race or PawnKind defName>
<Race or PawnKind defName>2.0</Race or PawnKind defName>
</Other Race's defName>
</hybridExtension>
</li> </li>
</value> </value>
</Operation> </Operation>
@ -17,16 +29,52 @@
<Operation Class="PatchOperationAddModExtension"> <Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[defName="Human"]</xpath> <xpath>Defs/ThingDef[defName="Human"]</xpath>
<value> <value>
<li Class="RJW_Menstruation.PawnDNAModExtention"> <li Class="RJW_Menstruation.PawnDNAModExtension">
<fetusTexPath>Fetus/Fetus_Default</fetusTexPath> <fetusTexPath>Fetus/Fetus_Default</fetusTexPath>
<cumColor>(255,255,255,255)</cumColor> <cumColor>(255,255,255,255)</cumColor>
<cumThickness>0.2</cumThickness> <cumThickness>0.2</cumThickness>
<hybridExtension>
<Horse>
<Alien_Eponalike>1.0</Alien_Eponalike>
</Horse>
</hybridExtension>
</li> </li>
</value> </value>
</Operation> </Operation>
<Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[defName="Horse"]</xpath>
<value>
<li Class="RJW_Menstruation.PawnDNAModExtension">
<fetusTexPath>Fetus/Fetus_Default</fetusTexPath>
<cumColor>(255,255,255,255)</cumColor>
<cumThickness>0.2</cumThickness>
<hybridExtension>
<Donkey>
<Mule>1.0</Mule>
</Donkey>
</hybridExtension>
</li>
</value>
</Operation>
<Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[defName="Donkey"]</xpath>
<value>
<li Class="RJW_Menstruation.PawnDNAModExtension">
<fetusTexPath>Fetus/Fetus_Default</fetusTexPath>
<cumColor>(255,255,255,255)</cumColor>
<cumThickness>0.2</cumThickness>
<hybridExtension>
<Horse>
<Hinny>1.0</Hinny>
</Horse>
</hybridExtension>
</li>
</value>
</Operation>

Binary file not shown.

Binary file not shown.

BIN
Textures/Fetus/Fetus.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Textures/Womb/Womb.zip Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,8 @@
Version 1.0.1.12
- added HybridExtension attribute to PawnDNAModExtension
- this will overrides RJW's hybrid definitions
- supports more detailed hybrid definition
- fixed bugs when menopause option off
Version 1.0.1.11 Version 1.0.1.11
- added a button for opening status window in health tab - added a button for opening status window in health tab
- added option for this - added option for this

View File

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
@ -27,7 +23,7 @@ namespace RJW_Menstruation
public static float ImplantationChance = ImplantationChanceDefault; public static float ImplantationChance = ImplantationChanceDefault;
public static int ImplantationChanceAdjust = ImplantationChanceAdjustDefault; public static int ImplantationChanceAdjust = ImplantationChanceAdjustDefault;
public static float FertilizeChance = FertilizeChanceDefault; public static float FertilizeChance = FertilizeChanceDefault;
public static int FertilizeChanceAdjust = FertilizeChanceAdjustDefault; public static int FertilizeChanceAdjust = FertilizeChanceAdjustDefault;
public static float CumDecayRatio = CumDecayRatioDefault; public static float CumDecayRatio = CumDecayRatioDefault;
public static int CumDecayRatioAdjust = CumDecayRatioAdjustDefault; public static int CumDecayRatioAdjust = CumDecayRatioAdjustDefault;
@ -51,6 +47,9 @@ namespace RJW_Menstruation
public static int BleedingAmount = BleedingAmountDefault; public static int BleedingAmount = BleedingAmountDefault;
public static bool EnableButtonInHT = false; public static bool EnableButtonInHT = false;
public static PawnFlags ShowFlag = PawnFlags.Colonist | PawnFlags.Prisoner; public static PawnFlags ShowFlag = PawnFlags.Colonist | PawnFlags.Prisoner;
public static bool UseHybridExtention = true;
public static bool MotherFirst = false;
public static bool HARActivated = false; public static bool HARActivated = false;
public static bool LLActivated = false; public static bool LLActivated = false;
@ -81,8 +80,14 @@ namespace RJW_Menstruation
} }
public static string HybridString(bool b)
{
if (b) return Translations.Option23_Label_1;
else return Translations.Option23_Label_2;
}
[Flags]public enum PawnFlags [Flags]
public enum PawnFlags
{ {
None = 0, None = 0,
Colonist = 1, Colonist = 1,
@ -120,6 +125,8 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref BleedingAmount, "BleedingAmount", BleedingAmount, true); Scribe_Values.Look(ref BleedingAmount, "BleedingAmount", BleedingAmount, true);
Scribe_Values.Look(ref EnableButtonInHT, "EnableButtonInHT", EnableButtonInHT, true); Scribe_Values.Look(ref EnableButtonInHT, "EnableButtonInHT", EnableButtonInHT, true);
Scribe_Values.Look(ref ShowFlag, "ShowFlag", ShowFlag, true); Scribe_Values.Look(ref ShowFlag, "ShowFlag", ShowFlag, true);
Scribe_Values.Look(ref UseHybridExtention, "UseHybridExtention", UseHybridExtention, true);
Scribe_Values.Look(ref MotherFirst, "MotherFirst", MotherFirst, true);
base.ExposeData(); base.ExposeData();
} }
@ -161,7 +168,7 @@ namespace RJW_Menstruation
Configurations.LLActivated = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs"); Configurations.LLActivated = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs");
} }
public override string SettingsCategory() public override string SettingsCategory()
{ {
@ -178,8 +185,8 @@ namespace RJW_Menstruation
listmain.Begin(mainRect); listmain.Begin(mainRect);
listmain.Gap(20f); listmain.Gap(20f);
Rect optionrect1 = listmain.GetRect(30f); Rect optionrect1 = listmain.GetRect(30f);
Widgets.CheckboxLabeled(optionrect1.LeftHalf(), Translations.Option1_Label_1, ref Configurations.EnableWombIcon); Widgets.CheckboxLabeled(optionrect1.LeftHalf(), Translations.Option1_Label_1, ref Configurations.EnableWombIcon,false,null,null,true);
Widgets.CheckboxLabeled(optionrect1.RightHalf(), Translations.Option1_Label_2, ref Configurations.EnableButtonInHT); Widgets.CheckboxLabeled(optionrect1.RightHalf(), Translations.Option1_Label_2, ref Configurations.EnableButtonInHT, false, null, null, true);
//listmain.CheckboxLabeled(Translations.Option1_Label, ref Configurations.EnableWombIcon, Translations.Option1_Desc); //listmain.CheckboxLabeled(Translations.Option1_Label, ref Configurations.EnableWombIcon, Translations.Option1_Desc);
if (Configurations.EnableWombIcon || Configurations.EnableButtonInHT) if (Configurations.EnableWombIcon || Configurations.EnableButtonInHT)
{ {
@ -210,7 +217,7 @@ namespace RJW_Menstruation
wombsection.Label(Translations.Option11_Desc_4); wombsection.Label(Translations.Option11_Desc_4);
break; break;
} }
wombsection.Label(Translations.Option21_Label + " " + Configurations.ShowFlag,-1, Translations.Option21_Desc); wombsection.Label(Translations.Option21_Label + " " + Configurations.ShowFlag, -1, Translations.Option21_Desc);
Rect flagrect = wombsection.GetRect(30f); Rect flagrect = wombsection.GetRect(30f);
Rect[] flagrects = new Rect[5]; Rect[] flagrects = new Rect[5];
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
@ -242,47 +249,54 @@ namespace RJW_Menstruation
listmain.EndSection(wombsection); listmain.EndSection(wombsection);
} }
listmain.CheckboxLabeled(Translations.Option2_Label, ref Configurations.EnableAnimalCycle, Translations.Option2_Desc); listmain.CheckboxLabeled(Translations.Option2_Label, ref Configurations.EnableAnimalCycle, Translations.Option2_Desc);
listmain.CheckboxLabeled(Translations.Option12_Label, ref Configurations.EnableMenopause, Translations.Option12_Desc); listmain.CheckboxLabeled(Translations.Option12_Label, ref Configurations.EnableMenopause, Translations.Option12_Desc);
listmain.Label(Translations.Option3_Label + " " + Configurations.ImplantationChance*100 + "%", -1, Translations.Option3_Desc); listmain.Label(Translations.Option3_Label + " " + Configurations.ImplantationChance * 100 + "%", -1, Translations.Option3_Desc);
Configurations.ImplantationChanceAdjust = (int)listmain.Slider(Configurations.ImplantationChanceAdjust, 0, 1000); Configurations.ImplantationChanceAdjust = (int)listmain.Slider(Configurations.ImplantationChanceAdjust, 0, 1000);
Configurations.ImplantationChance = (float)Configurations.ImplantationChanceAdjust/100; Configurations.ImplantationChance = (float)Configurations.ImplantationChanceAdjust / 100;
listmain.Label(Translations.Option4_Label + " " + Configurations.FertilizeChance*100 + "%", -1, Translations.Option4_Desc); listmain.Label(Translations.Option4_Label + " " + Configurations.FertilizeChance * 100 + "%", -1, Translations.Option4_Desc);
Configurations.FertilizeChanceAdjust = (int)listmain.Slider(Configurations.FertilizeChanceAdjust, 0, 1000); Configurations.FertilizeChanceAdjust = (int)listmain.Slider(Configurations.FertilizeChanceAdjust, 0, 1000);
Configurations.FertilizeChance = (float)Configurations.FertilizeChanceAdjust/1000; Configurations.FertilizeChance = (float)Configurations.FertilizeChanceAdjust / 1000;
listmain.Label(Translations.Option5_Label + " " + Configurations.CumDecayRatio*100 + "%", -1, Translations.Option5_Desc); listmain.Label(Translations.Option5_Label + " " + Configurations.CumDecayRatio * 100 + "%", -1, Translations.Option5_Desc);
Configurations.CumDecayRatioAdjust = (int)listmain.Slider(Configurations.CumDecayRatioAdjust, 0, 1000); Configurations.CumDecayRatioAdjust = (int)listmain.Slider(Configurations.CumDecayRatioAdjust, 0, 1000);
Configurations.CumDecayRatio = (float)Configurations.CumDecayRatioAdjust/1000; Configurations.CumDecayRatio = (float)Configurations.CumDecayRatioAdjust / 1000;
listmain.Label(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio*100 + "%", -1, Translations.Option6_Desc); listmain.Label(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", -1, Translations.Option6_Desc);
Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000); Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000);
Configurations.CumFertilityDecayRatio = (float)Configurations.CumFertilityDecayRatioAdjust/1000; Configurations.CumFertilityDecayRatio = (float)Configurations.CumFertilityDecayRatioAdjust / 1000;
listmain.Label(Translations.Option7_Label + " x" + Configurations.CycleAcceleration, -1, Translations.Option7_Desc); listmain.Label(Translations.Option7_Label + " x" + Configurations.CycleAcceleration, -1, Translations.Option7_Desc);
Configurations.CycleAcceleration = (int)listmain.Slider(Configurations.CycleAcceleration,1,50); Configurations.CycleAcceleration = (int)listmain.Slider(Configurations.CycleAcceleration, 1, 50);
float var2 = EstimatedBleedingAmountPerHour; float var2 = EstimatedBleedingAmountPerHour;
float var1 = Math.Max(EstimatedBleedingAmount,var2); float var1 = Math.Max(EstimatedBleedingAmount, var2);
listmain.LabelDouble(Translations.Option19_Label_1, Translations.Option19_Label_2 + ": " + var1 + "ml, " + var2 + "ml/h", Translations.Option19_Desc); listmain.LabelDouble(Translations.Option19_Label_1, Translations.Option19_Label_2 + ": " + var1 + "ml, " + var2 + "ml/h", Translations.Option19_Desc);
Configurations.BleedingAmount = (int)listmain.Slider(Configurations.BleedingAmount, 0, 200); Configurations.BleedingAmount = (int)listmain.Slider(Configurations.BleedingAmount, 0, 200);
listmain.CheckboxLabeled(Translations.Option13_Label, ref Configurations.UseMultiplePregnancy, Translations.Option13_Desc); listmain.CheckboxLabeled(Translations.Option13_Label, ref Configurations.UseMultiplePregnancy, Translations.Option13_Desc);
if (Configurations.UseMultiplePregnancy) if (Configurations.UseMultiplePregnancy)
{ {
float sectionheight = 50f; float sectionheight = 75f;
if (Configurations.EnableEnzygoticTwins) sectionheight += 100; if (Configurations.EnableEnzygoticTwins) sectionheight += 100;
Listing_Standard twinsection = listmain.BeginSection_NewTemp(sectionheight); Listing_Standard twinsection = listmain.BeginSection_NewTemp(sectionheight);
Rect hybridrect = twinsection.GetRect(25);
Widgets.CheckboxLabeled(hybridrect.LeftHalf(), Translations.Option22_Label, ref Configurations.UseHybridExtention, false, null, null, true);
if (Widgets.ButtonText(hybridrect.RightHalf(), Translations.Option23_Label + ": " + Configurations.HybridString(Configurations.MotherFirst)))
{
Configurations.MotherFirst = !Configurations.MotherFirst;
}
twinsection.CheckboxLabeled(Translations.Option14_Label, ref Configurations.EnableHeteroOvularTwins, Translations.Option14_Desc); twinsection.CheckboxLabeled(Translations.Option14_Label, ref Configurations.EnableHeteroOvularTwins, Translations.Option14_Desc);
twinsection.CheckboxLabeled(Translations.Option15_Label, ref Configurations.EnableEnzygoticTwins, Translations.Option15_Desc); twinsection.CheckboxLabeled(Translations.Option15_Label, ref Configurations.EnableEnzygoticTwins, Translations.Option15_Desc);
if (Configurations.EnableEnzygoticTwins) if (Configurations.EnableEnzygoticTwins)
{ {
twinsection.Label(Translations.Option16_Label + " " + Configurations.EnzygoticTwinsChance*100 + "%", -1, Translations.Option16_Desc); twinsection.Label(Translations.Option16_Label + " " + Configurations.EnzygoticTwinsChance * 100 + "%", -1, Translations.Option16_Desc);
Configurations.EnzygoticTwinsChanceAdjust = (int)twinsection.Slider(Configurations.EnzygoticTwinsChanceAdjust, 0, 1000); Configurations.EnzygoticTwinsChanceAdjust = (int)twinsection.Slider(Configurations.EnzygoticTwinsChanceAdjust, 0, 1000);
Configurations.EnzygoticTwinsChance = (float)Configurations.EnzygoticTwinsChanceAdjust / 1000; Configurations.EnzygoticTwinsChance = (float)Configurations.EnzygoticTwinsChanceAdjust / 1000;

View File

@ -1,13 +1,7 @@
using System; using RimWorld;
using System.Collections; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using UnityEngine; using UnityEngine;
using rjw; using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
@ -36,7 +30,7 @@ namespace RJW_Menstruation
} }
private Color customColor; private Color customColor;
public PawnDNAModExtention DNA public PawnDNAModExtension DNA
{ {
get get
{ {
@ -44,22 +38,22 @@ namespace RJW_Menstruation
{ {
try try
{ {
DNAcache = pawn.def.GetModExtension<PawnDNAModExtention>(); DNAcache = pawn.def.GetModExtension<PawnDNAModExtension>();
} }
catch (NullReferenceException) catch (NullReferenceException)
{ {
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtention>(); DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
} }
if (DNAcache == null) if (DNAcache == null)
{ {
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtention>(); DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
} }
return DNAcache; return DNAcache;
} }
else return DNAcache; else return DNAcache;
} }
} }
private PawnDNAModExtention DNAcache = null; private PawnDNAModExtension DNAcache = null;
public ThingDef FilthDef public ThingDef FilthDef
{ {
get get
@ -89,7 +83,7 @@ namespace RJW_Menstruation
} }
public Cum() {} public Cum() { }
public Cum(Pawn pawn) public Cum(Pawn pawn)
{ {

View File

@ -1,316 +1,312 @@
using System; using RimWorld;
using System.Collections.Generic; using rjw;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
using Verse.Sound; using Verse.Sound;
using RimWorld;
using rjw;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public class Dialog_WombStatus : Window public class Dialog_WombStatus : Window
{ {
public Pawn pawn; public Pawn pawn;
private HediffComp_Menstruation comp; private HediffComp_Menstruation comp;
private const float windowMargin = 20f; private const float windowMargin = 20f;
private const float pawnRectWidth = 150f; private const float pawnRectWidth = 150f;
private const float pawnRectHeight = 150f; private const float pawnRectHeight = 150f;
private const float wombRectHeight = 300f; private const float wombRectHeight = 300f;
private const float wombRectWidth = 300f; private const float wombRectWidth = 300f;
private const float fontheight = 30; private const float fontheight = 30;
private const float genitalRectWidth = 102; private const float genitalRectWidth = 102;
private const float genitalRectHeight = 140; private const float genitalRectHeight = 140;
private Texture2D womb; private Texture2D womb;
private Texture2D cum; private Texture2D cum;
private Texture2D vagina; private Texture2D vagina;
private Texture2D anal; private Texture2D anal;
private Color cumcolor; private Color cumcolor;
private GUIStyle fontstylecenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter }; private GUIStyle fontstylecenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter };
private GUIStyle fontstyleright = new GUIStyle() { alignment = TextAnchor.MiddleRight }; private GUIStyle fontstyleright = new GUIStyle() { alignment = TextAnchor.MiddleRight };
private GUIStyle fontstyleleft = new GUIStyle() { alignment = TextAnchor.MiddleLeft }; private GUIStyle fontstyleleft = new GUIStyle() { alignment = TextAnchor.MiddleLeft };
private GUIStyle boxstyle = new GUIStyle(GUI.skin.textArea); private GUIStyle boxstyle = new GUIStyle(GUI.skin.textArea);
private GUIStyle buttonstyle = new GUIStyle(GUI.skin.button); private GUIStyle buttonstyle = new GUIStyle(GUI.skin.button);
public override Vector2 InitialSize public override Vector2 InitialSize
{ {
get get
{ {
float width = 300f + 2 * windowMargin; float width = 300f + 2 * windowMargin;
float height = 820f; float height = 820f;
if (!Configurations.DrawWombStatus) height -= wombRectHeight; if (!Configurations.DrawWombStatus) height -= wombRectHeight;
if (!Configurations.DrawVaginaStatus) height -= genitalRectHeight; if (!Configurations.DrawVaginaStatus) height -= genitalRectHeight;
return new Vector2(width,height); return new Vector2(width, height);
} }
} }
public Dialog_WombStatus(Pawn pawn, HediffComp_Menstruation comp) public Dialog_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
{ {
this.pawn = pawn; this.pawn = pawn;
this.comp = comp; this.comp = comp;
} }
public void ChangePawn(Pawn pawn, HediffComp_Menstruation comp) public void ChangePawn(Pawn pawn, HediffComp_Menstruation comp)
{ {
this.pawn = pawn; this.pawn = pawn;
this.comp = comp; this.comp = comp;
} }
public static void ToggleWindow(Pawn pawn, HediffComp_Menstruation comp) public static void ToggleWindow(Pawn pawn, HediffComp_Menstruation comp)
{ {
Dialog_WombStatus window = (Dialog_WombStatus)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType().Equals(typeof(Dialog_WombStatus))); Dialog_WombStatus window = (Dialog_WombStatus)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType().Equals(typeof(Dialog_WombStatus)));
if (window != null) if (window != null)
{ {
if (window.pawn != pawn) if (window.pawn != pawn)
{ {
SoundDefOf.TabOpen.PlayOneShotOnCamera(); SoundDefOf.TabOpen.PlayOneShotOnCamera();
window.ChangePawn(pawn, comp); window.ChangePawn(pawn, comp);
} }
else Find.WindowStack.TryRemove(typeof(Dialog_WombStatus), true); else Find.WindowStack.TryRemove(typeof(Dialog_WombStatus), true);
} }
else else
{ {
SoundDefOf.InfoCard_Open.PlayOneShotOnCamera(); SoundDefOf.InfoCard_Open.PlayOneShotOnCamera();
Find.WindowStack.Add(new Dialog_WombStatus(pawn, comp)); Find.WindowStack.Add(new Dialog_WombStatus(pawn, comp));
} }
} }
public override void DoWindowContents(Rect inRect) public override void DoWindowContents(Rect inRect)
{ {
bool flag = false; bool flag = false;
soundClose = SoundDefOf.InfoCard_Close; soundClose = SoundDefOf.InfoCard_Close;
//closeOnClickedOutside = true; //closeOnClickedOutside = true;
absorbInputAroundWindow = false; absorbInputAroundWindow = false;
forcePause = false; forcePause = false;
preventCameraMotion = false; preventCameraMotion = false;
draggable = true; draggable = true;
//resizeable = true; //resizeable = true;
if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape)) if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape))
{
flag = true;
Event.current.Use();
}
Rect windowRect = inRect.ContractedBy(windowMargin);
Rect mainRect = new Rect(windowRect.x, windowRect.y, windowRect.width, windowRect.height);
Rect closeRect = new Rect(windowRect.xMax, 0f, 20f, 20f);
MainContents(mainRect);
if (Widgets.CloseButtonFor(closeRect))
{ {
Close(); flag = true;
Event.current.Use();
} }
}
private void MainContents(Rect mainRect) Rect windowRect = inRect.ContractedBy(windowMargin);
{ Rect mainRect = new Rect(windowRect.x, windowRect.y, windowRect.width, windowRect.height);
Rect closeRect = new Rect(windowRect.xMax, 0f, 20f, 20f);
MainContents(mainRect);
if (Widgets.CloseButtonFor(closeRect))
{
Close();
}
}
boxstyle.hover = boxstyle.normal; private void MainContents(Rect mainRect)
boxstyle.onHover = boxstyle.normal; {
boxstyle.onNormal = boxstyle.normal;
buttonstyle.onHover = buttonstyle.onNormal; boxstyle.hover = boxstyle.normal;
buttonstyle.hover = buttonstyle.normal; boxstyle.onHover = boxstyle.normal;
boxstyle.border.left = 4; boxstyle.border.right = 4; boxstyle.border.bottom = 4; boxstyle.border.top = 4; boxstyle.onNormal = boxstyle.normal;
float preginfoheight = 0f; buttonstyle.onHover = buttonstyle.onNormal;
bool pregnant = pawn.IsPregnant(); buttonstyle.hover = buttonstyle.normal;
Hediff hediff = PregnancyHelper.GetPregnancy(pawn); boxstyle.border.left = 4; boxstyle.border.right = 4; boxstyle.border.bottom = 4; boxstyle.border.top = 4;
if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff))
{ float preginfoheight = 0f;
womb = Utility.GetPregnancyIcon(comp, hediff); bool pregnant = pawn.IsPregnant();
if (hediff is Hediff_MultiplePregnancy) Hediff hediff = PregnancyHelper.GetPregnancy(pawn);
{ if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff))
Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff; {
if (h.GestationProgress < 0.2f) cum = comp.GetCumIcon(); womb = Utility.GetPregnancyIcon(comp, hediff);
else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); if (hediff is Hediff_MultiplePregnancy)
Pawn fetus = pawn.GetFetus(); {
if (fetus != null && Utility.ShowFetusInfo()) Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff;
{ if (h.GestationProgress < 0.2f) cum = comp.GetCumIcon();
string feinfo = h.GetBabyInfo(); else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
string fainfo = h.GetFatherInfo() + " "; Pawn fetus = pawn.GetFetus();
if (feinfo.Length + fainfo.Length > 45) if (fetus != null && Utility.ShowFetusInfo())
{
string feinfo = h.GetBabyInfo();
string fainfo = h.GetFatherInfo() + " ";
if (feinfo.Length + fainfo.Length > 45)
{ {
preginfoheight = fontheight + 2; preginfoheight = fontheight + 2;
buttonstyle.alignment = TextAnchor.UpperLeft; buttonstyle.alignment = TextAnchor.UpperLeft;
fontstyleright.alignment = TextAnchor.LowerRight; fontstyleright.alignment = TextAnchor.LowerRight;
} }
else else
{ {
preginfoheight = fontheight; preginfoheight = fontheight;
buttonstyle.alignment = TextAnchor.MiddleLeft; buttonstyle.alignment = TextAnchor.MiddleLeft;
} }
Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight);
fontstyleright.normal.textColor = Color.white; fontstyleright.normal.textColor = Color.white;
GUI.Box(preginfo, feinfo, buttonstyle); GUI.Box(preginfo, feinfo, buttonstyle);
GUI.Label(preginfo, fainfo, fontstyleright); GUI.Label(preginfo, fainfo, fontstyleright);
} }
} }
else if (hediff is Hediff_BasePregnancy) else if (hediff is Hediff_BasePregnancy)
{ {
Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff;
if (h.GestationProgress < 0.2f) cum = comp.GetCumIcon(); if (h.GestationProgress < 0.2f) cum = comp.GetCumIcon();
else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
Pawn fetus = pawn.GetFetus(); Pawn fetus = pawn.GetFetus();
if (fetus != null && Utility.ShowFetusInfo()) if (fetus != null && Utility.ShowFetusInfo())
{ {
preginfoheight = fontheight; preginfoheight = fontheight;
Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight);
fontstyleright.normal.textColor = Color.white; fontstyleright.normal.textColor = Color.white;
fontstyleright.alignment = TextAnchor.MiddleRight; fontstyleright.alignment = TextAnchor.MiddleRight;
buttonstyle.alignment = TextAnchor.MiddleLeft; buttonstyle.alignment = TextAnchor.MiddleLeft;
GUI.Box(preginfo, h.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle); GUI.Box(preginfo, h.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle);
GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + h.father.LabelShort + " ", fontstyleright); GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + h.father.LabelShort + " ", fontstyleright);
} }
} }
else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }
else else
{ {
womb = comp.GetWombIcon(); womb = comp.GetWombIcon();
cum = comp.GetCumIcon(); cum = comp.GetCumIcon();
} }
Rect pawnRect = new Rect(0, 0, pawnRectWidth, pawnRectHeight); Rect pawnRect = new Rect(0, 0, pawnRectWidth, pawnRectHeight);
Widgets.DrawTextureFitted(pawnRect, PortraitsCache.Get(pawn, pawnRect.size), 1.0f); Widgets.DrawTextureFitted(pawnRect, PortraitsCache.Get(pawn, pawnRect.size), 1.0f);
Rect pawnLabelRect = new Rect(0, pawnRectHeight, pawnRectWidth, fontheight - 10); Rect pawnLabelRect = new Rect(0, pawnRectHeight, pawnRectWidth, fontheight - 10);
Rect pawnLabel2Rect = new Rect(0, pawnRectHeight + fontheight - 10, pawnRectWidth, fontheight - 10); Rect pawnLabel2Rect = new Rect(0, pawnRectHeight + fontheight - 10, pawnRectWidth, fontheight - 10);
fontstylecenter.normal.textColor = pawn.DrawColor; fontstylecenter.normal.textColor = pawn.DrawColor;
GUI.Label(pawnLabelRect, pawn.Name.ToStringFull, fontstylecenter); GUI.Label(pawnLabelRect, pawn.Name.ToStringFull, fontstylecenter);
if (pawn.story != null)GUI.Label(pawnLabel2Rect, pawn.story.Title, fontstylecenter); if (pawn.story != null) GUI.Label(pawnLabel2Rect, pawn.story.Title, fontstylecenter);
GUI.color = Color.white; GUI.color = Color.white;
float wombrecth = 0; float wombrecth = 0;
if (Configurations.DrawWombStatus) if (Configurations.DrawWombStatus)
{ {
wombrecth = wombRectHeight; wombrecth = wombRectHeight;
cumcolor = comp.GetCumMixtureColor; cumcolor = comp.GetCumMixtureColor;
Rect wombRect = new Rect(0f, mainRect.yMax - wombRectHeight + preginfoheight, wombRectWidth, wombRectWidth*0.9f); Rect wombRect = new Rect(0f, mainRect.yMax - wombRectHeight + preginfoheight, wombRectWidth, wombRectWidth * 0.9f);
DrawWomb(wombRect); DrawWomb(wombRect);
if (Configurations.DrawEggOverlay) if (Configurations.DrawEggOverlay)
{ {
comp.DrawEggOverlay(wombRect); comp.DrawEggOverlay(wombRect);
} }
} }
Rect wombInfoRect = new Rect(0f, mainRect.yMax - wombrecth - fontheight - 2, wombRectWidth, fontheight); Rect wombInfoRect = new Rect(0f, mainRect.yMax - wombrecth - fontheight - 2, wombRectWidth, fontheight);
buttonstyle.normal.textColor = Color.white; buttonstyle.normal.textColor = Color.white;
//boxstyle.normal.background = Texture2D.whiteTexture; //boxstyle.normal.background = Texture2D.whiteTexture;
buttonstyle.alignment = TextAnchor.MiddleLeft; buttonstyle.alignment = TextAnchor.MiddleLeft;
GUI.backgroundColor = new Color(0.24f, 0.29f, 0.35f, 1); GUI.backgroundColor = new Color(0.24f, 0.29f, 0.35f, 1);
GUI.Box(wombInfoRect, Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel, buttonstyle); GUI.Box(wombInfoRect, Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel, buttonstyle);
GUI.color = Color.white; GUI.color = Color.white;
fontstyleright.normal.textColor = Color.red; fontstyleright.normal.textColor = Color.red;
fontstyleright.alignment = TextAnchor.MiddleRight; fontstyleright.alignment = TextAnchor.MiddleRight;
//if (comp.GetFertilization) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo05 + " ", fontstyleright); //if (comp.GetFertilization) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo05 + " ", fontstyleright);
//else if (comp.GetEggFertilizing) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo06 + " ", fontstyleright); //else if (comp.GetEggFertilizing) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo06 + " ", fontstyleright);
//else if (comp.GetEgg) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo07 + " ", fontstyleright); //else if (comp.GetEgg) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo07 + " ", fontstyleright);
GUI.Label(wombInfoRect, comp.GetFertilizingInfo + " ", fontstyleright); GUI.Label(wombInfoRect, comp.GetFertilizingInfo + " ", fontstyleright);
//Widgets.Label(wombInfoRect,Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel); //Widgets.Label(wombInfoRect,Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel);
if (Configurations.DrawVaginaStatus && !pawn.IsAnimal()) if (Configurations.DrawVaginaStatus && !pawn.IsAnimal())
{ {
Rect genitalRect = new Rect(24, pawnRectHeight + 2 * fontheight, genitalRectWidth, genitalRectHeight + fontheight * 2); Rect genitalRect = new Rect(24, pawnRectHeight + 2 * fontheight, genitalRectWidth, genitalRectHeight + fontheight * 2);
DrawVagina(genitalRect); DrawVagina(genitalRect);
} }
Rect cumlistTitle = new Rect(pawnRectWidth, 0, wombRectWidth - pawnRectWidth, fontheight);
GUI.Label(cumlistTitle,Translations.Dialog_WombInfo04);
Rect cumlistRect = new Rect(pawnRectWidth, fontheight, wombRectWidth - pawnRectWidth, mainRect.yMax - wombrecth - fontheight);
DrawCumlist(cumlistRect);
} Rect cumlistTitle = new Rect(pawnRectWidth, 0, wombRectWidth - pawnRectWidth, fontheight);
GUI.Label(cumlistTitle, Translations.Dialog_WombInfo04);
private void DrawCumlist(Rect rect) Rect cumlistRect = new Rect(pawnRectWidth, fontheight, wombRectWidth - pawnRectWidth, mainRect.yMax - wombrecth - fontheight);
DrawCumlist(cumlistRect);
}
private void DrawCumlist(Rect rect)
{ {
Listing_Standard cumlist = new Listing_Standard Listing_Standard cumlist = new Listing_Standard
{ {
maxOneColumn = true, maxOneColumn = true,
ColumnWidth = wombRectWidth - pawnRectWidth ColumnWidth = wombRectWidth - pawnRectWidth
}; };
cumlist.Begin(rect); cumlist.Begin(rect);
Listing_Standard cumlistsection = cumlist.BeginSection_NewTemp(rect.height - fontheight - 12f); Listing_Standard cumlistsection = cumlist.BeginSection_NewTemp(rect.height - fontheight - 12f);
foreach (string s in comp.GetCumsInfo) foreach (string s in comp.GetCumsInfo)
{ {
cumlistsection.Label(s); cumlistsection.Label(s);
} }
cumlist.EndSection(cumlistsection); cumlist.EndSection(cumlistsection);
cumlist.End(); cumlist.End();
} }
private void DrawWomb(Rect rect) private void DrawWomb(Rect rect)
{ {
GUI.color = new Color(1.00f, 0.47f, 0.47f, 1); GUI.color = new Color(1.00f, 0.47f, 0.47f, 1);
GUI.Box(rect, "", boxstyle); GUI.Box(rect, "", boxstyle);
//GUI.color = Color.white; //GUI.color = Color.white;
//Widgets.DrawTextureFitted(wombRect, womb,1.0f); //Widgets.DrawTextureFitted(wombRect, womb,1.0f);
//GUI.color = cumcolor; //GUI.color = cumcolor;
//Widgets.DrawTextureFitted(wombRect, cum,1.0f); //Widgets.DrawTextureFitted(wombRect, cum,1.0f);
GUI.DrawTexture(rect, womb, ScaleMode.ScaleToFit, true, 0, Color.white, 0, 0); GUI.DrawTexture(rect, womb, ScaleMode.ScaleToFit, true, 0, Color.white, 0, 0);
GUI.DrawTexture(rect, cum, ScaleMode.ScaleToFit, true, 0, cumcolor, 0, 0); GUI.DrawTexture(rect, cum, ScaleMode.ScaleToFit, true, 0, cumcolor, 0, 0);
GUI.color = Color.white; GUI.color = Color.white;
}
}
private void DrawVagina(Rect rect)
private void DrawVagina(Rect rect)
{ {
Rect genitalIconRect = new Rect(rect.x, rect.y + fontheight, genitalRectWidth, genitalRectHeight); Rect genitalIconRect = new Rect(rect.x, rect.y + fontheight, genitalRectWidth, genitalRectHeight);
Rect genitalVaginaLabelRect = new Rect(rect.x, rect.y, genitalRectWidth, fontheight); Rect genitalVaginaLabelRect = new Rect(rect.x, rect.y, genitalRectWidth, fontheight);
Rect genitalAnusLabelRect = new Rect(rect.x, rect.y + fontheight + genitalRectHeight, genitalRectWidth, fontheight); Rect genitalAnusLabelRect = new Rect(rect.x, rect.y + fontheight + genitalRectHeight, genitalRectWidth, fontheight);
vagina = pawn.GetGenitalIcon(); vagina = pawn.GetGenitalIcon();
anal = pawn.GetAnalIcon(); anal = pawn.GetAnalIcon();
GUI.color = new Color(1.00f, 0.47f, 0.47f, 1); GUI.color = new Color(1.00f, 0.47f, 0.47f, 1);
GUI.Box(rect, "", boxstyle); GUI.Box(rect, "", boxstyle);
GUI.color = pawn.story.SkinColor; GUI.color = pawn.story.SkinColor;
//Widgets.DrawTextureFitted(genitalIconRect, anal, 1.0f); //Widgets.DrawTextureFitted(genitalIconRect, anal, 1.0f);
//Widgets.DrawTextureFitted(genitalIconRect, vagina, 1.0f); //Widgets.DrawTextureFitted(genitalIconRect, vagina, 1.0f);
GUI.DrawTexture(genitalIconRect, anal, ScaleMode.ScaleToFit); GUI.DrawTexture(genitalIconRect, anal, ScaleMode.ScaleToFit);
GUI.DrawTexture(genitalIconRect, vagina, ScaleMode.ScaleToFit); GUI.DrawTexture(genitalIconRect, vagina, ScaleMode.ScaleToFit);
GUI.color = Color.white; GUI.color = Color.white;
GUI.Label(genitalVaginaLabelRect, pawn.GetVaginaLabel(), fontstylecenter); GUI.Label(genitalVaginaLabelRect, pawn.GetVaginaLabel(), fontstylecenter);
GUI.Label(genitalAnusLabelRect, pawn.GetAnusLabel(), fontstylecenter); GUI.Label(genitalAnusLabelRect, pawn.GetAnusLabel(), fontstylecenter);
} }
} }

View File

@ -1,9 +1,4 @@
using System; using RimWorld;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse; using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
@ -13,7 +8,7 @@ namespace RJW_Menstruation
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn); HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular) if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal) || comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular) || comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericLuteal) || comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericLuteal)
@ -50,7 +45,7 @@ namespace RJW_Menstruation
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn); HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
if (comp != null) if (comp != null)
{ {
comp.eggstack += Rand.Range(1,4); comp.eggstack += Rand.Range(1, 4);
} }

View File

@ -1,62 +1,59 @@
using System; using RimWorld;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using UnityEngine; using UnityEngine;
using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public class FilthMaker_Colored public class FilthMaker_Colored
{ {
public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable<string> sources, Color color , bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None) public static bool TryMakeFilth(IntVec3 c, Map map, ThingDef filthDef, IEnumerable<string> sources, Color color, bool shouldPropagate, FilthSourceFlags additionalFlags = FilthSourceFlags.None)
{ {
Filth_Colored filth = (Filth_Colored)(from t in c.GetThingList(map) Filth_Colored filth = (Filth_Colored)(from t in c.GetThingList(map)
where t.def == filthDef where t.def == filthDef
select t).FirstOrDefault<Thing>(); select t).FirstOrDefault<Thing>();
if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened)) if (!c.Walkable(map) || (filth != null && !filth.CanBeThickened))
{ {
if (shouldPropagate) if (shouldPropagate)
{ {
List<IntVec3> list = GenAdj.AdjacentCells8WayRandomized(); List<IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
IntVec3 c2 = c + list[i]; IntVec3 c2 = c + list[i];
if (c2.InBounds(map) && TryMakeFilth(c2, map, filthDef, sources, color,false, FilthSourceFlags.None)) if (c2.InBounds(map) && TryMakeFilth(c2, map, filthDef, sources, color, false, FilthSourceFlags.None))
{ {
return true; return true;
} }
} }
} }
if (filth != null) if (filth != null)
{ {
filth.AddSources(sources); filth.AddSources(sources);
} }
return false; return false;
} }
if (filth != null) if (filth != null)
{ {
filth.ThickenFilth(); filth.ThickenFilth();
filth.AddSources(sources); filth.AddSources(sources);
} }
else else
{ {
if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags)) if (!FilthMaker.CanMakeFilth(c, map, filthDef, additionalFlags))
{ {
return false; return false;
} }
Filth_Colored filth2 = (Filth_Colored)ThingMaker.MakeThing(filthDef, null); Filth_Colored filth2 = (Filth_Colored)ThingMaker.MakeThing(filthDef, null);
filth2.DrawColor = color; filth2.DrawColor = color;
filth2.AddSources(sources); filth2.AddSources(sources);
GenSpawn.Spawn(filth2, c, map, WipeMode.Vanish); GenSpawn.Spawn(filth2, c, map, WipeMode.Vanish);
} }
//FilthMonitor.Notify_FilthSpawned(); //FilthMonitor.Notify_FilthSpawned();
return true; return true;
} }
} }
} }

View File

@ -1,47 +1,40 @@
using System; using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse; using Verse;
using RimWorld;
using UnityEngine;
using Verse.Sound;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public class Gizmo_Womb : Command_Action public class Gizmo_Womb : Command_Action
{ {
public Texture2D icon_overay; public Texture2D icon_overay;
public Color cumcolor; public Color cumcolor;
public HediffComp_Menstruation comp; public HediffComp_Menstruation comp;
protected override void DrawIcon(Rect rect, Material buttonMat = null) protected override void DrawIcon(Rect rect, Material buttonMat = null)
{ {
Texture2D badTex = icon; Texture2D badTex = icon;
Texture2D overay = icon_overay; Texture2D overay = icon_overay;
Color color = cumcolor; Color color = cumcolor;
if (badTex == null)
{
badTex = BaseContent.BadTex;
}
if (overay == null)
{
overay = BaseContent.BadTex;
}
if (color == null) color = Color.white;
rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y);
GUI.color = IconDrawColor;
Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat);
GUI.color = color;
Widgets.DrawTextureFitted(rect, overay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat);
GUI.color = Color.white;
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect);
}
if (badTex == null)
{
badTex = BaseContent.BadTex;
}
if (overay == null)
{
overay = BaseContent.BadTex;
}
if (color == null) color = Color.white;
rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y);
GUI.color = IconDrawColor;
Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat);
GUI.color = color;
Widgets.DrawTextureFitted(rect, overay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat);
GUI.color = Color.white;
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect);
}
} }

View File

@ -1,10 +1,5 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse; using Verse;
using RimWorld;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {

View File

@ -1,17 +1,16 @@
using System; using HugsLib;
using RimWorld;
using rjw;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using HugsLib;
using rjw;
using UnityEngine; using UnityEngine;
using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
[Flags]public enum SeasonalBreed [Flags]
public enum SeasonalBreed
{ {
Always = 0, Always = 0,
Spring = 1, Spring = 1,
@ -26,8 +25,8 @@ namespace RJW_Menstruation
public class CompProperties_Menstruation : HediffCompProperties public class CompProperties_Menstruation : HediffCompProperties
{ {
public float maxCumCapacity; // ml public float maxCumCapacity; // ml
public float baseImplantationChanceFactor; public float baseImplantationChanceFactor;
public float basefertilizationChanceFactor; public float basefertilizationChanceFactor;
public float deviationFactor; public float deviationFactor;
public int folicularIntervalDays = 14; //before ovulation including beginning of bleeding public int folicularIntervalDays = 14; //before ovulation including beginning of bleeding
public int lutealIntervalDays = 14; //after ovulation until bleeding public int lutealIntervalDays = 14; //after ovulation until bleeding
@ -44,7 +43,7 @@ namespace RJW_Menstruation
public CompProperties_Menstruation() public CompProperties_Menstruation()
{ {
compClass = typeof(HediffComp_Menstruation); compClass = typeof(HediffComp_Menstruation);
} }
} }
@ -62,10 +61,10 @@ namespace RJW_Menstruation
public class HediffComp_Menstruation : HediffComp public class HediffComp_Menstruation : HediffComp
{ {
const float minmakefilthvalue = 1.0f; const float minmakefilthvalue = 1.0f;
@ -104,7 +103,7 @@ namespace RJW_Menstruation
private int lutealIntervalhours = -1; private int lutealIntervalhours = -1;
private int bleedingIntervalhours = -1; private int bleedingIntervalhours = -1;
private int recoveryIntervalhours = -1; private int recoveryIntervalhours = -1;
private float crampPain= -1; private float crampPain = -1;
private Need sexNeed = null; private Need sexNeed = null;
private string customwombtex = null; private string customwombtex = null;
private string customvagtex = null; private string customvagtex = null;
@ -164,7 +163,7 @@ namespace RJW_Menstruation
{ {
res += cum.volume; res += cum.volume;
} }
return res/ Props.maxCumCapacity; return res / Props.maxCumCapacity;
} }
} }
public float CumCapacity public float CumCapacity
@ -181,7 +180,7 @@ namespace RJW_Menstruation
get get
{ {
float res = 1.0f; float res = 1.0f;
if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) res = 0.001f; if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) res = 0.01f;
return res; return res;
} }
} }
@ -202,8 +201,8 @@ namespace RJW_Menstruation
{ {
float factor = 1.0f; float factor = 1.0f;
if (parent.pawn.Has(Quirk.Breeder)) factor = 10.0f; if (parent.pawn.Has(Quirk.Breeder)) factor = 10.0f;
if (xxx.is_animal(parent.pawn)) factor *= RJWPregnancySettings.animal_impregnation_chance/100f; if (xxx.is_animal(parent.pawn)) factor *= RJWPregnancySettings.animal_impregnation_chance / 100f;
else factor *= RJWPregnancySettings.humanlike_impregnation_chance/100f; else factor *= RJWPregnancySettings.humanlike_impregnation_chance / 100f;
return parent.pawn.health.capacities.GetLevel(xxx.reproduction) * factor; return parent.pawn.health.capacities.GetLevel(xxx.reproduction) * factor;
} }
} }
@ -230,7 +229,7 @@ namespace RJW_Menstruation
float mixedsofar = 0; float mixedsofar = 0;
foreach (Cum cum in cums) foreach (Cum cum in cums)
{ {
mixedcolor = Colors.CMYKLerp(mixedcolor, cum.color, cum.volume/(mixedsofar + cum.volume)); mixedcolor = Colors.CMYKLerp(mixedcolor, cum.color, cum.volume / (mixedsofar + cum.volume));
mixedsofar += cum.volume; mixedsofar += cum.volume;
} }
} }
@ -309,16 +308,19 @@ namespace RJW_Menstruation
string res = ""; string res = "";
if (!eggs.NullOrEmpty()) if (!eggs.NullOrEmpty())
{ {
if (cums.NullOrEmpty() || TotalFertCum == 0) return eggs.Count + " " + Translations.Dialog_WombInfo07; int fertilized = 0;
foreach (Egg egg in eggs)
{
if (egg.fertilized) fertilized++;
}
if (fertilized != 0) res += fertilized + " " + Translations.Dialog_WombInfo05;
if (fertilized != 0 && eggs.Count - fertilized != 0) res += ", ";
if (cums.NullOrEmpty() || TotalFertCum == 0)
{
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo07;
}
else else
{ {
int fertilized = 0;
foreach (Egg egg in eggs)
{
if (egg.fertilized) fertilized++;
}
if (fertilized != 0) res += fertilized + " " + Translations.Dialog_WombInfo05;
if (fertilized != 0 && eggs.Count - fertilized != 0) res += ", ";
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo06; if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo06;
} }
} }
@ -332,7 +334,7 @@ namespace RJW_Menstruation
{ {
if (!eggs.NullOrEmpty()) if (!eggs.NullOrEmpty())
{ {
if (!cums.NullOrEmpty()) foreach(Cum cum in cums) if (!cums.NullOrEmpty()) foreach (Cum cum in cums)
{ {
if (cum.fertvolume > 0) return true; if (cum.fertvolume > 0) return true;
} }
@ -350,7 +352,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (!eggs.NullOrEmpty()) foreach(Egg egg in eggs) if (!eggs.NullOrEmpty()) foreach (Egg egg in eggs)
{ {
if (egg.fertilized) return egg.fertstage; if (egg.fertilized) return egg.fertstage;
} }
@ -425,7 +427,7 @@ namespace RJW_Menstruation
} }
public override void CompPostPostAdd(DamageInfo? dinfo) public override void CompPostPostAdd(DamageInfo? dinfo)
{ {
if (!loaded) Initialize(); if (!loaded) Initialize();
@ -442,7 +444,7 @@ namespace RJW_Menstruation
public override void CompPostPostRemoved() public override void CompPostPostRemoved()
{ {
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref); HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref);
ModLog.Message(parent.pawn.Label + "tick scheduler removed"); ModLog.Message(parent.pawn.Label + "tick scheduler removed");
base.CompPostPostRemoved(); base.CompPostPostRemoved();
@ -451,7 +453,7 @@ namespace RJW_Menstruation
/// <summary> /// <summary>
/// Get fluid in womb that not a cum /// Get fluid in womb that not a cum
/// </summary> /// </summary>
@ -479,7 +481,7 @@ namespace RJW_Menstruation
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Inject pawn's cum into womb /// Inject pawn's cum into womb
/// </summary> /// </summary>
@ -497,18 +499,18 @@ namespace RJW_Menstruation
float cumoutrate = 1 - (CumCapacity / tmp); float cumoutrate = 1 - (CumCapacity / tmp);
bool merged = false; bool merged = false;
if (!cums.NullOrEmpty()) foreach (Cum cum in cums) if (!cums.NullOrEmpty()) foreach (Cum cum in cums)
{
if (cum.pawn.Equals(pawn))
{ {
cum.volume += volume; if (cum.pawn.Equals(pawn))
cum.fertvolume += volume; {
cum.FilthDef = filthdef; cum.volume += volume;
merged = true; cum.fertvolume += volume * CumInFactor;
cum.FilthDef = filthdef;
merged = true;
}
cum.volume *= 1 - cumoutrate;
cum.fertvolume *= 1 - cumoutrate;
} }
cum.volume *= 1 - cumoutrate; if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate), fertility, filthdef));
cum.fertvolume *= 1 - cumoutrate;
}
if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate),fertility, filthdef));
} }
else else
{ {
@ -560,7 +562,7 @@ namespace RJW_Menstruation
cum.volume *= 1 - cumoutrate; cum.volume *= 1 - cumoutrate;
cum.fertvolume *= 1 - cumoutrate; cum.fertvolume *= 1 - cumoutrate;
} }
if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate), notcumlabel,decayresist, filthdef)); if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate), notcumlabel, decayresist, filthdef));
} }
else else
{ {
@ -577,7 +579,7 @@ namespace RJW_Menstruation
merged = true; merged = true;
} }
} }
if (!merged) cums.Add(new Cum(pawn, volume, notcumlabel,decayresist, filthdef)); if (!merged) cums.Add(new Cum(pawn, volume, notcumlabel, decayresist, filthdef));
} }
cumd = TotalCumPercent - cumd; cumd = TotalCumPercent - cumd;
AfterNotCumIn(); AfterNotCumIn();
@ -661,7 +663,7 @@ namespace RJW_Menstruation
ModLog.Message("cumflation in"); ModLog.Message("cumflation in");
BodyPartRecord genital = Genital_Helper.get_genitalsBPR(parent.pawn); BodyPartRecord genital = Genital_Helper.get_genitalsBPR(parent.pawn);
HediffWithComps hediff = parent.pawn.health?.hediffSet?.GetHediffs<HediffWithComps>()?.FirstOrDefault(x => x.def == VariousDefOf.Cumflation && x.Part.Equals(genital)); HediffWithComps hediff = parent.pawn.health?.hediffSet?.GetHediffs<HediffWithComps>()?.FirstOrDefault(x => x.def == VariousDefOf.Cumflation && x.Part.Equals(genital));
if (hediff == null) // 1.0 fd = 0.002 severity if (hediff == null) // 1.0 fd = 0.002 severity
{ {
ModLog.Message("hediff null"); ModLog.Message("hediff null");
@ -688,7 +690,7 @@ namespace RJW_Menstruation
{ {
ModLog.Message("decrease severity: " + hediff?.Part?.Label + TotalCumPercent * 0.002f); ModLog.Message("decrease severity: " + hediff?.Part?.Label + TotalCumPercent * 0.002f);
hediff.Severity -= fd * 0.002f; hediff.Severity -= fd * 0.002f;
if (hediff.Severity < TotalCumPercent * 0.002f) hediff.Severity = TotalCumPercent * 0.002f; if (hediff.Severity < TotalCumPercent * 0.002f) hediff.Severity = TotalCumPercent * 0.002f;
} }
} }
@ -741,7 +743,7 @@ namespace RJW_Menstruation
if (cums.NullOrEmpty()) return; if (cums.NullOrEmpty()) return;
else if (absorber != null && absorber.dirty && !absorber.LeakAfterDirty) leakfactor = 0f; else if (absorber != null && absorber.dirty && !absorber.LeakAfterDirty) leakfactor = 0f;
List<Cum> removecums = new List<Cum>(); List<Cum> removecums = new List<Cum>();
foreach(Cum cum in cums) foreach (Cum cum in cums)
{ {
float vd = cum.volume; float vd = cum.volume;
cum.volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor)); cum.volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor));
@ -749,7 +751,7 @@ namespace RJW_Menstruation
vd -= cum.volume; vd -= cum.volume;
totalleak += AbsorbCum(cum, vd, absorber); totalleak += AbsorbCum(cum, vd, absorber);
string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString());
filthlabels.Add(tmp.Replace(" x1","")); filthlabels.Add(tmp.Replace(" x1", ""));
if (cum.fertvolume < 0.01f) cum.fertvolume = 0; if (cum.fertvolume < 0.01f) cum.fertvolume = 0;
if (cum.volume < 0.01f) removecums.Add(cum); if (cum.volume < 0.01f) removecums.Add(cum);
} }
@ -845,7 +847,7 @@ namespace RJW_Menstruation
return outcum; return outcum;
} }
@ -861,7 +863,8 @@ namespace RJW_Menstruation
foreach (Egg egg in eggs) foreach (Egg egg in eggs)
{ {
if (!egg.fertilized) egg.fertilizer = Fertilize(); if (!egg.fertilized) egg.fertilizer = Fertilize();
if (egg.fertilizer != null) { if (egg.fertilizer != null)
{
egg.fertilized = true; egg.fertilized = true;
egg.lifespanhrs += 240; egg.lifespanhrs += 240;
onefertilized = true; onefertilized = true;
@ -890,14 +893,18 @@ namespace RJW_Menstruation
if (crampPain < 0) crampPain = PainRandomizer(); if (crampPain < 0) crampPain = PainRandomizer();
if (cums == null) cums = new List<Cum>(); if (cums == null) cums = new List<Cum>();
if (eggs == null) eggs = new List<Egg>(); if (eggs == null) eggs = new List<Egg>();
if (!Configurations.EnableMenopause) if (!Configurations.EnableMenopause)
{ {
Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric); Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric);
if (hediff != null) parent.pawn.health.RemoveHediff(hediff); if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Menopause); hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Menopause);
if (hediff != null) parent.pawn.health.RemoveHediff(hediff); if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
if (curStage == Stage.ClimactericBleeding) curStage = Stage.Bleeding;
else if (curStage == Stage.ClimactericFollicular) curStage = Stage.Follicular;
else if (curStage == Stage.ClimactericLuteal) curStage = Stage.Luteal;
} }
else if (ovarypower < -50000) else if (ovarypower < -50000)
{ {
@ -914,7 +921,8 @@ namespace RJW_Menstruation
avglittersize = 1; avglittersize = 1;
} }
ovarypower = (int)(((Props.ovaryPower * Rand.Range(0.7f, 1.3f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy) 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 - 15)) * (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize); - (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) if (ovarypower < 1)
{ {
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
@ -930,8 +938,8 @@ namespace RJW_Menstruation
} }
} }
} }
if (parent.pawn.IsPregnant()) curStage = Stage.Pregnant; if (parent.pawn.IsPregnant()) curStage = Stage.Pregnant;
if (parent.pawn.IsAnimal()) if (parent.pawn.IsAnimal())
{ {
@ -958,7 +966,7 @@ namespace RJW_Menstruation
public void AfterSimulator() public void AfterSimulator()
{ {
if (ovarypower < ovarypowerthreshold) if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold)
{ {
if (sexNeed == null) sexNeed = parent.pawn.needs.TryGetNeed(VariousDefOf.SexNeed); if (sexNeed == null) sexNeed = parent.pawn.needs.TryGetNeed(VariousDefOf.SexNeed);
else else
@ -973,7 +981,7 @@ namespace RJW_Menstruation
HediffDef estrusdef; HediffDef estrusdef;
if (Props.consealedEstrus) estrusdef = VariousDefOf.Hediff_Estrus_Consealed; if (Props.consealedEstrus) estrusdef = VariousDefOf.Hediff_Estrus_Consealed;
else estrusdef = VariousDefOf.Hediff_Estrus; else estrusdef = VariousDefOf.Hediff_Estrus;
HediffWithComps hediff = (HediffWithComps)parent.pawn.health.hediffSet.GetFirstHediffOfDef(estrusdef); HediffWithComps hediff = (HediffWithComps)parent.pawn.health.hediffSet.GetFirstHediffOfDef(estrusdef);
if (hediff != null) if (hediff != null)
{ {
@ -987,6 +995,30 @@ namespace RJW_Menstruation
} }
} }
public bool IsBreedingSeason()
{
if (Props.breedingSeason == SeasonalBreed.Always) return true;
switch (GenLocalDate.Season(parent.pawn.Map))
{
case Season.Spring:
if ((Props.breedingSeason & SeasonalBreed.Spring) != 0) return true;
break;
case Season.Summer:
case Season.PermanentSummer:
if ((Props.breedingSeason & SeasonalBreed.Summer) != 0) return true;
break;
case Season.Fall:
if ((Props.breedingSeason & SeasonalBreed.Fall) != 0) return true;
break;
case Season.Winter:
case Season.PermanentWinter:
if ((Props.breedingSeason & SeasonalBreed.Winter) != 0) return true;
break;
default:
return false;
}
return false;
}
private Pawn Fertilize() private Pawn Fertilize()
{ {
@ -1010,7 +1042,7 @@ namespace RJW_Menstruation
{ {
List<Egg> deadeggs = new List<Egg>(); List<Egg> deadeggs = new List<Egg>();
bool pregnant = false; bool pregnant = false;
foreach(Egg egg in eggs) foreach (Egg egg in eggs)
{ {
if (!egg.fertilized || egg.fertstage < 168) continue; if (!egg.fertilized || egg.fertstage < 168) continue;
else if (Rand.Range(0.0f, 1.0f) <= Configurations.ImplantationChance * Props.baseImplantationChanceFactor * ImplantFactor * InterspeciesImplantFactor(egg.fertilizer)) else if (Rand.Range(0.0f, 1.0f) <= Configurations.ImplantationChance * Props.baseImplantationChanceFactor * ImplantFactor * InterspeciesImplantFactor(egg.fertilizer))
@ -1078,7 +1110,7 @@ namespace RJW_Menstruation
private void BleedOut() private void BleedOut()
{ {
//FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, ThingDefOf.Filth_Blood,parent.pawn.Label); //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, ThingDefOf.Filth_Blood);
GetNotCum(Translations.Menstrual_Blood).color = BloodColor; GetNotCum(Translations.Menstrual_Blood).color = BloodColor;
} }
@ -1087,7 +1119,7 @@ namespace RJW_Menstruation
/// </summary> /// </summary>
/// <param name="cum"></param> /// <param name="cum"></param>
/// <param name="amount"></param> /// <param name="amount"></param>
private void MakeCumFilth(Cum cum, float amount) private void MakeCumFilth(Cum cum, float amount)
{ {
if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown"); if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown");
} }
@ -1101,11 +1133,11 @@ namespace RJW_Menstruation
/// <returns></returns> /// <returns></returns>
private float AbsorbCum(Cum cum, float amount, Absorber absorber) private float AbsorbCum(Cum cum, float amount, Absorber absorber)
{ {
if (absorber != null) if (absorber != null)
{ {
float absorbable = absorber.GetStatValue(VariousDefOf.MaxAbsorbable); float absorbable = absorber.GetStatValue(VariousDefOf.MaxAbsorbable);
absorber.SetColor(Colors.CMYKLerp(GetCumMixtureColor, absorber.DrawColor, 1f - amount/absorbable)); absorber.SetColor(Colors.CMYKLerp(GetCumMixtureColor, absorber.DrawColor, 1f - amount / absorbable));
if (!absorber.dirty) if (!absorber.dirty)
{ {
absorber.absorbedfluids += amount; absorber.absorbedfluids += amount;
@ -1118,7 +1150,7 @@ namespace RJW_Menstruation
} }
else else
{ {
//if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort); //if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort);
return amount; return amount;
} }
@ -1133,10 +1165,10 @@ namespace RJW_Menstruation
private float MakeCumFilthMixture(float amount, List<string> cumlabels) private float MakeCumFilthMixture(float amount, List<string> cumlabels)
{ {
if (amount >= minmakefilthvalue) if (amount >= minmakefilthvalue)
{ {
FilthMaker_Colored.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, VariousDefOf.FilthMixture, cumlabels,GetCumMixtureColor,false); FilthMaker_Colored.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, VariousDefOf.FilthMixture, cumlabels, GetCumMixtureColor, false);
} }
return amount; return amount;
} }
@ -1164,6 +1196,14 @@ namespace RJW_Menstruation
} }
} }
private void AddCrampPain()
{
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, parent.pawn);
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
Prop.severityPerDay = -hediff.Severity / (bleedingIntervalhours / 24) * Configurations.CycleAcceleration;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
}
private Action PeriodSimulator(Stage targetstage) private Action PeriodSimulator(Stage targetstage)
{ {
@ -1173,28 +1213,10 @@ namespace RJW_Menstruation
case Stage.Follicular: case Stage.Follicular:
action = delegate action = delegate
{ {
if (Props.breedingSeason != SeasonalBreed.Always) if (!IsBreedingSeason())
{ {
if (!Props.breedingSeason.HasFlag(SeasonalBreed.Spring) && GenLocalDate.Season(parent.pawn.Map).Equals(Season.Spring)) GoNextStage(Stage.Anestrus);
{ return;
GoNextStage(Stage.Anestrus);
return;
}
else if (!Props.breedingSeason.HasFlag(SeasonalBreed.Summer) && (GenLocalDate.Season(parent.pawn.Map).Equals(Season.Summer) || GenLocalDate.Season(parent.pawn.Map).Equals(Season.PermanentSummer)))
{
GoNextStage(Stage.Anestrus);
return;
}
else if (!Props.breedingSeason.HasFlag(SeasonalBreed.Fall) && GenLocalDate.Season(parent.pawn.Map).Equals(Season.Fall))
{
GoNextStage(Stage.Anestrus);
return;
}
else if (!Props.breedingSeason.HasFlag(SeasonalBreed.Winter) && (GenLocalDate.Season(parent.pawn.Map).Equals(Season.Winter) || GenLocalDate.Season(parent.pawn.Map).Equals(Season.PermanentWinter)))
{
GoNextStage(Stage.Anestrus);
return;
}
} }
if (curStageHrs >= FollicularIntervalHours) if (curStageHrs >= FollicularIntervalHours)
{ {
@ -1202,8 +1224,8 @@ namespace RJW_Menstruation
} }
else else
{ {
curStageHrs+=Configurations.CycleAcceleration; curStageHrs += Configurations.CycleAcceleration;
if (!estrusflag && curStageHrs > FollicularIntervalHours - Props.estrusDaysBeforeOvulation*24) if (!estrusflag && curStageHrs > FollicularIntervalHours - Props.estrusDaysBeforeOvulation * 24)
{ {
estrusflag = true; estrusflag = true;
SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation); SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation);
@ -1265,8 +1287,8 @@ namespace RJW_Menstruation
} }
else if (curStageHrs <= lutealIntervalhours) else if (curStageHrs <= lutealIntervalhours)
{ {
curStageHrs+=Configurations.CycleAcceleration; curStageHrs += Configurations.CycleAcceleration;
StayCurrentStage(); StayCurrentStage();
} }
else else
{ {
@ -1280,11 +1302,7 @@ namespace RJW_Menstruation
bleedingIntervalhours = PeriodRandomizer(bleedingIntervalhours, Props.deviationFactor); bleedingIntervalhours = PeriodRandomizer(bleedingIntervalhours, Props.deviationFactor);
if (crampPain >= 0.05f) if (crampPain >= 0.05f)
{ {
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, parent.pawn); AddCrampPain();
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
Prop.severityPerDay = - hediff.Severity / (bleedingIntervalhours/24) * Configurations.CycleAcceleration;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
} }
GoNextStage(Stage.Bleeding); GoNextStage(Stage.Bleeding);
} }
@ -1304,7 +1322,7 @@ namespace RJW_Menstruation
else else
{ {
if (curStageHrs < bleedingIntervalhours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut(); if (curStageHrs < bleedingIntervalhours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut();
curStageHrs+=Configurations.CycleAcceleration; curStageHrs += Configurations.CycleAcceleration;
StayCurrentStage(); StayCurrentStage();
} }
}; };
@ -1366,7 +1384,7 @@ namespace RJW_Menstruation
} }
else else
{ {
curStageHrs+=Configurations.CycleAcceleration; curStageHrs += Configurations.CycleAcceleration;
StayCurrentStage(); StayCurrentStage();
} }
}; };
@ -1429,7 +1447,7 @@ namespace RJW_Menstruation
follicularIntervalhours = PeriodRandomizer(follicularIntervalhours, Props.deviationFactor * 6); follicularIntervalhours = PeriodRandomizer(follicularIntervalhours, Props.deviationFactor * 6);
GoNextStage(Stage.ClimactericFollicular); GoNextStage(Stage.ClimactericFollicular);
} }
else if (ovarypower < ovarypowerthreshold / 4 || (ovarypower < ovarypowerthreshold / 3 && Rand.Range(0.0f,1.0f) < 0.3f)) //skips bleeding else if (ovarypower < ovarypowerthreshold / 4 || (ovarypower < ovarypowerthreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.3f)) //skips bleeding
{ {
follicularIntervalhours = PeriodRandomizer(follicularIntervalhours, Props.deviationFactor * 6); follicularIntervalhours = PeriodRandomizer(follicularIntervalhours, Props.deviationFactor * 6);
GoNextStage(Stage.ClimactericFollicular); GoNextStage(Stage.ClimactericFollicular);
@ -1439,11 +1457,7 @@ namespace RJW_Menstruation
bleedingIntervalhours = PeriodRandomizer(bleedingIntervalhours, Props.deviationFactor); bleedingIntervalhours = PeriodRandomizer(bleedingIntervalhours, Props.deviationFactor);
if (crampPain >= 0.05f) if (crampPain >= 0.05f)
{ {
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, parent.pawn); AddCrampPain();
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
Prop.severityPerDay = -hediff.Severity / (bleedingIntervalhours / 24) * Configurations.CycleAcceleration;
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
} }
GoNextStage(Stage.ClimactericBleeding); GoNextStage(Stage.ClimactericBleeding);
} }
@ -1470,25 +1484,7 @@ namespace RJW_Menstruation
case Stage.Anestrus: case Stage.Anestrus:
action = delegate action = delegate
{ {
if (Props.breedingSeason == SeasonalBreed.Always) if (IsBreedingSeason())
{
//case for XML changes
follicularIntervalhours = PeriodRandomizer(follicularIntervalhours, Props.deviationFactor);
GoNextStage(Stage.Follicular);
}
else if (Props.breedingSeason.HasFlag(SeasonalBreed.Spring) && GenLocalDate.Season(parent.pawn.Map).Equals(Season.Spring))
{
GoFollicularOrBleeding();
}
else if (Props.breedingSeason.HasFlag(SeasonalBreed.Summer) && (GenLocalDate.Season(parent.pawn.Map).Equals(Season.Summer) || GenLocalDate.Season(parent.pawn.Map).Equals(Season.PermanentSummer)))
{
GoFollicularOrBleeding();
}
else if (Props.breedingSeason.HasFlag(SeasonalBreed.Fall) && GenLocalDate.Season(parent.pawn.Map).Equals(Season.Fall))
{
GoFollicularOrBleeding();
}
else if (Props.breedingSeason.HasFlag(SeasonalBreed.Winter) && (GenLocalDate.Season(parent.pawn.Map).Equals(Season.Winter) || GenLocalDate.Season(parent.pawn.Map).Equals(Season.PermanentWinter)))
{ {
GoFollicularOrBleeding(); GoFollicularOrBleeding();
} }
@ -1501,7 +1497,7 @@ namespace RJW_Menstruation
default: default:
curStage = Stage.Follicular; curStage = Stage.Follicular;
curStageHrs = 0; curStageHrs = 0;
if (follicularIntervalhours < 0) follicularIntervalhours = PeriodRandomizer(Props.folicularIntervalDays*24, Props.deviationFactor); if (follicularIntervalhours < 0) follicularIntervalhours = PeriodRandomizer(Props.folicularIntervalDays * 24, Props.deviationFactor);
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Follicular), tickInterval, parent.pawn, false); HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Follicular), tickInterval, parent.pawn, false);
break; break;
} }
@ -1522,7 +1518,7 @@ namespace RJW_Menstruation
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), (int)(tickInterval * factor), parent.pawn, false); HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), (int)(tickInterval * factor), parent.pawn, false);
} }
void GoNextStageSetHour(Stage nextstage, int hour, float factor = 1.0f) void GoNextStageSetHour(Stage nextstage, int hour, float factor = 1.0f)
{ {
curStageHrs = hour; curStageHrs = hour;
@ -1541,7 +1537,7 @@ namespace RJW_Menstruation
{ {
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curstage), (int)(tickInterval * factor), parent.pawn, false); HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curstage), (int)(tickInterval * factor), parent.pawn, false);
} }
void GoFollicularOrBleeding() void GoFollicularOrBleeding()
{ {
if (Props.bleedingIntervalDays == 0) if (Props.bleedingIntervalDays == 0)
@ -1562,7 +1558,7 @@ namespace RJW_Menstruation
private int PeriodRandomizer(int intervalhours, float deviation) private int PeriodRandomizer(int intervalhours, float deviation)
{ {
return intervalhours + (int)(intervalhours*Rand.Range(-deviation,deviation)); return intervalhours + (int)(intervalhours * Rand.Range(-deviation, deviation));
} }
private float InterspeciesImplantFactor(Pawn fertilizer) private float InterspeciesImplantFactor(Pawn fertilizer)
@ -1574,7 +1570,7 @@ namespace RJW_Menstruation
private float PainRandomizer() private float PainRandomizer()
{ {
float rand = Rand.Range(0.0f, 1.0f); float rand = Rand.Range(0.0f, 1.0f);
if (rand < 0.01f) return Rand.Range(0.0f,0.2f); if (rand < 0.01f) return Rand.Range(0.0f, 0.2f);
else if (rand < 0.2f) return Rand.Range(0.1f, 0.2f); else if (rand < 0.2f) return Rand.Range(0.1f, 0.2f);
else if (rand < 0.8f) return Rand.Range(0.2f, 0.4f); else if (rand < 0.8f) return Rand.Range(0.2f, 0.4f);
else if (rand < 0.95f) return Rand.Range(0.4f, 0.6f); else if (rand < 0.95f) return Rand.Range(0.4f, 0.6f);
@ -1583,7 +1579,7 @@ namespace RJW_Menstruation
private Stage RandomStage() private Stage RandomStage()
{ {
int rand = Rand.Range(0,2); int rand = Rand.Range(0, 2);
switch (rand) switch (rand)
{ {
@ -1605,7 +1601,7 @@ namespace RJW_Menstruation
public class Egg : IExposable public class Egg : IExposable
{ {
public bool fertilized; public bool fertilized;

View File

@ -1,45 +1,39 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using Verse.AI; using Verse.AI;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public class JobDriver_VaginaWashing : JobDriver public class JobDriver_VaginaWashing : JobDriver
{ {
const int excretingTime = 300;//ticks - 120 = 2 real seconds, 3 in-game minutes const int excretingTime = 300;//ticks - 120 = 2 real seconds, 3 in-game minutes
public override bool TryMakePreToilReservations(bool errorOnFailed) public override bool TryMakePreToilReservations(bool errorOnFailed)
{ {
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed); return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
} }
protected override IEnumerable<Toil> MakeNewToils() protected override IEnumerable<Toil> MakeNewToils()
{ {
HediffComp_Menstruation Comp = Utility.GetMenstruationComp(pawn); HediffComp_Menstruation Comp = Utility.GetMenstruationComp(pawn);
this.FailOn(delegate this.FailOn(delegate
{ {
return !(Comp.TotalCumPercent > 0.01); return !(Comp.TotalCumPercent > 0.01);
}); });
Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of
excreting.WithProgressBarToilDelay(TargetIndex.A); excreting.WithProgressBarToilDelay(TargetIndex.A);
yield return excreting; yield return excreting;
yield return new Toil() yield return new Toil()
{ {
initAction = delegate () initAction = delegate ()
{ {
Comp.CumOutForce(null, 0.5f); Comp.CumOutForce(null, 0.5f);
if (Comp.TotalCumPercent > 0.01) this.JumpToToil(excreting); if (Comp.TotalCumPercent > 0.01) this.JumpToToil(excreting);
} }
}; };
//yield return excreting; //yield return excreting;
} }
} }
} }

View File

@ -1,14 +1,9 @@
using System; using HarmonyLib;
using rjw;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using Verse;
using RimWorld;
using rjw;
using UnityEngine; using UnityEngine;
using Verse.Sound; using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
@ -38,7 +33,7 @@ namespace RJW_Menstruation
__result = gizmoList; __result = gizmoList;
} }
@ -50,9 +45,9 @@ namespace RJW_Menstruation
} }
private static Gizmo CreateGizmo_WombStatus(Pawn pawn , HediffComp_Menstruation comp) private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
{ {
Texture2D icon,icon_overay; Texture2D icon, icon_overay;
string description = ""; string description = "";
if (Configurations.Debug) description += comp.curStage + ": " + comp.curStageHrs + "\n" + "fertcums: " + comp.TotalFertCum + "\n" + "ovarypower: " + comp.ovarypower + "\n" + "eggs: " + comp.GetNumofEggs + "\n"; if (Configurations.Debug) description += comp.curStage + ": " + comp.curStageHrs + "\n" + "fertcums: " + comp.TotalFertCum + "\n" + "ovarypower: " + comp.ovarypower + "\n" + "eggs: " + comp.GetNumofEggs + "\n";
else description += comp.GetCurStageLabel + "\n"; else description += comp.GetCurStageLabel + "\n";

View File

@ -1,27 +1,20 @@
using System; using HarmonyLib;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using HarmonyLib;
using Verse; using Verse;
using RimWorld;
using rjw;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
[StaticConstructorOnStartup] [StaticConstructorOnStartup]
internal static class First internal static class First
{ {
static First() static First()
{ {
var har = new Harmony("RJW_Menstruation"); var har = new Harmony("RJW_Menstruation");
har.PatchAll(Assembly.GetExecutingAssembly()); har.PatchAll(Assembly.GetExecutingAssembly());
} }
} }
} }

View File

@ -1,14 +1,10 @@
using System; using HarmonyLib;
using HugsLib;
using RimWorld;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using RimWorld;
using Verse; using Verse;
using HarmonyLib;
using HugsLib;
using rjw;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
@ -40,12 +36,12 @@ namespace RJW_Menstruation
if (pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t)); if (pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t));
break; break;
} }
} }
public static FloatMenuOption MakeSelfMenu(Pawn pawn, LocalTargetInfo target) public static FloatMenuOption MakeSelfMenu(Pawn pawn, LocalTargetInfo target)
{ {
FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Translations.FloatMenu_CleanSelf, delegate () FloatMenuOption option = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(Translations.FloatMenu_CleanSelf, delegate ()
@ -59,7 +55,7 @@ namespace RJW_Menstruation
} }
//[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffListing")] //[HarmonyPatch(typeof(HealthCardUtility), "DrawHediffListing")]
//public class DrawHediffListing_Patch //public class DrawHediffListing_Patch
//{ //{

View File

@ -1,9 +1,4 @@
using System; using HarmonyLib;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using rjw; using rjw;
using Verse; using Verse;
@ -11,76 +6,76 @@ using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
[HarmonyPatch(typeof(PregnancyHelper), "impregnate")] [HarmonyPatch(typeof(PregnancyHelper), "impregnate")]
public static class impregnate_Patch public static class impregnate_Patch
{ {
public static bool Prefix(Pawn pawn, Pawn partner, xxx.rjwSextype sextype = xxx.rjwSextype.None) public static bool Prefix(Pawn pawn, Pawn partner, xxx.rjwSextype sextype = xxx.rjwSextype.None)
{ {
if (sextype == xxx.rjwSextype.Vaginal) if (sextype == xxx.rjwSextype.Vaginal)
{
var pawnpartBPR = Genital_Helper.get_genitalsBPR(pawn);
var pawnparts = Genital_Helper.get_PartsHediffList(pawn, pawnpartBPR);
var partnerpartBPR = Genital_Helper.get_genitalsBPR(partner);
var partnerparts = Genital_Helper.get_PartsHediffList(partner, partnerpartBPR);
if (Genital_Helper.has_vagina(partner, partnerparts))
{
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = Utility.GetMenstruationComp(partner);
if (comp != null)
{
if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype))
{
PregnancyHelper.Doimpregnate(pawn, partner);
return false;
}
else comp.CumIn(pawn, pawn.GetCumVolume(), 0);
}
}
else if (Genital_Helper.has_vagina(pawn, pawnparts))
{
if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
if (comp != null)
{
if (Genital_Helper.has_penis_fertile(partner, partnerparts) && PregnancyHelper.CanImpregnate(partner, pawn, sextype))
{
PregnancyHelper.Doimpregnate(partner, pawn);
return false;
}
else comp.CumIn(partner, partner.GetCumVolume(), 0);
}
}
}
return true;
}
}
[HarmonyPatch(typeof(PregnancyHelper), "Doimpregnate")]
public static class Doimpregnate_Patch
{
public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
{
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = partner.GetMenstruationComp();
if (comp != null)
{ {
if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn)) var pawnpartBPR = Genital_Helper.get_genitalsBPR(pawn);
{ var pawnparts = Genital_Helper.get_PartsHediffList(pawn, pawnpartBPR);
comp.CumIn(pawn, pawn.GetCumVolume(), 0); var partnerpartBPR = Genital_Helper.get_genitalsBPR(partner);
return false; var partnerparts = Genital_Helper.get_PartsHediffList(partner, partnerpartBPR);
}
else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction)); if (Genital_Helper.has_vagina(partner, partnerparts))
return false; {
} if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
ModLog.Message("used original rjw method: Comp missing"); HediffComp_Menstruation comp = Utility.GetMenstruationComp(partner);
return true; if (comp != null)
} {
} if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype))
{
PregnancyHelper.Doimpregnate(pawn, partner);
return false;
}
else comp.CumIn(pawn, pawn.GetCumVolume(), 0);
}
}
else if (Genital_Helper.has_vagina(pawn, pawnparts))
{
if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn);
if (comp != null)
{
if (Genital_Helper.has_penis_fertile(partner, partnerparts) && PregnancyHelper.CanImpregnate(partner, pawn, sextype))
{
PregnancyHelper.Doimpregnate(partner, pawn);
return false;
}
else comp.CumIn(partner, partner.GetCumVolume(), 0);
}
}
}
return true;
}
}
[HarmonyPatch(typeof(PregnancyHelper), "Doimpregnate")]
public static class Doimpregnate_Patch
{
public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
{
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = partner.GetMenstruationComp();
if (comp != null)
{
if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn))
{
comp.CumIn(pawn, pawn.GetCumVolume(), 0);
return false;
}
else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction));
return false;
}
ModLog.Message("used original rjw method: Comp missing");
return true;
}
}

View File

@ -43,7 +43,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>..\..\..\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -92,6 +92,7 @@
<HintPath>..\..\..\..\RJW\1.2\Assemblies\RJW.dll</HintPath> <HintPath>..\..\..\..\RJW\1.2\Assemblies\RJW.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Xml" />
<Reference Include="Unity.TextMeshPro"> <Reference Include="Unity.TextMeshPro">
<HintPath>..\..\..\..\..\RimWorldWin64_Data\Managed\Unity.TextMeshPro.dll</HintPath> <HintPath>..\..\..\..\..\RimWorldWin64_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private> <Private>False</Private>

View File

@ -1,10 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection; using System.Reflection;
using RimWorld;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {

View File

@ -1,26 +1,83 @@
using System; using System;
using System.Xml;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld; using RimWorld;
using Verse;
using rjw; using rjw;
using UnityEngine; using UnityEngine;
using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public class PawnDNAModExtention : DefModExtension public class PawnDNAModExtension : DefModExtension
{ {
public string fetusTexPath; public string fetusTexPath;
public ColorInt cumColor; public ColorInt cumColor;
public Color CumColor => cumColor.ToColor; public Color CumColor => cumColor.ToColor;
public float cumThickness = 0f; public float cumThickness = 0f;
public List<HybridExtension> hybridExtension;
public HybridExtension GetHybridExtention(string race)
{
if (hybridExtension.NullOrEmpty()) return null;
else
{
return hybridExtension.Find(x => x.thingDef.defName.Equals(race));
}
}
public PawnKindDef GetHybridWith(string race)
{
return GetHybridExtention(race)?.ChooseOne() ?? null;
}
}
public class HybridExtension
{
public Dictionary<string, float> hybridInfo;
public ThingDef thingDef;
public HybridExtension() { }
public PawnKindDef ChooseOne()
{
if (hybridInfo.EnumerableNullOrEmpty()) return null;
PawnKindDef res = null;
do
{
res = DefDatabase<PawnKindDef>.GetNamedSilentFail(hybridInfo.RandomElementByWeight(x => x.Value).Key);
if (res == null) res = DefDatabase<ThingDef>.GetNamedSilentFail(hybridInfo.RandomElementByWeight(x => x.Value).Key).race.AnyPawnKind;
if (res == null) hybridInfo.Remove(res.defName);
} while (res == null && !hybridInfo.EnumerableNullOrEmpty());
return res;
}
public void LoadDataFromXmlCustom(XmlNode xmlRoot)
{
hybridInfo = new Dictionary<string, float>();
DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingDef", xmlRoot.Name);
XmlNodeList childNodes = xmlRoot.ChildNodes;
if (childNodes.Count >= 1) foreach (XmlNode node in childNodes)
{
//Log.Message(xmlRoot.Name + "HybridInfo: " + node.Name + " " + node.InnerText);
hybridInfo.Add(node.Name, ParseHelper.FromString<float>(node.InnerText));
}
}
} }
public class AbsorberModExtention : DefModExtension
public class AbsorberModExtension : DefModExtension
{ {
public bool leakAfterDirty = false; public bool leakAfterDirty = false;
public bool effectsAfterDirty = false; public bool effectsAfterDirty = false;
@ -34,20 +91,20 @@ namespace RJW_Menstruation
public float absorbedfluids = 0; public float absorbedfluids = 0;
public bool dirty = false; public bool dirty = false;
public int wearhours = 0; public int wearhours = 0;
public virtual bool LeakAfterDirty => def.GetModExtension<AbsorberModExtention>().leakAfterDirty; public virtual bool LeakAfterDirty => def.GetModExtension<AbsorberModExtension>().leakAfterDirty;
public virtual bool EffectAfterDirty => def.GetModExtension<AbsorberModExtention>().effectsAfterDirty; public virtual bool EffectAfterDirty => def.GetModExtension<AbsorberModExtension>().effectsAfterDirty;
public virtual ThingDef DirtyDef => def.GetModExtension<AbsorberModExtention>().dirtyDef; public virtual ThingDef DirtyDef => def.GetModExtension<AbsorberModExtension>().dirtyDef;
public virtual int MinHrstoDirtyEffect => def.GetModExtension<AbsorberModExtention>().minHourstoDirtyEffect; public virtual int MinHrstoDirtyEffect => def.GetModExtension<AbsorberModExtension>().minHourstoDirtyEffect;
public Color fluidColor = Color.white; public Color fluidColor = Color.white;
public virtual void DirtyEffect() {}
public virtual void WearEffect() public virtual void DirtyEffect() { }
public virtual void WearEffect()
{ {
absorbedfluids+=0.1f; absorbedfluids += 0.1f;
wearhours++; wearhours++;
} }

View File

@ -32,47 +32,47 @@ namespace RJW_Menstruation
public static readonly string Option1_Label_1 = "Option1_Label_1".Translate(); public static readonly string Option1_Label_1 = "Option1_Label_1".Translate();
public static readonly string Option1_Label_2 = "Option1_Label_2".Translate(); public static readonly string Option1_Label_2 = "Option1_Label_2".Translate();
public static readonly string Option2_Label = "Option2_Label".Translate(); public static readonly string Option2_Label = "Option2_Label".Translate();
public static readonly string Option2_Desc = "Option2_Desc".Translate(); public static readonly string Option2_Desc = "Option2_Desc".Translate();
public static readonly string Option3_Label = "Option3_Label".Translate(); public static readonly string Option3_Label = "Option3_Label".Translate();
public static readonly string Option3_Desc = "Option3_Desc".Translate(); public static readonly string Option3_Desc = "Option3_Desc".Translate();
public static readonly string Option4_Label = "Option4_Label".Translate(); public static readonly string Option4_Label = "Option4_Label".Translate();
public static readonly string Option4_Desc = "Option4_Desc".Translate(); public static readonly string Option4_Desc = "Option4_Desc".Translate();
public static readonly string Option5_Label = "Option5_Label".Translate(); public static readonly string Option5_Label = "Option5_Label".Translate();
public static readonly string Option5_Desc = "Option5_Desc".Translate(); public static readonly string Option5_Desc = "Option5_Desc".Translate();
public static readonly string Option6_Label = "Option6_Label".Translate(); public static readonly string Option6_Label = "Option6_Label".Translate();
public static readonly string Option6_Desc = "Option6_Desc".Translate(); public static readonly string Option6_Desc = "Option6_Desc".Translate();
public static readonly string Option7_Label = "Option7_Label".Translate(); public static readonly string Option7_Label = "Option7_Label".Translate();
public static readonly string Option7_Desc = "Option7_Desc".Translate(); public static readonly string Option7_Desc = "Option7_Desc".Translate();
public static readonly string Option8_Label = "Option8_Label".Translate(); public static readonly string Option8_Label = "Option8_Label".Translate();
public static readonly string Option8_Desc = "Option8_Desc".Translate(); public static readonly string Option8_Desc = "Option8_Desc".Translate();
public static readonly string Option9_Label = "Option9_Label".Translate(); public static readonly string Option9_Label = "Option9_Label".Translate();
public static readonly string Option9_Desc = "Option9_Desc".Translate(); public static readonly string Option9_Desc = "Option9_Desc".Translate();
public static readonly string Option10_Label = "Option10_Label".Translate(); public static readonly string Option10_Label = "Option10_Label".Translate();
public static readonly string Option10_Desc = "Option10_Desc".Translate(); public static readonly string Option10_Desc = "Option10_Desc".Translate();
public static readonly string Option11_Label = "Option11_Label".Translate(); public static readonly string Option11_Label = "Option11_Label".Translate();
public static readonly string Option11_Desc_1 = "Option11_Desc_1".Translate(); public static readonly string Option11_Desc_1 = "Option11_Desc_1".Translate();
public static readonly string Option11_Desc_2 = "Option11_Desc_2".Translate(); public static readonly string Option11_Desc_2 = "Option11_Desc_2".Translate();
public static readonly string Option11_Desc_3 = "Option11_Desc_3".Translate(); public static readonly string Option11_Desc_3 = "Option11_Desc_3".Translate();
public static readonly string Option11_Desc_4 = "Option11_Desc_4".Translate(); public static readonly string Option11_Desc_4 = "Option11_Desc_4".Translate();
public static readonly string Option12_Label = "Option12_Label".Translate(); public static readonly string Option12_Label = "Option12_Label".Translate();
public static readonly string Option12_Desc = "Option12_Desc".Translate(); public static readonly string Option12_Desc = "Option12_Desc".Translate();
public static readonly string Option13_Label = "Option13_Label".Translate(); public static readonly string Option13_Label = "Option13_Label".Translate();
public static readonly string Option13_Desc = "Option13_Desc".Translate(); public static readonly string Option13_Desc = "Option13_Desc".Translate();
public static readonly string Option14_Label = "Option14_Label".Translate(); public static readonly string Option14_Label = "Option14_Label".Translate();
public static readonly string Option14_Desc = "Option14_Desc".Translate(); public static readonly string Option14_Desc = "Option14_Desc".Translate();
public static readonly string Option15_Label = "Option15_Label".Translate(); public static readonly string Option15_Label = "Option15_Label".Translate();
public static readonly string Option15_Desc = "Option15_Desc".Translate(); public static readonly string Option15_Desc = "Option15_Desc".Translate();
public static readonly string Option16_Label = "Option16_Label".Translate(); public static readonly string Option16_Label = "Option16_Label".Translate();
public static readonly string Option16_Desc = "Option16_Desc".Translate(); public static readonly string Option16_Desc = "Option16_Desc".Translate();
public static readonly string Option17_Label = "Option17_Label".Translate(); public static readonly string Option17_Label = "Option17_Label".Translate();
public static readonly string Option17_Desc = "Option17_Desc".Translate(); public static readonly string Option17_Desc = "Option17_Desc".Translate();
public static readonly string Option18_Label = "Option18_Label".Translate(); public static readonly string Option18_Label = "Option18_Label".Translate();
public static readonly string Option18_Desc = "Option18_Desc".Translate(); public static readonly string Option18_Desc = "Option18_Desc".Translate();
public static readonly string Option19_Label_1 = "Option19_Label_1".Translate(); public static readonly string Option19_Label_1 = "Option19_Label_1".Translate();
public static readonly string Option19_Label_2 = "Option19_Label_2".Translate(); public static readonly string Option19_Label_2 = "Option19_Label_2".Translate();
public static readonly string Option19_Desc = "Option19_Desc".Translate(); public static readonly string Option19_Desc = "Option19_Desc".Translate();
public static readonly string Option20_Label_1 = "Option20_Label_1".Translate(); public static readonly string Option20_Label_1 = "Option20_Label_1".Translate();
public static readonly string Option20_Label_2 = "Option20_Label_2".Translate(); public static readonly string Option20_Label_2 = "Option20_Label_2".Translate();
public static readonly string Option20_Label_3 = "Option20_Label_3".Translate(); public static readonly string Option20_Label_3 = "Option20_Label_3".Translate();
@ -80,6 +80,11 @@ namespace RJW_Menstruation
public static readonly string Option20_Label_5 = "Option20_Label_5".Translate(); public static readonly string Option20_Label_5 = "Option20_Label_5".Translate();
public static readonly string Option21_Label = "Option21_Label".Translate(); public static readonly string Option21_Label = "Option21_Label".Translate();
public static readonly string Option21_Desc = "Option21_Desc".Translate(); public static readonly string Option21_Desc = "Option21_Desc".Translate();
public static readonly string Option22_Label = "Option22_Label".Translate();
public static readonly string Option22_Desc = "Option22_Desc".Translate();
public static readonly string Option23_Label = "Option23_Label".Translate();
public static readonly string Option23_Label_1 = "Option23_Label_1".Translate();
public static readonly string Option23_Label_2 = "Option23_Label_2".Translate();
public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate(); public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate();

View File

@ -1,21 +1,16 @@
using System; using RimWorld;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using rjw; using rjw;
using RimWorld; using System;
using System.Linq;
using UnityEngine; using UnityEngine;
using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
public static class Colors public static class Colors
{ {
public static Color blood = new Color(0.78f, 0, 0); public static Color blood = new Color(0.78f, 0, 0);
public static Color CMYKLerp(Color a, Color b, float t) public static Color CMYKLerp(Color a, Color b, float t)
{ {
@ -27,14 +22,14 @@ namespace RJW_Menstruation
public static void RGBtoCMYK(Color rgb, out float c, out float m, out float y, out float k) public static void RGBtoCMYK(Color rgb, out float c, out float m, out float y, out float k)
{ {
k = 1 - Math.Max(rgb.r,Math.Max(rgb.g,rgb.b)); k = 1 - Math.Max(rgb.r, Math.Max(rgb.g, rgb.b));
c = (1 - rgb.r - k) / (1 - k); c = (1 - rgb.r - k) / (1 - k);
m = (1 - rgb.g - k) / (1 - k); m = (1 - rgb.g - k) / (1 - k);
y = (1 - rgb.b - k) / (1 - k); y = (1 - rgb.b - k) / (1 - k);
} }
public static Color CMYKtoRGB(float c,float m, float y, float k) public static Color CMYKtoRGB(float c, float m, float y, float k)
{ {
return new Color((1 - c) * (1 - k), (1 - m) * (1 - k), (1 - y) * (1 - k)); return new Color((1 - c) * (1 - k), (1 - m) * (1 - k), (1 - y) * (1 - k));
} }
@ -46,7 +41,7 @@ namespace RJW_Menstruation
public static class Utility public static class Utility
{ {
public static float GetCumVolume(this Pawn pawn) public static float GetCumVolume(this Pawn pawn)
@ -65,7 +60,7 @@ namespace RJW_Menstruation
{ {
res = 0.0f; res = 0.0f;
} }
if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f,8.0f); if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f);
return res; return res;
} }
@ -178,7 +173,7 @@ namespace RJW_Menstruation
else if (hediff is Hediff_BasePregnancy) else if (hediff is Hediff_BasePregnancy)
{ {
Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff;
string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension<PawnDNAModExtention>()?.fetusTexPath ?? "Fetus/Fetus_Default"; string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension<PawnDNAModExtension>()?.fetusTexPath ?? "Fetus/Fetus_Default";
if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted"; if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted";
else if (h.GestationProgress < 0.3f) icon += "Fetus/Fetus_Early00"; else if (h.GestationProgress < 0.3f) icon += "Fetus/Fetus_Early00";
else if (h.GestationProgress < 0.4f) icon += fetustex + "00"; else if (h.GestationProgress < 0.4f) icon += fetustex + "00";
@ -310,24 +305,24 @@ namespace RJW_Menstruation
{ {
if (pawn.Faction.IsPlayer) if (pawn.Faction.IsPlayer)
{ {
if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Colonist)) return true; if ((Configurations.ShowFlag & Configurations.PawnFlags.Colonist) != 0) return true;
} }
else if (pawn.IsPrisonerOfColony) else if (pawn.IsPrisonerOfColony)
{ {
if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Prisoner)) return true; if ((Configurations.ShowFlag & Configurations.PawnFlags.Prisoner) != 0) return true;
} }
else if (pawn.Faction.PlayerRelationKind == FactionRelationKind.Ally) else if (pawn.Faction.PlayerRelationKind == FactionRelationKind.Ally)
{ {
if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Ally)) return true; if ((Configurations.ShowFlag & Configurations.PawnFlags.Ally) != 0) return true;
} }
else if (pawn.Faction.PlayerRelationKind == FactionRelationKind.Hostile) else if (pawn.Faction.PlayerRelationKind == FactionRelationKind.Hostile)
{ {
if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Hostile)) return true; if ((Configurations.ShowFlag & Configurations.PawnFlags.Hostile) != 0) return true;
} }
else if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Neutral)) return true; else if ((Configurations.ShowFlag & Configurations.PawnFlags.Neutral) != 0) return true;
else return false; else return false;
} }
else if (Configurations.ShowFlag.HasFlag(Configurations.PawnFlags.Neutral)) return true; else if ((Configurations.ShowFlag & Configurations.PawnFlags.Neutral) != 0) return true;
return false; return false;
} }
@ -345,7 +340,7 @@ namespace RJW_Menstruation
public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect) 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); Rect rect = new Rect(wombRect.xMax - wombRect.width / 3, wombRect.y, wombRect.width / 3, wombRect.width / 3);
GUI.color = Color.white; GUI.color = Color.white;
GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit); GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit);
} }

View File

@ -1,11 +1,7 @@
using System; using RimWorld;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw; using rjw;
using System.Linq;
using Verse;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {