diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index 093a4ceae..175eb61e2 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -682,6 +682,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/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs index eebf1146a..7845f609c 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs @@ -26,10 +26,6 @@ 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)] diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index af2ac7d8e..0d2b87ba3 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -1077,7 +1077,7 @@ namespace Barotrauma } ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime); - if (body == null || !body.Enabled || !inWater || ParentInventory != null) return; + if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; } ApplyWaterForces(); CurrentHull?.ApplyFlowForces(deltaTime, this); @@ -1116,6 +1116,11 @@ namespace Barotrauma /// private void ApplyWaterForces() { + if (body.Mass <= 0.0f) + { + return; + } + float forceFactor = 1.0f; if (CurrentHull != null) { diff --git a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs index e4ee52c4c..b8823bf70 100644 --- a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs @@ -646,7 +646,6 @@ namespace Barotrauma /// public void ApplyForce(Vector2 force, float maxVelocity) { - if (!IsValidValue(force, "force", -1e10f, 1e10f)) return; if (!IsValidValue(maxVelocity, "max velocity")) return; Vector2 velocityAddition = force / Mass * (float)Timing.Step; @@ -657,7 +656,10 @@ namespace Barotrauma { newVelocity = newVelocity.ClampLength(maxVelocity); } - body.ApplyForce((newVelocity - body.LinearVelocity) * Mass / (float)Timing.Step); + + Vector2 clampedForce = (newVelocity - body.LinearVelocity) * Mass / (float)Timing.Step; + if (!IsValidValue(force, "clamped force", -1e10f, 1e10f)) return; + body.ApplyForce(force); } public void ApplyForce(Vector2 force, Vector2 point)