Automap (client) [VS plugin mod]
Revisão | 8c8cf97e48592b57cde243555596fe3904091568 (tree) |
---|---|
Hora | 2022-04-19 09:51:11 |
Autor | melchior <melchior@user...> |
Commiter | melchior |
Fixes for some post *.4 issues
Shapless block exclusion
Entity scan fix
@@ -171,7 +171,12 @@ namespace Automap | ||
171 | 171 | AutomapMod ownMod = ownApi.ModLoader.GetModSystem<AutomapMod>( ); |
172 | 172 | return ownMod.Mod; |
173 | 173 | } |
174 | - | |
174 | + | |
175 | + | |
176 | + public static bool EndsWith(this AssetLocation asset, string domain, string endPath) | |
177 | + { | |
178 | + return asset.Domain.Equals(domain,StringComparison.InvariantCultureIgnoreCase) && asset.Path.EndsWith(endPath, StringComparison.InvariantCultureIgnoreCase); | |
179 | + } | |
175 | 180 | } |
176 | 181 | } |
177 | 182 |
@@ -346,14 +346,24 @@ namespace Automap | ||
346 | 346 | |
347 | 347 | var airBlocksQuery = from airyBlock in ClientAPI.World.Blocks |
348 | 348 | where airyBlock.MatterState == EnumMatterState.Solid |
349 | - where airyBlock.BlockMaterial == EnumBlockMaterial.Plant || airyBlock.BlockMaterial == EnumBlockMaterial.Leaves | |
350 | - where airyBlock.CollisionBoxes == null || airyBlock.CollisionBoxes.Length == 0 ||airyBlock.RainPermeable == true | |
351 | - select airyBlock; | |
352 | - //^^ 'Solid' phase - 'Plant' Blocks without any boundg box ? Except water... | |
353 | - this.AiryIdCodes = airBlocksQuery.ToDictionary(aBlk => aBlk.BlockId, aBlk => aBlk.Code.Path); | |
354 | - | |
355 | - //Add special marker types for BlockID's of "Interest", overwrite colour, and method | |
356 | - Reload_POI_Designators(); | |
349 | + where airyBlock.BlockMaterial == EnumBlockMaterial.Plant || airyBlock.BlockMaterial == EnumBlockMaterial.Leaves | |
350 | + where airyBlock.CollisionBoxes == null || airyBlock.CollisionBoxes.Length == 0 || airyBlock.RainPermeable == true | |
351 | + select airyBlock; | |
352 | + //^^ 'Solid' phase - 'Plant' Blocks without any bounding-box; OR 'Invisible' shapes... | |
353 | + var invisibleBlocksQuery = from novisBlock in ClientAPI.World.Blocks | |
354 | + where novisBlock.Shape == null || novisBlock.Shape.Base.EndsWith(GlobalConstants.DefaultDomain, @"invisible") //Whaat! [ base: "block/basic/invisible" ] | |
355 | + select novisBlock; | |
356 | + this.AiryIdCodes = airBlocksQuery.Union(invisibleBlocksQuery).ToDictionary(aBlk => aBlk.BlockId, aBlk => aBlk.Code.Path); | |
357 | + | |
358 | + #if DEBUG | |
359 | + foreach (var fluffBlock in AiryIdCodes) { | |
360 | + Logger.VerboseDebug("ID#\t{0}:\t{1} IGNORED", fluffBlock.Key, fluffBlock.Value); | |
361 | + } | |
362 | + Logger.VerboseDebug("Ignoring {0} blocks", AiryIdCodes.Count); | |
363 | + #endif | |
364 | + | |
365 | + //Add special marker types for BlockID's of "Interest", overwrite colour, and method | |
366 | + Reload_POI_Designators(); | |
357 | 367 | } |
358 | 368 | |
359 | 369 | private void Reload_POI_Designators() |
@@ -714,26 +724,25 @@ namespace Automap | ||
714 | 724 | |
715 | 725 | private void UpdateEntityMetadata() |
716 | 726 | { |
727 | + #if DEBUG | |
728 | + Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count); | |
729 | + #endif | |
730 | + | |
731 | + //Handles mutations better than a plain Iterator | |
732 | + for (int entIndex = 0; entIndex < ClientAPI.World.LoadedEntities.Count; entIndex++ ) | |
733 | + { | |
734 | + var loadedEntity = ClientAPI.World.LoadedEntities.Values.ElementAt(entIndex); | |
735 | + | |
717 | 736 | #if DEBUG |
718 | - Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count); | |
737 | + //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<"); | |
719 | 738 | #endif |
720 | - //Mabey scan only for 'new' entities by tracking ID in set? | |
721 | - foreach (var loadedEntity in ClientAPI.World.LoadedEntities.ToArray()) | |
722 | - { | |
723 | - | |
724 | - #if DEBUG | |
725 | - //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<"); | |
726 | - #endif | |
727 | 739 | |
728 | - var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Value.Code)); | |
729 | - if (dMatch.Value != null) | |
740 | + var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Code)); | |
741 | + if (dMatch.Value != null) | |
730 | 742 | { |
731 | - dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Value.Pos.AsBlockPos.Copy(), loadedEntity.Value); | |
743 | + dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Pos.AsBlockPos.Copy( ), loadedEntity); | |
732 | 744 | } |
733 | - | |
734 | - } | |
735 | - | |
736 | - | |
745 | + } | |
737 | 746 | } |
738 | 747 | |
739 | 748 | private void AddNote(string notation) |
@@ -3,11 +3,11 @@ | ||
3 | 3 | "name": "Automap", |
4 | 4 | "description" : "Automap; Generates a static HTML5 map dynamically, with P.O.I. Tracking & more.", |
5 | 5 | "authors": ["Melchior","VeryGoodDog"], |
6 | - "contributors":["VeryGoodDog"], | |
6 | + "contributors":["VeryGoodDog", "Drakker"], | |
7 | 7 | "version": "0.1.8", |
8 | 8 | "side":"Client", |
9 | 9 | "dependencies": { |
10 | - "game": "1.16.0" | |
10 | + "game": "1.16.4" | |
11 | 11 | }, |
12 | 12 | "website": "http://automap.osdn.io/" |
13 | 13 | } |
\ No newline at end of file |