OSDN Git Service

W.I.P. III: Translocator working Via BlockEntity scan (surface only, for now)
[automap/automap.git] / Automap / Subsystems / AutomapSystem.cs
index 4d71bc8..200015b 100644 (file)
@@ -112,7 +112,9 @@ namespace Automap
                //Time to (re)write chunk shards
                cartographer_thread.Interrupt( );
                }
+               #if DEBUG
                ClientAPI.TriggerChatMessage($"Automap {updatedChunksTotal} Updates - MAX (N:{chunkTopMetadata.North_mostChunk},S:{chunkTopMetadata.South_mostChunk},E:{chunkTopMetadata.East_mostChunk}, W:{chunkTopMetadata.West_mostChunk} - TOTAL: {chunkTopMetadata.Count})");
+               #endif
                }
 
                }
@@ -408,16 +410,16 @@ namespace Automap
                tableWriter.RenderBeginTag(HtmlTextWriterTag.Ul);
                foreach (var poi in this.POIs) {
                tableWriter.RenderBeginTag(HtmlTextWriterTag.Li);
-               tableWriter.WriteEncodedText(poi.Location.PrettyCoords(this.ClientAPI));
-               tableWriter.WriteEncodedText(poi.Notes);
+               tableWriter.WriteEncodedText(poi.Location.PrettyCoords(this.ClientAPI)+"\t");
+               tableWriter.WriteEncodedText(poi.Notes+ "\t");
                tableWriter.WriteEncodedText(poi.Timestamp.ToString("u"));
                tableWriter.RenderEndTag( );
                }
 
                foreach (var eoi in this.EOIs.PointsList) {
                tableWriter.RenderBeginTag(HtmlTextWriterTag.Li);
-               tableWriter.WriteEncodedText(eoi.Location.PrettyCoords(this.ClientAPI));
-               tableWriter.WriteEncodedText(eoi.Notes);
+               tableWriter.WriteEncodedText(eoi.Location.PrettyCoords(this.ClientAPI)+ "\t");
+               tableWriter.WriteEncodedText(eoi.Notes+ "\t");
                tableWriter.WriteEncodedText(eoi.Timestamp.ToString("u") );
                tableWriter.RenderEndTag( );
                }
@@ -528,17 +530,30 @@ namespace Automap
                }
 
                /// <summary>
-               /// Does the heavy lifting of Scanning the whole (surface) chunk - creates Heightmap and Processes POIs, Entities, and stats...
+               /// Does the heavy lifting of Scanning columns of chunks - creates Heightmap and Processes POIs, Entities, and stats...
                /// </summary>
                /// <param name="key">Chunk Coordinate</param>
                /// <param name="mapChunk">Map chunk.</param>
                /// <param name="chunkMeta">Chunk metadata</param>
                private void ProcessChunkBlocks(Vec2i key, IMapChunk mapChunk, ColumnMeta chunkMeta)
                {
+               //TODO: build stack of chunk(s) - surface down to bedrock
                int topChunkY = mapChunk.YMax / chunkSize;
                WorldChunk chunkData = ( Vintagestory.Common.WorldChunk )ClientAPI.World.BlockAccessor.GetChunk(key.X, topChunkY, key.Y);
 
-               
+               if (chunkData.BlockEntities != null && chunkData.BlockEntities.Length > 0) {
+               #if DEBUG
+               Logger.VerboseDebug("Surface@ {0} = BlockEntities: {1}", key, chunkData.BlockEntities.Length);
+
+               foreach (var blockEnt in chunkData.BlockEntities) {             
+                       if (BlockID_Designators.ContainsKey(blockEnt.Block.BlockId)) 
+                       {
+                       var designator = BlockID_Designators[blockEnt.Block.BlockId];
+                       designator.SpecialAction(ClientAPI, POIs, blockEnt.Pos.Copy(), blockEnt.Block);
+                       }
+               }
+               #endif
+               }
 
                }