Automap (client) [VS plugin mod]
修订版 | 4539caba346d37f8ab34d97be51e21d90faf327b (tree) |
---|---|
时间 | 2020-01-28 08:57:28 |
作者 | ![]() |
Commiter | melchior |
W.I.P. for Split Rendering; Working Entity P.O.I. - only traders so far
@@ -75,7 +75,7 @@ | ||
75 | 75 | <Compile Include="Properties\AssemblyInfo.cs" /> |
76 | 76 | <Compile Include="Helpers.cs" /> |
77 | 77 | <Compile Include="Data\PointOfInterest.cs" /> |
78 | - <Compile Include="Data\Designator.cs" /> | |
78 | + <Compile Include="Data\BlockDesignator.cs" /> | |
79 | 79 | <Compile Include="Designators\DefaultDesignators.cs" /> |
80 | 80 | <Compile Include="Data\ColumnMeta.cs" /> |
81 | 81 | <Compile Include="Data\PngMetadataChunk.cs" /> |
@@ -84,6 +84,8 @@ | ||
84 | 84 | <Compile Include="Renderers\IChunkRenderer.cs" /> |
85 | 85 | <Compile Include="Renderers\StandardRenerer.cs" /> |
86 | 86 | <Compile Include="Renderers\AlternateRenderer.cs" /> |
87 | + <Compile Include="Data\EntitiesOfInterest.cs" /> | |
88 | + <Compile Include="Data\EntityDesignator.cs" /> | |
87 | 89 | </ItemGroup> |
88 | 90 | <ItemGroup> |
89 | 91 | <Folder Include="VS_libs\" /> |
@@ -9,25 +9,25 @@ using Vintagestory.API.MathTools; | ||
9 | 9 | |
10 | 10 | namespace Automap |
11 | 11 | { |
12 | - public delegate void DesignatonAction(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block); | |
12 | + public delegate void BlockDesignatonAction(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block); | |
13 | 13 | |
14 | 14 | /// <summary> |
15 | 15 | /// Point of Interest Rule Designator |
16 | 16 | /// </summary> |
17 | - public class Designator | |
17 | + public class BlockDesignator | |
18 | 18 | { |
19 | 19 | public Color OverwriteColor; |
20 | - public DesignatonAction SpecialAction; | |
20 | + public BlockDesignatonAction SpecialAction; | |
21 | 21 | public AssetLocation Pattern; |
22 | 22 | public EnumBlockMaterial? Material; |
23 | 23 | public bool Enabled { get; set; } |
24 | 24 | |
25 | - private Designator( ) | |
25 | + private BlockDesignator( ) | |
26 | 26 | { |
27 | 27 | throw new NotSupportedException( ); |
28 | 28 | } |
29 | 29 | |
30 | - public Designator( AssetLocation pattern , Color overwriteColor, EnumBlockMaterial? material) | |
30 | + public BlockDesignator( AssetLocation pattern , Color overwriteColor, EnumBlockMaterial? material) | |
31 | 31 | { |
32 | 32 | this.Pattern = pattern; |
33 | 33 | this.OverwriteColor = overwriteColor; |
@@ -35,7 +35,7 @@ namespace Automap | ||
35 | 35 | this.Enabled = true; |
36 | 36 | } |
37 | 37 | |
38 | - public Designator(AssetLocation pattern, Color overwriteColor, EnumBlockMaterial? material ,DesignatonAction specialAct ) | |
38 | + public BlockDesignator(AssetLocation pattern, Color overwriteColor, EnumBlockMaterial? material ,BlockDesignatonAction specialAct ) | |
39 | 39 | { |
40 | 40 | this.Pattern = pattern; |
41 | 41 | this.OverwriteColor = overwriteColor; |
@@ -47,7 +47,8 @@ namespace Automap | ||
47 | 47 | [ProtoMember(11)] |
48 | 48 | public ushort NonAirBlocks; |
49 | 49 | |
50 | - [ProtoMember(12)] | |
50 | + //[ProtoMember(12,OverwriteList = true)] | |
51 | + [ProtoIgnore] | |
51 | 52 | public ushort[ , ] HeightMap; |
52 | 53 | |
53 | 54 | public ColumnMeta(Vec2i loc, int chunkSize = 32) |
@@ -0,0 +1,48 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Collections.ObjectModel; | |
4 | + | |
5 | +using System.Linq; | |
6 | + | |
7 | +using Vintagestory.API.Common.Entities; | |
8 | + | |
9 | +namespace Automap | |
10 | +{ | |
11 | + /// <summary> | |
12 | + /// Entities of interest. | |
13 | + /// </summary> | |
14 | + /// <remarks>Tracked by ID - these never leave.</remarks> | |
15 | + public class EntitiesOfInterest | |
16 | + { | |
17 | + private Dictionary<long, PointOfInterest> entitySet = new Dictionary<long, PointOfInterest>(50); | |
18 | + | |
19 | + | |
20 | + internal void Upsert(Entity something, string message = @"") | |
21 | + { | |
22 | + if (entitySet.ContainsKey(something.EntityId)) { | |
23 | + var movingPOI = entitySet[something.EntityId]; | |
24 | + movingPOI.Location = something.Pos.AsBlockPos.Copy( ); | |
25 | + movingPOI.Timestamp = DateTimeOffset.UtcNow; | |
26 | + } | |
27 | + else { | |
28 | + PointOfInterest newPOI = new PointOfInterest( ); | |
29 | + newPOI.EntityId = something.EntityId; | |
30 | + newPOI.Location = something.Pos.AsBlockPos.Copy( ); | |
31 | + newPOI.Timestamp = DateTimeOffset.UtcNow; | |
32 | + newPOI.Notes = message; | |
33 | + entitySet.Add(something.EntityId, newPOI ); | |
34 | + } | |
35 | + | |
36 | + } | |
37 | + | |
38 | + | |
39 | + public List<PointOfInterest> PointsList { | |
40 | + get | |
41 | + { | |
42 | + return entitySet.Values.ToList(); | |
43 | + } | |
44 | + } | |
45 | + | |
46 | + } | |
47 | +} | |
48 | + |
@@ -0,0 +1,54 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Collections.ObjectModel; | |
4 | +using System.Drawing; | |
5 | + | |
6 | +using Vintagestory.API.Client; | |
7 | +using Vintagestory.API.Common; | |
8 | +using Vintagestory.API.Common.Entities; | |
9 | +using Vintagestory.API.MathTools; | |
10 | + | |
11 | +namespace Automap | |
12 | +{ | |
13 | + public delegate void EntityDesignatonAction(ICoreClientAPI clientAPI, EntitiesOfInterest poi, BlockPos posn, Entity entity); | |
14 | + | |
15 | + /// <summary> | |
16 | + /// Point of Interest Rule Designator | |
17 | + /// </summary> | |
18 | + public class EntityDesignator | |
19 | + { | |
20 | + public Color OverwriteColor; | |
21 | + public EntityDesignatonAction SpecialAction; | |
22 | + public AssetLocation Pattern; | |
23 | + public EnumEntityState? StateCheck;//Needed? | |
24 | + public bool Enabled { get; set; } | |
25 | + | |
26 | + private EntityDesignator( ) | |
27 | + { | |
28 | + throw new NotSupportedException( ); | |
29 | + } | |
30 | + | |
31 | + public EntityDesignator(AssetLocation pattern, Color overwriteColor, EnumEntityState? state) | |
32 | + { | |
33 | + this.Pattern = pattern; | |
34 | + this.OverwriteColor = overwriteColor; | |
35 | + this.StateCheck = state; | |
36 | + this.Enabled = true; | |
37 | + } | |
38 | + | |
39 | + public EntityDesignator(AssetLocation pattern, Color overwriteColor, EnumEntityState? state, EntityDesignatonAction specialAct) | |
40 | + { | |
41 | + this.Pattern = pattern; | |
42 | + this.OverwriteColor = overwriteColor; | |
43 | + this.StateCheck = state; | |
44 | + this.SpecialAction = specialAct; | |
45 | + this.Enabled = true; | |
46 | + } | |
47 | + | |
48 | + public override string ToString( ) | |
49 | + { | |
50 | + return Pattern.ToShortString( ) + "|" + OverwriteColor.Name + "|" + StateCheck ?? ""; | |
51 | + } | |
52 | + } | |
53 | +} | |
54 | + |
@@ -10,11 +10,11 @@ namespace Automap | ||
10 | 10 | /// Actual Physical Point in space - that is interesting. |
11 | 11 | /// </summary> |
12 | 12 | public struct PointOfInterest |
13 | - { | |
14 | - //public CollectibleObject Thing; | |
13 | + { | |
15 | 14 | public string Notes; |
16 | 15 | public BlockPos Location; |
17 | 16 | public DateTimeOffset Timestamp; |
17 | + public long? EntityId; | |
18 | 18 | } |
19 | 19 | |
20 | 20 | public class PointsOfInterest : KeyedCollection<BlockPos, PointOfInterest> |
@@ -4,6 +4,7 @@ using System.Drawing; | ||
4 | 4 | |
5 | 5 | using Vintagestory.API.Client; |
6 | 6 | using Vintagestory.API.Common; |
7 | +using Vintagestory.API.Common.Entities; | |
7 | 8 | using Vintagestory.API.MathTools; |
8 | 9 | using Vintagestory.GameContent; |
9 | 10 |
@@ -11,45 +12,71 @@ namespace Automap | ||
11 | 12 | { |
12 | 13 | public static class DefaultDesignators |
13 | 14 | { |
14 | - public static Designator Roads = | |
15 | - new Designator( | |
15 | + public static BlockDesignator Roads = | |
16 | + new BlockDesignator( | |
16 | 17 | new AssetLocation("game", "stonepath"), |
17 | 18 | Color.Yellow, |
18 | 19 | EnumBlockMaterial.Gravel |
19 | 20 | ); |
20 | 21 | |
21 | - public static Designator GroundSigns = | |
22 | - new Designator( | |
22 | + public static BlockDesignator GroundSigns = | |
23 | + new BlockDesignator( | |
23 | 24 | new AssetLocation("game", "sign-ground"), |
24 | 25 | Color.Teal, |
25 | 26 | EnumBlockMaterial.Wood, |
26 | 27 | DecodeSign |
27 | 28 | ); |
28 | 29 | |
29 | - public static Designator WallSigns = | |
30 | - new Designator( | |
30 | + public static BlockDesignator WallSigns = | |
31 | + new BlockDesignator( | |
31 | 32 | new AssetLocation("game", "sign-wall"), |
32 | 33 | Color.Teal, |
33 | 34 | EnumBlockMaterial.Wood, |
34 | 35 | DecodeSign |
35 | 36 | ); |
36 | 37 | |
37 | - public static Designator PostSigns = | |
38 | - new Designator( | |
38 | + public static BlockDesignator PostSigns = | |
39 | + new BlockDesignator( | |
39 | 40 | new AssetLocation("game", "signpost"), |
40 | 41 | Color.Teal, |
41 | 42 | EnumBlockMaterial.Wood, |
42 | 43 | DecodePostSign |
43 | 44 | ); |
44 | 45 | |
45 | - public static Designator Translocators = | |
46 | - new Designator( | |
46 | + public static BlockDesignator Translocators = | |
47 | + new BlockDesignator( | |
47 | 48 | new AssetLocation("game", "statictranslocator-normal"), |
48 | 49 | Color.Violet, |
49 | 50 | EnumBlockMaterial.Metal |
50 | 51 | //DecodeTranslocator |
51 | 52 | ); |
52 | 53 | |
54 | + public static EntityDesignator Traders = | |
55 | + new EntityDesignator( | |
56 | + new AssetLocation("game", "humanoid-trader"), | |
57 | + Color.LightGoldenrodYellow, | |
58 | + EnumEntityState.Active, | |
59 | + KeepTrackOfMerchant | |
60 | + ); | |
61 | + | |
62 | + | |
63 | + public static List<BlockDesignator> DefaultBlockDesignators( ) | |
64 | + { | |
65 | + return new List<BlockDesignator>{ | |
66 | + DefaultDesignators.Roads, | |
67 | + DefaultDesignators.GroundSigns, | |
68 | + DefaultDesignators.WallSigns, | |
69 | + DefaultDesignators.PostSigns, | |
70 | + }; | |
71 | + } | |
72 | + | |
73 | + public static List<EntityDesignator> DefaultEntityDesignators( ) | |
74 | + { | |
75 | + return new List<EntityDesignator>{ | |
76 | + DefaultDesignators.Traders, | |
77 | + }; | |
78 | + } | |
79 | + | |
53 | 80 | internal static void DecodeSign(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block) |
54 | 81 | { |
55 | 82 | clientAPI.Logger.VerboseDebug("Sign Designator Invoked!"); |
@@ -91,8 +118,17 @@ namespace Automap | ||
91 | 118 | } |
92 | 119 | } |
93 | 120 | |
121 | + internal static void KeepTrackOfMerchant(ICoreClientAPI clientAPI, EntitiesOfInterest poi, BlockPos posn, Entity entity) | |
122 | + { | |
123 | + clientAPI.Logger.VerboseDebug("Trader: {0} @ {1}", entity.GetName( ), posn); | |
94 | 124 | |
95 | - | |
125 | + var message = $"{entity.GetName( )}"; | |
126 | + var traderJoe = entity as EntityTrader; | |
127 | + if (traderJoe.TradeProps != null) { | |
128 | + message = $"{traderJoe.GetName( )} Alive:{traderJoe.Alive} - Gears: {traderJoe.TradeProps.Money}, "; | |
129 | + } | |
130 | + poi.Upsert(entity, message); | |
131 | + } | |
96 | 132 | } |
97 | 133 | } |
98 | 134 |
@@ -13,7 +13,7 @@ namespace Automap | ||
13 | 13 | { |
14 | 14 | public virtual ICoreClientAPI ClientAPI { get; protected set; } |
15 | 15 | public virtual ILogger Logger { get; protected set; } |
16 | - public virtual Dictionary<int, Designator> BlockID_Designators { get; set; } | |
16 | + public virtual Dictionary<int, BlockDesignator> BlockID_Designators { get; set; } | |
17 | 17 | |
18 | 18 | protected IChunkRenderer(ICoreClientAPI clientAPI, ILogger logger) |
19 | 19 | { |
@@ -33,8 +33,7 @@ namespace Automap | ||
33 | 33 | var chunksColumn = new IWorldChunk[ClientAPI.World.BlockAccessor.MapSizeY / chunkSize]; |
34 | 34 | |
35 | 35 | int topChunkY = mc.YMax / chunkSize;//Heywaitaminute -- this isn't a highest FEATURE, if Rainmap isn't accurate! |
36 | - //Metadata of DateTime chunk was edited, chunk coords.,world-seed? Y-Max feature height | |
37 | - //Grab a chunk COLUMN... Topmost Y down... | |
36 | + | |
38 | 37 | for (int chunkY = 0; chunkY <= topChunkY; chunkY++) { |
39 | 38 | chunksColumn[chunkY] = ClientAPI.World.BlockAccessor.GetChunk(chunkPos.X, chunkY, chunkPos.Y); |
40 | 39 | //What to do if chunk is a void? invalid? |
@@ -125,11 +124,15 @@ namespace Automap | ||
125 | 124 | |
126 | 125 | |
127 | 126 | //============ POI Population ================= |
128 | - if (BlockID_Designators.ContainsKey(blockId)) { | |
127 | + if (BlockID_Designators.ContainsKey(blockId)) { | |
129 | 128 | var desig = BlockID_Designators[blockId]; |
130 | - red = desig.OverwriteColor.R; | |
131 | - green = desig.OverwriteColor.G; | |
132 | - blue = desig.OverwriteColor.B; | |
129 | + | |
130 | + if (desig.Enabled) | |
131 | + { | |
132 | + red = desig.OverwriteColor.R; | |
133 | + green = desig.OverwriteColor.G; | |
134 | + blue = desig.OverwriteColor.B; | |
135 | + } | |
133 | 136 | } |
134 | 137 | |
135 | 138 | ImageLineHelper.SetPixel(lines[localZ], localX, red, green, blue); |
@@ -15,9 +15,9 @@ using Hjg.Pngcs.Chunks; | ||
15 | 15 | |
16 | 16 | using Vintagestory.API.Client; |
17 | 17 | using Vintagestory.API.Common; |
18 | +using Vintagestory.API.Common.Entities; | |
18 | 19 | using Vintagestory.API.MathTools; |
19 | - | |
20 | - | |
20 | +using Vintagestory.Common; | |
21 | 21 | |
22 | 22 | namespace Automap |
23 | 23 | { |
@@ -37,12 +37,14 @@ namespace Automap | ||
37 | 37 | private ConcurrentDictionary<Vec2i, uint> columnCounter = new ConcurrentDictionary<Vec2i, uint>(3, 150 ); |
38 | 38 | private ColumnsMetadata chunkTopMetadata; |
39 | 39 | private PointsOfInterest POIs; |
40 | + private EntitiesOfInterest EOIs; | |
41 | + | |
42 | + internal Dictionary<int, BlockDesignator> BlockID_Designators { get; private set;} | |
43 | + internal Dictionary<AssetLocation, EntityDesignator> Entity_Designators { get; private set; } | |
40 | 44 | |
41 | - internal Dictionary<int, Designator> BlockID_Designators { get; private set;} | |
42 | 45 | internal bool Enabled { get; set; } |
43 | 46 | //Run status, Chunks processed, stats, center of map.... |
44 | - internal uint nullChunkCount; | |
45 | - internal uint updatedChunksTotal; | |
47 | + internal uint nullChunkCount, updatedChunksTotal; | |
46 | 48 | internal Vec2i startChunkColumn; |
47 | 49 | |
48 | 50 | private readonly int chunkSize; |
@@ -141,6 +143,7 @@ namespace Automap | ||
141 | 143 | |
142 | 144 | ColumnMeta chunkMeta = CreateColumnMetadata(mostActiveCol,mapChunk); |
143 | 145 | PngWriter pngWriter = SetupPngImage(mostActiveCol.Key, chunkMeta); |
146 | + UpdateEntityMetadata( ); | |
144 | 147 | ProcessChunkBlocks(mostActiveCol.Key, mapChunk, chunkMeta); |
145 | 148 | |
146 | 149 | uint updatedPixels = 0; |
@@ -193,24 +196,19 @@ namespace Automap | ||
193 | 196 | private void Prefill_POI_Designators( ) |
194 | 197 | { |
195 | 198 | this.POIs = new PointsOfInterest( ); |
196 | - this.BlockID_Designators = new Dictionary<int, Designator>( ); | |
199 | + this.EOIs = new EntitiesOfInterest( ); | |
200 | + this.BlockID_Designators = new Dictionary<int, BlockDesignator>( ); | |
201 | + this.Entity_Designators = new Dictionary<AssetLocation, EntityDesignator>( ); | |
197 | 202 | |
198 | 203 | //Add special marker types for BlockID's of "Interest", overwrite colour, and method |
199 | 204 | |
200 | - var standardDesignators = new List<Designator>{ | |
201 | - DefaultDesignators.Roads, | |
202 | - DefaultDesignators.GroundSigns, | |
203 | - DefaultDesignators.WallSigns, | |
204 | - DefaultDesignators.PostSigns, | |
205 | - }; | |
206 | - | |
207 | - Install_POI_Designators(standardDesignators); | |
205 | + Install_POI_Designators(DefaultDesignators.DefaultBlockDesignators(), DefaultDesignators.DefaultEntityDesignators()); | |
208 | 206 | } |
209 | 207 | |
210 | - private void Install_POI_Designators(ICollection<Designator> designators) | |
208 | + private void Install_POI_Designators(ICollection<BlockDesignator> blockDesig, List<EntityDesignator> entDesig) | |
211 | 209 | { |
212 | - Logger.VerboseDebug("Connecting {0} configured Designators", designators.Count); | |
213 | - foreach (var designator in designators) { | |
210 | + Logger.VerboseDebug("Connecting {0} standard Block-Designators", blockDesig.Count); | |
211 | + foreach (var designator in blockDesig) { | |
214 | 212 | var blockIDs = Helpers.ArbitrarytBlockIdHunter(ClientAPI, designator.Pattern, designator.Material); |
215 | 213 | if (blockIDs.Count > 0) { Logger.VerboseDebug("Designator {0} has {1} associated blockIDs", designator.ToString( ), blockIDs.Count); } |
216 | 214 | foreach (var entry in blockIDs) { |
@@ -218,6 +216,24 @@ namespace Automap | ||
218 | 216 | } |
219 | 217 | } |
220 | 218 | this.ChunkRenderer.BlockID_Designators = BlockID_Designators; |
219 | + | |
220 | + | |
221 | + Logger.VerboseDebug("Connecting {0} standard Entity-Designators", entDesig.Count); | |
222 | + foreach (var designator in entDesig) { | |
223 | + //Get Variants first, from EntityTypes...better be populated! | |
224 | + var matched = ClientAPI.World.EntityTypes.FindAll(entp => entp.Code.BeginsWith(designator.Pattern.Domain, designator.Pattern.Path)); | |
225 | + | |
226 | + foreach (var match in matched) { | |
227 | + Logger.VerboseDebug("Linked Entity: {0} Designator: {1}", match.Code, designator); | |
228 | + this.Entity_Designators.Add(match.Code, designator); | |
229 | + } | |
230 | + | |
231 | + | |
232 | + | |
233 | + //EntityProperties props = ClientAPI.World.GetEntityType(designator.Pattern); | |
234 | + } | |
235 | + | |
236 | + | |
221 | 237 | } |
222 | 238 | |
223 | 239 | //TODO: Convert to RAZOR model |
@@ -384,14 +400,25 @@ namespace Automap | ||
384 | 400 | |
385 | 401 | |
386 | 402 | tableWriter.RenderEndTag( );//</table> |
387 | - | |
403 | + | |
388 | 404 | //############## POI list ##################### |
405 | + tableWriter.RenderBeginTag(HtmlTextWriterTag.P); | |
406 | + tableWriter.WriteLine("Points of Interest"); | |
407 | + tableWriter.RenderEndTag( ); | |
389 | 408 | tableWriter.RenderBeginTag(HtmlTextWriterTag.Ul); |
390 | 409 | foreach (var poi in this.POIs) { |
391 | 410 | tableWriter.RenderBeginTag(HtmlTextWriterTag.Li); |
392 | - tableWriter.WriteEncodedText(poi.Timestamp.ToString("u")); | |
393 | - tableWriter.WriteEncodedText(poi.Notes); | |
394 | 411 | tableWriter.WriteEncodedText(poi.Location.PrettyCoords(this.ClientAPI)); |
412 | + tableWriter.WriteEncodedText(poi.Notes); | |
413 | + tableWriter.WriteEncodedText(poi.Timestamp.ToString("u")); | |
414 | + tableWriter.RenderEndTag( ); | |
415 | + } | |
416 | + | |
417 | + foreach (var eoi in this.EOIs.PointsList) { | |
418 | + tableWriter.RenderBeginTag(HtmlTextWriterTag.Li); | |
419 | + tableWriter.WriteEncodedText(eoi.Location.PrettyCoords(this.ClientAPI)); | |
420 | + tableWriter.WriteEncodedText(eoi.Notes); | |
421 | + tableWriter.WriteEncodedText(eoi.Timestamp.ToString("u") ); | |
395 | 422 | tableWriter.RenderEndTag( ); |
396 | 423 | } |
397 | 424 |
@@ -421,10 +448,7 @@ namespace Automap | ||
421 | 448 | mostActiveCol.Key.Y * chunkSize); |
422 | 449 | |
423 | 450 | var climate = ClientAPI.World.BlockAccessor.GetClimateAt(equivBP); |
424 | - data.UpdateFieldsFrom(climate, mapChunk,TimeSpan.FromHours(ClientAPI.World.Calendar.TotalHours)); | |
425 | - | |
426 | - | |
427 | - | |
451 | + data.UpdateFieldsFrom(climate, mapChunk,TimeSpan.FromHours(ClientAPI.World.Calendar.TotalHours)); | |
428 | 452 | |
429 | 453 | return data; |
430 | 454 | } |
@@ -449,6 +473,8 @@ namespace Automap | ||
449 | 473 | |
450 | 474 | |
451 | 475 | foreach (var shardFile in files) { |
476 | + | |
477 | + if (shardFile.Length < 1000) continue; | |
452 | 478 | var result = chunkShardRegex.Match(shardFile.Name); |
453 | 479 | if (result.Success) { |
454 | 480 | int X_chunk_pos = int.Parse(result.Groups["X"].Value ); |
@@ -502,16 +528,43 @@ namespace Automap | ||
502 | 528 | } |
503 | 529 | |
504 | 530 | /// <summary> |
505 | - /// Does the heavy lifting of Scanning the whole (surface) chunk - creates Heightmap and Processes POIs, and stats... | |
531 | + /// Does the heavy lifting of Scanning the whole (surface) chunk - creates Heightmap and Processes POIs, Entities, and stats... | |
506 | 532 | /// </summary> |
507 | 533 | /// <param name="key">Chunk Coordinate</param> |
508 | 534 | /// <param name="mapChunk">Map chunk.</param> |
509 | 535 | /// <param name="chunkMeta">Chunk metadata</param> |
510 | 536 | private void ProcessChunkBlocks(Vec2i key, IMapChunk mapChunk, ColumnMeta chunkMeta) |
511 | 537 | { |
538 | + int topChunkY = mapChunk.YMax / chunkSize; | |
539 | + WorldChunk chunkData = ( Vintagestory.Common.WorldChunk )ClientAPI.World.BlockAccessor.GetChunk(key.X, topChunkY, key.Y); | |
540 | + | |
541 | + | |
542 | + | |
543 | + } | |
544 | + | |
545 | + private void UpdateEntityMetadata( ) | |
546 | + { | |
547 | + Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count); | |
548 | + //Mabey scan only for 'new' entities by tracking ID in set? | |
549 | + foreach (var loadedEntity in ClientAPI.World.LoadedEntities.ToList()) { | |
550 | + | |
551 | + #if DEBUG | |
552 | + //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<"); | |
553 | + #endif | |
512 | 554 | |
555 | + var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Value.Code)); | |
556 | + if (dMatch.Value != null) { | |
557 | + if (dMatch.Value.Enabled) { | |
558 | + dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Value.LocalPos.AsBlockPos.Copy( ), loadedEntity.Value); | |
559 | + } | |
513 | 560 | } |
514 | 561 | |
562 | + } | |
563 | + | |
564 | + | |
565 | + } | |
566 | + | |
567 | + | |
515 | 568 | |
516 | 569 | |
517 | 570 |