mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Replace hugslib scheduler with CompPostTick. Hopefully this will cut down on phantom menstruation bugs.
This commit is contained in:
		
							parent
							
								
									7dcab74af5
								
							
						
					
					
						commit
						85c479a45b
					
				
					 6 changed files with 88 additions and 161 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
using HugsLib;
 | 
					using RimWorld;
 | 
				
			||||||
using RimWorld;
 | 
					 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
| 
						 | 
					@ -63,8 +62,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
        protected Color cachedColor;
 | 
					        protected Color cachedColor;
 | 
				
			||||||
        protected bool loaded = false;
 | 
					        protected bool loaded = false;
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
        public Action action;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        protected float BabyHalfAge
 | 
					        protected float BabyHalfAge
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            get
 | 
					            get
 | 
				
			||||||
| 
						 | 
					@ -160,7 +157,30 @@ namespace RJW_Menstruation
 | 
				
			||||||
            Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
 | 
					            Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void CompPostTick(ref float severityAdjustment) { }
 | 
					        public override void CompPostTick(ref float severityAdjustment)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            base.CompPostTick(ref severityAdjustment);
 | 
				
			||||||
 | 
					            // If an exception makes it out, RW will remove the hediff, so catch it here
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (
 | 
				
			||||||
 | 
					                    !parent.pawn.IsHashIntervalTick(tickInterval) ||
 | 
				
			||||||
 | 
					                    !parent.pawn.Spawned ||  // TODO: Add option to simulate off-map pawns
 | 
				
			||||||
 | 
					                    parent.pawn.health.Dead
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                CalculateBreastSize();
 | 
				
			||||||
 | 
					                CalculateNipples();
 | 
				
			||||||
 | 
					                UpdateNipples();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Log.Error($"Error processing breasts of {parent.pawn}: {ex}");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void CompPostPostAdd(DamageInfo? dinfo)
 | 
					        public override void CompPostPostAdd(DamageInfo? dinfo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -175,8 +195,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
                Log.Warning($"Attempted to remove breast comp from wrong pawn ({parent.pawn}).");
 | 
					                Log.Warning($"Attempted to remove breast comp from wrong pawn ({parent.pawn}).");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(action);
 | 
					 | 
				
			||||||
            if (Configurations.Debug) Log.Message(parent.pawn.Label + " breast tick scheduler removed");
 | 
					 | 
				
			||||||
            base.CompPostPostRemoved();
 | 
					            base.CompPostPostRemoved();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,7 +226,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public void Initialize()
 | 
					        public void Initialize()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Props = (CompProperties_Breast)props;
 | 
					            Props = (CompProperties_Breast)props;
 | 
				
			||||||
            action = Update;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (maxBreastIncrement <= 0f)
 | 
					            if (maxBreastIncrement <= 0f)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -232,15 +249,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            UpdateNipples();
 | 
					            UpdateNipples();
 | 
				
			||||||
            loaded = true;
 | 
					            loaded = true;
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, GetNextUpdate(), parent.pawn);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public void Update()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, GetNextUpdate(), parent.pawn);
 | 
					 | 
				
			||||||
            CalculateBreastSize();
 | 
					 | 
				
			||||||
            CalculateNipples();
 | 
					 | 
				
			||||||
            UpdateNipples();
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected void CalculateBreastSize()
 | 
					        protected void CalculateBreastSize()
 | 
				
			||||||
| 
						 | 
					@ -344,15 +352,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
            cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
 | 
					            cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected int GetNextUpdate()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // Just like the menstruation code
 | 
					 | 
				
			||||||
            int currentOffset = Find.TickManager.TicksGame % tickInterval;
 | 
					 | 
				
			||||||
            int nextOffset = (parent.pawn.HashOffset() % tickInterval + tickInterval) % tickInterval;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return ((nextOffset - currentOffset + tickInterval - 1) % tickInterval) + 1;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public void CopyBreastProperties(HediffComp_Breast original)
 | 
					        public void CopyBreastProperties(HediffComp_Breast original)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            maxBreastIncrement = original.maxBreastIncrement;
 | 
					            maxBreastIncrement = original.maxBreastIncrement;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
using HugsLib;
 | 
					using RimWorld;
 | 
				
			||||||
using RimWorld;
 | 
					 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
| 
						 | 
					@ -70,7 +69,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public CompProperties_Menstruation Props;
 | 
					        public CompProperties_Menstruation Props;
 | 
				
			||||||
        public Stage curStage = Stage.Follicular;
 | 
					        public Stage curStage = Stage.Follicular;
 | 
				
			||||||
        public int curStageHrs = 0;
 | 
					        public int curStageHrs = 0;
 | 
				
			||||||
        public Action actionref;
 | 
					 | 
				
			||||||
        public bool loaded = false;
 | 
					        public bool loaded = false;
 | 
				
			||||||
        public int ovarypower = -100000;
 | 
					        public int ovarypower = -100000;
 | 
				
			||||||
        public int eggstack = 0;
 | 
					        public int eggstack = 0;
 | 
				
			||||||
| 
						 | 
					@ -530,11 +528,68 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void CompPostTick(ref float severityAdjustment)
 | 
					        public override void CompPostTick(ref float severityAdjustment)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            //initializer moved to SpawnSetup
 | 
					            base.CompPostTick(ref severityAdjustment);
 | 
				
			||||||
            //if (!loaded)
 | 
					            // If an exception makes it out, RW will remove the hediff, so catch it here
 | 
				
			||||||
            //{
 | 
					            try
 | 
				
			||||||
            //    Initialize();
 | 
					            {
 | 
				
			||||||
            //}
 | 
					                if (
 | 
				
			||||||
 | 
					                    !parent.pawn.IsHashIntervalTick(tickInterval) ||
 | 
				
			||||||
 | 
					                    !parent.pawn.Spawned || // TODO: Add option to simulate off-map pawns
 | 
				
			||||||
 | 
					                    parent.pawn.health.Dead ||
 | 
				
			||||||
 | 
					                    (parent.pawn.IsAnimal() && !Configurations.EnableAnimalCycle)
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                CumOut();
 | 
				
			||||||
 | 
					                switch (curStage)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    case Stage.Follicular:
 | 
				
			||||||
 | 
					                        FollicularAction(false);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Ovulatory:
 | 
				
			||||||
 | 
					                        OvulatoryAction();
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Luteal:
 | 
				
			||||||
 | 
					                        LutealAction(false);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Bleeding:
 | 
				
			||||||
 | 
					                        BleedingAction(false);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Pregnant:
 | 
				
			||||||
 | 
					                        PregnantAction();
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Recover:
 | 
				
			||||||
 | 
					                        RecoverAction();
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.None:
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Young:
 | 
				
			||||||
 | 
					                        YoungAction();
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.ClimactericFollicular:
 | 
				
			||||||
 | 
					                        FollicularAction(true);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.ClimactericLuteal:
 | 
				
			||||||
 | 
					                        LutealAction(true);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.ClimactericBleeding:
 | 
				
			||||||
 | 
					                        BleedingAction(true);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case Stage.Anestrus:
 | 
				
			||||||
 | 
					                        AnestrusAction();
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    default:
 | 
				
			||||||
 | 
					                        GoNextStage(Stage.Follicular);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Log.Error($"Error processing womb of {parent.pawn}: {ex}");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void CompPostPostRemoved()
 | 
					        public override void CompPostPostRemoved()
 | 
				
			||||||
| 
						 | 
					@ -546,8 +601,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
                Log.Warning($"Attempted to remove menstruation comp from wrong pawn ({parent.pawn}).");
 | 
					                Log.Warning($"Attempted to remove menstruation comp from wrong pawn ({parent.pawn}).");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref);
 | 
					 | 
				
			||||||
            if (Configurations.Debug) Log.Message(parent.pawn.Label + " menstruation tick scheduler removed");
 | 
					 | 
				
			||||||
            pregnancy?.Miscarry();
 | 
					            pregnancy?.Miscarry();
 | 
				
			||||||
            base.CompPostPostRemoved();
 | 
					            base.CompPostPostRemoved();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -871,7 +924,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (cums == null) cums = new List<Cum>();
 | 
					                if (cums == null) cums = new List<Cum>();
 | 
				
			||||||
                curStage = Stage.None;
 | 
					                curStage = Stage.None;
 | 
				
			||||||
                HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
                loaded = true;
 | 
					                loaded = true;
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -912,18 +964,6 @@ namespace RJW_Menstruation
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (parent.pawn.IsAnimal())
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                if (Configurations.EnableAnimalCycle)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Young), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
                else HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            //Log.Message(parent.pawn.Label + " - Initialized menstruation comp");
 | 
					            //Log.Message(parent.pawn.Label + " - Initialized menstruation comp");
 | 
				
			||||||
            loaded = true;
 | 
					            loaded = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1576,108 +1616,12 @@ namespace RJW_Menstruation
 | 
				
			||||||
            TaleRecorder.RecordTale(VariousDefOf.TaleCameInside, new object[] { cummer, parent.pawn });
 | 
					            TaleRecorder.RecordTale(VariousDefOf.TaleCameInside, new object[] { cummer, parent.pawn });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private Action PeriodSimulator(Stage targetstage)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Action action = null;
 | 
					 | 
				
			||||||
            switch (targetstage)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                case Stage.Follicular:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        FollicularAction(false);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Ovulatory:
 | 
					 | 
				
			||||||
                    action = OvulatoryAction;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Luteal:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        LutealAction(false);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Bleeding:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        BleedingAction(false);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Pregnant:
 | 
					 | 
				
			||||||
                    action = PregnantAction;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Recover:
 | 
					 | 
				
			||||||
                    action = RecoverAction;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.None:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        StayCurrentStageConst(Stage.None);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Young:
 | 
					 | 
				
			||||||
                    action = YoungAction;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.ClimactericFollicular:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        FollicularAction(true);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.ClimactericLuteal:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        LutealAction(true);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.ClimactericBleeding:
 | 
					 | 
				
			||||||
                    action = delegate
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        BleedingAction(true);
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case Stage.Anestrus:
 | 
					 | 
				
			||||||
                    action = AnestrusAction;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                default:
 | 
					 | 
				
			||||||
                    curStage = Stage.Follicular;
 | 
					 | 
				
			||||||
                    curStageHrs = 0;
 | 
					 | 
				
			||||||
                    if (currentIntervalHours < 0) currentIntervalHours = PeriodRandomizer(curStage);
 | 
					 | 
				
			||||||
                    HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Follicular), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            action += delegate
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
 | 
					 | 
				
			||||||
                //CumOut();
 | 
					 | 
				
			||||||
                AfterSimulator();
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
            action = CumOut + action;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            actionref = action;
 | 
					 | 
				
			||||||
            return actionref;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        protected int GetNextUpdate()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // Ticks past the hour. Will be equal except for game start or load
 | 
					 | 
				
			||||||
            int currentOffset = Find.TickManager.TicksGame % tickInterval;
 | 
					 | 
				
			||||||
            int nextOffset = (parent.pawn.HashOffset() % tickInterval + tickInterval) % tickInterval;  // Messy, but HashOffset is negative a lot
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // The -1/+1 to ensure that equality works out to 1 hour and not 0 ticks
 | 
					 | 
				
			||||||
            return ((nextOffset - currentOffset + tickInterval - 1) % tickInterval) + 1;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        protected void GoNextStage(Stage nextstage, bool calculateHours = true)
 | 
					        protected void GoNextStage(Stage nextstage, bool calculateHours = true)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            curStageHrs = 0;
 | 
					            curStageHrs = 0;
 | 
				
			||||||
            float variabilityFactor = nextstage == Stage.ClimactericFollicular || nextstage == Stage.ClimactericLuteal || nextstage == Stage.ClimactericBleeding ? 6.0f : 1.0f;
 | 
					            float variabilityFactor = nextstage == Stage.ClimactericFollicular || nextstage == Stage.ClimactericLuteal || nextstage == Stage.ClimactericBleeding ? 6.0f : 1.0f;
 | 
				
			||||||
            if (calculateHours) currentIntervalHours = PeriodRandomizer(nextstage, variabilityFactor);
 | 
					            if (calculateHours) currentIntervalHours = PeriodRandomizer(nextstage, variabilityFactor);
 | 
				
			||||||
            curStage = nextstage;
 | 
					            curStage = nextstage;
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected virtual void GoOvulatoryStage(bool climacteric)
 | 
					        protected virtual void GoOvulatoryStage(bool climacteric)
 | 
				
			||||||
| 
						 | 
					@ -1688,13 +1632,11 @@ namespace RJW_Menstruation
 | 
				
			||||||
        //stage can be interrupted in other reasons
 | 
					        //stage can be interrupted in other reasons
 | 
				
			||||||
        protected void StayCurrentStage()
 | 
					        protected void StayCurrentStage()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //stage never changes
 | 
					        //stage never changes
 | 
				
			||||||
        protected void StayCurrentStageConst(Stage curstage)
 | 
					        protected void StayCurrentStageConst(Stage curstage)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curstage), GetNextUpdate(), parent.pawn, false);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected void GoFollicularOrBleeding()
 | 
					        protected void GoFollicularOrBleeding()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
using HarmonyLib;
 | 
					using HarmonyLib;
 | 
				
			||||||
using HugsLib;
 | 
					 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using UnityEngine;
 | 
					using UnityEngine;
 | 
				
			||||||
| 
						 | 
					@ -16,14 +15,12 @@ namespace RJW_Menstruation
 | 
				
			||||||
            //Log.Message("Initialize on spawnsetup");
 | 
					            //Log.Message("Initialize on spawnsetup");
 | 
				
			||||||
            foreach (HediffComp_Menstruation comp in __instance.GetMenstruationComps())
 | 
					            foreach (HediffComp_Menstruation comp in __instance.GetMenstruationComps())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(comp.actionref);
 | 
					 | 
				
			||||||
                comp.Initialize();
 | 
					                comp.Initialize();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            HediffComp_Breast bcomp = __instance.GetBreastComp();
 | 
					            HediffComp_Breast bcomp = __instance.GetBreastComp();
 | 
				
			||||||
            if (bcomp != null)
 | 
					            if (bcomp != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(bcomp.action);
 | 
					 | 
				
			||||||
                bcomp.Initialize();
 | 
					                bcomp.Initialize();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,10 +93,6 @@
 | 
				
			||||||
      <HintPath>..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
 | 
					      <HintPath>..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="HugsLib">
 | 
					 | 
				
			||||||
      <HintPath>..\..\..\..\..\..\..\..\workshop\content\294100\818773962\v1.3\Assemblies\HugsLib.dll</HintPath>
 | 
					 | 
				
			||||||
      <Private>False</Private>
 | 
					 | 
				
			||||||
    </Reference>
 | 
					 | 
				
			||||||
    <Reference Include="RJW">
 | 
					    <Reference Include="RJW">
 | 
				
			||||||
      <HintPath>..\..\..\..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
 | 
					      <HintPath>..\..\..\..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,12 +13,6 @@
 | 
				
			||||||
			<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
 | 
								<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
 | 
				
			||||||
			<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
 | 
								<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
 | 
				
			||||||
		</li>
 | 
							</li>
 | 
				
			||||||
		<li>
 | 
					 | 
				
			||||||
			<packageId>UnlimitedHugs.HugsLib</packageId>
 | 
					 | 
				
			||||||
			<displayName>HugsLib</displayName>
 | 
					 | 
				
			||||||
			<downloadUrl>https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest</downloadUrl>
 | 
					 | 
				
			||||||
			<steamWorkshopUrl>steam://url/CommunityFilePage/818773962</steamWorkshopUrl>
 | 
					 | 
				
			||||||
		</li>
 | 
					 | 
				
			||||||
		<li>
 | 
							<li>
 | 
				
			||||||
			<packageId>rim.job.world</packageId>
 | 
								<packageId>rim.job.world</packageId>
 | 
				
			||||||
			<displayName>RimJobWorld</displayName>
 | 
								<displayName>RimJobWorld</displayName>
 | 
				
			||||||
| 
						 | 
					@ -26,7 +20,6 @@
 | 
				
			||||||
		</li>
 | 
							</li>
 | 
				
			||||||
	</modDependencies>
 | 
						</modDependencies>
 | 
				
			||||||
	<loadAfter>
 | 
						<loadAfter>
 | 
				
			||||||
		<li>UnlimitedHugs.HugsLib</li>
 | 
					 | 
				
			||||||
		<li>brrainz.harmony</li>
 | 
							<li>brrainz.harmony</li>
 | 
				
			||||||
		<li>rim.job.world</li>
 | 
							<li>rim.job.world</li>
 | 
				
			||||||
		<li>Abraxas.RJW.RaceSupport</li>
 | 
							<li>Abraxas.RJW.RaceSupport</li>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue