var airBlocksQuery = from airyBlock in ClientAPI.World.Blocks
where airyBlock.MatterState == EnumMatterState.Solid
- where airyBlock.BlockMaterial == EnumBlockMaterial.Plant || airyBlock.BlockMaterial == EnumBlockMaterial.Leaves
- where airyBlock.CollisionBoxes == null || airyBlock.CollisionBoxes.Length == 0 ||airyBlock.RainPermeable == true
- select airyBlock;
- //^^ 'Solid' phase - 'Plant' Blocks without any boundg box ? Except water...
- this.AiryIdCodes = airBlocksQuery.ToDictionary(aBlk => aBlk.BlockId, aBlk => aBlk.Code.Path);
-
- //Add special marker types for BlockID's of "Interest", overwrite colour, and method
- Reload_POI_Designators();
+ where airyBlock.BlockMaterial == EnumBlockMaterial.Plant || airyBlock.BlockMaterial == EnumBlockMaterial.Leaves
+ where airyBlock.CollisionBoxes == null || airyBlock.CollisionBoxes.Length == 0 || airyBlock.RainPermeable == true
+ select airyBlock;
+ //^^ 'Solid' phase - 'Plant' Blocks without any bounding-box; OR 'Invisible' shapes...
+ var invisibleBlocksQuery = from novisBlock in ClientAPI.World.Blocks
+ where novisBlock.Shape == null || novisBlock.Shape.Base.EndsWith(GlobalConstants.DefaultDomain, @"invisible") //Whaat! [ base: "block/basic/invisible" ]
+ select novisBlock;
+ this.AiryIdCodes = airBlocksQuery.Union(invisibleBlocksQuery).ToDictionary(aBlk => aBlk.BlockId, aBlk => aBlk.Code.Path);
+
+ #if DEBUG
+ foreach (var fluffBlock in AiryIdCodes) {
+ Logger.VerboseDebug("ID#\t{0}:\t{1} IGNORED", fluffBlock.Key, fluffBlock.Value);
+ }
+ Logger.VerboseDebug("Ignoring {0} blocks", AiryIdCodes.Count);
+ #endif
+
+ //Add special marker types for BlockID's of "Interest", overwrite colour, and method
+ Reload_POI_Designators();
}
private void Reload_POI_Designators()
private void UpdateEntityMetadata()
{
+ #if DEBUG
+ Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count);
+ #endif
+
+ //Handles mutations better than a plain Iterator
+ for (int entIndex = 0; entIndex < ClientAPI.World.LoadedEntities.Count; entIndex++ )
+ {
+ var loadedEntity = ClientAPI.World.LoadedEntities.Values.ElementAt(entIndex);
+
#if DEBUG
- Logger.Debug("Presently {0} Entities", ClientAPI.World.LoadedEntities.Count);
+ //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<");
#endif
- //Mabey scan only for 'new' entities by tracking ID in set?
- foreach (var loadedEntity in ClientAPI.World.LoadedEntities.ToArray())
- {
-
- #if DEBUG
- //Logger.VerboseDebug($"ENTITY: ({loadedEntity.Value.Code}) = #{loadedEntity.Value.EntityId} {loadedEntity.Value.State} {loadedEntity.Value.LocalPos} <<<<<<<<<<<<");
- #endif
- var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Value.Code));
- if (dMatch.Value != null)
+ var dMatch = Entity_Designators.SingleOrDefault(se => se.Key.Equals(loadedEntity.Code));
+ if (dMatch.Value != null)
{
- dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Value.Pos.AsBlockPos.Copy(), loadedEntity.Value);
+ dMatch.Value.SpecialAction(ClientAPI, this.EOIs, loadedEntity.Pos.AsBlockPos.Copy( ), loadedEntity);
}
-
- }
-
-
+ }
}
private void AddNote(string notation)