private static void RevealEntities( Dictionary<IMyEntity, string> entitiesToReveal ) { int RevealCount = 0; foreach ( KeyValuePair<IMyEntity, string> entity in entitiesToReveal ) { IMyEntity processEntity = entity.Key; ConcealItem item = new ConcealItem( processEntity, entity.Value ); if ( ConcealQueue.ContainsKey( processEntity.EntityId ) ) { //if this entity is in the queue, we want to replace it ConcealQueue.Remove( processEntity.EntityId ); } if ( MedbayQueue.ContainsKey( processEntity.EntityId ) ) continue; //skip this entity if it's already in the medbay queue, since it has a higher priority ++RevealCount; } RevealQueue.Clear( ); foreach ( KeyValuePair<IMyEntity, string> entity in entitiesToReveal ) RevealQueue.Add( entity.Key.EntityId, new ConcealItem( entity ) ); if ( PluginSettings.Instance.DynamicShowMessages ) Essentials.Log.Info( "Queued {0} entities for reveal.", RevealCount ); }
private static void RevealMedbays( IMyEntity entity, string reason ) { ConcealItem item = new ConcealItem( entity, reason ); if ( ConcealQueue.ContainsKey( entity.EntityId ) ) ConcealQueue.Remove( entity.EntityId ); //if this entity is in the concealment queue, remove it if ( RevealQueue.ContainsKey( entity.EntityId ) ) RevealQueue.Remove( entity.EntityId ); //if this entity is in reveal queue, remove it. medbay is priority 0 if ( MedbayQueue.ContainsKey( entity.EntityId ) ) return; //we don't want dupes in the queue MedbayQueue.Add( entity.EntityId, item ); }
static public void RevealAll( ) { ConcealQueue.Clear( ); RevealQueue.Clear( ); ProcessConceal.ForceReveal = true; //set the force flag HashSet<IMyEntity> entities = new HashSet<IMyEntity>( ); Wrapper.GameAction( ( ) => { MyAPIGateway.Entities.GetEntities( entities ); } ); List<MyObjectBuilder_EntityBase> addList = new List<MyObjectBuilder_EntityBase>( ); int count = 0; foreach ( IMyEntity entity in entities ) { if ( entity.InScene ) continue; if ( !(entity is IMyCubeGrid) ) continue; MyObjectBuilder_CubeGrid builder = CubeGrids.SafeGetObjectBuilder( (IMyCubeGrid)entity ); if ( builder == null ) continue; long itemId = entity.EntityId; ConcealItem item = new ConcealItem( entity, "Force reveal" ); if ( MedbayQueue.ContainsKey( itemId ) ) continue; count++; RevealQueue.Add( entity.EntityId, item ); } if ( PluginSettings.Instance.DynamicShowMessages ) Essentials.Log.Info( "Queued {0} grids for force reveal.", count ); }