OSDN Git Service

Apparently 'fixed' Air Block type filters (non-solid plants)
[automap/automap.git] / Automap / Subsystems / AutomapSystem.cs
index 4013b9a..f61fef5 100644 (file)
@@ -132,9 +132,14 @@ namespace Automap
 
                private void ChunkAChanging(Vec3i chunkCoord, IWorldChunk chunk, EnumChunkDirtyReason reason)
                {
-                       Vec2i topPosition = new Vec2i(chunkCoord.X, chunkCoord.Z);
-
-                       columnCounter.AddOrUpdate(topPosition, 1, (key, colAct) => colAct + 1);
+               Vec2i topPosition = new Vec2i(chunkCoord.X, chunkCoord.Z);
+
+               //TODO: Track Y Chunk - Column, surface chunks being more important
+               //Only NEW/LOADED chunks unless edits > N 
+               //if (reason == EnumChunkDirtyReason.NewlyCreated || reason == EnumChunkDirtyReason.NewlyLoaded)
+               //{
+               columnCounter.AddOrUpdate(topPosition, 1, (key, colAct) => colAct + 1);
+               //}
                }
 
                private void AwakenCartographer(float delayed)
@@ -221,7 +226,7 @@ namespace Automap
                                                ProcessChunkBlocks(mostActiveCol.Key, mapChunk, ref chunkMeta);
 
                                                ChunkRenderer.SetupPngImage(mostActiveCol.Key, path, _chunkPath, ref chunkMeta);
-                                               ChunkRenderer.GenerateChunkPngShard(mostActiveCol.Key, mapChunk, chunkMeta, out updatedPixels);
+                                               ChunkRenderer.GenerateChunkPngShard(mostActiveCol.Key, mapChunk, chunkMeta, ref chunkTopMetadata, out updatedPixels);
 
                                                if (updatedPixels > 0)
                                                {
@@ -323,10 +328,16 @@ namespace Automap
                        this.BlockID_Designators = new Dictionary<int, BlockDesignator>();
                        this.Entity_Designators = new Dictionary<AssetLocation, EntityDesignator>();
                        this.RockIdCodes = Helpers.ArbitrarytBlockIdHunter(ClientAPI, new AssetLocation(GlobalConstants.DefaultDomain, "rock-"), EnumBlockMaterial.Stone);
-                       this.AiryIdCodes = Helpers.ArbitrarytBlockIdHunter(ClientAPI, new AssetLocation(GlobalConstants.DefaultDomain, "tallgrass-"), EnumBlockMaterial.Plant);
 
-                       //Add special marker types for BlockID's of "Interest", overwrite colour, and method
+                       var airBlocksQuery = from airyBlock in ClientAPI.World.Blocks
+                                                        where airyBlock.MatterState == EnumMatterState.Solid
+                                                        where airyBlock.BlockMaterial == EnumBlockMaterial.Plant || airyBlock.BlockMaterial == EnumBlockMaterial.Leaves
+                                                        where airyBlock.CollisionBoxes == null || airyBlock.CollisionBoxes.Length == 0
+                                                        select airyBlock;                      
+                       //^^ 'Solid' phase - 'Plant' Blocks without any boundg box ? Except water...
+                       this.AiryIdCodes = airBlocksQuery.ToDictionary(aBlk => aBlk.BlockId, aBlk => aBlk.Code.Path);
 
+                       //Add special marker types for BlockID's of "Interest", overwrite colour, and method
                        Reload_POI_Designators();
                }