Ejemplo n.º 1
0
 public override void Tick()
 {
     base.ageTicks++;
     if (base.pawn.IsHashIntervalTick(1000))
     {
         if (base.pawn.needs.food != null && base.pawn.needs.food.CurCategory == HungerCategory.Starving && Rand.MTBEventOccurs(0.5f, 60000f, 1000f))
         {
             if (this.Visible && PawnUtility.ShouldSendNotificationAbout(base.pawn))
             {
                 Messages.Message("MessageMiscarriedStarvation".Translate(base.pawn.LabelIndefinite()).CapitalizeFirst(), base.pawn, MessageTypeDefOf.NegativeHealthEvent);
             }
             this.Miscarry();
             return;
         }
         if (this.IsSeverelyWounded && Rand.MTBEventOccurs(0.5f, 60000f, 1000f))
         {
             if (this.Visible && PawnUtility.ShouldSendNotificationAbout(base.pawn))
             {
                 Messages.Message("MessageMiscarriedPoorHealth".Translate(base.pawn.LabelIndefinite()).CapitalizeFirst(), base.pawn, MessageTypeDefOf.NegativeHealthEvent);
             }
             this.Miscarry();
             return;
         }
     }
     this.GestationProgress += (float)(1.0 / (base.pawn.RaceProps.gestationPeriodDays * 60000.0));
     if (this.GestationProgress >= 1.0)
     {
         if (this.Visible && PawnUtility.ShouldSendNotificationAbout(base.pawn))
         {
             Messages.Message("MessageGaveBirth".Translate(base.pawn.LabelIndefinite()).CapitalizeFirst(), base.pawn, MessageTypeDefOf.PositiveEvent);
         }
         Hediff_Pregnant.DoBirthSpawn(base.pawn, this.father);
         base.pawn.health.RemoveHediff(this);
     }
 }
Ejemplo n.º 2
0
 public override void Tick()
 {
     this.ageTicks++;
     if (this.pawn.IsHashIntervalTick(1000))
     {
         if (this.pawn.needs.food != null && this.pawn.needs.food.CurCategory == HungerCategory.Starving && this.pawn.health.hediffSet.HasHediff(HediffDefOf.Malnutrition, false) && this.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition, false).Severity > 0.25f && Rand.MTBEventOccurs(0.5f, 60000f, 1000f))
         {
             if (this.Visible && PawnUtility.ShouldSendNotificationAbout(this.pawn))
             {
                 Messages.Message("MessageMiscarriedStarvation".Translate(this.pawn).CapitalizeFirst(), this.pawn, MessageTypeDefOf.NegativeHealthEvent, true);
             }
             this.Miscarry();
             return;
         }
         if (this.IsSeverelyWounded && Rand.MTBEventOccurs(0.5f, 60000f, 1000f))
         {
             if (this.Visible && PawnUtility.ShouldSendNotificationAbout(this.pawn))
             {
                 Messages.Message("MessageMiscarriedPoorHealth".Translate(this.pawn).CapitalizeFirst(), this.pawn, MessageTypeDefOf.NegativeHealthEvent, true);
             }
             this.Miscarry();
             return;
         }
     }
     this.GestationProgress += 1f / (this.pawn.RaceProps.gestationPeriodDays * 60000f);
     if (this.GestationProgress >= 1f)
     {
         if (this.Visible && PawnUtility.ShouldSendNotificationAbout(this.pawn))
         {
             Messages.Message("MessageGaveBirth".Translate(this.pawn).CapitalizeFirst(), this.pawn, MessageTypeDefOf.PositiveEvent, true);
         }
         Hediff_Pregnant.DoBirthSpawn(this.pawn, this.father);
         this.pawn.health.RemoveHediff(this);
     }
 }