public static void NotifyVoxelChanged(MyVoxelBase.OperationType type, MyVoxelBase voxelMap, ref BoundingBoxD cutOutBox) { cutOutBox.Inflate((double)0.25); MyGamePruningStructure.GetTopmostEntitiesInBox(ref cutOutBox, m_overlapList, MyEntityQueryType.Both); if (MyFakes.ENABLE_BLOCKS_IN_VOXELS_TEST) { foreach (MyEntity entity in m_overlapList) { if (Sync.IsServer) { MyCubeGrid grid = entity as MyCubeGrid; if ((grid != null) && grid.IsStatic) { if ((grid.Physics != null) && (grid.Physics.Shape != null)) { grid.Physics.Shape.RecalculateConnectionsToWorld(grid.GetBlocks()); } if (type == MyVoxelBase.OperationType.Cut) { grid.TestDynamic = MyCubeGrid.MyTestDynamicReason.GridSplit; } } } MyPhysicsBody physics = entity.Physics as MyPhysicsBody; if (((physics != null) && !physics.IsStatic) && (physics.RigidBody != null)) { physics.RigidBody.Activate(); } } } m_overlapList.Clear(); if (Sync.IsServer) { MyPlanetEnvironmentComponent component = voxelMap.Components.Get <MyPlanetEnvironmentComponent>(); if (component != null) { component.GetSectorsInRange(ref cutOutBox, m_overlapList); using (List <MyEntity> .Enumerator enumerator = m_overlapList.GetEnumerator()) { while (enumerator.MoveNext()) { ((MyEnvironmentSector)enumerator.Current).DisableItemsInBox(ref cutOutBox); } } m_overlapList.Clear(); } } }
protected void WritePlanetSectors(BitStream stream) { stream.WriteInt32(PlanetMagic); var planets = MyPlanets.GetPlanets(); // Planets are not enabled if session component is not loaded. if (planets == null) { stream.WriteInt32(0); return; } stream.WriteInt32(planets.Count); foreach (var planet in planets) { stream.WriteInt64(planet.EntityId); MyPlanetEnvironmentComponent env = planet.Components.Get <MyPlanetEnvironmentComponent>(); var syncLod = env.EnvironmentDefinition.SyncLod; foreach (var provider in env.Providers) { foreach (var sector in provider.LogicalSectors) { if (sector.MinLod <= syncLod) { stream.WriteInt64(sector.Id); } } } // don't know how many in advance so I will use ~0 termination instead of count. stream.WriteInt64(~0); } }