public override void MapComponentTick()
        {
            base.MapComponentTick();

            if (DirtyCells.Count != 0)
            {
                HashSet <Building_Window> windowsToUpdate = new HashSet <Building_Window>();
                foreach (var c in DirtyCells)
                {
                    try
                    {
                        foreach (var window in WindowCells[c])
                        {
                            windowsToUpdate.Add(window);
                        }
                    } catch
                    {
                        DirtyCells.Remove(c);
                    }
                }

                foreach (var window in windowsToUpdate)
                {
                    UpdateWindowCells(window, false);
                    // when we attempt to resolve the facing, we also query cells, and push them to the calculation
                    window.Cells = WindowUtility.CalculateWindowLightCells(window, window.WindowComp.TryResolveFacing());
                    UpdateWindowCells(window, true);

                    DirtyCells.Clear();
                }
            }
        }
 public void RegisterWindow(Building_Window window)
 {
     if (!windows.Contains(window))
     {
         windows.Add(window);
         // when we attempt to resolve the facing, we also query cells, and push them to the calculation
         if (window.WindowComp.facing == LinkDirections.None)
         {
             window.Cells = WindowUtility.CalculateWindowLightCells(window, window.WindowComp.TryResolveFacing());
         }
         UpdateWindowCells(window, true);
     }
 }
示例#3
0
        private void UpdateWindow()
        {
            WindowCache.WindowComponent.UpdateWindowCells(Parent, false);
            Parent.Cells = WindowUtility.CalculateWindowLightCells(Parent);
            WindowCache.WindowComponent.UpdateWindowCells(Parent, true);

            Find.CurrentMap.mapDrawer.MapMeshDirty(Parent.Position, MapMeshFlag.GroundGlow);

            if (ElifsDecorationsSettings.BeautyEnabled)
            {
                GetBeauty();
            }
        }