2 using System.Collections.Concurrent;
3 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
9 using System.Text.RegularExpressions;
10 using System.Threading;
14 using Hjg.Pngcs.Chunks;
16 using Vintagestory.API.Client;
17 using Vintagestory.API.Common;
18 using Vintagestory.API.Common.Entities;
19 using Vintagestory.API.Config;
20 using Vintagestory.API.MathTools;
21 using Vintagestory.Common;
25 public class AutomapSystem
27 private Thread cartographer_thread;
28 private ICoreClientAPI ClientAPI { get; set; }
29 private ILogger Logger { get; set; }
30 private IChunkRenderer ChunkRenderer { get; set; }
32 private const string _mapPath = @"Maps";
33 private const string _chunkPath = @"Chunks";
34 private const string _domain = @"automap";
35 private const string chunkFile_filter = @"*_*.png";
36 private static Regex chunkShardRegex = new Regex(@"(?<X>[\d]+)_(?<Z>[\d]+).png", RegexOptions.Singleline);
38 private ConcurrentDictionary<Vec2i, uint> columnCounter = new ConcurrentDictionary<Vec2i, uint>(3, 150 );
39 private ColumnsMetadata chunkTopMetadata;
40 private PointsOfInterest POIs;
41 private EntitiesOfInterest EOIs;
43 internal Dictionary<int, BlockDesignator> BlockID_Designators { get; private set;}
44 internal Dictionary<AssetLocation, EntityDesignator> Entity_Designators { get; private set; }
45 internal Dictionary<int, string> RockIdCodes { get; private set; }
47 internal bool Enabled { get; set; }
48 //Run status, Chunks processed, stats, center of map....
49 internal uint nullChunkCount, updatedChunksTotal;
50 internal Vec2i startChunkColumn;
52 private readonly int chunkSize;
54 private IAsset stylesFile;
57 public AutomapSystem(ICoreClientAPI clientAPI, ILogger logger)
59 this.ClientAPI = clientAPI;
61 chunkSize = ClientAPI.World.BlockAccessor.ChunkSize;
62 ClientAPI.Event.LevelFinalize += EngageAutomap;
64 //TODO:Choose which one from GUI
65 this.ChunkRenderer = new StandardRenderer(clientAPI, logger);
70 private void EngageAutomap( )
72 path = ClientAPI.GetOrCreateDataPath(_mapPath);
73 path = ClientAPI.GetOrCreateDataPath(Path.Combine(path, "World_" + ClientAPI.World.Seed));//Add name of World too...'ServerApi.WorldManager.CurrentWorldName'
75 stylesFile = ClientAPI.World.AssetManager.Get(new AssetLocation(_domain, "config/automap_format.css"));
76 Logger.VerboseDebug("CSS loaded: {0} size: {1}",stylesFile.IsLoaded() ,stylesFile.ToText( ).Length);
78 Prefill_POI_Designators( );
79 startChunkColumn = new Vec2i((ClientAPI.World.Player.Entity.LocalPos.AsBlockPos.X / chunkSize), (ClientAPI.World.Player.Entity.LocalPos.AsBlockPos.Z / chunkSize));
80 chunkTopMetadata = new ColumnsMetadata(startChunkColumn);
82 Logger.Notification("AUTOMAP Start {0}", startChunkColumn);
85 ClientAPI.Event.ChunkDirty += ChunkAChanging;
87 cartographer_thread = new Thread(Cartographer);
88 cartographer_thread.Name = "Cartographer";
89 cartographer_thread.Priority = ThreadPriority.Lowest;
90 cartographer_thread.IsBackground = true;
92 ClientAPI.Event.RegisterGameTickListener(AwakenCartographer, 6000);
95 private void ChunkAChanging(Vec3i chunkCoord, IWorldChunk chunk, EnumChunkDirtyReason reason)
97 Vec2i topPosition = new Vec2i(chunkCoord.X, chunkCoord.Z);
99 columnCounter.AddOrUpdate(topPosition, 1, (key, colAct) => colAct + 1);
102 private void AwakenCartographer(float delayed)
105 if (Enabled && (ClientAPI.IsGamePaused != false || ClientAPI.IsShuttingDown != true)) {
107 Logger.VerboseDebug("Cartographer re-trigger from [{0}]", cartographer_thread.ThreadState);
110 if (cartographer_thread.ThreadState.HasFlag(ThreadState.Unstarted)) {
111 cartographer_thread.Start( );
113 else if (cartographer_thread.ThreadState.HasFlag(ThreadState.WaitSleepJoin)) {
114 //Time to (re)write chunk shards
115 cartographer_thread.Interrupt( );
118 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})");
125 private void Cartographer( )
128 Logger.VerboseDebug("Cartographer thread awoken");
131 uint ejectedItem = 0;
132 uint updatedChunks = 0;
134 //-- Should dodge enumerator changing underfoot....at a cost.
135 if (!columnCounter.IsEmpty) {
136 var tempSet = columnCounter.ToArray( ).OrderByDescending(kvp => kvp.Value);
137 foreach (var mostActiveCol in tempSet) {
139 var mapChunk = ClientAPI.World.BlockAccessor.GetMapChunk(mostActiveCol.Key);
141 if (mapChunk == null) {
142 Logger.Warning("SKIP CHUNK: ({0}) - Map Chunk NULL!", mostActiveCol.Key);
144 columnCounter.TryRemove(mostActiveCol.Key, out ejectedItem );
148 ColumnMeta chunkMeta = CreateColumnMetadata(mostActiveCol,mapChunk);
149 PngWriter pngWriter = SetupPngImage(mostActiveCol.Key, chunkMeta);
150 UpdateEntityMetadata( );
151 ProcessChunkBlocks(mostActiveCol.Key, mapChunk, chunkMeta);
153 uint updatedPixels = 0;
155 ChunkRenderer.GenerateChunkPngShard(mostActiveCol.Key, mapChunk, chunkMeta, pngWriter , out updatedPixels);
157 if (updatedPixels > 0) {
160 Logger.VerboseDebug("Wrote chunk shard: ({0}) - Edits#:{1}, Pixels#:{2}", mostActiveCol.Key, mostActiveCol.Value, updatedPixels);
163 chunkTopMetadata.Update(chunkMeta);
164 columnCounter.TryRemove(mostActiveCol.Key, out ejectedItem);
167 columnCounter.TryRemove(mostActiveCol.Key, out ejectedItem);
168 Logger.VerboseDebug("Un-painted chunk: ({0}) ", mostActiveCol.Key);
174 if (updatedChunks > 0) {
175 //What about chunk updates themselves; a update bitmap isn't kept...
176 updatedChunksTotal += updatedChunks;
181 //Then sleep until interupted again, and repeat
183 Logger.VerboseDebug("Thread '{0}' about to sleep indefinitely.", Thread.CurrentThread.Name);
185 Thread.Sleep(Timeout.Infinite);
187 } catch (ThreadInterruptedException) {
189 Logger.VerboseDebug("Thread '{0}' interupted [awoken]", Thread.CurrentThread.Name);
192 } catch (ThreadAbortException) {
193 Logger.VerboseDebug("Thread '{0}' aborted.", Thread.CurrentThread.Name);
196 Logger.VerboseDebug("Thread '{0}' executing finally block.", Thread.CurrentThread.Name);
200 private void Prefill_POI_Designators( )
202 this.POIs = new PointsOfInterest( );
203 this.EOIs = new EntitiesOfInterest( );
204 this.BlockID_Designators = new Dictionary<int, BlockDesignator>( );
205 this.Entity_Designators = new Dictionary<AssetLocation, EntityDesignator>( );
206 this.RockIdCodes = Helpers.ArbitrarytBlockIdHunter(ClientAPI, new AssetLocation(GlobalConstants.DefaultDomain, "rock"), EnumBlockMaterial.Stone);
208 //Add special marker types for BlockID's of "Interest", overwrite colour, and method
210 Install_POI_Designators(DefaultDesignators.DefaultBlockDesignators(), DefaultDesignators.DefaultEntityDesignators());
213 private void Install_POI_Designators(ICollection<BlockDesignator> blockDesig, List<EntityDesignator> entDesig)
215 Logger.VerboseDebug("Connecting {0} standard Block-Designators", blockDesig.Count);
216 foreach (var designator in blockDesig) {
217 var blockIDs = Helpers.ArbitrarytBlockIdHunter(ClientAPI, designator.Pattern, designator.Material);
218 if (blockIDs.Count > 0) { Logger.VerboseDebug("Designator {0} has {1} associated blockIDs", designator.ToString( ), blockIDs.Count); }
219 foreach (var entry in blockIDs) {
220 BlockID_Designators.Add(entry.Key, designator);
223 this.ChunkRenderer.BlockID_Designators = BlockID_Designators;
226 Logger.VerboseDebug("Connecting {0} standard Entity-Designators", entDesig.Count);
227 foreach (var designator in entDesig) {
228 //Get Variants first, from EntityTypes...better be populated!
229 var matched = ClientAPI.World.EntityTypes.FindAll(entp => entp.Code.BeginsWith(designator.Pattern.Domain, designator.Pattern.Path));
231 foreach (var match in matched) {
232 Logger.VerboseDebug("Linked Entity: {0} Designator: {1}", match.Code, designator);
233 this.Entity_Designators.Add(match.Code, designator);
238 //EntityProperties props = ClientAPI.World.GetEntityType(designator.Pattern);
244 //TODO: Convert to RAZOR model
245 private void GenerateMapHTML( )
247 string mapFilename = Path.Combine(path, "Automap.html");
249 int TopNorth = chunkTopMetadata.North_mostChunk;
250 int TopSouth = chunkTopMetadata.South_mostChunk;
251 int TopEast = chunkTopMetadata.East_mostChunk;
252 int TopWest = chunkTopMetadata.West_mostChunk;
254 using (StreamWriter outputText = new StreamWriter(File.Open(mapFilename, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))) {
255 using (HtmlTextWriter tableWriter = new HtmlTextWriter(outputText)) {
256 tableWriter.BeginRender( );
257 tableWriter.RenderBeginTag(HtmlTextWriterTag.Html);
259 tableWriter.RenderBeginTag(HtmlTextWriterTag.Head);
260 tableWriter.RenderBeginTag(HtmlTextWriterTag.Title);
261 tableWriter.WriteEncodedText("Generated Automap");
262 tableWriter.RenderEndTag( );
264 tableWriter.RenderBeginTag(HtmlTextWriterTag.Style);
265 tableWriter.Write(stylesFile.ToText( ));
266 tableWriter.RenderEndTag( );//</style>
268 //## JSON map-state data ######################
269 tableWriter.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
270 tableWriter.RenderBeginTag(HtmlTextWriterTag.Script);
272 tableWriter.Write("var available_images = [");
274 foreach (var shard in this.chunkTopMetadata) {
275 tableWriter.Write("{{X:{0},Y:{1} }}, ", shard.Location.X, shard.Location.Y);
278 tableWriter.Write(" ];\n");
280 tableWriter.RenderEndTag( );
282 tableWriter.RenderEndTag( );
284 tableWriter.RenderBeginTag(HtmlTextWriterTag.Body);
285 tableWriter.RenderBeginTag(HtmlTextWriterTag.P);
286 tableWriter.WriteEncodedText($"Created {DateTimeOffset.UtcNow.ToString("u")}");
287 tableWriter.RenderEndTag( );
288 tableWriter.RenderBeginTag(HtmlTextWriterTag.P);
289 tableWriter.WriteEncodedText($"W:{TopWest}, E: {TopEast}, N:{TopNorth}, S:{TopSouth} ");
290 tableWriter.RenderEndTag( );
291 tableWriter.WriteLine( );
292 tableWriter.RenderBeginTag(HtmlTextWriterTag.Table);
293 tableWriter.RenderBeginTag(HtmlTextWriterTag.Caption);
294 tableWriter.WriteEncodedText($"Start: {startChunkColumn}, Seed: {ClientAPI.World.Seed}\n");
295 tableWriter.RenderEndTag( );
297 //################ X-Axis <thead> #######################
298 tableWriter.RenderBeginTag(HtmlTextWriterTag.Thead);
299 tableWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
301 tableWriter.RenderBeginTag(HtmlTextWriterTag.Th);
302 tableWriter.Write("N, W");
303 tableWriter.RenderEndTag( );
305 for (int xAxisT = TopWest; xAxisT <= TopEast; xAxisT++) {
306 tableWriter.RenderBeginTag(HtmlTextWriterTag.Th);
307 tableWriter.Write(xAxisT);
308 tableWriter.RenderEndTag( );
311 tableWriter.RenderBeginTag(HtmlTextWriterTag.Th);
312 tableWriter.Write("N, E");
313 tableWriter.RenderEndTag( );
315 tableWriter.RenderEndTag( );
316 tableWriter.RenderEndTag( );
317 //###### </thead> ################################
319 //###### <tbody> - Chunk rows & Y-axis cols
320 tableWriter.RenderBeginTag(HtmlTextWriterTag.Tbody);
322 //######## <tr> for every vertical row
323 for (int yAxis = TopNorth; yAxis <= TopSouth; yAxis++) {
324 tableWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
325 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
326 tableWriter.Write(yAxis);//legend: Y-axis
327 tableWriter.RenderEndTag( );
329 for (int xAxis = TopWest; xAxis <= TopEast; xAxis++) {
330 //###### <td> #### for chunk shard
331 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
332 var colLoc = new Vec2i(xAxis, yAxis);
333 if (chunkTopMetadata.Contains( colLoc)){
334 ColumnMeta meta = chunkTopMetadata[colLoc];
336 tableWriter.AddAttribute(HtmlTextWriterAttribute.Class, "tooltip");
337 tableWriter.RenderBeginTag(HtmlTextWriterTag.Div);
339 tableWriter.AddAttribute(HtmlTextWriterAttribute.Src, $"{xAxis}_{yAxis}.png");
340 tableWriter.RenderBeginTag(HtmlTextWriterTag.Img);
341 tableWriter.RenderEndTag( );
342 // <span class="tooltiptext">Tooltip text
343 tableWriter.AddAttribute(HtmlTextWriterAttribute.Class, "tooltiptext");
344 tableWriter.RenderBeginTag(HtmlTextWriterTag.Span);
346 StringBuilder tooltipText = new StringBuilder( );
347 tooltipText.Append($"{meta.Location.PrettyCoords(ClientAPI)} ");
348 tooltipText.Append($" Max-Height: {meta.YMax}, Temp: {meta.Temperature.ToString("F1")} " );
349 tooltipText.Append($" Rainfall: {meta.Rainfall.ToString("F1")}, ");
350 tooltipText.Append($" Shrubs: {meta.ShrubDensity.ToString("F1")}, ");
351 tooltipText.Append($" Forest: {meta.ForestDensity.ToString("F1")}, ");
352 tooltipText.Append($" Fertility: {meta.Fertility.ToString("F1")}, ");
354 if (meta.RockRatio != null) {
355 foreach (KeyValuePair<int, uint> blockID in meta.RockRatio) {
356 var block = ClientAPI.World.GetBlock(blockID.Key);
357 tooltipText.AppendFormat(" {0} × {1},\t", block.Code.GetName( ), meta.RockRatio[blockID.Key]);
361 tableWriter.WriteEncodedText(tooltipText.ToString() );
363 tableWriter.RenderEndTag( );//</span>
366 tableWriter.RenderEndTag( );//</div> --tooltip enclosure
369 tableWriter.Write("?");
372 tableWriter.RenderEndTag( );
373 }//############ </td> ###########
375 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
376 tableWriter.Write(yAxis);//legend: Y-axis
377 tableWriter.RenderEndTag( );
379 tableWriter.RenderEndTag( );
382 tableWriter.RenderEndTag( );
384 //################ X-Axis <tfoot> #######################
385 tableWriter.RenderBeginTag(HtmlTextWriterTag.Tfoot);
386 tableWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
388 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
389 tableWriter.Write("S, W");
390 tableWriter.RenderEndTag( );
392 for (int xAxisB = TopWest; xAxisB <= TopEast; xAxisB++) {
393 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
394 tableWriter.Write(xAxisB);
395 tableWriter.RenderEndTag( );
398 tableWriter.RenderBeginTag(HtmlTextWriterTag.Td);
399 tableWriter.Write("S, E");
400 tableWriter.RenderEndTag( );
402 tableWriter.RenderEndTag( );
403 tableWriter.RenderEndTag( );
404 //###### </tfoot> ################################
407 tableWriter.RenderEndTag( );//</table>
409 //############## POI list #####################
410 tableWriter.RenderBeginTag(HtmlTextWriterTag.P);
411 tableWriter.WriteLine("Points of Interest");
412 tableWriter.RenderEndTag( );
413 tableWriter.RenderBeginTag(HtmlTextWriterTag.Ul);
414 foreach (var poi in this.POIs) {
415 tableWriter.RenderBeginTag(HtmlTextWriterTag.Li);
416 tableWriter.WriteEncodedText(poi.Location.PrettyCoords(this.ClientAPI)+"\t");
417 tableWriter.WriteEncodedText(poi.Notes+ "\t");
418 tableWriter.WriteEncodedText(poi.Timestamp.ToString("u"));
419 tableWriter.RenderEndTag( );
422 foreach (var eoi in this.EOIs.PointsList) {
423 tableWriter.RenderBeginTag(HtmlTextWriterTag.Li);
424 tableWriter.WriteEncodedText(eoi.Location.PrettyCoords(this.ClientAPI)+ "\t");
425 tableWriter.WriteEncodedText(eoi.Notes+ "\t");
426 tableWriter.WriteEncodedText(eoi.Timestamp.ToString("u") );
427 tableWriter.RenderEndTag( );
430 tableWriter.RenderEndTag( );
435 tableWriter.RenderEndTag( );//### </BODY> ###
437 tableWriter.EndRender( );
438 tableWriter.Flush( );
443 Logger.VerboseDebug("Generated HTML map");
448 private ColumnMeta CreateColumnMetadata(KeyValuePair<Vec2i, uint> mostActiveCol, IMapChunk mapChunk)
450 ColumnMeta data = new ColumnMeta(mostActiveCol.Key.Copy(), chunkSize);
451 BlockPos equivBP = new BlockPos(mostActiveCol.Key.X * chunkSize,
453 mostActiveCol.Key.Y * chunkSize);
455 var climate = ClientAPI.World.BlockAccessor.GetClimateAt(equivBP);
456 data.UpdateFieldsFrom(climate, mapChunk,TimeSpan.FromHours(ClientAPI.World.Calendar.TotalHours));
462 /// Reload chunk bounds from chunk shards
464 /// <returns>The metadata.</returns>
465 private void Reload_Metadata( )
467 var worldmapDir = new DirectoryInfo(path);
469 if (worldmapDir.Exists) {
471 var files = worldmapDir.GetFiles(chunkFile_filter);
473 if (files.Length > 0) {
475 Logger.VerboseDebug("{0} Existing world chunk shards", files.Length);
480 foreach (var shardFile in files) {
482 if (shardFile.Length < 512) continue;
483 var result = chunkShardRegex.Match(shardFile.Name);
484 if (result.Success) {
485 int X_chunk_pos = int.Parse(result.Groups["X"].Value );
486 int Z_chunk_pos = int.Parse(result.Groups["Z"].Value );
488 //Parse PNG chunks for METADATA in shard
489 using (var fileStream = shardFile.OpenRead( ))
491 PngReader pngRead = new PngReader(fileStream );
492 pngRead.ReadSkippingAllRows( );
495 PngMetadataChunk metadataFromPng = pngRead.GetChunksList( ).GetById1(PngMetadataChunk.ID) as PngMetadataChunk;
497 chunkTopMetadata.Add(metadataFromPng.ChunkMetadata);
507 Logger.VerboseDebug("Could not open world map directory");
515 private PngWriter SetupPngImage(Vec2i coord, ColumnMeta metadata)
517 ImageInfo imageInf = new ImageInfo(chunkSize, chunkSize, 8, false);
519 string filename = $"{coord.X}_{coord.Y}.png";
520 filename = Path.Combine(path, filename);
522 PngWriter pngWriter = FileHelper.CreatePngWriter(filename, imageInf, true);
523 PngMetadata meta = pngWriter.GetMetadata( );
525 meta.SetText("Chunk_X", coord.X.ToString("D"));
526 meta.SetText("Chunk_Y", coord.Y.ToString("D"));
527 //Setup specialized meta-data PNG chunks here...
528 PngMetadataChunk pngChunkMeta = new PngMetadataChunk(pngWriter.ImgInfo);
529 pngChunkMeta.ChunkMetadata = metadata;
530 pngWriter.GetChunksList( ).Queue(pngChunkMeta);
536 /// Does the heavy lifting of Scanning columns of chunks - creates Heightmap and Processes POIs, Entities, and stats...
538 /// <param name="key">Chunk Coordinate</param>
539 /// <param name="mapChunk">Map chunk.</param>
540 /// <param name="chunkMeta">Chunk metadata</param>
541 private void ProcessChunkBlocks(Vec2i key, IMapChunk mapChunk, ColumnMeta chunkMeta)
544 int targetChunkY = mapChunk.YMax / chunkSize;//Surface ...
545 for (; targetChunkY > 0; targetChunkY--) {
546 WorldChunk chunkData = ClientAPI.World.BlockAccessor.GetChunk(key.X, targetChunkY, key.Y) as WorldChunk;
548 if (chunkData == null || chunkData.BlockEntities == null) {
550 Logger.VerboseDebug("Chunk null or empty X{0} Y{1} Z{2}", key.X,targetChunkY,key.Y);
555 /*************** Chunk Entities Scanning *********************/
556 if (chunkData.BlockEntities != null && chunkData.BlockEntities.Length > 0) {
558 Logger.VerboseDebug("Surface@ {0} = BlockEntities: {1}", key, chunkData.BlockEntities.Length);
561 foreach (var blockEnt in chunkData.BlockEntities) {
563 if (blockEnt != null && blockEnt.Block != null && BlockID_Designators.ContainsKey(blockEnt.Block.BlockId))
565 var designator = BlockID_Designators[blockEnt.Block.BlockId];
566 designator.SpecialAction(ClientAPI, POIs, blockEnt.Pos.Copy( ), blockEnt.Block);
571 /********************* Chunk/Column BLOCKs scanning ****************/
572 //Heightmap, Stats, block tally
575 int X_index, Y_index, Z_index;
576 X_index = Y_index = Z_index = 0;
581 /* Encode packed indicie
582 (y * chunksize + z) * chunksize + x
584 var indicie = Helpers.ChunkBlockIndicie16(X_index, Y_index, Z_index);
585 int aBlockId = chunkData.Blocks[indicie];
587 if (aBlockId == 0) {//Air
588 chunkMeta.AirBlocks++;
592 if (RockIdCodes.ContainsKey(aBlockId)) {
593 if (chunkMeta.RockRatio.ContainsKey(aBlockId)) { chunkMeta.RockRatio[aBlockId]++; } else { chunkMeta.RockRatio.Add(aBlockId, 1); }
596 chunkMeta.NonAirBlocks++;
599 if (chunkMeta.HeightMap[X_index, Z_index] == 0)
600 { chunkMeta.HeightMap[X_index, Z_index] = ( ushort )(Y_index + (targetChunkY * chunkSize)); }
603 while (X_index++ < (chunkSize - 1));
606 while (Z_index++ < (chunkSize - 1));
609 while (Y_index++ < (chunkSize - 1));
614 private void UpdateEntityMetadata( )
616 Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count);
617 //Mabey scan only for 'new' entities by tracking ID in set?
618 foreach (var loadedEntity in ClientAPI.World.LoadedEntities.ToList()) {
621 //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<");
624 var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Value.Code));
625 if (dMatch.Value != null) {
626 dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Value.LocalPos.AsBlockPos.Copy( ), loadedEntity.Value);