Пример #1
0
        public override void Tick()
        {
            counter += 1;

            if (counter > 100)
            {
                var pawn = GridsUtility.GetFirstPawn(this.Position, this.Map);

                if (pawn != null)
                {
                    if (pawn.Faction != null)
                    {
                        if (pawn.Faction.def.defName != "Horrors")
                        {
                            num *= pawn.GetStatValue(StatDefOf.ToxicSensitivity, true);
                            float num2 = Mathf.Lerp(0.85f, 1.15f, Rand.ValueSeeded(pawn.thingIDNumber ^ 74374237));
                            num *= num2;
                            HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, num);
                        }
                    }
                }
                counter = 0;
            }

            if (this.destroyTick <= Find.TickManager.TicksGame)
            {
                this.Destroy(DestroyMode.Vanish);
            }
            this.graphicRotation += this.graphicRotationSpeed;
        }
Пример #2
0
        // Token: 0x06000051 RID: 81 RVA: 0x00004498 File Offset: 0x00002698
        internal void JPHitRoof(bool up)
        {
            if (!this.def.skyfaller.hitRoof)
            {
                return;
            }
            CellRect cr;

            if (up)
            {
                IntVec3 hrpcell   = IntVec3Utility.ToIntVec3(base.DrawPos);
                IntVec2 punchsize = new IntVec2(3, 3);
                cr = GenAdj.OccupiedRect(hrpcell, base.Rotation, punchsize);
            }
            else
            {
                cr = GenAdj.OccupiedRect(this);
            }
            if (cr.Cells.Any((IntVec3 x) => GridsUtility.Roofed(x, this.Map)))
            {
                RoofDef roof = GridsUtility.GetRoof(cr.Cells.First((IntVec3 x) => GridsUtility.Roofed(x, this.Map)), base.Map);
                if (!SoundDefHelper.NullOrUndefined(roof.soundPunchThrough))
                {
                    SoundStarter.PlayOneShot(roof.soundPunchThrough, new TargetInfo(base.Position, base.Map, false));
                }
                RoofCollapserImmediate.DropRoofInCells(cr.ExpandedBy(1).ClipInsideMap(base.Map).Cells.Where(delegate(IntVec3 c)
                {
                    if (!GenGrid.InBounds(c, this.Map))
                    {
                        return(false);
                    }
                    if (cr.Contains(c))
                    {
                        return(true);
                    }
                    if (GridsUtility.GetFirstPawn(c, this.Map) != null)
                    {
                        return(false);
                    }
                    Building edifice = GridsUtility.GetEdifice(c, this.Map);
                    return(edifice == null || !edifice.def.holdsRoof);
                }), base.Map, null);
                if (up)
                {
                    this.PilotRoofPunchUp = true;
                    return;
                }
                this.PilotRoofPunchDown = true;
            }
        }
Пример #3
0
        public List <Pawn> CollectPawns()
        {
            List <Pawn> TmpList = new List <Pawn>();

            if (this.Map.thingGrid.CellContains(this.Position, ThingDefOf.Table_interactive_2x2c))
            {
                //Top Cells
                AdjacentCellsAround_2x2[0] = new IntVec3(0, 0, 2);
                AdjacentCellsAround_2x2[5] = new IntVec3(1, 0, 2);
                //Right Cells
                AdjacentCellsAround_2x2[1] = new IntVec3(2, 0, 0);
                AdjacentCellsAround_2x2[6] = new IntVec3(2, 0, 1);
                //Bottom Cells
                AdjacentCellsAround_2x2[2] = new IntVec3(0, 0, -1);
                AdjacentCellsAround_2x2[4] = new IntVec3(1, 0, -1);
                //Left Cells
                AdjacentCellsAround_2x2[3] = new IntVec3(-1, 0, 0);
                AdjacentCellsAround_2x2[7] = new IntVec3(-1, 0, 1);

                for (int i = 0; i < AdjacentCellsAround_2x2.Length; i++)
                {
                    if (GridsUtility.GetFirstPawn(this.Position + AdjacentCellsAround_2x2[i], this.Map) != null)
                    {
                        TmpList.Add(GridsUtility.GetFirstPawn(this.Position + AdjacentCellsAround_2x2[i], this.Map));
                    }
                }
            }
            else
            {
                for (int i = 0; i < GenAdj.CardinalDirectionsAround.Length; i++)
                {
                    if (GridsUtility.GetFirstPawn(this.Position + GenAdj.CardinalDirectionsAround[i], this.Map) != null)
                    {
                        TmpList.Add(GridsUtility.GetFirstPawn(this.Position + GenAdj.CardinalDirectionsAround[i], this.Map));
                    }
                }
            }
            return(TmpList);
        }
        // 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();
        }
Пример #5
0
 public Pawn GetFirstPawn(IntVec3 loc, int mapIndex)
 {
     return(GridsUtility.GetFirstPawn(loc, Find.Maps[mapIndex]));
 }