Ejemplo n.º 1
0
        public override void CompTick()
        {
            base.CompTick();
            Pawn pawn = this.parent as Pawn;

            if ((pawn.Faction == Faction.OfPlayer) && (pawn.ageTracker.CurLifeStage.reproductive))
            {
                asexualFissionCounter++;
                if (asexualFissionCounter >= ticksInday * reproductionIntervalDays)
                {
                    if (produceEggs)
                    {
                        GenSpawn.Spawn(ThingDef.Named(eggDef), pawn.Position, pawn.Map);
                        Messages.Message("AA_AsexualHatchedEgg".Translate(pawn.LabelIndefinite().CapitalizeFirst()), pawn, MessageTypeDefOf.PositiveEvent, true);
                        asexualFissionCounter = 0;
                    }
                    else
                    {
                        Hediff_Pregnant.DoBirthSpawn(pawn, pawn);
                        Messages.Message("AA_AsexualHatched".Translate(pawn.LabelIndefinite().CapitalizeFirst()), pawn, MessageTypeDefOf.PositiveEvent, true);
                        asexualFissionCounter = 0;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void CompTick()
        {
            base.CompTick();
            Pawn pawn = this.parent as Pawn;

            //Important, without a null map check creatures will reproduce while on caravans, producing errors
            if (pawn.Map != null)
            {
                if (this.Props.isGreenGoo)
                {
                    asexualFissionCounter++;
                    //This checks if the map has been filled with creatures. If this check wasn't made, the animal would fill
                    //the map and grind the game to a halt
                    if ((asexualFissionCounter >= ticksInday * reproductionIntervalDays) && ((this.parent.Map != null) && (this.parent.Map.listerThings.ThingsOfDef(ThingDef.Named(this.Props.GreenGooTarget)).Count < this.Props.GreenGooLimit)))
                    {
                        //The offspring has the pawn as both mother and father and I find this funny
                        Hediff_Pregnant.DoBirthSpawn(pawn, pawn);
                        //Only show a message if the pawn is part of the player's faction
                        if (pawn.Faction == Faction.OfPlayer)
                        {
                            Messages.Message(Props.asexualCloningMessage.Translate(pawn.LabelIndefinite().CapitalizeFirst()), pawn, MessageTypeDefOf.PositiveEvent, true);
                        }
                        asexualFissionCounter = 0;
                    }
                    //Just reset the counter if the map is filled
                    else if (asexualFissionCounter >= ticksInday * reproductionIntervalDays)
                    {
                        asexualFissionCounter = 0;
                    }
                }

                //Non-green goo creatures only reproduce if they are part of the player's faction, like vanilla animals
                else if ((pawn.Faction == Faction.OfPlayer) && (pawn.ageTracker.CurLifeStage.reproductive))
                {
                    asexualFissionCounter++;
                    if (asexualFissionCounter >= ticksInday * reproductionIntervalDays)
                    {
                        //If it produces eggs or spores, it will just spawn them. Note that these eggs are not part of the player's
                        //faction, the animal hatched from them will be wild
                        if (produceEggs)
                        {
                            GenSpawn.Spawn(ThingDef.Named(eggDef), pawn.Position, pawn.Map);
                            Messages.Message(Props.asexualEggMessage.Translate(pawn.LabelIndefinite().CapitalizeFirst()), pawn, MessageTypeDefOf.PositiveEvent, true);
                            asexualFissionCounter = 0;
                        }
                        //If not, do a normal fission
                        else
                        {
                            Hediff_Pregnant.DoBirthSpawn(pawn, pawn);
                            Messages.Message(Props.asexualHatchedMessage.Translate(pawn.LabelIndefinite().CapitalizeFirst()), pawn, MessageTypeDefOf.PositiveEvent, true);
                            asexualFissionCounter = 0;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private static void FinishPregnancy()
        {
            var pregnancies = Find.Selector.SelectedPawns.Where(candidate => candidate.health.hediffSet.HasHediff(RimWorld.HediffDefOf.Pregnant))
                              .Select(candidate => candidate.health.hediffSet.GetFirstHediffOfDef(RimWorld.HediffDefOf.Pregnant));

            foreach (Hediff_Pregnant hediff in pregnancies)
            {
                Hediff_Pregnant.DoBirthSpawn(hediff.pawn, hediff.father);
                hediff.pawn.health.RemoveHediff(hediff);
            }
        }
Ejemplo n.º 4
0
        private static void GiveBirthTogether()
        {
            var males   = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male);
            var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female);

            if (males.Count() != 1 || females.Count() != 1)
            {
                return;
            }

            Hediff_Pregnant.DoBirthSpawn(females.First(), males.First());
            DebugActionsUtility.DustPuffFrom(females.First());
        }
Ejemplo n.º 5
0
        private static void GiveBirthTogether()
        {
            var males   = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male);
            var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female);

            if (males.Count() != 1 || females.Count() != 1)
            {
                return;
            }

            Hediff_Pregnant hediff_Pregnant = (Hediff_Pregnant)HediffMaker.MakeHediff(RimWorld.HediffDefOf.Pregnant, females.First(), null);

            hediff_Pregnant.father = males.First();
            females.First().health.AddHediff(hediff_Pregnant, null, null, null);

            Hediff_Pregnant.DoBirthSpawn(females.First(), males.First());
            DebugActionsUtility.DustPuffFrom(females.First());
        }