Esempio n. 1
0
        public override void MapComponentUpdate()
        {
            if (this.elevationDrawer == null)
            {
                elevationDrawer = new CellBoolDrawer(new TopographyCellGiver(map, elevation, Color.yellow, Color.red), this.map.Size.x, this.map.Size.z);
            }
            if (this.moistureDrawer == null)
            {
                moistureDrawer = new CellBoolDrawer(new TopographyCellGiver(map, moisture, Color.yellow, Color.cyan), this.map.Size.x, this.map.Size.z);
            }
            if (this.waterLevelDrawer == null)
            {
                waterLevelDrawer = new CellBoolDrawer(new TopographyCellGiver(map, waterLevel, Color.yellow, Color.blue), this.map.Size.x, this.map.Size.z);
            }

            if (SettingsController.ShowElevationMap)
            {
                this.elevationDrawer.MarkForDraw();
                this.elevationDrawer.CellBoolDrawerUpdate();
            }
            if (SettingsController.ShowMoistureMap)
            {
                this.moistureDrawer.MarkForDraw();
                this.moistureDrawer.CellBoolDrawerUpdate();
            }
            if (SettingsController.ShowWaterLevelMap)
            {
                this.waterLevelDrawer.MarkForDraw();
                this.waterLevelDrawer.CellBoolDrawerUpdate();
            }
        }
Esempio n. 2
0
 public MapComponent_HiddenWaterSpot(Map map) : base(map)
 {
     this.spotGrid       = new ushort[map.cellIndices.NumGridCells];
     this.spotCells      = new HashSet <IntVec3>();
     this.drawer         = new CellBoolDrawer(this, map.Size.x, map.Size.z, 1f);
     this.lastUpdateTick = Find.TickManager.TicksGame;
 }
Esempio n. 3
0
 public PriorityLayer(PriorityGrid grid, SpatialPriority priority, Color color)
 {
     _priority = priority;
     _grid     = grid;
     Color     = color;
     _drawer   = new CellBoolDrawer(this, grid.map.Size.x, grid.map.Size.z);
     Debug.Log($"Creating layer {priority} ({color})");
 }
Esempio n. 4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SlurryNet" /> class.
        /// </summary>
        /// <param name="map">The map.</param>
        public SlurryNet([NotNull] Map map)
        {
            _disjointSet = new BoolGrid(map);
            _connectors  = new List <SlurryNetComp>();
            _traders     = new List <ISlurryNetTrader>();
            _storage     = new List <ISlurryNetStorage>();
            Map          = map;
#if DEBUG
            _drawer = new CellBoolDrawer(i => _disjointSet[i], () => _color, i => _color, map.Size.x, map.Size.z);
#endif
        }
Esempio n. 5
0
 public void BuildLevelDrawers()
 {
     this.LevelDrawers = new List <CellBoolDrawer>();
     foreach (PathAvoidDef current in DefDatabase <PathAvoidDef> .AllDefs)
     {
         bool display = current.display;
         if (display)
         {
             CellBoolDrawer item = new CellBoolDrawer(new PathAvoidGrid.PathAvoidLevel(this, (byte)current.level, current.color), this.map.Size.x, this.map.Size.z);
             this.LevelDrawers.Add(item);
         }
     }
 }
Esempio n. 6
0
        public MapComp_Noise(Map map) : base(map)
        {
            int numGridCells = map.cellIndices.NumGridCells;

            noiseGrid = new int[numGridCells];
            for (int i = 0; i < numGridCells; i++)
            {
                noiseGrid[i] = 0;
            }
            drawer          = new CellBoolDrawer(this, map.Size.x, map.Size.z);
            polluters       = new Dictionary <Sustainer, List <Vector2Int> >();
            bangs           = new Dictionary <int, List <Vector2Int> >();
            soothers        = new Dictionary <Thing, List <Vector2Int> >();
            currentJobNoise = new Dictionary <Pawn, int>();
        }
        public GasNet(IEnumerable <CompGas> connectors, Map map)
        {
            this.map = map;
            netGrid  = new BoolGrid(map);

#if DEBUG
            drawer = new CellBoolDrawer((index) => netGrid[index], () => color, (index) => color, map.Size.x,
                                        map.Size.z);
#endif

            foreach (var connector in connectors)
            {
                Register(connector);
            }
        }
Esempio n. 8
0
        public DesireGrid(Map map) : base(map)
        {
            var n = map.cellIndices.NumGridCells;

            walkGrid        = new float[n];
            stoneGrid       = new float[n];
            originalTerrain = new TerrainDef[n];

            for (var i = 0; i < n; i++)
            {
                walkGrid[i]  = 0;
                stoneGrid[i] = 0;
            }

            pathsDrawer = new CellBoolDrawer(this, map.Size.x, map.Size.z, 2610, .5f);
        }
Esempio n. 9
0
        public virtual void Update()
        {
            if (toggleShow.Contains(this.GetType()) || ShouldAutoDraw() && AutoDraw())
            {
                if (drawer == null)
                {
                    MakeDrawer();
                }

                drawer.MarkForDraw();                // can't just call ActuallyDraw :/
                drawer.CellBoolDrawerUpdate();
                PostDraw();
                dirty = false;
            }
            else
            {
                drawer = null;
            }
        }
Esempio n. 10
0
        public void BuildLevelDrawers()
        {
            this.LevelDrawers = new List <CellBoolDrawer>();
            foreach (PathAvoidDef current in DefDatabase <PathAvoidDef> .AllDefsListForReading)
            {
                if (current.isPrefer && !Settings.IsPreferredEnabled)
                {
                    continue;
                }

                if (current.display)
                {
                    var p = new PathAvoidGrid.PathAvoidLevel();
                    p.Initialize(this, (byte)current.level, current.color);
                    CellBoolDrawer item = new CellBoolDrawer(p, this.map.Size.x, this.map.Size.z);
                    this.LevelDrawers.Add(item);
                }
            }
        }
        public override void MapComponentUpdate()
        {
            base.MapComponentUpdate();

            drawer.CellBoolDrawerUpdate();
            var anyPools = false;

            foreach (var pool in pools)
            {
                if (pool == null)
                {
                    continue;
                }

                pool.Update();
                anyPools = true;
            }

            if (anyPools)
            {
                return;
            }

            if (gridUpdates > 20)
            {
                if (gridUpdates >= 50)
                {
                    return;
                }

                Log.Message("No water no life: Water grid not found, and failed to regenerate after 20 tries");
                gridUpdates = 55;
                return;
            }

            gridUpdates++;
            poolIDGrid = new ushort[map.cellIndices.NumGridCells];
            drawer     = new CellBoolDrawer(this, map.Size.x, map.Size.z, 1f);
            pools      = new List <UndergroundWaterPool>();
            MizuUtility.GenerateUndergroundWaterGrid(map, this);
        }
            internal ReplayDrawer(InstantReplay replay)
            {
                this.replay = replay;
                color       = colors[colorIndex % colors.Length];
                colorIndex++;
                frame         = 0;
                framesPerTick = Math.Max(replay.frames.Count / finishWithinTicks, 5);

                ReplayFrame firstFrame = replay.frames[0];

                frameCells = firstFrame.cells;
                frameLines = firstFrame.lines;

                ICellBoolGiver oldCellGiver = new ReplayCellBoolGiver(cells.Contains, color);

                oldCellDrawer = new CellBoolDrawer(oldCellGiver, replay.map.Size.x, replay.map.Size.z, 0.10f);

                ICellBoolGiver frameCellGiver = new ReplayCellBoolGiver(c => frameCells.Contains(c), color);

                frameCellDrawer = new CellBoolDrawer(frameCellGiver, replay.map.Size.x, replay.map.Size.z, 0.66f);
            }
 public void Update()
 {
     if (toggleShow)
     {
         if (drawer == null)
         {
             MakeDrawer();
         }
         drawer.MarkForDraw();
         //from heatmap
         int ticksGame = Find.TickManager.TicksGame;
         if (nextUpdateTick == 0 || ticksGame >= nextUpdateTick || Find.CurrentMap != lastSeenMap)
         {
             drawer.SetDirty();
             nextUpdateTick = ticksGame + updateDelay;
             lastSeenMap    = Find.CurrentMap;
         }//
         drawer.CellBoolDrawerUpdate();
         //dirty = false;
         return;
     }
     drawer = null;
 }
Esempio n. 14
0
 public void Reset()
 {
     _drawerInt = null;
 }
Esempio n. 15
0
 public void MakeDrawer()
 {
     drawer = new CellBoolDrawer((ICellBoolGiver)this, Find.CurrentMap.Size.x, Find.CurrentMap.Size.z, defaultOpacity * Settings.Get().overlayOpacity);
 }
Esempio n. 16
0
 public void MakeDrawer()
 {
     drawer = new CellBoolDrawer(this, Find.CurrentMap.Size.x, Find.CurrentMap.Size.z);
 }
 public MapComponent_WaterGrid(Map map) : base(map)
 {
     this.poolIDGrid = new ushort[map.cellIndices.NumGridCells];
     this.drawer     = new CellBoolDrawer(this, map.Size.x, map.Size.z, 1f);
 }
 public void MakeDrawer()
 {
     drawer      = new CellBoolDrawer(this, Find.CurrentMap.Size.x, Find.CurrentMap.Size.z);
     needsUpdate = true;
 }
 public NaturalLightOverlay(MapComp_Windows parent)
 {
     Parent      = parent;
     lastSeenMap = parent.map;
     drawer      = new CellBoolDrawer(this, parent.map.Size.x, parent.map.Size.z);
 }
 public CleaningManager_MapComponent(Map map) : base(map)
 {
     priorityAreasDrawer = new CellBoolDrawer(this, map.Size.x, map.Size.z);
 }
Esempio n. 21
0
 public BetharianGrid(Map map)
 {
     this.map     = map;
     strengthGrid = new ushort[map.cellIndices.NumGridCells];
     drawer       = new CellBoolDrawer(this, map.Size.x, map.Size.z, 0.33f);
 }