• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Automap (client) [VS plugin mod]


Commit MetaInfo

Revision8c8cf97e48592b57cde243555596fe3904091568 (tree)
Time2022-04-19 09:51:11
Authormelchior <melchior@user...>
Commitermelchior

Log Message

Fixes for some post *.4 issues

Shapless block exclusion
Entity scan fix

Change Summary

Incremental Difference

--- a/Automap/Helpers.cs
+++ b/Automap/Helpers.cs
@@ -171,7 +171,12 @@ namespace Automap
171171 AutomapMod ownMod = ownApi.ModLoader.GetModSystem<AutomapMod>( );
172172 return ownMod.Mod;
173173 }
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+ }
175180 }
176181 }
177182
--- a/Automap/Subsystems/AutomapSystem.cs
+++ b/Automap/Subsystems/AutomapSystem.cs
@@ -346,14 +346,24 @@ namespace Automap
346346
347347 var airBlocksQuery = from airyBlock in ClientAPI.World.Blocks
348348 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();
357367 }
358368
359369 private void Reload_POI_Designators()
@@ -714,26 +724,25 @@ namespace Automap
714724
715725 private void UpdateEntityMetadata()
716726 {
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+
717736 #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} <<<<<<<<<<<<");
719738 #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
727739
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)
730742 {
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);
732744 }
733-
734- }
735-
736-
745+ }
737746 }
738747
739748 private void AddNote(string notation)
--- a/Automap/modinfo.json
+++ b/Automap/modinfo.json
@@ -3,11 +3,11 @@
33 "name": "Automap",
44 "description" : "Automap; Generates a static HTML5 map dynamically, with P.O.I. Tracking & more.",
55 "authors": ["Melchior","VeryGoodDog"],
6- "contributors":["VeryGoodDog"],
6+ "contributors":["VeryGoodDog", "Drakker"],
77 "version": "0.1.8",
88 "side":"Client",
99 "dependencies": {
10- "game": "1.16.0"
10+ "game": "1.16.4"
1111 },
1212 "website": "http://automap.osdn.io/"
1313 }
\ No newline at end of file