Automap (client) [VS plugin mod]
Revisão | 16d03c488cf240334842f6a9c38a9fc2921ec227 (tree) |
---|---|
Hora | 2021-06-30 09:45:20 |
Autor | melchior <melchior@user...> |
Commiter | melchior |
Resinous Resources Revealed
@@ -64,6 +64,16 @@ namespace Automap | ||
64 | 64 | this.Enabled = true; |
65 | 65 | } |
66 | 66 | |
67 | + public BlockDesignator(AssetLocation pattern, Color overwriteColor, EnumBlockMaterial? material, BlockDesignatorAction specialAct, bool state) | |
68 | + { | |
69 | + this.Pattern = pattern; | |
70 | + this.OverwriteColor = overwriteColor; | |
71 | + this.Material = material; | |
72 | + this.SpecialAction = specialAct; | |
73 | + this.SpecialActionName = specialAct.Method.Name; | |
74 | + this.Enabled = state; | |
75 | + } | |
76 | + | |
67 | 77 | public override string ToString() |
68 | 78 | { |
69 | 79 | return $"{Pattern.ToShortString()} | {OverwriteColor.Name} | {(Material.HasValue ? Material.ToString() : "?")} | [{SpecialActionName}]"; |
@@ -77,9 +77,21 @@ namespace Automap | ||
77 | 77 | new AssetLocation("game", "wildbeehive"), |
78 | 78 | Color.Honeydew, |
79 | 79 | EnumBlockMaterial.Other, |
80 | - NoteWildbeehive | |
80 | + NoteWildbeehive, | |
81 | + false | |
81 | 82 | ); |
82 | 83 | |
84 | + public static BlockDesignator PineResinLeaks = | |
85 | + new BlockDesignator( | |
86 | + new AssetLocation("game", "log-resin"), | |
87 | + Color.DarkOrange, | |
88 | + EnumBlockMaterial.Wood, | |
89 | + NotePineResinLeak, | |
90 | + false | |
91 | + ); | |
92 | + | |
93 | + | |
94 | + | |
83 | 95 | /// <summary> |
84 | 96 | /// Not just blocks, but block-entities as well! |
85 | 97 | /// </summary> |
@@ -96,6 +108,7 @@ namespace Automap | ||
96 | 108 | DefaultDesignators.Translocators, |
97 | 109 | DefaultDesignators.Teleporters, |
98 | 110 | DefaultDesignators.Wildbeehives, |
111 | + DefaultDesignators.PineResinLeaks, | |
99 | 112 | }; |
100 | 113 | } |
101 | 114 | } |
@@ -289,7 +302,7 @@ namespace Automap | ||
289 | 302 | BlockEntityBeehive bees = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntityBeehive; |
290 | 303 | |
291 | 304 | if (bees != null) { |
292 | - EnumHivePopSize hiveSize = AccessTools.FieldRefAccess<BlockEntityBeehive, EnumHivePopSize>(bees, @"hivePopSize");//TeleporterLocation tpLocation; | |
305 | + EnumHivePopSize hiveSize = AccessTools.FieldRefAccess<BlockEntityBeehive, EnumHivePopSize>(bees, @"hivePopSize"); | |
293 | 306 | |
294 | 307 | StringBuilder textTarget = new StringBuilder( ); |
295 | 308 | textTarget.AppendLine($" Population: {(hiveSize != null? hiveSize.ToString() : "?")} "); |
@@ -306,6 +319,23 @@ namespace Automap | ||
306 | 319 | } |
307 | 320 | } |
308 | 321 | |
322 | + internal static void NotePineResinLeak(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block) | |
323 | + { | |
324 | + #if DEBUG | |
325 | + clientAPI.Logger.VerboseDebug("Resin leaking Pine tree Designator Invoked!"); | |
326 | + #endif | |
327 | + //Note:Due to how Block-Entities are handled...only Harvested resin is tracked.... | |
328 | + poi.AddReplace( | |
329 | + new PointOfInterest { | |
330 | + Name = "PineResin", | |
331 | + PrettyLocation = posn.PrettyCoords(clientAPI), | |
332 | + Location = posn.Copy( ), | |
333 | + Notes = String.Empty, | |
334 | + Timestamp = DateTime.UtcNow, | |
335 | + } | |
336 | + ); | |
337 | + } | |
338 | + | |
309 | 339 | #endregion |
310 | 340 | } |
311 | 341 | } |
@@ -353,34 +353,36 @@ namespace Automap | ||
353 | 353 | |
354 | 354 | private void Reload_POI_Designators() |
355 | 355 | { |
356 | - Logger.VerboseDebug("Connecting {0} Configured Block-Designators", configuration.BlockDesignators.Count); | |
356 | + uint poisSetup =0, eoiSetup = 0; | |
357 | 357 | foreach (var designator in configuration.BlockDesignators) |
358 | 358 | { |
359 | + if (designator.Enabled == false) continue; | |
359 | 360 | var blockIDs = Helpers.ArbitrarytBlockIdHunter(ClientAPI, designator.Pattern, designator.Material); |
360 | 361 | if (blockIDs.Count > 0) { Logger.VerboseDebug("Designator {0} has {1} associated blockIDs", designator.ToString(), blockIDs.Count); } |
361 | 362 | foreach (var entry in blockIDs) |
362 | 363 | { |
363 | 364 | BlockID_Designators.Add(entry.Key, designator); |
365 | + poisSetup++; | |
364 | 366 | } |
365 | 367 | } |
366 | 368 | this.ChunkRenderer.BlockID_Designators = BlockID_Designators; |
369 | + Logger.VerboseDebug("Connected {0} IDs from {1} Block-Designators", poisSetup, configuration.BlockDesignators.Count ); | |
367 | 370 | |
368 | 371 | |
369 | - Logger.VerboseDebug("Connecting {0} Configured Entity-Designators", configuration.EntityDesignators.Count); | |
370 | 372 | foreach (var designator in configuration.EntityDesignators) |
371 | 373 | { |
374 | + if (designator.Enabled == false) continue; | |
372 | 375 | //Get Variants first, from EntityTypes...better be populated! |
373 | 376 | var matched = ClientAPI.World.EntityTypes.FindAll(entp => entp.Code.BeginsWith(designator.Pattern.Domain, designator.Pattern.Path)); |
374 | 377 | |
375 | 378 | foreach (var match in matched) |
376 | - { | |
379 | + { | |
377 | 380 | Logger.VerboseDebug("Linked Entity: {0} Designator: {1}", match.Code, designator); |
378 | 381 | this.Entity_Designators.Add(match.Code, designator); |
382 | + eoiSetup++; | |
379 | 383 | } |
380 | - | |
381 | - //EntityProperties props = ClientAPI.World.GetEntityType(designator.Pattern); | |
382 | 384 | } |
383 | - | |
385 | + Logger.VerboseDebug("Connected {0} IDs from {1} Entity-Designators", eoiSetup, configuration.EntityDesignators.Count); | |
384 | 386 | |
385 | 387 | } |
386 | 388 |