public static bool WipeExistingThings( IntVec3 thingPos, Rot4 thingRot, BuildableDef thingDef, Map map, DestroyMode mode) { foreach (IntVec3 c in GenAdj.CellsOccupiedBy(thingPos, thingRot, thingDef.Size)) { Thing[] array; List <Thing> list = ThingGrid_Patch.ThingsListAt2(map.thingGrid, c); lock (list) { array = list.ToArray(); } foreach (Thing thing in array) { if (null != thing) { ThingDef d = thing.def; if (null != d) { if (GenSpawn.SpawningWipes(thingDef, thing.def)) { thing.Destroy(mode); } } } } } return(false); }
public static void Postfix_Constructor(ThingGrid __instance, Map map) { ThingGrid_Patch.map(__instance) = map; CellIndices cellIndices = map.cellIndices; List <Thing>[] thingGrid = new List <Thing> [cellIndices.NumGridCells]; thingGridDict.Add(__instance, thingGrid); for (int i = 0; i < cellIndices.NumGridCells; ++i) { thingGrid[i] = new List <Thing>(4); } }