// when a new roof is placed, notify windows that enclose that cell to update public static void Prefix(IntVec3 c, RoofDef def) { MapComponent_Windows mapComp = WindowCache.WindowComponent; if (mapComp?.WindowCells?.ContainsKey(c) ?? false) { mapComp?.DirtyCells?.Add(c); } }
private static void RecalcLight(Map map, MapComponent_Windows comp) { changedRoofs = new Dictionary <int, RoofDef>(); // hypothetically we don't need to redo all of this, we could simply get the tiles. Todo: Check overhead of this // not much overhead, but it could be done! maybe if complaints are raised foreach (IntVec3 cell in comp.WindowCells.Keys) { var index = map.cellIndices.CellToIndex(cell); changedRoofs.Add(index, roofRef[index]); roofRef[index] = null; } // we have validated our cache, lets make sure we don't do it needlessly WindowCache.WindowComponent.dirty = false; }