From fabec3e99852e26734177455a7c8745f87533308 Mon Sep 17 00:00:00 2001 From: melchior Date: Tue, 29 Jun 2021 19:28:32 -0400 Subject: [PATCH] Added assists aiding Aspiring Apiarists --- Automap/AutomapMod.cs | 31 ++++++++++++++++++++++++--- Automap/Designators/DefaultDesignators.cs | 35 +++++++++++++++++++++++++++++++ Automap/Subsystems/AutomapSystem.cs | 8 ++++--- Automap/modinfo.json | 2 +- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/Automap/AutomapMod.cs b/Automap/AutomapMod.cs index 4fec56d..7b24649 100644 --- a/Automap/AutomapMod.cs +++ b/Automap/AutomapMod.cs @@ -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(this.CachedConfiguration, _configFilename); } + #region External Interfaces + //Perhaps Other mods can make use of POI / EOI? + + public ReadOnlyCollection PointsOfInterest { + get + { + return _localAutomap.POIs.ToList().AsReadOnly(); + } + } + + public ReadOnlyCollection EntitiesOfInterest { + get + { + return _localAutomap.EOIs.ToList().AsReadOnly(); + } + } + + public CommandType Status + { + get { return _localAutomap.CurrentState; } + } + + #endregion } diff --git a/Automap/Designators/DefaultDesignators.cs b/Automap/Designators/DefaultDesignators.cs index 4bdcaab..f42e088 100644 --- a/Automap/Designators/DefaultDesignators.cs +++ b/Automap/Designators/DefaultDesignators.cs @@ -72,6 +72,14 @@ namespace Automap KeepTrackOfMerchant ); + public static BlockDesignator Wildbeehives = + new BlockDesignator( + new AssetLocation("game", "wildbeehive"), + Color.Honeydew, + EnumBlockMaterial.Other, + NoteWildbeehive + ); + /// /// Not just blocks, but block-entities as well! /// @@ -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(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 } } diff --git a/Automap/Subsystems/AutomapSystem.cs b/Automap/Subsystems/AutomapSystem.cs index 3481d1e..33a6f79 100644 --- a/Automap/Subsystems/AutomapSystem.cs +++ b/Automap/Subsystems/AutomapSystem.cs @@ -44,9 +44,8 @@ namespace Automap private ConcurrentDictionary columnCounters = new ConcurrentDictionary(3, 150); private ColumnsMetadata chunkTopMetadata; - private PointsOfInterest POIs = new PointsOfInterest(); - private EntitiesOfInterest EOIs = new EntitiesOfInterest(); - private Dictionary blockTally;//TODO: TOTAL Road Tally + internal PointsOfInterest POIs = new PointsOfInterest(); + internal EntitiesOfInterest EOIs = new EntitiesOfInterest(); internal Dictionary BlockID_Designators { get; private set; } internal Dictionary 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( ); } } diff --git a/Automap/modinfo.json b/Automap/modinfo.json index b648cc8..5a0c69e 100644 --- a/Automap/modinfo.json +++ b/Automap/modinfo.json @@ -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" -- 2.11.0