diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 77ed140e1..8a797dfa8 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -23,6 +23,8 @@ namespace Barotrauma protected float hudInfoTimer; protected bool hudInfoVisible; + private float pressureParticleTimer; + private float findFocusedTimer; protected float lastRecvPositionUpdateTime; @@ -170,13 +172,23 @@ namespace Barotrauma { if (needsAir && pressureProtection < 80.0f && - (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure > 50.0f)) + (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure > 0.0f)) { float pressure = AnimController.CurrentHull == null ? 100.0f : AnimController.CurrentHull.LethalPressure; + if (pressure > 0.0f) + { + float zoomInEffectStrength = MathHelper.Clamp(pressure / 100.0f, 0.1f, 1.0f); + cam.Zoom = MathHelper.Lerp(cam.Zoom, + cam.DefaultZoom + (Math.Max(pressure, 10) / 150.0f) * Rand.Range(0.9f, 1.1f), + zoomInEffectStrength); - cam.Zoom = MathHelper.Lerp(cam.Zoom, - (pressure / 50.0f) * Rand.Range(1.0f, 1.05f), - (pressure - 50.0f) / 50.0f); + pressureParticleTimer += pressure * deltaTime; + if (pressureParticleTimer > 10.0f) + { + Particle p = GameMain.ParticleManager.CreateParticle("waterblood", WorldPosition + Rand.Vector(5.0f), Rand.Vector(10.0f)); + pressureParticleTimer = 0.0f; + } + } } if (IsHumanoid) @@ -713,7 +725,7 @@ namespace Barotrauma for (int i = 0; i < 10; i++) { Particle p = GameMain.ParticleManager.CreateParticle("waterblood", - ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), + WorldPosition + Rand.Vector(5.0f), Rand.Vector(10.0f)); if (p != null) p.Size *= 2.0f; diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index 175eb61e2..bdcad204d 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -701,6 +701,25 @@ namespace Barotrauma } }; + //spacing + new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null); + + new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft), + TextManager.Get("Cancel"), style: "GUIButtonLarge") + { + IgnoreLayoutGroups = true, + OnClicked = (x, y) => + { + if (UnsavedSettings) + { + LoadPlayerConfig(); + } + if (Screen.Selected == GameMain.MainMenuScreen) GameMain.MainMenuScreen.ReturnToMainMenu(null, null); + GUI.SettingsMenuOpen = false; + return true; + } + }; + applyButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight), TextManager.Get("ApplySettingsButton"), style: "GUIButtonLarge") { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index ebbaceea1..8d0463909 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1898,15 +1898,22 @@ namespace Barotrauma //cannot be protected from pressure when below crush depth protectedFromPressure = protectedFromPressure && WorldPosition.Y > CharacterHealth.CrushDepth; //implode if not protected from pressure, and either outside or in a high-pressure hull - if (!protectedFromPressure && + if (!protectedFromPressure && (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 80.0f)) { - PressureTimer += ((AnimController.CurrentHull == null) ? - 100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime; + if (CharacterHealth.PressureKillDelay <= 0.0f) + { + PressureTimer = 100.0f; + } + else + { + PressureTimer += ((AnimController.CurrentHull == null) ? + 100.0f : AnimController.CurrentHull.LethalPressure) / CharacterHealth.PressureKillDelay * deltaTime; + } if (PressureTimer >= 100.0f) { - if (Controlled == this) cam.Zoom = 5.0f; + if (Controlled == this) { cam.Zoom = 5.0f; } if (GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient) { Implode(); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs index 5d6f70a83..e7f908c4e 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs @@ -103,6 +103,7 @@ namespace Barotrauma } public float CrushDepth { get; private set; } + public float PressureKillDelay { get; private set; } = 5.0f; public float Vitality { get; private set; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs index 7845f609c..eebf1146a 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs @@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components private float blinkTimer; + private bool itemLoaded; + + private float blinkTimer; + public PhysicsBody ParentBody; [Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]