Beispiel #1
0
        private void UnfogWorker(IntVec3 c)
        {
            int num = map.cellIndices.CellToIndex(c);

            if (fogGrid[num])
            {
                fogGrid[num] = false;
                if (Current.ProgramState == ProgramState.Playing)
                {
                    map.mapDrawer.MapMeshDirty(c, MapMeshFlag.FogOfWar);
                }
                Designation designation = map.designationManager.DesignationAt(c, DesignationDefOf.Mine);
                if (designation != null && c.GetFirstMineable(map) == null)
                {
                    designation.Delete();
                }
                if (Current.ProgramState == ProgramState.Playing)
                {
                    map.roofGrid.Drawer.SetDirty();
                }
            }
        }
 public void SetTerrain(IntVec3 c, TerrainDef newTerr)
 {
     if (newTerr == null)
     {
         Log.Error("Tried to set terrain at " + c + " to null.", false);
     }
     else
     {
         if (Current.ProgramState == ProgramState.Playing)
         {
             Designation designation = this.map.designationManager.DesignationAt(c, DesignationDefOf.SmoothFloor);
             if (designation != null)
             {
                 designation.Delete();
             }
         }
         int num = this.map.cellIndices.CellToIndex(c);
         if (newTerr.layerable)
         {
             if (this.underGrid[num] == null)
             {
                 if (this.topGrid[num].passability != Traversability.Impassable)
                 {
                     this.underGrid[num] = this.topGrid[num];
                 }
                 else
                 {
                     this.underGrid[num] = TerrainDefOf.Sand;
                 }
             }
         }
         else
         {
             this.underGrid[num] = null;
         }
         this.topGrid[num] = newTerr;
         this.DoTerrainChangedEffects(c);
     }
 }