internal void UnmarkReplicable(MyProceduralLogicalSector sector)
 {
     Debug.Assert(sector.Replicable);
     m_sectorsForReplication.Remove(sector);
     QueueDestroyLogicalSector(sector);
     sector.Replicable = false;
 }
 private void QueueRaiseLogicalSector(MyProceduralLogicalSector sector)
 {
     if (Sync.IsServer && Sync.MultiplayerActive)
     {
         Debug.Assert(MyMultiplayer.Static != null);
         m_sectorsToRaise.Enqueue(sector);
     }
 }
        internal void MarkReplicable(MyProceduralLogicalSector sector)
        {
            Debug.Assert(!sector.Replicable);

            m_sectorsForReplication.Add(sector);
            QueueRaiseLogicalSector(sector);
            sector.Replicable = true;
        }
        private void SaveLogicalSector(MyProceduralLogicalSector sector)
        {
            var sectorOb = sector.GetObjectBuilder();

            if (sectorOb == null)
            {
                m_savedSectors.Remove(sector.Id);
            }
            else
            {
                m_savedSectors[sector.Id] = (MyObjectBuilder_ProceduralEnvironmentSector)sectorOb;
            }
        }
        internal void CloseSector(MyProceduralLogicalSector sector)
        {
            SaveLogicalSector(sector);
            m_sectors.Remove(sector.Id);

            if (sector.Replicable)
                UnmarkReplicable(sector);
            else
                QueueDestroyLogicalSector(sector);
        }
        private MyProceduralLogicalSector GetLogicalSector(int x, int y, int localLod)
        {
            var key = MyPlanetSectorId.MakeSectorId(x, y, ProviderId, localLod);
            MyProceduralLogicalSector sector;
            if (!m_sectors.TryGetValue(key, out sector))
            {
                MyObjectBuilder_ProceduralEnvironmentSector sectorBuilder;
                m_savedSectors.TryGetValue(key, out sectorBuilder);
                sector = new MyProceduralLogicalSector(this, x, y, localLod, sectorBuilder);
                sector.Id = key;

                m_sectors[key] = sector;
            }
            return sector;
        }
 private void QueueDestroyLogicalSector(MyProceduralLogicalSector sector)
 {
     if (Sync.IsServer && Sync.MultiplayerActive)
     {
         Debug.Assert(MyMultiplayer.Static != null);
         m_sectorsToDestroy.Enqueue(sector);
     }
     else
     {
         sector.Close();
     }
 }