Beispiel #1
0
        // original rebuilded
        public static bool CompTick(CompEggLayer __instance)
        {
            if (WorkRebalancerMod.Instance.Prof.RestoreWhenHostileDetected &&
                HostileHandler.HostileDetected)
            {
                return(true);
            }

            if ((bool)Active.Invoke(__instance, null))
            {
                float num  = 1f / (__instance.Props.eggLayIntervalDays * 60000f);
                Pawn  pawn = __instance.parent as Pawn;
                if (pawn != null)
                {
                    num *= PawnUtility.BodyResourceGrowthSpeed(pawn);
                }

                float _eggProgress = (float)eggProgress.GetValue(__instance);
                _eggProgress += num * WorkRebalancerMod.Instance.Prof.EggLayerSpeedMult;
                if (_eggProgress > 1f)
                {
                    _eggProgress = 1f;
                }
                if ((bool)ProgressStoppedBecauseUnfertilized.Invoke(__instance, null))
                {
                    _eggProgress = __instance.Props.eggProgressUnfertilizedMax;
                }
                eggProgress.SetValue(__instance, _eggProgress);
            }

            return(false);
        }
Beispiel #2
0
 // Token: 0x06002894 RID: 10388 RVA: 0x00134D48 File Offset: 0x00133148
 public override void CompTick()
 {
     if (this.Active)
     {
         float num = 1f / (this.Props.eggLayIntervalDays * 60000f);
         if (this.parent is Pawn pawn)
         {
             num *= PawnUtility.BodyResourceGrowthSpeed(pawn);
         }
         this.eggProgress += num;
         if (this.eggProgress > 1f)
         {
             this.eggProgress = 1f;
         }
     }
 }
Beispiel #3
0
        public static int TicksTillHarvestable(this CompHasGatherableBodyResource comp)
        {
            var interval          = Traverse.Create(comp).Property("GatherResourcesIntervalDays").GetValue <int>();
            var growthRatePerTick = 1f / (interval * GenDate.TicksPerDay);

            var pawn = comp.parent as Pawn;

            if (pawn == null)
            {
                throw new ArgumentException("harvestable should always be on a Pawn");
            }
            growthRatePerTick *= PawnUtility.BodyResourceGrowthSpeed((Pawn)comp.parent);

            // Logger.Debug( $"rate: {growthRatePerTick}, interval: {interval}");

            return(Mathf.CeilToInt((1 - comp.Fullness) / growthRatePerTick));
        }
Beispiel #4
0
 public override void CompTick()
 {
     if (avaliLayEggs)
     {
         if (!this.Active)
         {
             return;
         }
         float num = (float)(1.0 / ((double)this.Props.eggLayIntervalDays * 60000.0));
         if (this.parent is Pawn parent)
         {
             num *= PawnUtility.BodyResourceGrowthSpeed(parent);
         }
         this.eggProgress += num;
         if ((double)this.eggProgress > 1.0)
         {
             this.eggProgress = 1f;
         }
     }
 }
 public override void CompTick()
 {
     if (this.Active)
     {
         float num  = 1f / (this.Props.eggLayIntervalDays * 60000f);
         Pawn  pawn = this.parent as Pawn;
         if (pawn != null)
         {
             num *= PawnUtility.BodyResourceGrowthSpeed(pawn);
         }
         this.eggProgress += num;
         if (this.eggProgress > 1f)
         {
             this.eggProgress = 1f;
         }
         if (this.ProgressStoppedBecauseUnfertilized)
         {
             this.eggProgress = this.Props.eggProgressUnfertilizedMax;
         }
     }
 }
Beispiel #6
0
 public override void CompTick()
 {
     if (Active)
     {
         float num  = 1f / (Props.eggLayIntervalDays * 60000f);
         Pawn  pawn = parent as Pawn;
         if (pawn != null)
         {
             num *= PawnUtility.BodyResourceGrowthSpeed(pawn);
         }
         eggProgress += num;
         if (eggProgress > 1f)
         {
             eggProgress = 1f;
             if (pawn.Awake() && !pawn.Downed)
             {
                 ProduceEgg(pawn);
                 eggProgress = 0f;
             }
         }
     }
 }
 // Token: 0x06000016 RID: 22 RVA: 0x00002460 File Offset: 0x00000660
 public override void CompTick()
 {
     if (this.Active)
     {
         Pawn pawn = this.parent as Pawn;
         if (pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("HugeBreasts"), false) || pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("BionicBreasts"), false) || pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("SlimeBreasts"), false) || pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("GR_MuffaloMammaries"), false))
         {
             this.BreastSizeDays = 3f;
         }
         else if (pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("Breasts"), false) || pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("HydraulicBreasts"), false) || (pawn.gender == Gender.Female && DefDatabase <HediffDef> .GetNamedSilentFail("Breasts") == null))
         {
             this.BreastSizeDays = 1.2f;
         }
         else if (pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("SmallBreasts"), false))
         {
             this.BreastSizeDays = 1f;
         }
         else if (pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("LargeBreasts"), false) || pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("ArchotechBreasts"), false))
         {
             this.BreastSizeDays = 1.5f;
         }
         else if (pawn.health.hediffSet.HasHediff(DefDatabase <HediffDef> .GetNamedSilentFail("FlatBreasts"), false) || pawn.gender == Gender.Male)
         {
             this.BreastSizeDays = 0.85f;
         }
         float num = 1f / (this.GatherResourcesIntervalDays / this.BreastSizeDays * 60000f);
         if (pawn != null)
         {
             num *= PawnUtility.BodyResourceGrowthSpeed(pawn);
         }
         this.fullness += num;
         if (this.fullness > 1f)
         {
             this.fullness = 1f;
         }
     }
 }