OSDN Git Service

Resinous Resources Revealed
authormelchior <melchior@users.osdn.me>
Wed, 30 Jun 2021 00:45:20 +0000 (20:45 -0400)
committermelchior <melchior@users.osdn.me>
Wed, 30 Jun 2021 00:45:20 +0000 (20:45 -0400)
Automap/Data/BlockDesignator.cs
Automap/Designators/DefaultDesignators.cs
Automap/Subsystems/AutomapSystem.cs

index 224b1f6..b2235f8 100644 (file)
@@ -64,6 +64,16 @@ namespace Automap
                        this.Enabled = true;
                }
 
+               public BlockDesignator(AssetLocation pattern, Color overwriteColor, EnumBlockMaterial? material, BlockDesignatorAction specialAct, bool state)
+               {
+               this.Pattern = pattern;
+               this.OverwriteColor = overwriteColor;
+               this.Material = material;
+               this.SpecialAction = specialAct;
+               this.SpecialActionName = specialAct.Method.Name;
+               this.Enabled = state;
+               }
+
                public override string ToString()
                {
                        return $"{Pattern.ToShortString()}  | {OverwriteColor.Name} | {(Material.HasValue ? Material.ToString() : "?")} | [{SpecialActionName}]";
index f42e088..5c9aee2 100644 (file)
@@ -77,9 +77,21 @@ namespace Automap
                                new AssetLocation("game", "wildbeehive"),
                                Color.Honeydew,
                                EnumBlockMaterial.Other,
-                               NoteWildbeehive
+                               NoteWildbeehive,
+                               false
                        );
 
+               public static BlockDesignator PineResinLeaks =
+                        new BlockDesignator(
+                               new AssetLocation("game", "log-resin"),
+                               Color.DarkOrange,
+                               EnumBlockMaterial.Wood,
+                               NotePineResinLeak,
+                               false
+                       );
+
+
+
                /// <summary>
                /// Not just blocks, but block-entities as well!
                /// </summary>
@@ -96,6 +108,7 @@ namespace Automap
                                        DefaultDesignators.Translocators,
                                        DefaultDesignators.Teleporters,
                        DefaultDesignators.Wildbeehives,
+                       DefaultDesignators.PineResinLeaks,
                                        };
                        }
                }
@@ -289,7 +302,7 @@ namespace Automap
                BlockEntityBeehive bees = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntityBeehive;
 
                if (bees != null) {                             
-               EnumHivePopSize hiveSize = AccessTools.FieldRefAccess<BlockEntityBeehive, EnumHivePopSize>(bees, @"hivePopSize");//TeleporterLocation tpLocation;
+               EnumHivePopSize hiveSize = AccessTools.FieldRefAccess<BlockEntityBeehive, EnumHivePopSize>(bees, @"hivePopSize");
 
                StringBuilder textTarget = new StringBuilder( );
                textTarget.AppendLine($" Population: {(hiveSize != null? hiveSize.ToString() : "?")} ");                
@@ -306,6 +319,23 @@ namespace Automap
                }
                }
 
+               internal static void NotePineResinLeak(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block)
+               {
+               #if DEBUG
+               clientAPI.Logger.VerboseDebug("Resin leaking Pine tree Designator Invoked!");
+               #endif
+               //Note:Due to how Block-Entities are handled...only Harvested resin is tracked....
+               poi.AddReplace(
+                                       new PointOfInterest {
+                                               Name = "PineResin",
+                                               PrettyLocation = posn.PrettyCoords(clientAPI),
+                                               Location = posn.Copy( ),
+                                               Notes = String.Empty,
+                                               Timestamp = DateTime.UtcNow,
+                                       }
+                                       );
+               }
+
                #endregion
        }
 }
index 33a6f79..c041803 100644 (file)
@@ -353,34 +353,36 @@ namespace Automap
 
                private void Reload_POI_Designators()
                {
-                       Logger.VerboseDebug("Connecting {0} Configured Block-Designators", configuration.BlockDesignators.Count);
+               uint poisSetup =0, eoiSetup = 0;
                        foreach (var designator in configuration.BlockDesignators)
                        {
+                               if (designator.Enabled == false) continue;
                                var blockIDs = Helpers.ArbitrarytBlockIdHunter(ClientAPI, designator.Pattern, designator.Material);
                                if (blockIDs.Count > 0) { Logger.VerboseDebug("Designator {0} has {1} associated blockIDs", designator.ToString(), blockIDs.Count); }
                                foreach (var entry in blockIDs)
                                {
                                        BlockID_Designators.Add(entry.Key, designator);
+                                       poisSetup++;
                                }
                        }
                        this.ChunkRenderer.BlockID_Designators = BlockID_Designators;
+                       Logger.VerboseDebug("Connected {0} IDs from {1} Block-Designators", poisSetup, configuration.BlockDesignators.Count );
 
 
-                       Logger.VerboseDebug("Connecting {0} Configured Entity-Designators", configuration.EntityDesignators.Count);
                        foreach (var designator in configuration.EntityDesignators)
                        {
+                               if (designator.Enabled == false) continue;
                                //Get Variants first, from EntityTypes...better be populated!
                                var matched = ClientAPI.World.EntityTypes.FindAll(entp => entp.Code.BeginsWith(designator.Pattern.Domain, designator.Pattern.Path));
 
                                foreach (var match in matched)
-                               {
+                               {                                       
                                        Logger.VerboseDebug("Linked Entity: {0} Designator: {1}", match.Code, designator);
                                        this.Entity_Designators.Add(match.Code, designator);
+                                       eoiSetup++;
                                }
-
-                               //EntityProperties props = ClientAPI.World.GetEntityType(designator.Pattern);
                        }
-
+                       Logger.VerboseDebug("Connected {0} IDs from {1} Entity-Designators", eoiSetup, configuration.EntityDesignators.Count);
 
                }