This commit is contained in:
moreoreganostodump 2021-07-01 01:02:42 +09:00
parent cb898a5bc2
commit 96bca993c7
17 changed files with 113 additions and 50 deletions

Binary file not shown.

View File

@ -11,7 +11,7 @@
<li> <li>
<label>dripping fluids</label> <label>dripping fluids</label>
<description>It bothers me.</description> <description>It bothers me.</description>
<baseMoodEffect>-1</baseMoodEffect> <baseMoodEffect>-2</baseMoodEffect>
</li> </li>
</stages> </stages>
</ThoughtDef> </ThoughtDef>

View File

@ -90,12 +90,14 @@
<Option27_Desc>Set speed of transition of nipples/areolas.&#10;1 = instant transition</Option27_Desc> <Option27_Desc>Set speed of transition of nipples/areolas.&#10;1 = instant transition</Option27_Desc>
<Option28_Label>Customize Hybrids</Option28_Label> <Option28_Label>Customize Hybrids</Option28_Label>
<Option28_Tooltip>Open custom hybrid editor.&#10;This will overrides hybrid definitions of XML files.</Option28_Tooltip> <Option28_Tooltip>Open custom hybrid editor.&#10;This will overrides hybrid definitions of XML files.</Option28_Tooltip>
<Option29_Label>Allow shrink icon</Option29_Label>
<Option29_Desc>Let icon become smaller If needed.</Option29_Desc>
<FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf> <FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf>
<CustomHybrid_List_Title>Custom Hybrid Editor</CustomHybrid_List_Title> <CustomHybrid_List_Title>Custom Hybrid Editor</CustomHybrid_List_Title>
<CustomHybrid_Title>Hybrids of {0}</CustomHybrid_Title> <CustomHybrid_Title>Hybrids of {0}</CustomHybrid_Title>
<CustomHybrid_Tooltip>When {0} breed with {1}, {2} will be born at {3}% of chance.&#10;If both races have hybrid definitions for each other, the father's definition will be used.</CustomHybrid_Tooltip> <CustomHybrid_Tooltip>When {0} breed with {1}, {2} will be born at {3} chance.&#10;If both races have hybrid definitions for each other, the father's definition will be used.</CustomHybrid_Tooltip>
</LanguageData> </LanguageData>

View File

@ -90,11 +90,13 @@
<Option27_Desc>유두가 얼마나 빨리 변하는지 설정합니다.</Option27_Desc> <Option27_Desc>유두가 얼마나 빨리 변하는지 설정합니다.</Option27_Desc>
<Option28_Label>잡종 정의 변경하기</Option28_Label> <Option28_Label>잡종 정의 변경하기</Option28_Label>
<Option28_Tooltip>사용자 지정 잡종 편집기를 엽니다.&#10;이 설정은 XML파일의 잡종 정의를 대체합니다.</Option28_Tooltip> <Option28_Tooltip>사용자 지정 잡종 편집기를 엽니다.&#10;이 설정은 XML파일의 잡종 정의를 대체합니다.</Option28_Tooltip>
<Option29_Label>아이콘 축소 허용</Option29_Label>
<Option29_Desc>아이콘 축소를 허용합니다.</Option29_Desc>
<FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf> <FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf>
<CustomHybrid_List_Title>사용자 지정 잡종 편집기</CustomHybrid_List_Title> <CustomHybrid_List_Title>사용자 지정 잡종 편집기</CustomHybrid_List_Title>
<CustomHybrid_Title>{0}의 잡종설정</CustomHybrid_Title> <CustomHybrid_Title>{0}의 잡종설정</CustomHybrid_Title>
<CustomHybrid_Tooltip>{0}이(가) {1}와(과) 교미했을 때, {2}이(가) {3}%의 확률로 태어납니다.&#10;만약 두 종족이 서로에 대한 잡종 정의가 있을경우 아버지 쪽의 정의가 우선적으로 사용됩니다.</CustomHybrid_Tooltip> <CustomHybrid_Tooltip>{0}이(가) {1}와(과) 교미했을 때, {2}이(가) {3}의 확률로 태어납니다.&#10;만약 두 종족이 서로에 대한 잡종 정의가 있을경우 아버지 쪽의 정의가 우선적으로 사용됩니다.</CustomHybrid_Tooltip>
</LanguageData> </LanguageData>

View File

@ -184,6 +184,19 @@
</value> </value>
</Operation> </Operation>
<Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[defName="WildBoar"]</xpath>
<value>
<li Class="RJW_Menstruation.PawnDNAModExtension">
<fetusTexPath>Fetus/Livestocks/Fetus_Pig</fetusTexPath>
<cumColor>(255,255,255,255)</cumColor>
<cumThickness>0.8</cumThickness>
<hybridExtension>
</hybridExtension>
</li>
</value>
</Operation>
<Operation Class="PatchOperationAddModExtension"> <Operation Class="PatchOperationAddModExtension">
<xpath>Defs/ThingDef[@Name="BaseInsect"]</xpath> <xpath>Defs/ThingDef[@Name="BaseInsect"]</xpath>
<value> <value>

View File

@ -1,3 +1,10 @@
Version 1.0.4.1
- fixed errors when the race mods are uninstalled
- minor bug fixes
- removed mechanoids from hybrid table
- increased probability weight range of custom hybrid
- breasts size increase gradually after pregnancy about one cup
Version 1.0.4.0 Version 1.0.4.0
- minor bug fixes - minor bug fixes
- cums will get maximum thickness initially and become thinner gradually - cums will get maximum thickness initially and become thinner gradually

View File

@ -53,6 +53,7 @@ namespace RJW_Menstruation
public static PawnFlags ShowFlag = PawnFlags.Colonist | PawnFlags.Prisoner; public static PawnFlags ShowFlag = PawnFlags.Colonist | PawnFlags.Prisoner;
public static bool UseHybridExtention = true; public static bool UseHybridExtention = true;
public static bool MotherFirst = false; public static bool MotherFirst = false;
public static bool AllowShrinkIcon = false;
public static float NippleTransitionVariance = NippleTransitionVarianceDefault; public static float NippleTransitionVariance = NippleTransitionVarianceDefault;
public static float NipplePermanentTransitionVariance = NipplePermanentTransitionVarianceDefault; public static float NipplePermanentTransitionVariance = NipplePermanentTransitionVarianceDefault;
@ -65,6 +66,8 @@ namespace RJW_Menstruation
return NippleTransitionVariance * NippleTransitionSpeed; return NippleTransitionVariance * NippleTransitionSpeed;
} }
} }
public static List<HybridInformations> HybridOverride = new List<HybridInformations>(); public static List<HybridInformations> HybridOverride = new List<HybridInformations>();
@ -169,6 +172,7 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref NipplePermanentTransitionVariance, "NipplePermanentTransitionVariance", NipplePermanentTransitionVariance, true); Scribe_Values.Look(ref NipplePermanentTransitionVariance, "NipplePermanentTransitionVariance", NipplePermanentTransitionVariance, true);
Scribe_Values.Look(ref NippleMaximumTransition, "NippleMaximumTransition", NippleMaximumTransition, true); Scribe_Values.Look(ref NippleMaximumTransition, "NippleMaximumTransition", NippleMaximumTransition, true);
Scribe_Values.Look(ref NippleTransitionSpeed, "NippleTransitionSpeed", NippleTransitionSpeed, true); Scribe_Values.Look(ref NippleTransitionSpeed, "NippleTransitionSpeed", NippleTransitionSpeed, true);
Scribe_Values.Look(ref AllowShrinkIcon, "AllowShrinkIcon", AllowShrinkIcon, true);
Scribe_Collections.Look(ref HybridOverride, saveDestroyedThings: true, label: "HybridOverride", lookMode: LookMode.Deep, ctorArgs: new object[0]); Scribe_Collections.Look(ref HybridOverride, saveDestroyedThings: true, label: "HybridOverride", lookMode: LookMode.Deep, ctorArgs: new object[0]);
base.ExposeData(); base.ExposeData();
} }
@ -233,13 +237,14 @@ namespace RJW_Menstruation
//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)
{ {
Listing_Standard wombsection = listmain.BeginSection_NewTemp(376); Listing_Standard wombsection = listmain.BeginSection_NewTemp(400);
wombsection.CheckboxLabeled(Translations.Option9_Label, ref Configurations.DrawWombStatus, Translations.Option9_Desc); wombsection.CheckboxLabeled(Translations.Option9_Label, ref Configurations.DrawWombStatus, Translations.Option9_Desc);
if (Configurations.DrawWombStatus) if (Configurations.DrawWombStatus)
{ {
wombsection.CheckboxLabeled(Translations.Option18_Label, ref Configurations.DrawEggOverlay, Translations.Option18_Desc); wombsection.CheckboxLabeled(Translations.Option18_Label, ref Configurations.DrawEggOverlay, Translations.Option18_Desc);
} }
wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc); wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc);
wombsection.CheckboxLabeled(Translations.Option29_Label, ref Configurations.AllowShrinkIcon, Translations.Option29_Desc);
if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.InfoDetail))) if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.InfoDetail)))
{ {
if (Configurations.InfoDetail == Configurations.DetailLevel.Hide) Configurations.InfoDetail = Configurations.DetailLevel.All; if (Configurations.InfoDetail == Configurations.DetailLevel.Hide) Configurations.InfoDetail = Configurations.DetailLevel.All;
@ -354,6 +359,7 @@ namespace RJW_Menstruation
Dialog_HybridCustom.ToggleWindow(); Dialog_HybridCustom.ToggleWindow();
//Configurations.MotherFirst = !Configurations.MotherFirst; //Configurations.MotherFirst = !Configurations.MotherFirst;
} }
TooltipHandler.TipRegion(hybridrect, Translations.Option28_Tooltip);
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);

View File

@ -34,11 +34,12 @@ namespace RJW_Menstruation
public class HediffComp_Breast : HediffComp public class HediffComp_Breast : HediffComp
{ {
public const float defaultalpha = -1; public const float DEFAULTALPHA = -1;
public const float defaultareola = -1; public const float DEFAULTAREOLA = -1;
public const float defaultnipple = -1; public const float DEFAULTNIPPLE = -1;
public const float variation = 0.2f; public const float VARIANT = 0.2f;
public const int tickinterval = 3750; public const int TICKINTERVAL = 3750;
public const float MAX_BREAST_INCREMENT = 0.10f;
public CompProperties_Breast Props; public CompProperties_Breast Props;
@ -57,7 +58,7 @@ namespace RJW_Menstruation
protected float originnipple = -1f; protected float originnipple = -1f;
protected Color cachedcolor; protected Color cachedcolor;
protected bool loaded = false; protected bool loaded = false;
protected bool pregnant = false;
public Action action; public Action action;
public float MaxAlpha public float MaxAlpha
@ -117,19 +118,20 @@ namespace RJW_Menstruation
public override void CompExposeData() public override void CompExposeData()
{ {
base.CompExposeData(); base.CompExposeData();
Scribe_Values.Look(ref alphaPermanent, "alphaPermanent", defaultalpha, true); Scribe_Values.Look(ref alphaPermanent, "alphaPermanent", DEFAULTALPHA, true);
Scribe_Values.Look(ref alphaCurrent, "alphaCurrent", defaultalpha, true); Scribe_Values.Look(ref alphaCurrent, "alphaCurrent", DEFAULTALPHA, true);
Scribe_Values.Look(ref alpha, "alpha", defaultalpha, true); Scribe_Values.Look(ref alpha, "alpha", DEFAULTALPHA, true);
Scribe_Values.Look(ref areolaSizePermanent, "areolaSizePermanent", defaultareola, true); Scribe_Values.Look(ref areolaSizePermanent, "areolaSizePermanent", DEFAULTAREOLA, true);
Scribe_Values.Look(ref areolaSizeCurrent, "areolaSizeCurrent", defaultareola, true); Scribe_Values.Look(ref areolaSizeCurrent, "areolaSizeCurrent", DEFAULTAREOLA, true);
Scribe_Values.Look(ref areolaSize, "areolaSize", defaultareola, true); Scribe_Values.Look(ref areolaSize, "areolaSize", DEFAULTAREOLA, true);
Scribe_Values.Look(ref nippleSizePermanent, "nippleSizePermanent", defaultnipple, true); Scribe_Values.Look(ref nippleSizePermanent, "nippleSizePermanent", DEFAULTNIPPLE, true);
Scribe_Values.Look(ref nippleSizeCurrent, "nippleSizeCurrent", defaultnipple, true); Scribe_Values.Look(ref nippleSizeCurrent, "nippleSizeCurrent", DEFAULTNIPPLE, true);
Scribe_Values.Look(ref nippleSize, "nippleSize", defaultnipple, true); Scribe_Values.Look(ref nippleSize, "nippleSize", DEFAULTNIPPLE, true);
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true); Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
Scribe_Values.Look(ref originalpha, "originalpha", originalpha, true); Scribe_Values.Look(ref originalpha, "originalpha", originalpha, true);
Scribe_Values.Look(ref originareola, "originareola", originareola, true); Scribe_Values.Look(ref originareola, "originareola", originareola, true);
Scribe_Values.Look(ref originnipple, "originnipple", originnipple, true); Scribe_Values.Look(ref originnipple, "originnipple", originnipple, true);
Scribe_Values.Look(ref pregnant, "pregnant", pregnant, true);
} }
@ -174,7 +176,7 @@ namespace RJW_Menstruation
} }
UpdateColor(); UpdateColor();
loaded = true; loaded = true;
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, tickinterval, parent.pawn); HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
} }
@ -185,7 +187,24 @@ namespace RJW_Menstruation
areolaSizeCurrent = Mathf.Lerp(areolaSizeCurrent, areolaSize, Configurations.NippleTransitionRatio); areolaSizeCurrent = Mathf.Lerp(areolaSizeCurrent, areolaSize, Configurations.NippleTransitionRatio);
nippleSizeCurrent = Mathf.Lerp(nippleSizeCurrent, nippleSize, Configurations.NippleTransitionRatio); nippleSizeCurrent = Mathf.Lerp(nippleSizeCurrent, nippleSize, Configurations.NippleTransitionRatio);
UpdateColor(); UpdateColor();
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, tickinterval, parent.pawn); HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
if (pregnant)
{
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
{
breastSizeIncreased += 0.02f;
parent.Severity += 0.02f;
}
}
else
{
if (breastSizeIncreased > 0)
{
breastSizeIncreased -= 0.02f;
parent.Severity -= 0.02f;
}
}
} }
public void ChangeColorFermanant(float alpha) public void ChangeColorFermanant(float alpha)
@ -200,12 +219,13 @@ namespace RJW_Menstruation
public void PregnancyTransition() public void PregnancyTransition()
{ {
alphaPermanent = Math.Min(MaxAlpha, alphaPermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(variation)); alphaPermanent = Math.Min(MaxAlpha, alphaPermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(variation)); areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(variation)); nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
alpha = Math.Min(MaxAlpha, alpha + Configurations.NippleTransitionVariance.VariationRange(variation)); alpha = Math.Min(MaxAlpha, alpha + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
areolaSize = Math.Min(MaxAreola, areolaSize + Configurations.NippleTransitionVariance.VariationRange(variation)); areolaSize = Math.Min(MaxAreola, areolaSize + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
nippleSize = Math.Min(MaxNipple, nippleSize + Configurations.NippleTransitionVariance.VariationRange(variation)); nippleSize = Math.Min(MaxNipple, nippleSize + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
pregnant = true;
} }
public void BirthTransition() public void BirthTransition()
@ -213,6 +233,7 @@ namespace RJW_Menstruation
alpha = alphaPermanent; alpha = alphaPermanent;
areolaSize = areolaSizePermanent; areolaSize = areolaSizePermanent;
nippleSize = nippleSizePermanent; nippleSize = nippleSizePermanent;
pregnant = false;
} }
@ -244,7 +265,7 @@ namespace RJW_Menstruation
public void UpdateColor() public void UpdateColor()
{ {
cachedcolor = Colors.CMYKLerp(parent.pawn.story.SkinColor, Props.BlackNippleColor, Alpha); cachedcolor = Colors.CMYKLerp(parent?.pawn?.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
} }
public string DebugInfo() public string DebugInfo()

View File

@ -345,7 +345,7 @@ namespace RJW_Menstruation
updateTraits(baby, traitpool); updateTraits(baby, traitpool);
} }
else else if (baby.relations != null)
{ {
baby.relations.AddDirectRelation(VariousDefOf.Relation_birthgiver, mother); baby.relations.AddDirectRelation(VariousDefOf.Relation_birthgiver, mother);
mother.relations.AddDirectRelation(VariousDefOf.Relation_spawn, baby); mother.relations.AddDirectRelation(VariousDefOf.Relation_spawn, baby);
@ -419,7 +419,7 @@ namespace RJW_Menstruation
if (FatherRaceName != "" && Configurations.UseHybridExtention) if (FatherRaceName != "" && Configurations.UseHybridExtention)
{ {
spawn_kind_def = GetHybrid(father, mother); spawn_kind_def = GetHybrid(father, mother);
Log.Message("pawnkind: " + spawn_kind_def?.defName); //Log.Message("pawnkind: " + spawn_kind_def?.defName);
} }
if (MotherRaceName != FatherRaceName && FatherRaceName != "") if (MotherRaceName != FatherRaceName && FatherRaceName != "")
@ -490,10 +490,10 @@ namespace RJW_Menstruation
{ {
PawnKindDef res = null; PawnKindDef res = null;
Pawn opposite = second; Pawn opposite = second;
HybridInformations info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def.defName); HybridInformations info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def.defName && x.hybridExtension.Exists(y => y.defName == second.def.defName));
if (info == null) if (info == null)
{ {
info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def.defName); info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def.defName && x.hybridExtension.Exists(y => y.defName == first.def.defName));
opposite = first; opposite = first;
} }

View File

@ -95,6 +95,7 @@ namespace RJW_Menstruation
defaultDesc = description, defaultDesc = description,
icon = icon, icon = icon,
icon_overay = icon_overay, icon_overay = icon_overay,
shrinkable = Configurations.AllowShrinkIcon,
cumcolor = c, cumcolor = c,
comp = comp, comp = comp,
order = 100, order = 100,

View File

@ -57,8 +57,8 @@
<ItemGroup> <ItemGroup>
<Compile Include="Configurations.cs" /> <Compile Include="Configurations.cs" />
<Compile Include="Cum.cs" /> <Compile Include="Cum.cs" />
<Compile Include="Dialog_HybridCustom.cs" /> <Compile Include="UI\Dialog_HybridCustom.cs" />
<Compile Include="Dialog_WombStatus.cs" /> <Compile Include="UI\Dialog_WombStatus.cs" />
<Compile Include="DrugOutcomDoers.cs" /> <Compile Include="DrugOutcomDoers.cs" />
<Compile Include="FilthMaker_Colored.cs" /> <Compile Include="FilthMaker_Colored.cs" />
<Compile Include="HARCompatibility.cs" /> <Compile Include="HARCompatibility.cs" />
@ -67,7 +67,7 @@
<Compile Include="Hediff_MultiplePregnancy.cs" /> <Compile Include="Hediff_MultiplePregnancy.cs" />
<Compile Include="JobDrivers.cs" /> <Compile Include="JobDrivers.cs" />
<Compile Include="Patch\GetGizmos.cs" /> <Compile Include="Patch\GetGizmos.cs" />
<Compile Include="Gizmo_Womb.cs" /> <Compile Include="UI\Gizmo_Womb.cs" />
<Compile Include="Patch\Harmony.cs" /> <Compile Include="Patch\Harmony.cs" />
<Compile Include="HediffComps\HediffComp_Menstruation.cs" /> <Compile Include="HediffComps\HediffComp_Menstruation.cs" />
<Compile Include="Patch\Pawn_Patch.cs" /> <Compile Include="Patch\Pawn_Patch.cs" />

View File

@ -9,6 +9,7 @@ using UnityEngine;
namespace RJW_Menstruation namespace RJW_Menstruation
{ {
[StaticConstructorOnStartup]
public static class TextureCache public static class TextureCache
{ {

View File

@ -96,11 +96,13 @@ namespace RJW_Menstruation
public static readonly string Option27_Desc = "Option27_Desc".Translate(); public static readonly string Option27_Desc = "Option27_Desc".Translate();
public static readonly string Option28_Label = "Option28_Label".Translate(); public static readonly string Option28_Label = "Option28_Label".Translate();
public static readonly string Option28_Tooltip = "Option28_Tooltip".Translate(); public static readonly string Option28_Tooltip = "Option28_Tooltip".Translate();
public static readonly string Option29_Label = "Option29_Label".Translate();
public static readonly string Option29_Desc = "Option29_Desc".Translate();
public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate(); public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate();
public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".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_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); } static public string CustomHybrid_Tooltip(string label, string breedee, string baby, string chance) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Tooltip", label, breedee, baby, chance); }
} }
} }

View File

@ -52,7 +52,7 @@ namespace RJW_Menstruation
Configurations.HybridOverride = new List<HybridInformations>(); Configurations.HybridOverride = new List<HybridInformations>();
} }
Configurations.HybridOverride.Add(new HybridInformations(def)); Configurations.HybridOverride.Add(new HybridInformations(def));
Configurations.HybridOverride.SortBy(x => x.GetDef?.label); Configurations.HybridOverride.SortBy(x => x.GetDef?.label ?? "Undefined");
} }
} }
@ -126,7 +126,7 @@ namespace RJW_Menstruation
{ {
var element = removeList.Last(); var element = removeList.Last();
Configurations.HybridOverride.Add(element); Configurations.HybridOverride.Add(element);
Configurations.HybridOverride.SortBy(x => x.GetDef.label); Configurations.HybridOverride.SortBy(x => x.GetDef?.label ?? "Undefined");
removeList.Remove(element); removeList.Remove(element);
} }
@ -160,7 +160,7 @@ namespace RJW_Menstruation
protected void DoRow(Rect rect, HybridInformations extension, int index) protected void DoRow(Rect rect, HybridInformations extension, int index)
{ {
Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height); Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height);
Widgets.Label(rect, extension.GetDef.label); Widgets.Label(rect, extension.GetDef?.label ?? "Undefined");
if (Widgets.ButtonText(buttonRect, "Delete")) if (Widgets.ButtonText(buttonRect, "Delete"))
{ {
removeList.Add(extension); removeList.Add(extension);
@ -310,7 +310,7 @@ namespace RJW_Menstruation
Rect labelRect = new Rect(inRect.xMin, inRect.yMin, 300, 24); Rect labelRect = new Rect(inRect.xMin, inRect.yMin, 300, 24);
Rect buttonRect = new Rect(inRect.xMax - 120, 0, 100, 30); Rect buttonRect = new Rect(inRect.xMax - 120, 0, 100, 30);
Widgets.Label(labelRect, Translations.CustomHybrid_Title(info.GetDef.label)); Widgets.Label(labelRect, Translations.CustomHybrid_Title(info.GetDef?.label ?? "Undefined"));
Widgets.DrawLineHorizontal(inRect.x, labelRect.yMax, inRect.width); Widgets.DrawLineHorizontal(inRect.x, labelRect.yMax, inRect.width);
if (Widgets.ButtonText(buttonRect, "Add")) if (Widgets.ButtonText(buttonRect, "Add"))
{ {
@ -367,7 +367,7 @@ namespace RJW_Menstruation
Rect mainRect = new Rect(rect.x, rect.y, rect.width, rowH); 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 subRect = new Rect(rect.x, rect.y + rowH, rect.width, rect.height - rowH);
Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rowH); Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rowH);
Widgets.Label(mainRect, extension.GetDef.label); Widgets.Label(mainRect, extension.GetDef?.label ?? "Undefined");
if (Widgets.ButtonText(buttonRect, "Delete")) if (Widgets.ButtonText(buttonRect, "Delete"))
{ {
@ -388,7 +388,12 @@ namespace RJW_Menstruation
} }
} }
} }
if (!list.NullOrEmpty()) Find.WindowStack.Add(new FloatMenu(list)); if (!list.NullOrEmpty())
{
list.SortBy(x => x.Label);
Find.WindowStack.Add(new FloatMenu(list));
}
} }
buttonRect.x -= 80f; buttonRect.x -= 80f;
@ -424,13 +429,13 @@ namespace RJW_Menstruation
protected void DoSubRow(Rect rect, string key, HybridExtensionExposable extension , List<string> removeelements) protected void DoSubRow(Rect rect, string key, HybridExtensionExposable extension , List<string> removeelements)
{ {
bool isPawnKind = false; bool isPawnKind = false;
float value = extension.hybridInfo.TryGetValue(key); int value = (int)extension.hybridInfo.TryGetValue(key);
string valuestr = value.ToString(); string valuestr = value.ToString();
string label = null; string label = null;
label = DefDatabase<ThingDef>.GetNamedSilentFail(key)?.label; label = DefDatabase<ThingDef>.GetNamedSilentFail(key)?.label;
if (label == null) if (label == null)
{ {
label = DefDatabase<PawnKindDef>.GetNamedSilentFail(key)?.label; label = DefDatabase<PawnKindDef>.GetNamedSilentFail(key)?.label ?? "Undefined";
isPawnKind = true; isPawnKind = true;
} }
Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height); Rect buttonRect = new Rect(rect.xMax - 90f, rect.y, 80f, rect.height);
@ -462,17 +467,17 @@ namespace RJW_Menstruation
} }
else else
{ {
label += ": " + key; Widgets.Label(buttonRect, " PawnKind");
Widgets.Label(buttonRect, "PawnKind");
buttonRect.x -= 80f; buttonRect.x -= 80f;
} }
label += ": " + key;
Widgets.Label(rect, " - " + label); Widgets.Label(rect, " - " + label);
Widgets.TextFieldNumeric(buttonRect, ref value, ref valuestr,0,10000); Widgets.TextFieldNumeric(buttonRect, ref value, ref valuestr,0,9999999);
extension.hybridInfo.SetOrAdd(key, value); extension.hybridInfo.SetOrAdd(key, value);
buttonRect.x -= 80f; buttonRect.x -= 80f;
Widgets.Label(buttonRect, String.Format("{0,0:P2}", value / totalWeight)); Widgets.Label(buttonRect, String.Format("{0,0:P2}", value / totalWeight));
Widgets.DrawHighlightIfMouseover(rect); Widgets.DrawHighlightIfMouseover(rect);
TooltipHandler.TipRegion(rect, Translations.CustomHybrid_Tooltip(info.GetDef.label, extension.GetDef.label, label, value/totalWeight*100)); TooltipHandler.TipRegion(rect, Translations.CustomHybrid_Tooltip(info.GetDef?.label ?? "Undefined", extension.GetDef?.label ?? "Undefined", label, String.Format("{0,0:0.########%}", value/totalWeight)));
} }

View File

@ -110,6 +110,8 @@ namespace RJW_Menstruation
{ {
Close(); Close();
} }
closeRect.x -= 20f;
} }
private void MainContents(Rect mainRect) private void MainContents(Rect mainRect)

View File

@ -33,7 +33,7 @@ namespace RJW_Menstruation
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect); if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect);
} }

View File

@ -53,8 +53,9 @@ namespace RJW_Menstruation
{ {
if (allraces == null) if (allraces == null)
{ {
List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading; List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading;
allraces = allThings.FindAll(x => x.race != null); allraces = allThings.FindAll(x => x.race != null && x.race.IsFlesh);
} }
return allraces; return allraces;
} }