@@ -23,11 +23,12 @@ public class ConcealGroup
2323 /// Entity ID of the first grid in the group.
2424 /// </summary>
2525 public long Id { get ; }
26- public bool IsConcealed { get ; set ; }
26+ public bool IsConcealed { get ; private set ; }
2727 public BoundingBoxD WorldAABB { get ; private set ; }
2828 public List < MyCubeGrid > Grids { get ; }
2929 public List < MyMedicalRoom > MedicalRooms { get ; } = new List < MyMedicalRoom > ( ) ;
3030 public List < MyCryoChamber > CryoChambers { get ; } = new List < MyCryoChamber > ( ) ;
31+ private Dictionary < long , bool > _unstatic = new Dictionary < long , bool > ( ) ;
3132 public event Action < ConcealGroup > Closing ;
3233 internal volatile int ProxyId = - 1 ;
3334
@@ -131,9 +132,15 @@ public bool IsCryoOccupied(ulong steamId)
131132 /// </summary>
132133 public void Conceal ( )
133134 {
134- foreach ( var body in Grids )
135- if ( body . Parent == null )
136- UnregisterRecursive ( body ) ;
135+ _unstatic . Clear ( ) ;
136+ foreach ( var grid in Grids )
137+ {
138+ _unstatic [ grid . EntityId ] = ! grid . IsStatic ;
139+ grid . ConvertToStatic ( ) ;
140+
141+ if ( grid . Parent == null )
142+ UnregisterRecursive ( grid ) ;
143+ }
137144
138145 //foreach (var entity in Grids)
139146 // if (entity.Parent == null)
@@ -160,9 +167,14 @@ public void Reveal()
160167 // if (entity.Parent == null)
161168 // MyGamePruningStructure.Add(entity);
162169
163- foreach ( var entity in Grids )
164- if ( entity . Parent == null )
165- RegisterRecursive ( entity ) ;
170+ foreach ( var grid in Grids )
171+ {
172+ if ( _unstatic [ grid . EntityId ] )
173+ grid . OnConvertToDynamic ( ) ;
174+
175+ if ( grid . Parent == null )
176+ RegisterRecursive ( grid ) ;
177+ }
166178
167179 void RegisterRecursive ( IMyEntity e )
168180 {
0 commit comments