OSDN Git Service

Added assists aiding Aspiring Apiarists
authormelchior <melchior@users.osdn.me>
Tue, 29 Jun 2021 23:28:32 +0000 (19:28 -0400)
committermelchior <melchior@users.osdn.me>
Tue, 29 Jun 2021 23:28:32 +0000 (19:28 -0400)
Automap/AutomapMod.cs
Automap/Designators/DefaultDesignators.cs
Automap/Subsystems/AutomapSystem.cs
Automap/modinfo.json

index 4fec56d..7b24649 100644 (file)
@@ -1,6 +1,8 @@
-using Vintagestory.API.Client;
-using Vintagestory.API.Common;
+using System.Collections.ObjectModel;
+using System.Linq;
 
+using Vintagestory.API.Client;
+using Vintagestory.API.Common;
 
 
 namespace Automap
@@ -46,7 +48,7 @@ namespace Automap
 
                public override double ExecuteOrder()
                {
-                       return 0.2;
+                       return 1.2;
                }
 
                private bool ToggleAM_Dialog(KeyCombination comb)
@@ -89,6 +91,29 @@ namespace Automap
                ClientAPI.StoreModConfig<PersistedConfiguration>(this.CachedConfiguration, _configFilename);
                }
 
+               #region External Interfaces
+               //Perhaps Other mods can make use of POI / EOI?
+
+               public ReadOnlyCollection<PointOfInterest> PointsOfInterest {
+                       get 
+                       {
+                               return _localAutomap.POIs.ToList().AsReadOnly();
+                       }
+               }
+
+               public ReadOnlyCollection<EntityOfInterest> EntitiesOfInterest {
+                       get 
+                       {
+                               return _localAutomap.EOIs.ToList().AsReadOnly();
+                       }
+               }
+
+               public CommandType Status
+               {
+                       get { return _localAutomap.CurrentState; }
+               }
+
+               #endregion
 
 
        }
index 4bdcaab..f42e088 100644 (file)
@@ -72,6 +72,14 @@ namespace Automap
                                KeepTrackOfMerchant
                        );
 
+               public static BlockDesignator Wildbeehives =
+                        new BlockDesignator(
+                               new AssetLocation("game", "wildbeehive"),
+                               Color.Honeydew,
+                               EnumBlockMaterial.Other,
+                               NoteWildbeehive
+                       );
+
                /// <summary>
                /// Not just blocks, but block-entities as well!
                /// </summary>
@@ -87,6 +95,7 @@ namespace Automap
                                        DefaultDesignators.PostSigns,
                                        DefaultDesignators.Translocators,
                                        DefaultDesignators.Teleporters,
+                       DefaultDesignators.Wildbeehives,
                                        };
                        }
                }
@@ -271,6 +280,32 @@ namespace Automap
                }
                }
 
+               internal static void NoteWildbeehive(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block)
+               {
+               #if DEBUG
+               clientAPI.Logger.VerboseDebug("Wild bee hive Designator Invoked!");
+               #endif
+
+               BlockEntityBeehive bees = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntityBeehive;
+
+               if (bees != null) {                             
+               EnumHivePopSize hiveSize = AccessTools.FieldRefAccess<BlockEntityBeehive, EnumHivePopSize>(bees, @"hivePopSize");//TeleporterLocation tpLocation;
+
+               StringBuilder textTarget = new StringBuilder( );
+               textTarget.AppendLine($" Population: {(hiveSize != null? hiveSize.ToString() : "?")} ");                
+               
+               poi.AddReplace(
+                                       new PointOfInterest {
+                                               Name = "Wildbeehive",
+                                               PrettyLocation = posn.PrettyCoords(clientAPI),
+                                               Location = posn.Copy( ),
+                                               Notes = textTarget.ToString( ),
+                                               Timestamp = DateTime.UtcNow,
+                                       }
+                                       );              
+               }
+               }
+
                #endregion
        }
 }
index 3481d1e..33a6f79 100644 (file)
@@ -44,9 +44,8 @@ namespace Automap
 
                private ConcurrentDictionary<Vec2i, ColumnCounter> columnCounters = new ConcurrentDictionary<Vec2i, ColumnCounter>(3, 150);
                private ColumnsMetadata chunkTopMetadata;
-               private PointsOfInterest POIs = new PointsOfInterest();
-               private EntitiesOfInterest EOIs = new EntitiesOfInterest();
-               private Dictionary<int, ulong> blockTally;//TODO: TOTAL Road Tally
+               internal PointsOfInterest POIs = new PointsOfInterest();
+               internal EntitiesOfInterest EOIs = new EntitiesOfInterest();
 
                internal Dictionary<int, BlockDesignator> BlockID_Designators { get; private set; }
                internal Dictionary<AssetLocation, EntityDesignator> Entity_Designators { get; private set; }
@@ -470,6 +469,9 @@ namespace Automap
                                mdWriter.WriteLine("AMVersion '{0}'", ClientAPI.Self().Info.Version);
                                mdWriter.WriteLine("PlayTime {0:F1}", ClientAPI.InWorldEllapsedMilliseconds / 1000);
                                mdWriter.WriteLine("GameDate {0}", ClientAPI.World.Calendar.PrettyDate());
+                               mdWriter.WriteLine("Chunks {0:D}", chunkTopMetadata.Count);
+                               mdWriter.WriteLine("Chunks Updated {0:D}", updatedChunksTotal);
+                               mdWriter.WriteLine("Null Chunks {0:D}", nullChunkCount);        
                                mdWriter.Flush( );
                        }
                }
index b648cc8..5a0c69e 100644 (file)
@@ -4,7 +4,7 @@
   "description" : "Automap; Generates a static HTML5 map dynamically, with P.O.I. Tracking & more.",
   "authors": ["Melchior","VeryGoodDog"],
   "contributors":["VeryGoodDog"],
-  "version": "0.1.6",
+  "version": "0.1.7",
     "side":"Client",
   "dependencies": { 
        "game": "1.14.10"