Esempio n. 1
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            CompEggLayer compEggLayer = pawn.TryGetComp <CompEggLayer>();

            if (compEggLayer != null && compEggLayer.CanLayNow)
            {
                IntVec3 c = RCellFinder.RandomWanderDestFor(pawn, pawn.Position, 5f, null, Danger.Some);
                return(new Job(JobDefOf.LayEgg, c));
            }
            return(null);
        }
 public static bool FertileMateTarget(Pawn male, Pawn female)
 {
     if (female.gender == Gender.Female && female.ageTracker.CurLifeStage.reproductive)
     {
         CompEggLayer compEggLayer = female.TryGetComp <CompEggLayer>();
         if (compEggLayer != null)
         {
             return(!compEggLayer.FullyFertilized);
         }
         return(!female.health.hediffSet.HasHediff(HediffDefOf.Pregnant, false));
     }
     return(false);
 }
        protected override Job TryGiveJob(Pawn pawn)
        {
            CompEggLayer compEggLayer = pawn.TryGetComp <CompEggLayer>();
            Job          result;

            if (compEggLayer == null || !compEggLayer.CanLayNow)
            {
                result = null;
            }
            else
            {
                IntVec3 c = RCellFinder.RandomWanderDestFor(pawn, pawn.Position, 5f, null, Danger.Some);
                result = new Job(JobDefOf.LayEgg, c);
            }
            return(result);
        }
 public static void Mated(Pawn male, Pawn female)
 {
     if (female.ageTracker.CurLifeStage.reproductive)
     {
         CompEggLayer compEggLayer = female.TryGetComp <CompEggLayer>();
         if (compEggLayer != null)
         {
             compEggLayer.Fertilize(male);
         }
         else if (Rand.Value < 0.5f && !female.health.hediffSet.HasHediff(HediffDefOf.Pregnant, false))
         {
             Hediff_Pregnant hediff_Pregnant = (Hediff_Pregnant)HediffMaker.MakeHediff(HediffDefOf.Pregnant, female, null);
             hediff_Pregnant.father = male;
             female.health.AddHediff(hediff_Pregnant, null, null, null);
         }
     }
 }
        public static bool FertileMateTarget(Pawn male, Pawn female)
        {
            bool result;

            if (female.gender != Gender.Female || !female.ageTracker.CurLifeStage.reproductive)
            {
                result = false;
            }
            else
            {
                CompEggLayer compEggLayer = female.TryGetComp <CompEggLayer>();
                if (compEggLayer != null)
                {
                    result = !compEggLayer.FullyFertilized;
                }
                else
                {
                    result = !female.health.hediffSet.HasHediff(HediffDefOf.Pregnant, false);
                }
            }
            return(result);
        }