diff --git a/About/Manifest.xml b/About/Manifest.xml index c03fce1..32a46d3 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.3.2 + 1.0.4.0 diff --git a/Assemblies/RJW_Menstruation.dll b/Assemblies/RJW_Menstruation.dll index 2ed60ae..746b060 100644 Binary files a/Assemblies/RJW_Menstruation.dll and b/Assemblies/RJW_Menstruation.dll differ diff --git a/Languages/English/Keyed/RJW_Menstruation.xml b/Languages/English/Keyed/RJW_Menstruation.xml index bb2c3d0..06b9329 100644 --- a/Languages/English/Keyed/RJW_Menstruation.xml +++ b/Languages/English/Keyed/RJW_Menstruation.xml @@ -88,9 +88,14 @@ Nipples/areolas won't be darker/wider than this value. Transition speed of nipples Set speed of transition of nipples/areolas. 1 = instant transition - - + Customize Hybrids + Open custom hybrid editor. This will overrides hybrid definitions of XML files. Vaginal washing + Custom Hybrid Editor + Hybrids of {0} + When {0} breed with {1}, {2} will be born at {3}% of chance. If both races have hybrid definitions for each other, the father's definition will be used. + + \ No newline at end of file diff --git a/Languages/Korean/Keyed/RJW_Menstruation.xml b/Languages/Korean/Keyed/RJW_Menstruation.xml index 21898ec..e74b27a 100644 --- a/Languages/Korean/Keyed/RJW_Menstruation.xml +++ b/Languages/Korean/Keyed/RJW_Menstruation.xml @@ -88,7 +88,13 @@ 유두는 이 값 이상으로 변하지 않습니다. 유두 변화 속도 유두가 얼마나 빨리 변하는지 설정합니다. + 잡종 정의 변경하기 + 사용자 지정 잡종 편집기를 엽니다. 이 설정은 XML파일의 잡종 정의를 대체합니다. 질세척 + 사용자 지정 잡종 편집기 + {0}의 잡종설정 + {0}이(가) {1}와(과) 교미했을 때, {2}이(가) {3}%의 확률로 태어납니다. 만약 두 종족이 서로에 대한 잡종 정의가 있을경우 아버지 쪽의 정의가 우선적으로 사용됩니다. + \ No newline at end of file diff --git a/changelogs.txt b/changelogs.txt index 3309b57..3922adc 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,9 @@ +Version 1.0.4.0 + - minor bug fixes + - cums will get maximum thickness initially and become thinner gradually + - added custom hybrid editor + + Version 1.0.3.2 - fixed self-lactating not work properly - pawns having impregnation fetish or lover get less mood penalty on pregnancy diff --git a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index e507da0..d693c90 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; using Verse; @@ -65,6 +66,7 @@ namespace RJW_Menstruation } } + public static List HybridOverride = new List(); public static bool HARActivated = false; @@ -102,6 +104,26 @@ namespace RJW_Menstruation else return Translations.Option23_Label_2; } + public static bool IsOverrideExist(ThingDef def) + { + List removeList = new List(); + if (!HybridOverride.NullOrEmpty()) + foreach(HybridInformations o in HybridOverride) + { + if (o.IsNull) removeList.Add(o); + if (o.defName == def.defName) return true; + } + if (!removeList.NullOrEmpty()) + { + foreach(HybridInformations o in removeList) + { + HybridOverride.Remove(o); + } + } + removeList.Clear(); + return false; + } + [Flags] public enum PawnFlags { @@ -147,6 +169,7 @@ namespace RJW_Menstruation Scribe_Values.Look(ref NipplePermanentTransitionVariance, "NipplePermanentTransitionVariance", NipplePermanentTransitionVariance, true); Scribe_Values.Look(ref NippleMaximumTransition, "NippleMaximumTransition", NippleMaximumTransition, true); Scribe_Values.Look(ref NippleTransitionSpeed, "NippleTransitionSpeed", NippleTransitionSpeed, true); + Scribe_Collections.Look(ref HybridOverride, saveDestroyedThings: true, label: "HybridOverride", lookMode: LookMode.Deep, ctorArgs: new object[0]); base.ExposeData(); } @@ -326,9 +349,10 @@ namespace RJW_Menstruation 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))) + if (Widgets.ButtonText(hybridrect.RightHalf(), Translations.Option28_Label)) { - Configurations.MotherFirst = !Configurations.MotherFirst; + Dialog_HybridCustom.ToggleWindow(); + //Configurations.MotherFirst = !Configurations.MotherFirst; } twinsection.CheckboxLabeled(Translations.Option14_Label, ref Configurations.EnableHeteroOvularTwins, Translations.Option14_Desc); @@ -370,7 +394,7 @@ namespace RJW_Menstruation Configurations.NippleMaximumTransition = Configurations.NippleMaximumTransitionDefault; Configurations.NippleTransitionSpeed = Configurations.NippleTransitionSpeedDefault; - } + } listmain.End(); diff --git a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs index 3a2bc3b..a0b18d6 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs @@ -16,6 +16,16 @@ namespace RJW_Menstruation public string notcumLabel = ""; private bool useCustomColor = false; private float notcumthickness = 0; + private float cumthickness = 1.0f; + + public float CumThickness + { + get + { + return cumthickness; + } + } + public float decayresist { get @@ -131,6 +141,30 @@ namespace RJW_Menstruation Scribe_Values.Look(ref customColor, "customColor", customColor, true); } + + public void MakeThinner(int speed) + { + for (int i=0; i raceList = new List(); + static private List removeList = new List(); + + public Dialog_HybridCustom() + { + BuildRaceList(); + } + + public void BuildRaceList() + { + raceList.Clear(); + if (!VariousDefOf.AllRaces.NullOrEmpty()) + foreach(ThingDef def in VariousDefOf.AllRaces) + { + if (def.race != null) + { + if (Configurations.IsOverrideExist(def)) continue; + else + { + raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridOverride(def); } )); + } + } + } + raceList.SortBy(x => x.Label); + } + + public void AddHybridOverride(ThingDef def) + { + FloatMenuOption option = raceList.FirstOrDefault(x => x.Label.Equals(def?.label)); + if (option != null) + { + raceList.Remove(option); + if (Configurations.HybridOverride.NullOrEmpty()) + { + Configurations.HybridOverride = new List(); + } + Configurations.HybridOverride.Add(new HybridInformations(def)); + Configurations.HybridOverride.SortBy(x => x.GetDef?.label); + } + + } + + public override Vector2 InitialSize + { + get + { + float width = 480f; + float height = 640f; + return new Vector2(width, height); + } + } + + + public override void DoWindowContents(Rect inRect) + { + soundClose = SoundDefOf.CommsWindow_Close; + //closeOnClickedOutside = true; + absorbInputAroundWindow = false; + forcePause = false; + preventCameraMotion = false; + draggable = true; + //resizeable = true; + + if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape)) + { + 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); + + DoMainContents(mainRect); + + if (Widgets.CloseButtonFor(closeRect)) + { + Close(); + } + } + + public override void PostClose() + { + base.PostClose(); + if (!removeList.NullOrEmpty()) + { + foreach (HybridInformations extension in removeList) + { + Configurations.HybridOverride.Remove(extension); + } + raceList.SortBy(x => x.Label); + } + removeList.Clear(); + } + + protected void DoMainContents(Rect inRect) + { + Rect buttonRect = new Rect(inRect.xMax - 120, 0, 100, 30); + Rect titleRect = new Rect(inRect.x, 0, 200, 30); + Widgets.Label(titleRect, Translations.CustomHybrid_List_Title); + Widgets.DrawLineHorizontal(titleRect.x, titleRect.yMax + 12f, inRect.width); + if (Widgets.ButtonText(buttonRect, "Add")) + { + if (!raceList.NullOrEmpty()) Find.WindowStack.Add(new FloatMenu(raceList)); + } + if (!removeList.NullOrEmpty()) + { + buttonRect.x -= 100; + if (Widgets.ButtonText(buttonRect, "Undo")) + { + var element = removeList.Last(); + Configurations.HybridOverride.Add(element); + Configurations.HybridOverride.SortBy(x => x.GetDef.label); + removeList.Remove(element); + } + + foreach (HybridInformations extension in removeList) + { + Configurations.HybridOverride.Remove(extension); + } + raceList.SortBy(x => x.Label); + } + + + + Rect outRect = new Rect(inRect.x, inRect.y + 30f, inRect.width, inRect.height - 30f); + Rect mainRect = new Rect(inRect.x, inRect.y + 30f, inRect.width - 30f, Math.Max(24f*Configurations.HybridOverride.Count(),10f)); + Listing_Standard listmain = new Listing_Standard(); + + listmain.BeginScrollView(outRect, ref scroll, ref mainRect); + listmain.Begin(mainRect); + int i = 0; + if (!Configurations.HybridOverride.NullOrEmpty()) + foreach(HybridInformations extension in Configurations.HybridOverride) + { + if (extension.GetDef != null) DoRow(listmain.GetRect(24f),extension, i++); + } + listmain.EndScrollView(ref mainRect); + listmain.End(); + + + } + + protected void DoRow(Rect rect, HybridInformations extension, int index) + { + Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height); + Widgets.Label(rect, extension.GetDef.label); + if (Widgets.ButtonText(buttonRect, "Delete")) + { + removeList.Add(extension); + //raceList.Add(new FloatMenuOption(extension.GetDef.label, delegate { AddHybridOverride(extension.GetDef); })); + } + buttonRect.x -= 80f; + if (Widgets.ButtonText(buttonRect, "Edit")) + { + Dialog_EditHybrid.OpenWindow(extension); + } + + + Widgets.DrawHighlightIfMouseover(rect); + } + + + public static void ToggleWindow() + { + Dialog_HybridCustom window = (Dialog_HybridCustom)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType().Equals(typeof(Dialog_HybridCustom))); + if (window != null) + { + Find.WindowStack.TryRemove(typeof(Dialog_HybridCustom), true); + } + else + { + SoundDefOf.CommsWindow_Open.PlayOneShotOnCamera(); + Find.WindowStack.Add(new Dialog_HybridCustom()); + } + + + } + + } + + public class Dialog_EditHybrid : Window + { + private const float windowMargin = 20f; + private const float rowH = 24f; + private HybridInformations info; + private Vector2 scroll; + protected List raceList = new List(); + protected List removeList = new List(); + protected float totalWeight = 0; + + public Dialog_EditHybrid(HybridInformations info) + { + this.info = info; + BuildRaceList(); + } + + + + public override Vector2 InitialSize + { + get + { + float width = 840f; + float height = 640f; + return new Vector2(width, height); + } + } + + + public override void DoWindowContents(Rect inRect) + { + soundClose = SoundDefOf.CommsWindow_Close; + //closeOnClickedOutside = true; + absorbInputAroundWindow = false; + forcePause = false; + preventCameraMotion = false; + draggable = true; + //resizeable = true; + + if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape)) + { + 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); + + DoMainContents(mainRect); + + if (Widgets.CloseButtonFor(closeRect)) + { + Close(); + } + } + + public static void OpenWindow(HybridInformations info) + { + Dialog_EditHybrid window = (Dialog_EditHybrid)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType().Equals(typeof(Dialog_EditHybrid))); + if (window != null) + { + if (window.info != info) + { + SoundDefOf.TabOpen.PlayOneShotOnCamera(); + window.ChangeExtension(info); + } + } + else + { + SoundDefOf.TabClose.PlayOneShotOnCamera(); + Find.WindowStack.Add(new Dialog_EditHybrid(info)); + } + + + } + + protected void ChangeExtension(HybridInformations info) + { + this.info = info; + BuildRaceList(); + } + + protected void BuildRaceList() + { + raceList.Clear(); + if (!VariousDefOf.AllRaces.NullOrEmpty()) + foreach (ThingDef def in VariousDefOf.AllRaces) + { + if (def.race != null) + { + if (info.hybridExtension.Exists(x => x.defName == def.defName)) continue; + else + { + raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridInfo(def); })); + } + } + } + raceList.SortBy(x => x.Label); + } + + protected void AddHybridInfo(ThingDef def) + { + FloatMenuOption option = raceList.FirstOrDefault(x => x.Label == def.label); + if (option != null) + { + raceList.Remove(option); + } + info.hybridExtension.Add(new HybridExtensionExposable(def)); + } + + protected void DoMainContents(Rect inRect) + { + Rect labelRect = new Rect(inRect.xMin, inRect.yMin, 300, 24); + Rect buttonRect = new Rect(inRect.xMax - 120, 0, 100, 30); + + Widgets.Label(labelRect, Translations.CustomHybrid_Title(info.GetDef.label)); + Widgets.DrawLineHorizontal(inRect.x, labelRect.yMax, inRect.width); + if (Widgets.ButtonText(buttonRect, "Add")) + { + if (!raceList.NullOrEmpty()) Find.WindowStack.Add(new FloatMenu(raceList)); + } + if (!removeList.EnumerableNullOrEmpty()) + { + buttonRect.x -= 100; + if (Widgets.ButtonText(buttonRect, "Undo")) + { + var element = removeList.Last(); + info.hybridExtension.Add(element); + removeList.Remove(element); + } + + foreach (HybridExtensionExposable element in removeList) + { + info.hybridExtension.Remove(element); + } + } + + + float additionalHeight = 0f; + if (!info.hybridExtension.NullOrEmpty()) foreach(HybridExtensionExposable e in info.hybridExtension) + { + additionalHeight += e.hybridInfo.Count() * rowH; + } + + + Rect outRect = new Rect(inRect.x, inRect.y + 30f, inRect.width, inRect.height - 30f); + Rect mainRect = new Rect(inRect.x, inRect.y + 30f, inRect.width - 30f, rowH * info.hybridExtension.Count() + additionalHeight); + Listing_Standard listmain = new Listing_Standard(); + + listmain.BeginScrollView(outRect, ref scroll, ref mainRect); + listmain.Begin(mainRect); + + if (!info.hybridExtension.NullOrEmpty()) + { + foreach (HybridExtensionExposable extension in info.hybridExtension) + { + DoRow(listmain.GetRect(rowH + rowH * extension.hybridInfo.Count()), extension); + } + + } + + + + listmain.EndScrollView(ref mainRect); + listmain.End(); + } + + protected void DoRow(Rect rect, HybridExtensionExposable extension) + { + Rect mainRect = new Rect(rect.x, rect.y, rect.width, rowH); + Rect subRect = new Rect(rect.x, rect.y + rowH, rect.width, rect.height - rowH); + Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rowH); + Widgets.Label(mainRect, extension.GetDef.label); + + if (Widgets.ButtonText(buttonRect, "Delete")) + { + removeList.Add(extension); + } + buttonRect.x -= 80f; + if (Widgets.ButtonText(buttonRect, "Add")) + { + List list = new List(); + if (!VariousDefOf.AllRaces.NullOrEmpty()) foreach(ThingDef def in VariousDefOf.AllRaces) + { + if (def.race != null) + { + if (extension.hybridInfo.ContainsKey(def.defName)) continue; + else + { + list.Add(new FloatMenuOption(def.label, delegate { extension.hybridInfo.Add(def.defName, 1.0f); })); + } + } + } + if (!list.NullOrEmpty()) Find.WindowStack.Add(new FloatMenu(list)); + } + buttonRect.x -= 80f; + + Listing_Standard sublist = new Listing_Standard(); + sublist.Begin(subRect); + + List removeelements = new List(); + if (!extension.hybridInfo.EnumerableNullOrEmpty()) + { + totalWeight = 0; + foreach(KeyValuePair element in extension.hybridInfo) + { + totalWeight += element.Value; + } + + List keys = new List(extension.hybridInfo.Keys); + foreach (string key in keys) + { + DoSubRow(sublist.GetRect(rowH), key, extension, removeelements); + } + } + if(!removeelements.NullOrEmpty()) foreach(string key in removeelements) + { + extension.hybridInfo.Remove(key); + } + + sublist.End(); + Widgets.DrawHighlightIfMouseover(rect); + + + } + + protected void DoSubRow(Rect rect, string key, HybridExtensionExposable extension , List removeelements) + { + bool isPawnKind = false; + float value = extension.hybridInfo.TryGetValue(key); + string valuestr = value.ToString(); + string label = null; + label = DefDatabase.GetNamedSilentFail(key)?.label; + if (label == null) + { + label = DefDatabase.GetNamedSilentFail(key)?.label; + isPawnKind = true; + } + Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height); + if (Widgets.ButtonText(buttonRect, "Delete")) + { + removeelements.Add(key); + } + buttonRect.x -= 80f; + if (!isPawnKind) + { + if (Widgets.ButtonText(buttonRect, "PawnKind")) + { + List list = new List(); + if (!VariousDefOf.AllKinds.NullOrEmpty()) foreach (PawnKindDef def in VariousDefOf.AllKinds) + { + if (def.race.defName == key) + { + if (extension.hybridInfo.ContainsKey(def.defName)) continue; + else + { + list.Add(new FloatMenuOption(def.label, delegate { extension.hybridInfo.Add(def.defName, 1.0f); })); + } + } + } + if (!list.NullOrEmpty()) Find.WindowStack.Add(new FloatMenu(list)); + else SoundDefOf.ClickReject.PlayOneShotOnCamera(); + } + buttonRect.x -= 80f; + } + else + { + label += ": " + key; + Widgets.Label(buttonRect, "PawnKind"); + buttonRect.x -= 80f; + } + Widgets.Label(rect, " - " + label); + Widgets.TextFieldNumeric(buttonRect, ref value, ref valuestr,0,10000); + extension.hybridInfo.SetOrAdd(key, value); + buttonRect.x -= 80f; + Widgets.Label(buttonRect, String.Format("{0,0:P2}", value / totalWeight)); + Widgets.DrawHighlightIfMouseover(rect); + TooltipHandler.TipRegion(rect, Translations.CustomHybrid_Tooltip(info.GetDef.label, extension.GetDef.label, label, value/totalWeight*100)); + } + + + } + + +} diff --git a/source/RJW_Menstruation/RJW_Menstruation/Dialog_WombStatus.cs b/source/RJW_Menstruation/RJW_Menstruation/Dialog_WombStatus.cs index 8e68cd6..bd9cf5c 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Dialog_WombStatus.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Dialog_WombStatus.cs @@ -372,8 +372,23 @@ namespace RJW_Menstruation statvalue = pawn.records.GetValue(xxx.CountOfBirthEgg); FillableBarLabeled(lineRect, " " + xxx.CountOfBirthEgg.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 100, TextureCache.nurgleTexture, Texture2D.blackTexture); lineRect.y += height; - lineRect.y += height; - lineRect.y += height; + + statvalue = pawn.records.GetValue(xxx.CountOfWhore); + if (statvalue > 0) + { + FillableBarLabeled(lineRect, " " + xxx.CountOfWhore.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 500, TextureCache.slaaneshTexture, Texture2D.blackTexture); + statvalue = pawn.records.GetValue(xxx.EarnedMoneyByWhore); + lineRect.y += height; + FillableBarLabeled(lineRect, " " + VariousDefOf.RJW_EarnedMoneyByWhore.label.CapitalizeFirst() + " " + statvalue, statvalue / 10000, TextureCache.ghalmarazTexture, Texture2D.blackTexture); + + + lineRect.y += height; + } + else + { + lineRect.y += height; + lineRect.y += height; + } statvalue = Configurations.ImplantationChance * comp.Props.baseImplantationChanceFactor * comp.ImplantFactor; FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.fertilityTexture, Texture2D.blackTexture); diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 752c3eb..b2c4c7b 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -510,9 +510,7 @@ namespace RJW_Menstruation { if (cum.pawn.Equals(pawn)) { - cum.volume += volume; - cum.fertvolume += volume * CumInFactor; - cum.FilthDef = filthdef; + cum.MergeWithCum(volume, filthdef); merged = true; } cum.volume *= 1 - cumoutrate; @@ -528,9 +526,7 @@ namespace RJW_Menstruation { if (cum.pawn.Equals(pawn)) { - cum.volume += volume; - cum.fertvolume += volume; - cum.FilthDef = filthdef; + cum.MergeWithCum(volume, filthdef); merged = true; } } @@ -561,10 +557,7 @@ namespace RJW_Menstruation { if (cum.notcum && cum.pawn.Equals(pawn) && cum.notcumLabel.Equals(notcumlabel)) { - cum.volume += volume; - cum.decayresist = decayresist; - cum.fertvolume = 0; - cum.FilthDef = filthdef; + cum.MergeWithFluid(volume, decayresist, filthdef); merged = true; } cum.volume *= 1 - cumoutrate; @@ -580,10 +573,7 @@ namespace RJW_Menstruation { if (cum.notcum && cum.pawn.Equals(pawn) && cum.notcumLabel.Equals(notcumlabel)) { - cum.volume += volume; - cum.decayresist = decayresist; - cum.fertvolume = 0; - cum.FilthDef = filthdef; + cum.MergeWithFluid(volume, decayresist, filthdef); merged = true; } } @@ -665,6 +655,7 @@ namespace RJW_Menstruation cum.volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor)); cum.fertvolume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor) * (1 - (Configurations.CumFertilityDecayRatio * (1 - cum.decayresist)))); vd -= cum.volume; + cum.MakeThinner(Configurations.CycleAcceleration); totalleak += AbsorbCum(cum, vd, absorber); string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); filthlabels.Add(tmp.Replace(" x1", "")); diff --git a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index 26c5110..1a6848a 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -235,7 +235,9 @@ namespace RJW_Menstruation PawnGenerationRequest request = new PawnGenerationRequest( newborn: true, allowDowned: true, + faction: mother.IsPrisoner ? null : mother.Faction, canGeneratePawnRelations: false, + forceGenerateNewPawn: true, colonistRelationChanceFactor: 0, allowFood: false, allowAddictions: false, @@ -412,21 +414,16 @@ namespace RJW_Menstruation PawnKindDef tmp = spawn_kind_def; if (father != null) FatherRaceName = father.kindDef.race.defName; + + + if (FatherRaceName != "" && Configurations.UseHybridExtention) + { + spawn_kind_def = GetHybrid(father, mother); + Log.Message("pawnkind: " + spawn_kind_def?.defName); + } + if (MotherRaceName != FatherRaceName && FatherRaceName != "") { - - if (Configurations.UseHybridExtention) - { - if (Configurations.MotherFirst) - { - spawn_kind_def = GetHybrid(mother, father); - } - else - { - spawn_kind_def = GetHybrid(father, mother); - } - Log.Message("pawnkind: " + spawn_kind_def?.defName); - } if (!Configurations.UseHybridExtention || spawn_kind_def == null) { spawn_kind_def = tmp; @@ -459,7 +456,7 @@ namespace RJW_Menstruation } } - else + else if (!Configurations.UseHybridExtention || spawn_kind_def == null) { spawn_kind_def = mother.RaceProps.AnyPawnKind; } @@ -491,8 +488,23 @@ namespace RJW_Menstruation public PawnKindDef GetHybrid(Pawn first, Pawn second) { - PawnDNAModExtension dna; PawnKindDef res = null; + Pawn opposite = second; + HybridInformations info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def.defName); + if (info == null) + { + info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def.defName); + opposite = first; + } + + if (info != null) + { + res = info.GetHybridWith(opposite.def.defName) ?? null; + } + if (res != null) return res; + + + PawnDNAModExtension dna; dna = first.def.GetModExtension(); if (dna != null) { diff --git a/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs b/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs index 9498afd..ce71e50 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs @@ -140,11 +140,14 @@ namespace RJW_Menstruation //[HarmonyPatch(typeof(TransferableUIUtility), "DoExtraAnimalIcons")] //public class TransferableUIUtility_Patch_Icon //{ - // private static readonly Texture2D PregnantIcon = ContentFinder.Get("UI/Icons/Animal/Pregnant", true); - // public static void Postfix(Transferable trad, Rect rect, ref float curX) + // //private static readonly Texture2D PregnantIcon = ContentFinder.Get("UI/Icons/Animal/Pregnant", true); + // + // + // + // public static void Postfix(Transferable trad, Rect rect, ref float curX, Texture2D ___PregnantIcon) // { // Pawn pawn = trad.AnyThing as Pawn; - // if (pawn.IsVisiblyPregnant()) + // if (pawn?.health?.hediffSet != null && pawn.IsVisiblyPregnant()) // { // Rect rect3 = new Rect(curX - 24f, (rect.height - 24f) / 2f, 24f, 24f); // curX -= 24f; @@ -152,28 +155,12 @@ namespace RJW_Menstruation // { // TooltipHandler.TipRegion(rect3, PawnColumnWorker_Pregnant.GetTooltipText(pawn)); // } - // GUI.DrawTexture(rect3, PregnantIcon); + // GUI.DrawTexture(rect3, ___PregnantIcon); // } // } //} - //[HarmonyPatch(typeof(JobGiver_OptimizeApparel), "ApparelScoreGain_NewTmp")] - //public class OptimizeApparel_Patch - //{ - // public static bool Prefix(ref float __result, Pawn pawn, Apparel ap, List wornScoresCache) - // { - // if (ap is Absorber) - // { - // __result = -1000f; - // return false; - // } - // return true; - // } - // - //} - - } diff --git a/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 743f919..062ae9e 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -57,6 +57,7 @@ + diff --git a/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs b/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs index db4ebfc..f892a55 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs @@ -76,6 +76,14 @@ namespace RJW_Menstruation return fertilitytexturecache; } } + public static Texture2D ghalmarazTexture + { + get + { + if (ghalmaraztexturecache == null) ghalmaraztexturecache = SolidColorMaterials.NewSolidColorTexture(0.7f, 0.7f, 0.0f, 1.0f); + return ghalmaraztexturecache; + } + } @@ -88,6 +96,7 @@ namespace RJW_Menstruation private static Texture2D humantexturecache = null; private static Texture2D animaltexturecache = null; private static Texture2D fertilitytexturecache = null; + private static Texture2D ghalmaraztexturecache = null; diff --git a/source/RJW_Menstruation/RJW_Menstruation/Things.cs b/source/RJW_Menstruation/RJW_Menstruation/Things.cs index bc4a5af..b25f675 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Things.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Things.cs @@ -16,7 +16,7 @@ namespace RJW_Menstruation public float cumThickness = 0f; public List hybridExtension; - public HybridExtension GetHybridExtention(string race) + public HybridExtension GetHybridExtension(string race) { if (hybridExtension.NullOrEmpty()) return null; else @@ -27,7 +27,7 @@ namespace RJW_Menstruation public PawnKindDef GetHybridWith(string race) { - return GetHybridExtention(race)?.ChooseOne() ?? null; + return GetHybridExtension(race)?.ChooseOne() ?? null; } } @@ -36,19 +36,22 @@ namespace RJW_Menstruation public Dictionary hybridInfo; public ThingDef thingDef; - + public HybridExtension() { } + public PawnKindDef ChooseOne() { + if (hybridInfo.EnumerableNullOrEmpty()) return null; PawnKindDef res = null; do { - res = DefDatabase.GetNamedSilentFail(hybridInfo.RandomElementByWeight(x => x.Value).Key); - if (res == null) res = DefDatabase.GetNamedSilentFail(hybridInfo.RandomElementByWeight(x => x.Value).Key).race.AnyPawnKind; + string key = hybridInfo.RandomElementByWeight(x => x.Value).Key; + res = DefDatabase.GetNamedSilentFail(key); + if (res == null) res = DefDatabase.GetNamedSilentFail(key).race.AnyPawnKind; - if (res == null) hybridInfo.Remove(res.defName); + if (res == null) hybridInfo.Remove(key); } while (res == null && !hybridInfo.EnumerableNullOrEmpty()); return res; @@ -63,9 +66,9 @@ namespace RJW_Menstruation if (childNodes.Count >= 1) foreach (XmlNode node in childNodes) { -#if DEBUG + #if DEBUG Log.Message(xmlRoot.Name + "HybridInfo: " + node.Name + " " + node.InnerText); -#endif + #endif hybridInfo.Add(node.Name, ParseHelper.FromString(node.InnerText)); } @@ -73,8 +76,123 @@ namespace RJW_Menstruation } + + } + public class HybridInformations : IExposable + { + public List hybridExtension = new List(); + + private ThingDef thingDef; + private string thingDefName; + + public string defName + { + get + { + return thingDefName; + } + } + public bool IsNull + { + get + { + return thingDefName?.Length < 1; + } + } + public ThingDef GetDef + { + get + { + if (thingDef != null) return thingDef; + else + { + thingDef = DefDatabase.GetNamedSilentFail(thingDefName); + return thingDef; + } + } + } + + public HybridInformations() { } + + public HybridInformations(ThingDef def) + { + thingDef = def; + thingDefName = def.defName; + } + + public HybridExtensionExposable GetHybridExtension(string race) + { + if (hybridExtension.NullOrEmpty()) return null; + else + { + return hybridExtension.Find(x => x.GetDef.defName?.Equals(race) ?? false); + } + } + + public PawnKindDef GetHybridWith(string race) + { + return GetHybridExtension(race)?.ChooseOne() ?? null; + } + + public void ExposeData() + { + Scribe_Values.Look(ref thingDefName, "thingDefName"); + Scribe_Collections.Look(ref hybridExtension, "hybridExtension", LookMode.Deep, new object[0]); + } + + + + } + + public class HybridExtensionExposable : HybridExtension, IExposable + { + private string thingDefName; + + public string defName + { + get + { + return thingDefName; + } + } + public bool IsNull + { + get + { + return thingDefName?.Length < 1; + } + } + public ThingDef GetDef + { + get + { + if (thingDef != null) return thingDef; + else + { + thingDef = DefDatabase.GetNamedSilentFail(thingDefName); + return thingDef; + } + } + } + + public HybridExtensionExposable() { } + + public HybridExtensionExposable(ThingDef def) + { + thingDef = def; + thingDefName = def.defName; + hybridInfo = new Dictionary(); + } + + public void ExposeData() + { + Scribe_Values.Look(ref thingDefName, "thingDefName"); + Scribe_Collections.Look(ref hybridInfo, "hybridInfo", LookMode.Value, LookMode.Value); + + } + } diff --git a/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index 67b68aa..46e17f4 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -95,9 +95,12 @@ namespace RJW_Menstruation public static readonly string Option27_Label = "Option27_Label".Translate(); public static readonly string Option27_Desc = "Option27_Desc".Translate(); public static readonly string Option28_Label = "Option28_Label".Translate(); - public static readonly string Option28_Desc = "Option28_Desc".Translate(); + public static readonly string Option28_Tooltip = "Option28_Tooltip".Translate(); public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate(); + public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".Translate(); + static public string CustomHybrid_Title(string label) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Title", label); } + static public string CustomHybrid_Tooltip(string label, string breedee, string baby, float chance) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Tooltip", label, breedee, baby, chance); } } } diff --git a/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 73de632..7d4c605 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -52,6 +52,8 @@ namespace RJW_Menstruation public static System.Random random = new System.Random(Environment.TickCount); + + public static float GetCumVolume(this Pawn pawn) { CompHediffBodyPart part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp(); diff --git a/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 83e1e52..600521f 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -1,6 +1,8 @@ using RimWorld; using rjw; using System.Linq; +using System; +using System.Collections.Generic; using Verse; namespace RJW_Menstruation @@ -40,6 +42,36 @@ namespace RJW_Menstruation public static readonly HediffDef_PartBase Vagina = DefDatabase.GetNamed("Vagina"); public static readonly CompProperties_Menstruation VaginaCompProperties = (CompProperties_Menstruation)Vagina.comps.FirstOrDefault(x => x is CompProperties_Menstruation); public static readonly KeyBindingDef OpenStatusWindowKey = DefDatabase.GetNamed("OpenStatusWindow"); + public static readonly PawnColumnDef RJW_EarnedMoneyByWhore = DefDatabase.GetNamed("RJW_EarnedMoneyByWhore"); + + private static List allraces = null; + private static List allkinds = null; + + public static List AllRaces + { + get + { + if (allraces == null) + { + List allThings = DefDatabase.AllDefsListForReading; + allraces = allThings.FindAll(x => x.race != null); + } + return allraces; + } + } + public static List AllKinds + { + get + { + if (allkinds == null) + { + List allKinds = DefDatabase.AllDefsListForReading; + allkinds = allKinds.FindAll(x => x.race != null); + } + return allkinds; + } + } + // Defs from Milkable Colonists @@ -47,8 +79,7 @@ namespace RJW_Menstruation public static readonly HediffDef Hediff_Lactating_Natural = DefDatabase.GetNamedSilentFail("Lactating_Natural"); public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Lactating_Permanent"); public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Heavy_Lactating_Permanent"); - public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamed("LactateSelf_MC"); - + public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamedSilentFail("LactateSelf_MC");