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)); } } }
public void UpdateAtmosphereStatus() { if (m_character != null && (m_localPlayer == false || (MySession.Static != null && m_character == MySession.Static.LocalCharacter))) { Vector3D pos = m_character.PositionComp.GetPosition(); Vector3 gravity = MyGravityProviderSystem.CalculateNaturalGravityInPoint(pos); if (gravity.LengthSquared() > 0f) { MyPlanet planet = MyGravityProviderSystem.GetNearestPlanet(pos); float d = (float)Vector3D.DistanceSquared(planet.PositionComp.GetPosition(), pos); if (planet != null && planet.HasAtmosphere && Vector3D.DistanceSquared(planet.PositionComp.GetPosition(), pos) < planet.AtmosphereRadius * planet.AtmosphereRadius) { 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 } } } }
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)); } }