// Token: 0x0600001D RID: 29 RVA: 0x00002B28 File Offset: 0x00000D28
        public void damageBuildings(int amt)
        {
            IntVec3 intVec = GenAdj.RandomAdjacentCell8Way(this);
            bool    flag   = GenGrid.InBounds(intVec, base.Map);
            bool    flag2  = flag;

            if (flag2)
            {
                Building   firstBuilding = GridsUtility.GetFirstBuilding(intVec, base.Map);
                DamageInfo damageInfo;

                /*
                 * if (firstBuilding.GetStatValue(AvPDefOf.RRY_AcidResistance)>0)
                 * {
                 *
                 * }
                 */
                damageInfo = new DamageInfo(XenomorphDefOf.RRY_AcidBurn, (float)amt, 0f, -1f, null, null, null, 0, null);
                bool flag3 = firstBuilding != null;
                bool flag4 = flag3;
                if (flag4)
                {
                    MoteMaker.ThrowDustPuff(firstBuilding.Position, base.Map, 0.2f);
                    firstBuilding.TakeDamage(damageInfo);
                }
            }
        }
Example #2
0
 // Token: 0x0600237B RID: 9083 RVA: 0x0010F4C4 File Offset: 0x0010D8C4
 public override void Tick()
 {
     if (this.InnerThing == null)
     {
         //    Log.Error("MinifiedThing with null InnerThing. Destroying.", false);
         this.Destroy(DestroyMode.Vanish);
         return;
     }
     base.Tick();
     if (this.InnerThing.TryGetComp <CompXenoHatcher>() is CompXenoHatcher comp)
     {
         comp.CompTick();
         if (this.MapHeld != null && this.Map == null)
         {
             //    Log.Message("MinifiedThing being carried.", false);
         }
         else
         {
             ticksTillInstall--;
             if (ticksTillInstall == 0)
             {
                 Map     map = this.Map;
                 IntVec3 c   = this.Position;
                 this.InnerThing.SetFaction(null);
                 if (this.Spawned)
                 {
                     this.DeSpawn();
                 }
                 try
                 {
                     GenPlace.TryPlaceThing(this.InnerThing, c, map, ThingPlaceMode.Direct);
                 }
                 catch (Exception)
                 {
                     CellFinder.TryFindRandomCellNear(c, map, 2, (x => GridsUtility.GetFirstBuilding(x, this.Map) == null), out c);
                     GenPlace.TryPlaceThing(this.InnerThing, c, map, ThingPlaceMode.Direct);
                     throw;
                 }
                 ticksTillInstall = 1000;
             }
             //
             //    Log.Message("MinifiedThing on the ground.", false);
         }
     }
 }
        // Token: 0x06000027 RID: 39 RVA: 0x00002FDC File Offset: 0x000011DC
        public void damageBuildings(int amt)
        {
            IntVec3 intVec = GenAdj.RandomAdjacentCell8Way(this);
            bool    flag   = GenGrid.InBounds(intVec, base.Map);
            bool    flag2  = flag;

            if (flag2)
            {
                Building   firstBuilding = GridsUtility.GetFirstBuilding(intVec, base.Map);
                DamageInfo damageInfo    = new DamageInfo(DamageDefOf.Burn, (float)amt, 0f, -1f, null, null, null, 0, null);
                bool       flag3         = firstBuilding != null;
                bool       flag4         = flag3;
                if (flag4)
                {
                    firstBuilding.TakeDamage(damageInfo);
                }
            }
        }
Example #4
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Building b = GridsUtility.GetFirstBuilding(pawn.Position, pawn.Map);

            Log.Message("Attempting to burrow.");
            if (b != null)
            {
                Log.Message("There is a thing here.");
                return(null);
            }
            else
            {
                Log.Message("There is nothing here, burrowing.");
                Thing e = GenSpawn.Spawn(ThingDef.Named("HorrorBurrow"), pawn.Position, pawn.Map);

                return(new Job(JobDefOf.EnterCryptosleepCasket, (Building_CryptosleepCasket)e));
            }
        }
        // Token: 0x06000187 RID: 391 RVA: 0x0000EA24 File Offset: 0x0000CC24
        public override void Resolve(ResolveParams rp)
        {
            Map map = BaseGen.globalSettings.map;

            Rand.PushState();
            for (int i = 0; i < Rand.RangeInclusive(10, 25); i++)
            {
                IntVec3 randomCell = rp.rect.RandomCell;
                if (GenGrid.Standable(randomCell, map) && GridsUtility.GetFirstItem(randomCell, map) == null && GridsUtility.GetFirstPawn(randomCell, map) == null && GridsUtility.GetFirstBuilding(randomCell, map) == null)
                {
                    Pawn val = PawnGenerator.GeneratePawn(PawnKindDefOf.Villager, Find.FactionManager.RandomEnemyFaction(false, false, false, (TechLevel)0));
                    ((Thing)val).Kill((DamageInfo?)new DamageInfo(DamageDefOf.Cut, 9999f, 0f, -1f, (Thing)null, (BodyPartRecord)null, (ThingDef)null, (SourceCategory)0, (Thing)null), (Hediff)null);
                    Corpse corpse = val.Corpse;
                    corpse.timeOfDeath = 10000;
                    ThingCompUtility.TryGetComp <CompRottable>((Thing)(object)corpse).RotImmediately();
                    GenSpawn.Spawn((Thing)(object)corpse, randomCell, map, (WipeMode)0);
                    for (int j = 0; j < 5; j++)
                    {
                        IntVec3 val2 = default(IntVec3);
                        RCellFinder.TryFindRandomCellNearWith(randomCell, (Predicate <IntVec3>)((IntVec3 ni) => GenGrid.Walkable(ni, map)), map, out val2, 1, 3);
                        GenSpawn.Spawn(RimWorld.ThingDefOf.Filth_CorpseBile, val2, map, (WipeMode)0);
                    }
                }
            }
            Rand.PopState();
        }
        // Token: 0x060024B9 RID: 9401 RVA: 0x00117A10 File Offset: 0x00115E10
        public override void EjectContents()
        {
            List <Thing> list = new List <Thing>();

            if (!this.contentsKnown)
            {
                list.AddRange(this.innerContainer);
                list.AddRange(this.UnopenedCasketsInGroup().SelectMany((Building_XenomorphCryptosleepCasket c) => c.innerContainer));
            }
            bool     contentsKnown = this.contentsKnown;
            ThingDef filth_Slime   = ThingDefOf.Filth_Slime;

            foreach (Thing thing in ((IEnumerable <Thing>) this.innerContainer))
            {
                if (thing is Pawn pawn)
                {
                    PawnComponentsUtility.AddComponentsForSpawn(pawn);
                    pawn.filth.GainFilth(filth_Slime);
                    if (pawn.RaceProps.IsFlesh)
                    {
                        pawn.health.AddHediff(HediffDefOf.CryptosleepSickness, null, null, null);
                    }
                }
            }
            if (!base.Destroyed)
            {
                SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None));
            }
            this.innerContainer.TryDropAll(this.InteractionCell, base.Map, ThingPlaceMode.Near, null, (x => GridsUtility.GetFirstBuilding(x, this.Map) == null));
            this.contentsKnown = true;
            if (!contentsKnown)
            {
                //    ThingDef filth_Slime = ThingDefOf.Filth_Slime;
                FilthMaker.TryMakeFilth(base.Position, base.Map, filth_Slime, Rand.Range(8, 12));
                this.SetFaction(null, null);

                /*
                 * foreach (Building_XenomorphCryptosleepCasket building_AncientCryptosleepCasket in this.UnopenedCasketsInGroup())
                 * {
                 *  building_AncientCryptosleepCasket.EjectContents();
                 * }
                 */
                List <Pawn>        source     = list.OfType <Pawn>().ToList <Pawn>();
                IEnumerable <Pawn> enumerable = from p in source
                                                where p.RaceProps.Humanlike && p.GetLord() == null && p.Faction == Faction.OfAncientsHostile
                                                select p;
                if (enumerable.Any <Pawn>())
                {
                    LordMaker.MakeNewLord(Faction.OfAncientsHostile, new LordJob_AssaultColony(Faction.OfAncientsHostile, false, false, false, false, false), base.Map, enumerable);
                }
            }
        }
Example #7
0
 public Building GetFirstBuilding(IntVec3 loc, int mapIndex)
 {
     return(GridsUtility.GetFirstBuilding(loc, Find.Maps[mapIndex]));
 }