private static MyAsteroidGeneratorDefinition GetData()
        {
            MyAsteroidGeneratorDefinition myAsteroidGeneratorDefinition = null;
            int voxelGeneratorVersion = MySession.Static.Settings.VoxelGeneratorVersion;

            foreach (MyAsteroidGeneratorDefinition value in MyDefinitionManager.Static.GetAsteroidGeneratorDefinitions().Values)
            {
                if (value.Version == voxelGeneratorVersion)
                {
                    myAsteroidGeneratorDefinition = value;
                    break;
                }
            }
            if (myAsteroidGeneratorDefinition == null)
            {
                MyLog.Default.WriteLine("Generator of version " + voxelGeneratorVersion + "not found!");
                {
                    foreach (MyAsteroidGeneratorDefinition value2 in MyDefinitionManager.Static.GetAsteroidGeneratorDefinitions().Values)
                    {
                        if (myAsteroidGeneratorDefinition == null || (value2.Version > voxelGeneratorVersion && (myAsteroidGeneratorDefinition.Version < voxelGeneratorVersion || value2.Version < myAsteroidGeneratorDefinition.Version)))
                        {
                            myAsteroidGeneratorDefinition = value2;
                        }
                    }
                    return(myAsteroidGeneratorDefinition);
                }
            }
            return(myAsteroidGeneratorDefinition);
        }
 public ProceduralAsteroidsRingModule(int seed) : base(seed, CELL_SIZE_)
 {
     m_NotSavedMaps = new HashSet <MyVoxelBase>();
     MySession.Static.OnSavingCheckpoint += delegate
     {
         foreach (var map in m_NotSavedMaps)
         {
             map.Save = false;
         }
         m_saving = true;
     };
     m_data         = GetData();
     m_providerType = typeof(MyProceduralWorldGenerator).Assembly.GetType("Sandbox.Game.World.Generator.MyCompositeShapeProvider");
     m_createRoid   = m_providerType.GetMethod("CreateAsteroidShape");
     m_density      = SettingsSession.Static.Settings.GeneratorSettings.AsteroidDensity;
 }
        public MyProceduralAsteroidsModule(int seed) : base(seed, CELL_SIZE)
        {
            m_tmpAsteroids = new List <MyVoxelBase>();
            m_providerType = typeof(MyProceduralWorldGenerator).Assembly.GetType("Sandbox.Game.World.Generator.MyCompositeShapeProvider");
            m_createRoid   = m_providerType.GetMethod("CreateAsteroidShape");
            m_definition   = GetData();

            MySession.Static.OnSavingCheckpoint += delegate
            {
                foreach (var roid in m_tmpAsteroids)
                {
                    roid.Save = false;
                }
                m_isSaving = true;
            };
        }