Esempio n. 1
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            //light & ventilation comps:
            mainComp = GetComps <CompWindow>().FirstOrDefault();
            if (mainComp.Props.signal == "both")
            {
                if (!respawningAfterLoad)
                {
                    venting = true;
                }
                leaks    = true;
                ventComp = mainComp;
            }
            else
            {
                ventComp = GetComps <CompWindow>().Where(x => x.Props.signal == "air").FirstOrDefault();
            }

            //basic functionality
            map.GetComponent <MapComp_Windows>().RegisterWindow(this);
            WindowUtility.FindEnds(this);
            SetScanLines();

            //wall linking
            if (OpenTheWindowsSettings.LinkWindows)
            {
                map.linkGrid.Notify_LinkerCreatedOrDestroyed(this);
                map.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things, true, false);
            }
        }
Esempio n. 2
0
 private void ReactSkylights(MapUpdateWatcher.MapUpdateInfo info, IEnumerable <IntVec3> tiles)
 {
     if (info.removed)
     {
         ExcludeTileRange(tiles);
         WindowUtility.ResetWindowsAround(map, info.center);
     }
     else
     {
         IncludeTileRange(tiles);
     }
 }
Esempio n. 3
0
 private void ReactTransparentRoof(MapUpdateWatcher.MapUpdateInfo info)
 {
     if (TransparentRoofsList.Contains(info.roofDef))
     {
         if (info.removed)
         {
             ExcludeTile(info.center, true);
             WindowUtility.ResetWindowsAround(map, info.center);
         }
         else
         {
             IncludeTile(info.center);
         }
     }
 }
Esempio n. 4
0
 public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
 {
     if (thing == null)
     {
         Map     currentMap = Find.CurrentMap;
         IntVec3 start      = WindowUtility.FindEnd(center, rot, def.size, false);
         IntVec3 end        = WindowUtility.FindEnd(center, rot, def.size, true);
         GenDraw.DrawFieldEdges(WindowUtility.GetWindowObfuscation(def.size, center, rot, currentMap, start, end).ToList());
     }
     else
     {
         var window = thing as Building_Window;
         GenDraw.DrawFieldEdges(window.EffectArea);
     }
 }