mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	1.0.4.0
This commit is contained in:
		
							parent
							
								
									cb8e6eb893
								
							
						
					
					
						commit
						0f472fb7f0
					
				
					 18 changed files with 794 additions and 68 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
			
		||||
<Manifest>
 | 
			
		||||
	<identifier>RJW Menstruation</identifier>
 | 
			
		||||
	<version>1.0.3.2</version>
 | 
			
		||||
	<version>1.0.4.0</version>
 | 
			
		||||
	<dependencies>
 | 
			
		||||
	</dependencies>
 | 
			
		||||
	<incompatibleWith />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -88,9 +88,14 @@
 | 
			
		|||
  <Option26_Desc>Nipples/areolas won't be darker/wider than this value.</Option26_Desc>
 | 
			
		||||
  <Option27_Label>Transition speed of nipples</Option27_Label>
 | 
			
		||||
  <Option27_Desc>Set speed of transition of nipples/areolas.
1 = instant transition</Option27_Desc>
 | 
			
		||||
  <Option28_Label></Option28_Label>
 | 
			
		||||
  <Option28_Desc></Option28_Desc>
 | 
			
		||||
  <Option28_Label>Customize Hybrids</Option28_Label>
 | 
			
		||||
  <Option28_Tooltip>Open custom hybrid editor.
This will overrides hybrid definitions of XML files.</Option28_Tooltip>
 | 
			
		||||
  
 | 
			
		||||
  <FloatMenu_CleanSelf>Vaginal washing</FloatMenu_CleanSelf>
 | 
			
		||||
  
 | 
			
		||||
  <CustomHybrid_List_Title>Custom Hybrid Editor</CustomHybrid_List_Title>
 | 
			
		||||
  <CustomHybrid_Title>Hybrids of {0}</CustomHybrid_Title>
 | 
			
		||||
  <CustomHybrid_Tooltip>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.</CustomHybrid_Tooltip>
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
</LanguageData>
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +88,13 @@
 | 
			
		|||
  <Option26_Desc>유두는 이 값 이상으로 변하지 않습니다.</Option26_Desc>
 | 
			
		||||
  <Option27_Label>유두 변화 속도</Option27_Label>
 | 
			
		||||
  <Option27_Desc>유두가 얼마나 빨리 변하는지 설정합니다.</Option27_Desc>
 | 
			
		||||
  <Option28_Label>잡종 정의 변경하기</Option28_Label>
 | 
			
		||||
  <Option28_Tooltip>사용자 지정 잡종 편집기를 엽니다.
이 설정은 XML파일의 잡종 정의를 대체합니다.</Option28_Tooltip>
 | 
			
		||||
  
 | 
			
		||||
  <FloatMenu_CleanSelf>질세척</FloatMenu_CleanSelf>
 | 
			
		||||
  
 | 
			
		||||
  <CustomHybrid_List_Title>사용자 지정 잡종 편집기</CustomHybrid_List_Title>
 | 
			
		||||
  <CustomHybrid_Title>{0}의 잡종설정</CustomHybrid_Title>
 | 
			
		||||
  <CustomHybrid_Tooltip>{0}이(가) {1}와(과) 교미했을 때, {2}이(가) {3}%의 확률로 태어납니다.
만약 두 종족이 서로에 대한 잡종 정의가 있을경우 아버지 쪽의 정의가 우선적으로 사용됩니다.</CustomHybrid_Tooltip>
 | 
			
		||||
  
 | 
			
		||||
</LanguageData>
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +66,7 @@ namespace RJW_Menstruation
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<HybridInformations> HybridOverride = new List<HybridInformations>();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        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<HybridInformations> removeList = new List<HybridInformations>();
 | 
			
		||||
            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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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<speed; i++)
 | 
			
		||||
            {
 | 
			
		||||
                cumthickness = Mathf.Lerp(cumthickness, decayresist, 0.4f);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void MergeWithCum(float volumein, ThingDef updatefilthDef = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (updatefilthDef != null) filthDef = updatefilthDef;
 | 
			
		||||
            volume = volumein;
 | 
			
		||||
            fertvolume = volumein;
 | 
			
		||||
            cumthickness = Mathf.Lerp(cumthickness, 1.0f, volumein / volume);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void MergeWithFluid(float volumein, float thickness, ThingDef updatefilthDef = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (updatefilthDef != null) filthDef = updatefilthDef;
 | 
			
		||||
            volume = volumein;
 | 
			
		||||
            cumthickness = Mathf.Lerp(cumthickness, thickness, volumein / volume);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										482
									
								
								source/RJW_Menstruation/RJW_Menstruation/Dialog_HybridCustom.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										482
									
								
								source/RJW_Menstruation/RJW_Menstruation/Dialog_HybridCustom.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,482 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
using Verse.Sound;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Menstruation
 | 
			
		||||
{
 | 
			
		||||
    public class Dialog_HybridCustom : Window
 | 
			
		||||
    {
 | 
			
		||||
        private static Vector2 scroll;
 | 
			
		||||
        private const float windowMargin = 20f;
 | 
			
		||||
        static private List<FloatMenuOption> raceList = new List<FloatMenuOption>();
 | 
			
		||||
        static private List<HybridInformations> removeList = new List<HybridInformations>();
 | 
			
		||||
 | 
			
		||||
        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<HybridInformations>();
 | 
			
		||||
                }
 | 
			
		||||
                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<FloatMenuOption> raceList = new List<FloatMenuOption>();
 | 
			
		||||
        protected List<HybridExtensionExposable> removeList = new List<HybridExtensionExposable>();
 | 
			
		||||
        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<FloatMenuOption> list = new List<FloatMenuOption>();
 | 
			
		||||
                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<string> removeelements = new List<string>();
 | 
			
		||||
            if (!extension.hybridInfo.EnumerableNullOrEmpty())
 | 
			
		||||
            {
 | 
			
		||||
                totalWeight = 0;
 | 
			
		||||
                foreach(KeyValuePair<string,float> element in extension.hybridInfo)
 | 
			
		||||
                {
 | 
			
		||||
                    totalWeight += element.Value;
 | 
			
		||||
                }
 | 
			
		||||
            
 | 
			
		||||
                List<string> keys = new List<string>(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<string> removeelements)
 | 
			
		||||
        {
 | 
			
		||||
            bool isPawnKind = false;
 | 
			
		||||
            float value = extension.hybridInfo.TryGetValue(key);
 | 
			
		||||
            string valuestr = value.ToString();
 | 
			
		||||
            string label = null;
 | 
			
		||||
            label = DefDatabase<ThingDef>.GetNamedSilentFail(key)?.label;
 | 
			
		||||
            if (label == null)
 | 
			
		||||
            {
 | 
			
		||||
                label = DefDatabase<PawnKindDef>.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<FloatMenuOption> list = new List<FloatMenuOption>();
 | 
			
		||||
                    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));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
            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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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", ""));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 (MotherRaceName != FatherRaceName && FatherRaceName != "")
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if (Configurations.UseHybridExtention)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Configurations.MotherFirst)
 | 
			
		||||
                    {
 | 
			
		||||
                        spawn_kind_def = GetHybrid(mother, father);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
 | 
			
		||||
            if (FatherRaceName != "" && Configurations.UseHybridExtention)
 | 
			
		||||
            {
 | 
			
		||||
                spawn_kind_def = GetHybrid(father, mother);
 | 
			
		||||
                    }
 | 
			
		||||
                Log.Message("pawnkind: " + spawn_kind_def?.defName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (MotherRaceName != FatherRaceName && FatherRaceName != "")
 | 
			
		||||
            {
 | 
			
		||||
                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<PawnDNAModExtension>();
 | 
			
		||||
            if (dna != null)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,11 +140,14 @@ namespace RJW_Menstruation
 | 
			
		|||
    //[HarmonyPatch(typeof(TransferableUIUtility), "DoExtraAnimalIcons")]
 | 
			
		||||
    //public class TransferableUIUtility_Patch_Icon
 | 
			
		||||
    //{
 | 
			
		||||
    //    private static readonly Texture2D PregnantIcon = ContentFinder<Texture2D>.Get("UI/Icons/Animal/Pregnant", true);
 | 
			
		||||
    //    public static void Postfix(Transferable trad, Rect rect, ref float curX)
 | 
			
		||||
    //    //private static readonly Texture2D PregnantIcon = ContentFinder<Texture2D>.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<float> wornScoresCache)
 | 
			
		||||
    //    {
 | 
			
		||||
    //        if (ap is Absorber)
 | 
			
		||||
    //        {
 | 
			
		||||
    //            __result = -1000f;
 | 
			
		||||
    //            return false;
 | 
			
		||||
    //        }
 | 
			
		||||
    //        return true;
 | 
			
		||||
    //    }
 | 
			
		||||
    //
 | 
			
		||||
    //}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,6 +57,7 @@
 | 
			
		|||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Configurations.cs" />
 | 
			
		||||
    <Compile Include="Cum.cs" />
 | 
			
		||||
    <Compile Include="Dialog_HybridCustom.cs" />
 | 
			
		||||
    <Compile Include="Dialog_WombStatus.cs" />
 | 
			
		||||
    <Compile Include="DrugOutcomDoers.cs" />
 | 
			
		||||
    <Compile Include="FilthMaker_Colored.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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ namespace RJW_Menstruation
 | 
			
		|||
        public float cumThickness = 0f;
 | 
			
		||||
        public List<HybridExtension> 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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -39,16 +39,19 @@ namespace RJW_Menstruation
 | 
			
		|||
 | 
			
		||||
        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;
 | 
			
		||||
                string key = hybridInfo.RandomElementByWeight(x => x.Value).Key;
 | 
			
		||||
                res = DefDatabase<PawnKindDef>.GetNamedSilentFail(key);
 | 
			
		||||
                if (res == null) res = DefDatabase<ThingDef>.GetNamedSilentFail(key).race.AnyPawnKind;
 | 
			
		||||
 | 
			
		||||
                if (res == null) hybridInfo.Remove(res.defName);
 | 
			
		||||
                if (res == null) hybridInfo.Remove(key);
 | 
			
		||||
            } while (res == null && !hybridInfo.EnumerableNullOrEmpty());
 | 
			
		||||
 | 
			
		||||
            return res;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,8 +76,123 @@ namespace RJW_Menstruation
 | 
			
		|||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class HybridInformations : IExposable
 | 
			
		||||
    {
 | 
			
		||||
        public List<HybridExtensionExposable> hybridExtension = new List<HybridExtensionExposable>();
 | 
			
		||||
 | 
			
		||||
        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<ThingDef>.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<ThingDef>.GetNamedSilentFail(thingDefName);
 | 
			
		||||
                    return thingDef;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public HybridExtensionExposable() { }
 | 
			
		||||
 | 
			
		||||
        public HybridExtensionExposable(ThingDef def)
 | 
			
		||||
        {
 | 
			
		||||
            thingDef = def;
 | 
			
		||||
            thingDefName = def.defName;
 | 
			
		||||
            hybridInfo = new Dictionary<string, float>();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ExposeData()
 | 
			
		||||
        {
 | 
			
		||||
            Scribe_Values.Look(ref thingDefName, "thingDefName");
 | 
			
		||||
            Scribe_Collections.Look(ref hybridInfo, "hybridInfo", LookMode.Value, LookMode.Value);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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); }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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<CompHediffBodyPart>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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<HediffDef_PartBase>.GetNamed("Vagina");
 | 
			
		||||
        public static readonly CompProperties_Menstruation VaginaCompProperties = (CompProperties_Menstruation)Vagina.comps.FirstOrDefault(x => x is CompProperties_Menstruation);
 | 
			
		||||
        public static readonly KeyBindingDef OpenStatusWindowKey = DefDatabase<KeyBindingDef>.GetNamed("OpenStatusWindow");
 | 
			
		||||
        public static readonly PawnColumnDef RJW_EarnedMoneyByWhore = DefDatabase<PawnColumnDef>.GetNamed("RJW_EarnedMoneyByWhore");
 | 
			
		||||
 | 
			
		||||
        private static List<ThingDef> allraces = null;
 | 
			
		||||
        private static List<PawnKindDef> allkinds = null;
 | 
			
		||||
 | 
			
		||||
        public static List<ThingDef> AllRaces
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (allraces == null)
 | 
			
		||||
                {
 | 
			
		||||
                    List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading;
 | 
			
		||||
                    allraces = allThings.FindAll(x => x.race != null);
 | 
			
		||||
                }
 | 
			
		||||
                return allraces;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public static List<PawnKindDef> AllKinds
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (allkinds == null)
 | 
			
		||||
                {
 | 
			
		||||
                    List<PawnKindDef> allKinds = DefDatabase<PawnKindDef>.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<HediffDef>.GetNamedSilentFail("Lactating_Natural");
 | 
			
		||||
        public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Permanent");
 | 
			
		||||
        public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Heavy_Lactating_Permanent");
 | 
			
		||||
        public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamed("LactateSelf_MC");
 | 
			
		||||
 | 
			
		||||
        public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamedSilentFail("LactateSelf_MC");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue