Exemplo n.º 1
0
        public override void OnAddedToScene(object source)
        {
            base.OnAddedToScene(source);

            MyPlanets.Register(this);

            MyGravityProviderSystem.AddPlanet(this);
            MyOxygenProviderSystem.AddOxygenGenerator(this);
        }
Exemplo n.º 2
0
        public void Init(MyPlanetInitArguments arguments)
        {
            if (MyFakes.ENABLE_PLANETS == false)
            {
                throw new PlanetsNotEnabledException();
            }

            m_planetInitValues    = arguments;
            m_hasSpawningMaterial = arguments.Storage.DataProvider.HasMaterialSpawningFlora();

            base.Init(m_planetInitValues.StorageName, m_planetInitValues.Storage, m_planetInitValues.PositionMinCorner);

            NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;

            m_storage.RangeChanged += storage_RangeChangedPlanet;

            if (Physics != null)
            {
                Physics.Enabled = false;
                Physics.Close();
                Physics = null;
            }

            Vector3I storageSize = m_planetInitValues.Storage.Size;

            m_numCells = new Vector3I(storageSize.X / PHYSICS_SECTOR_SIZE_METERS, storageSize.Y / PHYSICS_SECTOR_SIZE_METERS, storageSize.Z / PHYSICS_SECTOR_SIZE_METERS);

            m_numCells -= 1;

            StorageName  = m_planetInitValues.StorageName;
            m_storageMax = m_planetInitValues.Storage.Size;

            MyGravityProviderSystem.AddPlanet(this);
            MyOxygenProviderSystem.AddOxygenGenerator(this);

            if (m_planetInitValues.MarkAreaEmpty)
            {
                MyProceduralWorldGenerator.Static.MarkEmptyArea(PositionComp.GetPosition());
            }
        }