private void DoTerrainChangedEffects(IntVec3 c) { map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Terrain, regenAdjacentCells: true, regenAdjacentSections: false); List <Thing> thingList = c.GetThingList(map); for (int num = thingList.Count - 1; num >= 0; num--) { if (thingList[num].def.category == ThingCategory.Plant && map.fertilityGrid.FertilityAt(c) < thingList[num].def.plant.fertilityMin) { thingList[num].Destroy(); } else if (thingList[num].def.category == ThingCategory.Filth && !FilthMaker.TerrainAcceptsFilth(TerrainAt(c), thingList[num].def)) { thingList[num].Destroy(); } else if ((thingList[num].def.IsBlueprint || thingList[num].def.IsFrame) && !GenConstruct.CanBuildOnTerrain(thingList[num].def.entityDefToBuild, thingList[num].Position, map, thingList[num].Rotation, null, ((IConstructible)thingList[num]).EntityToBuildStuff())) { thingList[num].Destroy(DestroyMode.Cancel); } } map.pathGrid.RecalculatePerceivedPathCostAt(c); if (drawerInt != null) { drawerInt.SetDirty(); } map.fertilityGrid.Drawer.SetDirty(); Region regionAt_NoRebuild_InvalidAllowed = map.regionGrid.GetRegionAt_NoRebuild_InvalidAllowed(c); if (regionAt_NoRebuild_InvalidAllowed != null && regionAt_NoRebuild_InvalidAllowed.Room != null) { regionAt_NoRebuild_InvalidAllowed.Room.Notify_TerrainChanged(); } }
public void SetAt(IntVec3 c, ThingDef def, int count) { if (count == 0) { def = null; } ushort num = def?.shortHash ?? 0; ushort num2 = (ushort)count; if (count > 65535) { Log.Error("Cannot store count " + count + " in DeepResourceGrid: out of ushort range."); num2 = ushort.MaxValue; } if (count < 0) { Log.Error("Cannot store count " + count + " in DeepResourceGrid: out of ushort range."); num2 = 0; } int num3 = map.cellIndices.CellToIndex(c); if (defGrid[num3] != num || countGrid[num3] != num2) { defGrid[num3] = num; countGrid[num3] = num2; drawer.SetDirty(); } }
private void Rebuild() { dirty = false; if (exitMapGrid == null) { exitMapGrid = new BoolGrid(map); } else { exitMapGrid.Clear(); } CellRect cellRect = CellRect.WholeMap(map); for (int i = cellRect.minZ; i <= cellRect.maxZ; i++) { for (int j = cellRect.minX; j <= cellRect.maxX; j++) { if (i > 1 && i < cellRect.maxZ - 2 + 1 && j > 1 && j < cellRect.maxX - 2 + 1) { j = cellRect.maxX - 2 + 1; } IntVec3 intVec = new IntVec3(j, 0, i); if (IsGoodExitCell(intVec)) { exitMapGrid[intVec] = true; } } } if (drawerInt != null) { drawerInt.SetDirty(); } }
public void SetRoof(IntVec3 c, RoofDef def) { if (roofGrid[map.cellIndices.CellToIndex(c)] != def) { roofGrid[map.cellIndices.CellToIndex(c)] = def; map.glowGrid.MarkGlowGridDirty(c); map.regionGrid.GetValidRegionAt_NoRebuild(c)?.Room.Notify_RoofChanged(); if (drawerInt != null) { drawerInt.SetDirty(); } map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Roofs); } }