コード例 #1
0
ファイル: JPSkyFaller.cs プロジェクト: zwfengineer/Jetpack
        // 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;
            }
        }
コード例 #2
0
 /// <summary>
 /// Sets a list of cells that will be changed so that they can be reverted if removed.
 /// </summary>
 private void GetOriginalRoofInRange()
 {
     foreach (IntVec3 cell in GenRadial.RadialCellsAround(base.Position, this.def.specialDisplayRadius, true))
     {
         if (cell.InBounds(base.Map))
         {
             if (cell.GetRoof(base.Map) != null)
             {
                 if (GridsUtility.GetRoof(cell, base.Map).isThickRoof)
                 {
                     originalThickRoof.Add(cell);
                 }
             }
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Sets thickRoofed cells in specialDisplayRadius to RoofClean RoofDef
        /// </summary>
        private void SetRoofInRange()
        {
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(base.Position, this.def.specialDisplayRadius, true))
            {
                if (cell.InBounds(base.Map))
                {
                    if (cell.GetRoof(base.Map) != null)
                    {
                        if (GridsUtility.GetRoof(cell, base.Map).isThickRoof)
                        {
                            RoofDef roofType = DefDatabase <RoofDef> .GetNamed("RoofClean");

                            base.Map.roofGrid.SetRoof(cell, roofType);
                        }
                    }
                }
            }
        }
コード例 #4
0
 public override IEnumerable <Thing> PotentialWorkThingsGlobal(Pawn pawn)        //Finds all actively deteriorating items
 {
     return(pawn.Map.listerHaulables.ThingsPotentiallyNeedingHauling().Where(t => t.GetStatValue(StatDefOf.DeteriorationRate, true) > 0f && GridsUtility.GetRoof(t.Position, t.Map) == null));
 }