Beispiel #1
0
        // Obtain day or night spawning info based on given planet and position. Position is in global space.
        public static MyPlanetAnimalSpawnInfo GetDayOrNightAnimalSpawnInfo(MyPlanet planet, Vector3D position)
        {
            if (planet == null)
            {
                return(null);
            }

            if (planet.Generator.NightAnimalSpawnInfo != null &&
                planet.Generator.NightAnimalSpawnInfo.Animals != null &&
                planet.Generator.NightAnimalSpawnInfo.Animals.Length > 0 &&
                IsThereNight(planet, ref position))
            {
                return(planet.Generator.NightAnimalSpawnInfo);
            }
            else if (planet.Generator.AnimalSpawnInfo != null &&
                     planet.Generator.AnimalSpawnInfo.Animals != null &&
                     planet.Generator.AnimalSpawnInfo.Animals.Length > 0)
            {
                return(planet.Generator.AnimalSpawnInfo);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public static void RefreshLists()
        {
            entityList.Clear();
            planetList.Clear();
            planetNameList.Clear();

            MyAPIGateway.Entities.GetEntities(entityList);

            if (entityList.Count != 0)
            {
                foreach (var entity in entityList)
                {
                    planet = entity as MyPlanet;

                    if (planet != null)
                    {
                        planetList.Add(planet);
                    }
                }
            }

            planetNameList.Clear();
            var planetDefList = MyDefinitionManager.Static.GetPlanetsGeneratorsDefinitions();

            foreach (var planetDef in planetDefList)
            {
                planetNameList.Add(planetDef.Id.SubtypeName);
            }
        }
Beispiel #3
0
        // Is there night on the given place on planet? Position is in global space.
        static bool IsThereNight(MyPlanet planet, ref Vector3D position)
        {
            // gravitation vector and vector to sun are facing same direction
            Vector3 grav = planet.GetWorldGravityNormalized(ref position);

            return(Vector3.Dot(MySector.DirectionToSunNormalized, grav) > 0);
        }
Beispiel #4
0
    public void generatePlanet()
    {
        if (((sm.listeVisited[this.planetIndex - 1] == true && sm.listeVisited[this.planetIndex] == false) || (this.planetIndex == 1 && sm.listeVisited[this.planetIndex] == false)) && this.planetIndex != 9)
        {
            //Si la planète n'a pas déjà été générée on la génère
            if (this.myPlanet == null)
            {
                this.myPlanet = new MyPlanet();
                this.changePlanetSkin(myPlanet.getPlanetType().getType());
                this.getPlanetInfo();
                this.infoTravel.text = "You are here\nClick on the planet to land";
            }
            else
            {
                //================================================================
                // Put here code to land on the planet
                GameObject.Find("SceneManager").GetComponent <CustomSceneManager>().TravelTo(this);
                //================================================================

                Debug.Log("land");

                // La planète a été visité
                sm.listeVisited[this.planetIndex] = true;
            }
        }
        else if (sm.listeVisited[this.planetIndex - 1] == true && this.planetIndex == 9)
        {
            //================================================================
            // Put win or losing condition here when palyer arrive to homeland
            GameObject.Find("SceneManager").GetComponent <CustomSceneManager>().WinTheGame();
            //================================================================
            Debug.Log("game win");
        }
    }
Beispiel #5
0
 public PlanetEntity(IMyEntity entity) : base(entity)
 {
     Planet        = entity as MyPlanet;
     HasGravity    = entity.Components.TryGet <MyGravityProviderComponent>(out Gravity);
     HasAtmosphere = Planet.HasAtmosphere;
     HasOxygen     = Planet.GetOxygenForPosition(GetPosition()) > 0 ? true : false;
 }
Beispiel #6
0
        public override void UpdateAfterSimulation()
        {
            if (Tick % 5 == 0)
            {
                if (Camera == null)
                {
                    return;
                }
                rainImpactEntities.Clear();

                MyGamePruningStructure.GetTopMostEntitiesInBox(ref frustumBBox, rainImpactEntities);
                //MyAPIGateway.Parallel.Start(CalculateLines);
                CalculateLines();
            }

            if (Tick % 60 == 0 && closestPlanet != null)
            {
                cameraDistanceFromSurface = closestPlanet.GetClosestSurfacePointGlobal(Camera.Position);
                cameraAltitude            = (Camera.Position - cameraDistanceFromSurface).Length();
            }

            if (Tick % 301 == 0)
            {
                closestPlanet = MyGamePruningStructure.GetClosestPlanet(Camera.Position);
                if (closestPlanet != null)
                {
                    planetCentre = closestPlanet.PositionComp.WorldAABB.Center;
                }
            }

            lines.Clear();
        }
        public static void AddPlanetPrefab(string prefabName, string name)
        {
            DictionaryValuesReader <MyDefinitionId, MyPlanetPrefabDefinition> planetDefinitions = MyDefinitionManager.Static.GetPlanetsPrefabsDefinitions();

            foreach (var planetPrebabDefinition in planetDefinitions)
            {
                if (planetPrebabDefinition.Id.SubtypeName == prefabName)
                {
                    var voxelMap = new MyPlanet();
                    var ob       = planetPrebabDefinition.PlanetBuilder;

                    string storageName = MyFileSystem.ContentPath + "\\VoxelMaps\\" + ob.StorageName + MyVoxelConstants.FILE_EXTENSION;
                    voxelMap.EntityId = ob.EntityId;

                    MyPlanetInitArguments planetInitArguments;
                    planetInitArguments.StorageName           = ob.StorageName;
                    planetInitArguments.Storage               = MyStorageBase.LoadFromFile(storageName);
                    planetInitArguments.PositionMinCorner     = ob.PositionAndOrientation.Value.Position;
                    planetInitArguments.AveragePlanetRadius   = ob.Radius;
                    planetInitArguments.AtmosphereRadius      = ob.AtmosphereRadius;
                    planetInitArguments.MaximumHillRadius     = ob.MaximumHillRadius;
                    planetInitArguments.MinimumSurfaceRadius  = ob.MinimumSurfaceRadius;
                    planetInitArguments.HasAtmosphere         = ob.HasAtmosphere;
                    planetInitArguments.AtmosphereWavelengths = ob.AtmosphereWavelengths;
                    planetInitArguments.MaxOxygen             = ob.MaximumOxygen;
                    planetInitArguments.GravityFalloff        = ob.GravityFalloff;
                    planetInitArguments.MarkAreaEmpty         = true;

                    voxelMap.Init(planetInitArguments);
                    MyEntities.Add(voxelMap);
                }
            }
        }
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            m_waitForUpdate--;
            if (m_waitForUpdate > 0)
            {
                return;
            }
            m_waitForUpdate = UPDATE_DELAY;


            Vector3D position = MySector.MainCamera.Position;


            MyPlanet planet = MyGamePruningStructure.GetClosestPlanet(position);

            if (planet != null)
            {
                var distanceFromPlanet = Vector3D.Distance(planet.PositionComp.GetPosition(), position);
                if (distanceFromPlanet > planet.MaximumRadius + Math.Max(100, planet.MaximumRadius))
                {
                    ;
                }
                planet = null; //too far planet
            }

            if (m_closestPlanet != planet)
            {
                m_closestPlanet = planet;

                if (m_closestPlanet != null)
                {
                    MyStringId category   = MyStringId.GetOrCompute(m_closestPlanet.Generator.Id.SubtypeId.ToString());
                    MyStringId transition = MyStringId.GetOrCompute(m_closestPlanet.Generator.Id.SubtypeId.ToString());

                    if (!MyAudio.Static.IsValidTransitionCategory(transition, category))
                    {
                        category   = MyStringId.GetOrCompute("OtherPlanet");
                        transition = MyStringId.GetOrCompute("OtherPlanet");
                    }

                    MyMusicTrack mt = new MyMusicTrack()
                    {
                        MusicCategory      = category,
                        TransitionCategory = transition
                    };

                    MyAudio.Static.PlayMusic(mt);
                }
                else
                {
                    //random
                    MyMusicTrack mt = new MyMusicTrack()
                    {
                    };
                    MyAudio.Static.PlayMusic(mt, 1);
                }
            }
        }
        void OnPickPlanet(MyGuiControlButton button)
        {
            var results = new List <MyLineSegmentOverlapResult <MyEntity> >();
            var ray     = new LineD(MySector.MainCamera.Position, MySector.MainCamera.ForwardVector);

            MyGamePruningStructure.GetAllEntitiesInRay(ref ray, results);

            float    closestPlanetDistance = float.MaxValue;
            MyPlanet closestPlanet         = null;

            foreach (var result in results)
            {
                var planet = result.Element as MyPlanet;
                if (planet != null && planet.EntityId != m_selectedPlanetEntityID)
                {
                    if (result.Distance < closestPlanetDistance)
                    {
                        closestPlanet = planet;
                    }
                }
            }

            if (closestPlanet != null)
            {
                m_selectedPlanetEntityID     = closestPlanet.EntityId;
                m_atmosphereSettings         = closestPlanet.AtmosphereSettings;
                m_originalAtmosphereSettings = m_atmosphereSettings;
                RecreateControls(false);
            }
        }
Beispiel #10
0
 private void GenerateDebugDrawPolygonNavmesh(MyPlanet planet, List <MyRecastDetourPolygon> polygons, MyOrientedBoundingBoxD centerOBB, Vector2I coords)
 {
     if (polygons != null)
     {
         List <MyFormatPositionColor> list = new List <MyFormatPositionColor>();
         int num  = 10;
         int num2 = 0;
         int num3 = 0x5f;
         int num4 = 10;
         using (List <MyRecastDetourPolygon> .Enumerator enumerator = polygons.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 foreach (Vector3 vector in enumerator.Current.Vertices)
                 {
                     MyFormatPositionColor item = new MyFormatPositionColor {
                         Position = (Vector3)this.LocalNavmeshPositionToWorldPosition(centerOBB, vector, this.Center, Vector3D.Zero),
                         Color    = new Color(0, num + num2, 0)
                     };
                     list.Add(item);
                 }
                 num2 = (num2 + num4) % num3;
             }
         }
         if (list.Count > 0)
         {
             this.m_newObbCoordsPolygons[coords] = list;
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// Checks if a position on a planet is underground
        /// </summary>
        public static bool IsUnderGround(MyPlanet planet, Vector3D position, double altitudeOffset = 0)
        {
            if (planet == null)
            {
                return(false);
            }

            double altitude = (position - planet.WorldMatrix.Translation).Length() + altitudeOffset;

            if (altitude < planet.MinimumRadius)
            {
                return(true);
            }

            if (altitude > planet.MaximumRadius)
            {
                return(false);
            }

            if ((altitude - (planet.GetClosestSurfacePointGlobal(position) - planet.WorldMatrix.Translation).Length()) < 0)
            {
                return(true);
            }

            return(false);
        }
Beispiel #12
0
 public override void OnAddedToScene()
 {
     base.OnAddedToScene();
     if (this.m_mesher == null)
     {
         this.m_mesher = new MyVoxelMesherComponent();
         MyPlanet rootVoxel = this.m_voxelMap.RootVoxel as MyPlanet;
         if (rootVoxel != null)
         {
             MyObjectBuilder_VoxelMesherComponentDefinition mesherPostprocessing = rootVoxel.Generator.MesherPostprocessing;
             if (mesherPostprocessing != null)
             {
                 MyVoxelMesherComponentDefinition def = new MyVoxelMesherComponentDefinition();
                 def.Init(mesherPostprocessing, MyModContext.BaseGame);
                 this.m_mesher.Init(def);
             }
         }
         this.m_mesher.SetContainer(base.Entity.Components);
         this.m_mesher.OnAddedToScene();
     }
     if (!this.m_bodiesInitialized)
     {
         this.CreateRigidBodies();
     }
     ActiveVoxelPhysicsBodies++;
 }
Beispiel #13
0
 public override void OnAddedToContainer()
 {
     base.OnAddedToContainer();
     this.m_planet       = base.Entity as MyPlanet;
     this.m_oldNeedsDraw = this.NeedsDraw;
     this.NeedsDraw      = true;
 }
Beispiel #14
0
        public MyNavmeshOBBs(MyPlanet planet, Vector3D centerPoint, Vector3D forwardDirection, int obbsPerLine, int tileSize, int tileHeight)
        {
            m_planet = planet;

            // There will always be an odd number of obbs in a line
            OBBsPerLine = obbsPerLine;
            if (OBBsPerLine % 2 == 0)
            {
                OBBsPerLine += 1;
            }

            m_middleCoord = (OBBsPerLine - 1) / 2;

            m_tileHalfSize   = tileSize * 0.5f;
            m_tileHalfHeight = tileHeight * 0.5f;

            m_obbs = new MyOrientedBoundingBoxD?[OBBsPerLine][];
            for (int i = 0; i < OBBsPerLine; i++)
            {
                m_obbs[i] = new MyOrientedBoundingBoxD?[OBBsPerLine];
            }

            Initialize(centerPoint, forwardDirection);

            BaseOBB = GetBaseOBB();
        }
        private void GenerateDebugDrawPolygonNavmesh(MyPlanet planet, List <MyRecastDetourPolygon> polygons, MyOrientedBoundingBoxD centerOBB, Vector2I coords /*List<Vertex> navmesh, int xCoord, int yCoord*/)
        {
            if (polygons == null)
            {
                return;
            }

            List <Vertex> navmesh = new List <Vertex>();

            int greenBase              = 10;
            int greenValue             = 0;
            int maxExclusiveGreenValue = 95;
            int greenStep              = 10;

            foreach (var polygon in polygons)
            {
                foreach (var vertice in polygon.Vertices)
                {
                    var v = new Vertex()
                    {
                        pos   = LocalNavmeshPositionToWorldPosition(centerOBB, vertice, Center, Vector3D.Zero),
                        color = new Color(0, greenBase + greenValue, 0)
                    };
                    navmesh.Add(v);
                }
                greenValue += greenStep;
                greenValue %= maxExclusiveGreenValue;
            }

            if (navmesh != null && navmesh.Count > 0)
            {
                m_newObbCoordsPolygons[coords] = navmesh;
            }
        }
 private bool PlanetHasFauna(MyPlanet planet)
 {
     // compulsory: at least normal spawning info, planet can exist without night animals
     return(planet.Generator.AnimalSpawnInfo != null &&
            planet.Generator.AnimalSpawnInfo.Animals != null &&
            planet.Generator.AnimalSpawnInfo.Animals.Length > 0);
 }
Beispiel #17
0
        /// <summary>
        /// Returns the planet that has the most influential gravity well in the given world point.
        /// The most influential gravity well is defined as the planet that has the highest gravity in the point and
        /// if no such planet is found, it returns the planet, whose gravity well is the closest to the given point.
        /// </summary>
        /// <param name="worldPosition">Position to test for the strongest gravity well</param>
        /// <returns>Planet that has the most influential gravity well in the given world point</returns>
        public static MyPlanet GetStrongestGravityWell(Vector3D worldPosition)
        {
            MyPlanet nearestPlanet  = null;
            double   maxMetricValue = double.MinValue;

            foreach (IMyGravityProvider gravityProvider in m_planetGenerators)
            {
                MyPlanet planet = gravityProvider as MyPlanet;
                if (planet == null)
                {
                    continue;
                }

                double planetDistance = (planet.PositionComp.GetPosition() - worldPosition).Length();
                double metricValue    = double.MinValue;
                if (planetDistance <= planet.GravityLimit)
                {
                    metricValue = (double)planet.GetGravityMultiplier(worldPosition);
                }
                else
                {
                    // Outside of the gravity well, just invert the distance, so that we can use only one value
                    // for comparison of planets which affect us and which don't
                    metricValue = planet.GravityLimit - planetDistance;
                }

                if (metricValue > maxMetricValue)
                {
                    nearestPlanet  = planet;
                    maxMetricValue = metricValue;
                }
            }

            return(nearestPlanet);
        }
Beispiel #18
0
        /// <summary>
        /// This quickly checks if a given position is in any natural gravity.
        /// </summary>
        /// <param name="position">Position to check</param>
        /// <param name="sphereSize">Sphere size to test with.</param>
        /// <returns>True if there is natural gravity at this position, false otherwise.</returns>
        public static bool IsPositionInNaturalGravity(Vector3D position, double sphereSize = 0)
        {
            // Clamp sphere size to be at least 0.
            sphereSize = MathHelper.Max(sphereSize, 0);

            for (int i = 0; i < m_planetGenerators.Count; i++)
            {
                IMyGravityProvider provider = m_planetGenerators[i];
                if (provider == null)
                {
                    continue;
                }

                MyPlanet planet = provider as MyPlanet;
                if (planet == null)
                {
                    continue;
                }

                //we don't really care which planet's gravity we're in, so return as soon as we find one
                if (planet.IsPositionInGravityWell(position))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #19
0
 public void UpdateBeforeSimulation100()
 {
     m_soundEmitters[(int)MySoundEmitterEnum.PrimaryState].Update();
     if (windSystem)
     {
         float oxygen = MyOxygenProviderSystem.GetOxygenInPoint(m_character.PositionComp.GetPosition());
         if (oxygen > 0f)
         {
             inAtmosphere = true;//in pressurized environment
         }
         else
         {
             Vector3 gravity = MyGravityProviderSystem.CalculateNaturalGravityInPoint(m_character.PositionComp.GetPosition());
             if (gravity.LengthSquared() > 0f)
             {
                 MyPlanet planet = MyGravityProviderSystem.GetNearestPlanet(m_character.PositionComp.GetPosition());
                 if (planet != null && planet.AtmosphereSettings.FogIntensity > 0f)
                 {
                     inAtmosphere = true;//in atmosphere without oxygen
                 }
                 else
                 {
                     inAtmosphere = false;
                 }
             }
             else
             {
                 inAtmosphere = false;
             }
         }
         windEmitter.Update();
     }
 }
        public MyPlanet GetClosestContainingPlanet(Vector3D point)
        {
            m_voxels.Clear();
            BoundingBoxD b = new BoundingBoxD(point, point);

            MyGamePruningStructure.GetAllVoxelMapsInBox(ref b, m_voxels);

            double dist = double.PositiveInfinity;

            MyPlanet p = null;

            foreach (var v in m_voxels)
            {
                if (v is MyPlanet)
                {
                    var d = Vector3.Distance(v.WorldMatrix.Translation, point);
                    if (d < dist)
                    {
                        dist = d;
                        p    = (MyPlanet)v;
                    }
                }
            }

            return(p);
        }
        //alter position based on altitude
        private void HoverMechanic(ref Vector3D pos)
        {
            m_hoverMin = 5;
            m_hoverMax = 25;

            Vector3 gravity = MyGravityProviderSystem.CalculateNaturalGravityInPoint(pos);

            if (gravity.LengthSquared() > 0f)
            {
                MyPlanet planet = MyGamePruningStructure.GetClosestPlanet(pos);
                if (planet != null)
                {
                    Vector3D closestPoint = planet.GetClosestSurfacePointGlobal(ref pos);
                    float    altitude     = (float)Vector3D.Distance(closestPoint, pos);
                    if (Vector3D.DistanceSquared(planet.PositionComp.GetPosition(), closestPoint) > Vector3D.DistanceSquared(planet.PositionComp.GetPosition(), pos))
                    {
                        altitude *= -1;
                    }
                    if (altitude < m_hoverMin)
                    {
                        pos = closestPoint - Vector3D.Normalize(gravity) * m_hoverMin;
                    }
                    else if (altitude > m_hoverMax)
                    {
                        pos = closestPoint - Vector3D.Normalize(gravity) * m_hoverMax;
                    }
                }
            }
        }
Beispiel #22
0
 public override void OnAddedToContainer()
 {
     base.OnAddedToContainer();
     m_planet       = Entity as MyPlanet;
     m_oldNeedsDraw = NeedsDraw;
     NeedsDraw      = true;
 }
        private void CreatePlanet(int seed, float size)
        {
            Vector3D pos = MySector.MainCamera.Position + MySector.MainCamera.ForwardVector * size * 3 - new Vector3D(size);

            MyPlanetGeneratorDefinition planetDefinition = MyDefinitionManager.Static.GetDefinition <MyPlanetGeneratorDefinition>(MyStringHash.GetOrCompute(m_selectedPlanetName));
            MyPlanetStorageProvider     provider         = new MyPlanetStorageProvider();

            provider.Init(seed, planetDefinition, size / 2f);

            IMyStorage storage = new MyOctreeStorage(provider, provider.StorageSize);

            float minHillSize = provider.Radius * planetDefinition.HillParams.Min;
            float maxHillSize = provider.Radius * planetDefinition.HillParams.Max;

            float averagePlanetRadius = provider.Radius;

            float outerRadius = averagePlanetRadius + maxHillSize;
            float innerRadius = averagePlanetRadius + minHillSize;

            float atmosphereRadius = planetDefinition.AtmosphereSettings.HasValue && planetDefinition.AtmosphereSettings.Value.Scale > 1f ? 1 + planetDefinition.AtmosphereSettings.Value.Scale : 1.75f;

            atmosphereRadius *= provider.Radius;

            var planet = new MyPlanet();

            planet.EntityId = MyRandom.Instance.NextLong();

            MyPlanetInitArguments planetInitArguments;

            planetInitArguments.StorageName           = "test";
            planetInitArguments.Storage               = storage;
            planetInitArguments.PositionMinCorner     = pos;
            planetInitArguments.Radius                = provider.Radius;
            planetInitArguments.AtmosphereRadius      = atmosphereRadius;
            planetInitArguments.MaxRadius             = outerRadius;
            planetInitArguments.MinRadius             = innerRadius;
            planetInitArguments.HasAtmosphere         = planetDefinition.HasAtmosphere;
            planetInitArguments.AtmosphereWavelengths = Vector3.Zero;
            planetInitArguments.GravityFalloff        = planetDefinition.GravityFalloffPower;
            planetInitArguments.MarkAreaEmpty         = true;
            planetInitArguments.AtmosphereSettings    = planetDefinition.AtmosphereSettings.HasValue ? planetDefinition.AtmosphereSettings.Value : MyAtmosphereSettings.Defaults();
            planetInitArguments.SurfaceGravity        = planetDefinition.SurfaceGravity;
            planetInitArguments.AddGps                = false;
            planetInitArguments.SpherizeWithDistance  = true;
            planetInitArguments.Generator             = planetDefinition;
            planetInitArguments.UserCreated           = true;

            planet.Init(planetInitArguments);

            m_lastAsteroidInfo = new SpawnAsteroidInfo()
            {
                Asteroid         = null,
                RandomSeed       = seed,
                Position         = Vector3D.Zero,
                IsProcedural     = true,
                ProceduralRadius = size,
            };

            MyCubeBuilder.Static.ActivateVoxelClipboard(planet.GetObjectBuilder(), storage, MySector.MainCamera.ForwardVector, (storage.Size * 0.5f).Length());
        }
Beispiel #24
0
        public void UpdateAtmosphereStatus()
        {
            if (m_character != null && (m_localPlayer == false || (MySession.Static != null && m_character == MySession.Static.LocalCharacter)))
            {
                AtmosphereStatus original = m_atmosphereStatus;
                Vector3D         pos      = m_character.PositionComp.GetPosition();
                Vector3          gravity  = MyGravityProviderSystem.CalculateNaturalGravityInPoint(pos);
                if (gravity.LengthSquared() > 0f)
                {
                    MyPlanet planet = MyGamePruningStructure.GetClosestPlanet(pos);
                    if (planet != null && planet.HasAtmosphere && planet.GetAirDensity(pos) > 0.5f)
                    {
                        m_atmosphereStatus = AtmosphereStatus.Atmosphere;//in atmosphere
                    }
                    else
                    {
                        m_atmosphereStatus = AtmosphereStatus.Space;
                    }
                }
                else
                {
                    m_atmosphereStatus = AtmosphereStatus.Space;
                }

                if (m_atmosphereStatus == AtmosphereStatus.Space)
                {
                    float oxygen = 0f;
                    if (m_character.OxygenComponent != null)
                    {
                        if (m_localPlayer)
                        {
                            if (MySession.Static.ControlledEntity is MyCharacter)
                            {
                                //in suit
                                oxygen = m_character.OxygenComponent.EnvironmentOxygenLevel;
                            }
                            else
                            {
                                //in cockpit
                                oxygen = m_character.OxygenComponent.OxygenLevelAtCharacterLocation;
                            }
                        }
                        else
                        {
                            oxygen = m_character.OxygenComponent.EnvironmentOxygenLevel;
                        }
                    }
                    if (oxygen > 0.1f)
                    {
                        m_atmosphereStatus = AtmosphereStatus.ShipOrStation;//in pressurized environment
                    }
                }

                if (MyFakes.ENABLE_REALISTIC_LIMITER && MyFakes.ENABLE_NEW_SOUNDS && original != m_atmosphereStatus && MySession.Static != null && MySession.Static.Settings.RealisticSound)
                {
                    MyAudio.Static.EnableMasterLimiter(!(InAtmosphere || InShipOrStation));
                }
            }
        }
Beispiel #25
0
 public MyRDPath(MyRDPathfinding pathfinding, Vector3D begin, IMyDestinationShape destination)
 {
     this.m_pathfinding       = pathfinding;
     this.m_destination       = destination;
     this.m_isValid           = true;
     this.m_currentPointIndex = 0;
     this.m_planet            = this.GetClosestPlanet(begin);
 }
 public SpawnInfo(MyObjectBuilder_SpaceFaunaComponent.SpawnInfo info, int currentTime)
 {
     SpawnTime   = currentTime + info.SpawnTime;
     AbandonTime = currentTime + info.SpawnTime;
     Position    = new Vector3D(info.X, info.Y, info.Z);
     Planet      = MyGamePruningStructure.GetClosestPlanet(Position);
     SpawnDone   = false;
 }
 public Vector3D?GetWind(MyPlanet Planet, Vector3D pos, IMyEntity ent)
 {
     if (WindGetter != null)
     {
         return(WindGetter(Planet, pos, ent));
     }
     return(null);
 }
Beispiel #28
0
        public static Vector3D GetClosestSurface(Vector3D coords, MyPlanet planet, Water water, ref bool isWater, bool ignoreWater = false)
        {
            double waterLevel = 0;
            var    result     = GetClosestSurface(coords, planet, water, ref waterLevel, ignoreWater);

            isWater = waterLevel < 0;
            return(result);
        }
Beispiel #29
0
 public SpawnInfo(MyObjectBuilder_SpaceFaunaComponent.SpawnInfo info, int currentTime)
 {
     SpawnTime   = currentTime + info.SpawnTime;
     AbandonTime = currentTime + info.SpawnTime;
     Position    = new Vector3D(info.X, info.Y, info.Z);
     Planet      = MyGravityProviderSystem.GetNearestPlanet(Position);
     SpawnDone   = false;
 }
Beispiel #30
0
        public static string GetWeather(MyPlanet planet)
        {
            float    planetRadius   = planet.MaximumRadius;
            Vector3D pos            = planet.PositionLeftBottomCorner + new Vector3D(planetRadius, planetRadius, planetRadius);
            var      currentWeather = GetWeather(pos);

            return(currentWeather);
        }
Beispiel #31
0
 public static void UnRegister(MyPlanet myPlanet)
 {
     Get().m_planets.Remove(myPlanet);
 }
Beispiel #32
0
 public static void Register(MyPlanet myPlanet)
 {
     Get().m_planets.Add(myPlanet);
 }