From f8af8db91a18fc55e27dadc8b69ac247f62a5e42 Mon Sep 17 00:00:00 2001 From: Regalis11 Date: Wed, 12 Apr 2023 15:42:35 +0300 Subject: [PATCH] v1.0.9.0 (2nd hotfix) --- .../ClientSource/GUI/GUITextBox.cs | 1 + .../ClientSource/Map/Lights/LightManager.cs | 2 +- .../ClientSource/Map/Lights/LightSource.cs | 25 ++++++++++--------- .../BarotraumaClient/LinuxClient.csproj | 4 +-- Barotrauma/BarotraumaClient/MacClient.csproj | 4 +-- .../BarotraumaClient/WindowsClient.csproj | 4 +-- .../BarotraumaServer/LinuxServer.csproj | 4 +-- Barotrauma/BarotraumaServer/MacServer.csproj | 4 +-- .../BarotraumaServer/WindowsServer.csproj | 4 +-- .../Items/Components/ItemContainer.cs | 4 +-- .../SharedSource/Map/Submarine.cs | 25 +++++++++++-------- .../SharedSource/Settings/GameSettings.cs | 9 ++++++- Barotrauma/BarotraumaShared/changelog.txt | 12 +++++++++ 13 files changed, 63 insertions(+), 39 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUITextBox.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUITextBox.cs index 1ae121338..7e63ac0e7 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUITextBox.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUITextBox.cs @@ -801,6 +801,7 @@ namespace Barotrauma IEnumerable GetAndSortTextBoxes(GUIComponent parent) => parent.GetAllChildren().OrderBy(t => t.Rect.Y).ThenBy(t => t.Rect.X); GUITextBox SelectNextTextBox(GUIListBox listBox) { + if (listBox?.SelectedComponent == null) { return null; } var textBoxes = GetAndSortTextBoxes(listBox.SelectedComponent); if (textBoxes.Any()) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightManager.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightManager.cs index 4d734fc23..37b05c639 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightManager.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightManager.cs @@ -155,7 +155,7 @@ namespace Barotrauma.Lights { foreach (LightSource light in lights) { - light.NeedsHullCheck = true; + light.HullsUpToDate.Clear(); light.NeedsRecalculation = true; } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightSource.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightSource.cs index eaca44df3..428d4e0b3 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightSource.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/Lights/LightSource.cs @@ -222,9 +222,10 @@ namespace Barotrauma.Lights private float prevCalculatedRange; private Vector2 prevCalculatedPosition; - //do we need to recheck which convex hulls are within range - //(e.g. position or range of the lightsource has changed) - public bool NeedsHullCheck = true; + //Which submarines' convex hulls are up to date? Resets when the item moves/rotates relative to the submarine. + //Can contain null (means convex hulls that aren't part of any submarine). + public HashSet HullsUpToDate = new HashSet(); + //do we need to recalculate the vertices of the light volume private bool needsRecalculation; public bool NeedsRecalculation @@ -277,7 +278,7 @@ namespace Barotrauma.Lights return; } - NeedsHullCheck = true; + HullsUpToDate.Clear(); NeedsRecalculation = true; } } @@ -298,7 +299,7 @@ namespace Barotrauma.Lights return; } - NeedsHullCheck = true; + HullsUpToDate.Clear(); NeedsRecalculation = true; } } @@ -368,7 +369,7 @@ namespace Barotrauma.Lights lightSourceParams.Range = value; if (Math.Abs(prevCalculatedRange - lightSourceParams.Range) < 10.0f) return; - NeedsHullCheck = true; + HullsUpToDate.Clear(); NeedsRecalculation = true; prevCalculatedRange = lightSourceParams.Range; } @@ -384,8 +385,8 @@ namespace Barotrauma.Lights set { NeedsRecalculation = true; - NeedsHullCheck = true; lightTextureTargetSize = value; + HullsUpToDate.Clear(); } } @@ -526,7 +527,7 @@ namespace Barotrauma.Lights chList.List.Add(convexHull); } chList.IsHidden.RemoveWhere(ch => !chList.List.Contains(ch)); - NeedsHullCheck = false; + HullsUpToDate.Add(sub); } /// @@ -571,7 +572,7 @@ namespace Barotrauma.Lights //light and the convexhulls are both outside if (sub == null) { - if (NeedsHullCheck) + if (!HullsUpToDate.Contains(null)) { RefreshConvexHullList(chList, lightPos, null); } @@ -603,7 +604,7 @@ namespace Barotrauma.Lights //light and convexhull are both inside the same sub if (sub == ParentSub) { - if (NeedsHullCheck) + if (!HullsUpToDate.Contains(sub)) { RefreshConvexHullList(chList, lightPos, sub); } @@ -611,7 +612,7 @@ namespace Barotrauma.Lights //light and convexhull are inside different subs else { - if (sub.DockedTo.Contains(ParentSub) && !NeedsHullCheck) { return; } + if (sub.DockedTo.Contains(ParentSub) && HullsUpToDate.Contains(sub)) { return; } lightPos -= (sub.Position - ParentSub.Position); @@ -1385,9 +1386,9 @@ namespace Barotrauma.Lights public void Reset() { + HullsUpToDate.Clear(); convexHullsInRange.Clear(); diffToSub.Clear(); - NeedsHullCheck = true; NeedsRecalculation = true; vertexCount = 0; diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index de81b72cf..26fdc0e9b 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index c555b58ce..1421aa367 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index f9a76d377..3db6a3776 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index db3e2e713..b2c29b9fd 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index 555e2504d..c8e74a308 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 1df6a27dd..7a6026a51 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,8 +6,8 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.8.0 - Copyright © FakeFish 2018-2022 + 1.0.9.0 + Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer ..\BarotraumaShared\Icon.ico diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs index 5a90d80a3..555611027 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs @@ -482,8 +482,8 @@ namespace Barotrauma.Items.Components { foreach (Item item in Inventory.AllItemsMod) { - item.ApplyStatusEffects(ActionType.OnSuccess, 1.0f, ownerCharacter); - item.ApplyStatusEffects(ActionType.OnUse, 1.0f, ownerCharacter); + item.ApplyStatusEffects(ActionType.OnSuccess, 1.0f, ownerCharacter, useTarget: ownerCharacter); + item.ApplyStatusEffects(ActionType.OnUse, 1.0f, ownerCharacter, useTarget: ownerCharacter); item.GetComponent()?.Equip(ownerCharacter); } autoInjectCooldown = AutoInjectInterval; diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs index de5632bef..85ddf7425 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs @@ -259,7 +259,7 @@ namespace Barotrauma { if (outpost.exitPoints.Any()) { - Rectangle worldBorders = Borders; + Rectangle worldBorders = GetDockedBorders(); worldBorders.Location += WorldPosition.ToPoint(); foreach (var exitPoint in outpost.exitPoints) { @@ -425,18 +425,22 @@ namespace Barotrauma } } + private static readonly HashSet checkSubmarineBorders = new HashSet(); + /// - /// Returns a rect that contains the borders of this sub and all subs docked to it + /// Returns a rect that contains the borders of this sub and all subs docked to it, excluding outposts /// - public Rectangle GetDockedBorders(List checkd = null) + public Rectangle GetDockedBorders() { - if (checkd == null) { checkd = new List(); } - checkd.Add(this); + checkSubmarineBorders.Clear(); + return GetDockedBordersRecursive(); + } + private Rectangle GetDockedBordersRecursive() + { Rectangle dockedBorders = Borders; - - var connectedSubs = DockedTo.Where(s => !checkd.Contains(s) && !s.Info.IsOutpost).ToList(); - + checkSubmarineBorders.Add(this); + var connectedSubs = DockedTo.Where(s => !checkSubmarineBorders.Contains(s) && !s.Info.IsOutpost); foreach (Submarine dockedSub in connectedSubs) { //use docking ports instead of world position to determine @@ -445,7 +449,7 @@ namespace Barotrauma Vector2? expectedLocation = CalculateDockOffset(this, dockedSub); if (expectedLocation == null) { continue; } - Rectangle dockedSubBorders = dockedSub.GetDockedBorders(checkd); + Rectangle dockedSubBorders = dockedSub.GetDockedBordersRecursive(); dockedSubBorders.Location += MathUtils.ToPoint(expectedLocation.Value); dockedBorders.Y = -dockedBorders.Y; @@ -477,8 +481,7 @@ namespace Barotrauma { foreach (Submarine dockedSub in DockedTo) { - if (subs.Contains(dockedSub)) continue; - + if (subs.Contains(dockedSub)) { continue; } subs.Add(dockedSub); dockedSub.GetConnectedSubsRecursive(subs); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs b/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs index 2c8f0353b..06e291b5b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Settings/GameSettings.cs @@ -52,7 +52,12 @@ namespace Barotrauma { Config config = new Config { +#if SERVER + //server defaults to English, clients get a prompt to select a language Language = TextManager.DefaultLanguage, +#else + Language = LanguageIdentifier.None, +#endif SubEditorUndoBuffer = 32, MaxAutoSaves = 8, AutoSaveIntervalSeconds = 300, @@ -100,11 +105,13 @@ namespace Barotrauma Config retVal = fallback ?? GetDefault(); retVal.DeserializeElement(element); +#if SERVER + //server defaults to English, clients get a prompt to select a language if (retVal.Language == LanguageIdentifier.None) { retVal.Language = TextManager.DefaultLanguage; } - +#endif retVal.Graphics = GraphicsSettings.FromElements(element.GetChildElements("graphicsmode", "graphicssettings"), retVal.Graphics); retVal.Audio = AudioSettings.FromElements(element.GetChildElements("audio"), retVal.Audio); #if CLIENT diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 5ba2fe596..232affe74 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,3 +1,15 @@ +--------------------------------------------------------------------------------------------------------- +v1.0.9.0 +--------------------------------------------------------------------------------------------------------- + +- Fixed crashing when you move from one textbox to another using tab and go past the last available textbox. +- Fixed inability to enter the final levels on some subs that include shuttles/drones. +- Fixed autoinjectors (PUCS, autoinjector headset) wasting the syringe without any effects on the character. +- Fixed bots failing to operate turrets in Typhon 1 due to them being partially inside the ceiling. +- Fixed lights going through walls in outposts. +- Fixed language selection prompt not showing up when launching the game for the first time. +- Fixed bots doing objectives during the roles tutorial, e.g. repairing the leaks for you. + --------------------------------------------------------------------------------------------------------- v1.0.8.0 ---------------------------------------------------------------------------------------------------------