protected override void UnloadData()
        {
            Enabled = false;

            asteroidModule = null;

            planetModule = null;

            m_existingObjectSeeds?.Clear();

            m_toTrackedEntities?.Clear();
            m_trackedEntities?.Clear();

            Static = null;
        }
Exemplo n.º 2
0
        protected override void UnloadData()
        {
            PluginLog.Log("unloading procedural generator data");
            Enabled = false;

            asteroidModule = null;

            planetModule = null;

            m_existingObjectSeeds?.Clear();

            m_toTrackedEntities?.Clear();
            m_trackedEntities?.Clear();

            Static = null;
        }
Exemplo n.º 3
0
        public override void LoadData()
        {
            PluginLog.Log("Loading procedural generator data");
            Static = this;

            m_seed = MySession.Static.Settings.ProceduralSeed;

            planetModule = new ProceduralPlanetModule(m_seed);

            if (!SettingsSession.Static.Settings.Enable || !Sync.IsServer || MySession.Static.Settings.WorldSizeKm != 0)
            {
                return;
            }

            MyObjectBuilder_AsteroidGenerator b = GetConfig();

            m_existingObjectSeeds = b.ExistingObjectsSeeds;

            proceduralDensity = b.ProceduralDensity == 0 ? MySession.Static.Settings.ProceduralDensity : b.ProceduralDensity;

            if (SettingsSession.Static.Settings.GeneratorSettings.AsteroidGenerator == AsteroidGenerator.PLUGIN)
            {
                MySession.Static.Settings.ProceduralDensity = 0;
                MySession.Static.OnSavingCheckpoint        += delegate
                {
                    if (Enabled)
                    {
                        MySession.Static.Settings.ProceduralDensity = proceduralDensity;
                    }
                };
            }
            else
            {
                if (MySession.Static.Settings.ProceduralDensity != 0 && MySession.Static.Settings.ProceduralDensity != proceduralDensity)
                {
                    proceduralDensity = MySession.Static.Settings.ProceduralDensity;
                }
                else
                {
                    MySession.Static.Settings.ProceduralDensity = proceduralDensity;
                }
            }

            //if (MySession.Static.Settings.ProceduralDensity != 0) return;

            asteroidModule = new ProceduralAsteroidsRingModule(m_seed);
        }