Ejemplo n.º 1
0
 public override void UpdateAllDuties()
 {
     this.FilterOutUnspawnedWombs();
     for (int i = 0; i < this.lord.ownedPawns.Count; i++)
     {
         WombBetweenWorlds hiveFor = this.GetHiveFor(this.lord.ownedPawns[i]);
         PawnDuty          duty    = new PawnDuty(CultDefOfs.DefendAndExpandWomb, hiveFor, this.distToHiveToAttack);
         this.lord.ownedPawns[i].mindState.duty = duty;
     }
 }
Ejemplo n.º 2
0
        public override void CompTickRare()
        {
            WombBetweenWorlds Womb = this.parent as WombBetweenWorlds;

            if ((Womb == null || Womb.active) && Find.TickManager.TicksGame >= this.nextWombSpawnTick)
            {
                WombBetweenWorlds Womb2;
                if (this.TrySpawnChildWomb(false, out Womb2))
                {
                    Womb2.nextPawnSpawnTick = Find.TickManager.TicksGame + Rand.Range(150, 350);
                    Messages.Message("MessageWombReproduced".Translate(), Womb2, MessageSound.Negative);
                }
                else
                {
                    this.CalculateNextWombSpawnTick();
                }
            }
        }
Ejemplo n.º 3
0
        public bool TrySpawnChildWomb(bool ignoreRoofedRequirement, out Womb newWomb)
        {
            if (!this.CanSpawnChildWomb)
            {
                newWomb = null;
                return(false);
            }
            IntVec3 invalid = IntVec3.Invalid;

            for (int i = 0; i < 3; i++)
            {
                float minDist = this.Props.WombSpawnPreferredMinDist;
                if (i == 1)
                {
                    minDist = 0f;
                }
                else if (i == 2)
                {
                    newWomb = null;
                    return(false);
                }
                if (CellFinder.TryFindRandomReachableCellNear(this.parent.Position, this.Props.WombSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), (IntVec3 c) => this.CanSpawnWombAt(c, minDist, ignoreRoofedRequirement), null, out invalid, 999999))
                {
                    break;
                }
            }
            newWomb = (WombBetweenWorlds)GenSpawn.Spawn(this.parent.def, invalid);
            if (newWomb.Faction != this.parent.Faction)
            {
                newWomb.SetFaction(this.parent.Faction, null);
            }
            WombBetweenWorlds Womb = this.parent as WombBetweenWorlds;

            if (Womb != null)
            {
                newWomb.active = Womb.active;
            }
            this.CalculateNextWombSpawnTick();
            return(true);
        }