From 0a0a9784c5aff857e34fe0b23f98008a8f17e5fa Mon Sep 17 00:00:00 2001 From: Markus Isberg Date: Thu, 2 May 2024 14:08:04 +0300 Subject: [PATCH 1/2] Blood in the Water Hotfix 2 - 1.4.6.0 --- .../ClientSource/DebugConsole.cs | 46 +++---- .../ClientSource/GUI/Store.cs | 2 +- .../ClientSource/GameSession/CrewManager.cs | 35 +++-- .../ClientSource/Map/Submarine.cs | 10 +- .../ClientSource/Networking/GameClient.cs | 2 +- .../ClientSource/Screens/NetLobbyScreen.cs | 42 +++++- .../ServerListScreen/ServerListScreen.cs | 4 + .../Serialization/SerializableEntityEditor.cs | 8 +- .../ClientSource/Utils/ToolBox.cs | 1 + .../BarotraumaClient/LinuxClient.csproj | 2 +- Barotrauma/BarotraumaClient/MacClient.csproj | 2 +- .../BarotraumaClient/WindowsClient.csproj | 2 +- .../BarotraumaServer/LinuxServer.csproj | 2 +- Barotrauma/BarotraumaServer/MacServer.csproj | 2 +- .../BarotraumaServer/WindowsServer.csproj | 2 +- .../AI/Objectives/AIObjectiveCleanupItem.cs | 2 +- .../AI/Objectives/AIObjectiveGetItem.cs | 2 +- .../SharedSource/Events/EventManager.cs | 11 +- .../SharedSource/Items/Components/Rope.cs | 130 +++++++++--------- .../SharedSource/Items/Item.cs | 24 ++++ .../SharedSource/Networking/ServerSettings.cs | 6 + .../StatusEffects/StatusEffect.cs | 16 +-- Barotrauma/BarotraumaShared/changelog.txt | 30 ++++ Deploy/DeployAll/SteamPipeAssistant.cs | 4 +- .../BarotraumaCore/BarotraumaCore.csproj | 56 ++++---- .../EosInterface/EosInterface.csproj | 52 +++---- 26 files changed, 304 insertions(+), 191 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs b/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs index c53433a68..d6e738888 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs @@ -2321,6 +2321,29 @@ namespace Barotrauma } })); + commands.Add(new Command("converttowreck", "", (string[] args) => + { + if (Screen.Selected is not SubEditorScreen) + { + ThrowError("The command can only be used in the submarine editor."); + return; + } + if (Submarine.MainSub == null) + { + ThrowError("Load a submarine first to convert it to a wreck."); + return; + } + if (Submarine.MainSub.Info.SubmarineElement == null) + { + ThrowError("The submarine must be saved before you can convert it to a wreck."); + return; + } + var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement)); + wreckedSubmarineInfo.Name += "_Wrecked"; + wreckedSubmarineInfo.Type = SubmarineType.Wreck; + GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo); + })); + #if DEBUG commands.Add(new Command("listspamfilters", "Lists filters that are in the global spam filter.", (string[] args) => { @@ -2434,29 +2457,6 @@ namespace Barotrauma } })); - commands.Add(new Command("converttowreck", "", (string[] args) => - { - if (Screen.Selected is not SubEditorScreen) - { - ThrowError("The command can only be used in the submarine editor."); - return; - } - if (Submarine.MainSub == null) - { - ThrowError("Load a submarine first to convert it to a wreck."); - return; - } - if (Submarine.MainSub.Info.SubmarineElement == null) - { - ThrowError("The submarine must be saved before you can convert it to a wreck."); - return; - } - var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement)); - wreckedSubmarineInfo.Name += "_Wrecked"; - wreckedSubmarineInfo.Type = SubmarineType.Wreck; - GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo); - })); - commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) => { float defaultZoom = Screen.Selected.Cam.DefaultZoom; diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/Store.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/Store.cs index daceed791..cd303b3ce 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GUI/Store.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/Store.cs @@ -1735,7 +1735,7 @@ namespace Barotrauma if (!ItemAndAllContainersInteractable(subItem)) { continue; } //don't list items in a character inventory (the ones in a crew member's inventory are counted below) var rootInventoryOwner = subItem.GetRootInventoryOwner(); - if (rootInventoryOwner != null) { continue; } + if (rootInventoryOwner is Character) { continue; } AddOwnedItem(subItem); } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/ClientSource/GameSession/CrewManager.cs index 5f5862e60..68439bf0c 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GameSession/CrewManager.cs @@ -806,12 +806,18 @@ namespace Barotrauma { if (order.Identifier == Tags.DeconstructThis) { - Item.DeconstructItems.Add(item); + foreach (var stackedItem in item.GetStackedItems()) + { + Item.DeconstructItems.Add(stackedItem); + } HintManager.OnItemMarkedForDeconstruction(order.OrderGiver); } else { - Item.DeconstructItems.Remove(item); + foreach (var stackedItem in item.GetStackedItems()) + { + Item.DeconstructItems.Remove(stackedItem); + } } } } @@ -820,8 +826,19 @@ namespace Barotrauma WallSection ws = null; if (order.TargetType == Order.OrderTargetType.Entity && order.TargetEntity is IIgnorable ignorable) { - ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis; - AddOrder(order.Clone(), null); + if (ignorable is Item item) + { + foreach (var stackedItem in item.GetStackedItems()) + { + stackedItem.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis; + AddOrder(order.Clone().WithTargetEntity(stackedItem), fadeOutTime: null); + } + } + else + { + ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis; + AddOrder(order.Clone(), fadeOutTime: null); + } } else if (order.TargetType == Order.OrderTargetType.WallSection && order.TargetEntity is Structure s) { @@ -830,7 +847,7 @@ namespace Barotrauma if (ws != null) { ws.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis; - AddOrder(order.WithWallSection(s, wallSectionIndex), null); + AddOrder(order.WithWallSection(s, wallSectionIndex), fadeOutTime: null); } } else @@ -841,9 +858,9 @@ namespace Barotrauma { hull = Hull.FindHull(ws.WorldPosition); } - else if (order.TargetEntity is Item i) + else if (order.TargetEntity is Item item) { - hull = i.CurrentHull; + hull = item.CurrentHull; } else if (order.TargetEntity is ISpatialEntity se) { @@ -1238,7 +1255,7 @@ namespace Barotrauma if (GUI.DisableHUD) { return; } if (CoroutineManager.IsCoroutineRunning("LevelTransition") || CoroutineManager.IsCoroutineRunning("SubmarineTransition")) { return; } - commandFrame?.AddToGUIUpdateList(); + commandFrame?.AddToGUIUpdateList(order: 1); if (GUI.DisableUpperHUD) { return; } @@ -1977,8 +1994,6 @@ namespace Barotrauma { if (commandFrame != null) { DisableCommandUI(); } - CharacterHealth.OpenHealthWindow = null; - // Character context works differently to others as we still use the "basic" command interface, // but the order will be automatically assigned to this character isContextual = forceContextual; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs index 0b4494a0d..490077abb 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs @@ -720,9 +720,16 @@ namespace Barotrauma if (errorMsgs.Any()) { - GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Join("\n\n", errorMsgs), new Vector2(0.25f, 0.0f), new Point(400, 200)); + GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Empty, new Vector2(0.25f, 0.0f), minSize: new Point(GUI.IntScale(650), GUI.IntScale(650))); if (warnings.Any()) { + var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.75f), msgBox.Content.RectTransform)); + var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), string.Join("\n\n", errorMsgs), wrap: true) + { + CanBeFocused = false + }; + text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y); + Point size = msgBox.RectTransform.NonScaledSize; GUITickBox suppress = new GUITickBox(new RectTransform(new Vector2(1f, 0.33f), msgBox.Content.RectTransform), TextManager.Get("editor.suppresswarnings")); msgBox.RectTransform.NonScaledSize = new Point(size.X, size.Y + suppress.RectTransform.NonScaledSize.Y); @@ -736,7 +743,6 @@ namespace Barotrauma SubEditorScreen.SuppressedWarnings.Add(warning); } } - return true; }; } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs index 1f115ec0f..27dc9eca4 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs @@ -1820,7 +1820,7 @@ namespace Barotrauma.Networking if (Screen.Selected != GameMain.GameScreen) { new GUIMessageBox(TextManager.Get("PleaseWait"), TextManager.Get(allowSpectating ? "RoundRunningSpectateEnabled" : "RoundRunningSpectateDisabled")); - if (!(Screen.Selected is ModDownloadScreen)) { GameMain.NetLobbyScreen.Select(); } + if (Screen.Selected is not ModDownloadScreen) { GameMain.NetLobbyScreen.Select(); } } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs index 14bd2d8a1..ca5efd9f1 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs @@ -57,6 +57,7 @@ namespace Barotrauma private GUILayoutGroup roundControlsHolder; public GUIButton SettingsButton { get; private set; } + public GUIButton ServerMessageButton { get; private set; } public static GUIButton JobInfoFrame { get; set; } private GUITickBox spectateBox; @@ -427,6 +428,20 @@ namespace Barotrauma TextGetter = serverNameShadow.TextGetter = () => GameMain.Client?.ServerName }; + ServerMessageButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.15f), serverInfoContent.RectTransform, Anchor.BottomLeft), + TextManager.Get("workshopitemdescription"), style: "GUIButtonSmall") + { + IgnoreLayoutGroups = true, + OnClicked = (bt, userdata) => + { + if (GameMain.Client?.ServerSettings is { } serverSettings) + { + CreateServerMessagePopup(serverSettings.ServerName, serverSettings.ServerMessageText); + } + return true; + } + }; + playStyleIconContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.4f), serverInfoContent.RectTransform, Anchor.BottomRight), isHorizontal: true, childAnchor: Anchor.BottomRight) { AbsoluteSpacing = GUI.IntScale(5) @@ -455,8 +470,23 @@ namespace Barotrauma } }; - SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), serverInfoContent.RectTransform, Anchor.TopRight), - TextManager.Get("ServerSettingsButton"), style: "GUIButtonSmall"); + SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.4f), serverInfoContent.RectTransform, Anchor.TopRight), + TextManager.Get("ServerSettingsButton"), style: "GUIButtonFreeScale"); + } + + private void CreateServerMessagePopup(string serverName, string message) + { + if (string.IsNullOrEmpty(message)) { return; } + var popup = new GUIMessageBox(serverName, string.Empty, minSize: new Point(GUI.IntScale(650), GUI.IntScale(650))); + //popup.Content.Stretch = true; + popup.Header.Font = GUIStyle.LargeFont; + popup.Header.RectTransform.MinSize = new Point(0, (int)popup.Header.TextSize.Y); + var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), popup.Content.RectTransform)); + var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), message, wrap: true) + { + CanBeFocused = false + }; + text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y); } public void RefreshPlaystyleIcons() @@ -1474,7 +1504,8 @@ namespace Barotrauma } else { - GameMain.Client.RequestStartRound(); + //if a campaign is active, and we're not setting one up atm, start button continues the existing campaign + GameMain.Client.RequestStartRound(continueCampaign: GameMain.GameSession?.GameMode is CampaignMode && CampaignSetupFrame is not { Visible: true }); CoroutineManager.StartCoroutine(WaitForStartRound(StartButton), "WaitForStartRound"); } return true; @@ -1570,10 +1601,7 @@ namespace Barotrauma chatInput.OnTextChanged += GameMain.Client.TypingChatMessage; chatInput.OnDeselected += (sender, key) => { - if (GameMain.Client != null) - { - GameMain.Client.ChatBox.ChatManager.Clear(); - } + GameMain.Client?.ChatBox.ChatManager.Clear(); }; //disable/hide elements the clients are not supposed to use/see diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs index 472a0292d..4b3ff25ff 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs @@ -1815,6 +1815,7 @@ namespace Barotrauma public void StoreServerFilters() { + if (loadingServerFilters) { return; } foreach (KeyValuePair filterBox in filterTickBoxes) { ServerListFilters.Instance.SetAttribute(filterBox.Key, filterBox.Value.Selected.ToString()); @@ -1826,8 +1827,10 @@ namespace Barotrauma GameSettings.SaveCurrentConfig(); } + private bool loadingServerFilters; public void LoadServerFilters() { + loadingServerFilters = true; XDocument currentConfigDoc = XMLExtensions.TryLoadXml(GameSettings.PlayerConfigPath); ServerListFilters.Init(currentConfigDoc.Root.GetChildElement("serverfilters")); foreach (KeyValuePair filterBox in filterTickBoxes) @@ -1845,6 +1848,7 @@ namespace Barotrauma var child = ternaryFilter.Value.ListBox.Content.GetChildByUserData(ternaryOption); ternaryFilter.Value.Select(ternaryFilter.Value.ListBox.Content.GetChildIndex(child)); } + loadingServerFilters = false; } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Serialization/SerializableEntityEditor.cs b/Barotrauma/BarotraumaClient/ClientSource/Serialization/SerializableEntityEditor.cs index 69298eef4..bede9e3c6 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Serialization/SerializableEntityEditor.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Serialization/SerializableEntityEditor.cs @@ -868,12 +868,8 @@ namespace Barotrauma string prefabTags = GetPrefabTags(it); if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(prefabTags)) { return text; } - text = text.Remove(prefabTags); - if (text.StartsWith(",")) - { - text = text.Remove(0, 1); - } - return text; + string[] splitTags = text.Split(','); + return string.Join(',', splitTags.Where(t => !it.Prefab.Tags.Contains(t))); } static string GetPrefabTags(Item it) => string.Join(',', it.Prefab.Tags); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Utils/ToolBox.cs b/Barotrauma/BarotraumaClient/ClientSource/Utils/ToolBox.cs index c17369cd4..ed43fa312 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Utils/ToolBox.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Utils/ToolBox.cs @@ -444,6 +444,7 @@ namespace Barotrauma var modifiedLine = line; while (font.MeasureString($"{modifiedLine}...").X > lineX) { + if (modifiedLine.Length == 0) { break; } modifiedLine = modifiedLine[..^1]; } sb.AppendLine($"{modifiedLine}..."); diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index dd2bdf7fc..303aedb2f 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 61c9542cc..bd6b38153 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index ea9773d05..d3675cef9 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index c27e3e704..013e7d3db 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index 1052b103a..92f84c239 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 2e610f36a..6b8b6d61c 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.4.4.1 + 1.4.6.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCleanupItem.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCleanupItem.cs index df9c74e24..c200a173c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCleanupItem.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCleanupItem.cs @@ -123,7 +123,7 @@ namespace Barotrauma { Abandon = true; } - else if (item.ParentInventory != null) + else if (item.ParentInventory != null && item.GetRootInventoryOwner() != character) { if (!objectiveManager.HasOrder()) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs index 2335d8f3c..717653432 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs @@ -368,7 +368,7 @@ namespace Barotrauma return new AIObjectiveGoTo(moveToTarget, character, objectiveManager, repeat: false, getDivingGearIfNeeded: AllowToFindDivingGear, closeEnough: DefaultReach) { // If the root container changes, the item is no longer where it was (taken by someone -> need to find another item) - AbortCondition = obj => targetItem == null || targetItem.GetRootInventoryOwner() != moveToTarget, + AbortCondition = obj => targetItem == null || (targetItem.GetRootInventoryOwner() is Entity owner && owner != moveToTarget && owner != character), SpeakIfFails = false, endNodeFilter = CreateEndNodeFilter(moveToTarget) }; diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs index 183777f8b..556eb3474 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs @@ -272,6 +272,7 @@ namespace Barotrauma CumulativeMonsterStrengthRuins = 0; CumulativeMonsterStrengthWrecks = 0; CumulativeMonsterStrengthCaves = 0; + distanceTraveled = 0; } public void ActivateEvent(Event newEvent) @@ -726,14 +727,12 @@ namespace Barotrauma private bool CanStartEventSet(EventSet eventSet) { - ISpatialEntity refEntity = GetRefEntity(); - float distFromStart = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.StartExitPosition.ToPoint(), level.StartPosition.ToPoint(), refEntity.WorldPosition.ToPoint())); - float distFromEnd = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.EndExitPosition.ToPoint(), level.EndPosition.ToPoint(), refEntity.WorldPosition.ToPoint())); - if (!eventSet.AllowAtStart) { - if (distFromStart * Physics.DisplayToRealWorldRatio < 50.0f || - distFromEnd * Physics.DisplayToRealWorldRatio < 50.0f) + ISpatialEntity refEntity = GetRefEntity(); + float distFromStart = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.StartExitPosition.ToPoint(), level.StartPosition.ToPoint(), refEntity.WorldPosition.ToPoint())); + float distFromEnd = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.EndExitPosition.ToPoint(), level.EndPosition.ToPoint(), refEntity.WorldPosition.ToPoint())); + if (distFromStart * Physics.DisplayToRealWorldRatio < 50.0f || distFromEnd * Physics.DisplayToRealWorldRatio < 50.0f) { return false; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Rope.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Rope.cs index 96b34c9f2..cd8e9150e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Rope.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Rope.cs @@ -182,7 +182,6 @@ namespace Barotrauma.Items.Components if (source == null || target == null || target.Removed || source is Entity { Removed: true } || source is Limb { Removed: true } || - user is null || user is { Removed: true }) { ResetSource(); @@ -312,82 +311,87 @@ namespace Barotrauma.Items.Components { targetMass = float.MaxValue; } - if (!snapped) + // Currently can only apply pull forces to the source, when it's a character, not e.g. when the item would be auto-operated by an AI. Might have to change this. + if (user != null) { - user.AnimController.HoldToRope(); - if (targetCharacter != null) + if (!snapped) { - targetCharacter.AnimController.DragWithRope(); - } - if (user.InWater) - { - user.AnimController.HangWithRope(); - } - } - if (Math.Abs(SourcePullForce) > 0.001f && targetMass > TargetMinMass) - { - // This should be the main collider. - var sourceBody = GetBodyToPull(source); - if (sourceBody != null) - { - isReelingIn = user.InWater && user.IsRagdolled || !user.InWater && targetCharacter is { IsIncapacitated: false }; - if (isReelingIn) + user.AnimController.HoldToRope(); + if (targetCharacter != null) { - float pullForce = SourcePullForce; - if (!user.InWater) + targetCharacter.AnimController.DragWithRope(); + } + if (user.InWater) + { + user.AnimController.HangWithRope(); + } + } + if (Math.Abs(SourcePullForce) > 0.001f && targetMass > TargetMinMass) + { + // This should be the main collider. + var sourceBody = GetBodyToPull(source); + if (sourceBody != null) + { + isReelingIn = user.InWater && user.IsRagdolled || !user.InWater && targetCharacter is { IsIncapacitated: false }; + if (isReelingIn) { - // Apply a tiny amount to the character holding the rope, so that the connection "feels" more real. - pullForce *= 0.1f; - } - float lengthFactor = MathUtils.InverseLerp(0, MaxLength / 2, currentRopeLength); - float force = LerpForces ? MathHelper.Lerp(0, pullForce, lengthFactor) : pullForce; - sourceBody.ApplyForce(forceDir * force); - // Take the target velocity into account. - PhysicsBody targetBody = GetBodyToPull(target); - if (targetBody != null) - { - if (targetCharacter != null) + float pullForce = SourcePullForce; + if (!user.InWater) { - if (targetBody.LinearVelocity != Vector2.Zero && sourceBody.LinearVelocity != Vector2.Zero) + // Apply a tiny amount to the character holding the rope, so that the connection "feels" more real. + pullForce *= 0.1f; + } + float lengthFactor = MathUtils.InverseLerp(0, MaxLength / 2, currentRopeLength); + float force = LerpForces ? MathHelper.Lerp(0, pullForce, lengthFactor) : pullForce; + sourceBody.ApplyForce(forceDir * force); + // Take the target velocity into account. + PhysicsBody targetBody = GetBodyToPull(target); + if (targetBody != null) + { + if (targetCharacter != null) { - Vector2 targetDir = Vector2.Normalize(targetBody.LinearVelocity); - float movementDot = Vector2.Dot(Vector2.Normalize(sourceBody.LinearVelocity), targetDir); - if (movementDot < 0) + if (targetBody.LinearVelocity != Vector2.Zero && sourceBody.LinearVelocity != Vector2.Zero) { - // Pushing to a different dir -> add some counter force - const float multiplier = 5; - float inverseLengthFactor = MathHelper.Lerp(1, 0, lengthFactor); - sourceBody.ApplyForce(targetBody.LinearVelocity * Math.Min(targetBody.Mass * multiplier, 250) * sourceBody.Mass * -movementDot * inverseLengthFactor); - } - float forceDot = Vector2.Dot(forceDir, targetDir); - if (forceDot > 0) - { - // Pulling to the same dir -> add extra force - float targetSpeed = targetBody.LinearVelocity.Length(); - const float multiplier = 25; - sourceBody.ApplyForce(forceDir * targetSpeed * sourceBody.Mass * multiplier * forceDot * lengthFactor); - } - float colliderMainLimbDistance = Vector2.Distance(sourceBody.SimPosition, user.AnimController.MainLimb.SimPosition); - const float minDist = 1; - const float maxDist = 10; - if (colliderMainLimbDistance > minDist) - { - // Move the ragdoll closer to the collider, if it's too far (the correction force in HumanAnimController is not enough -> the ragdoll would lag behind and get teleported). - float correctionForce = MathHelper.Lerp(10.0f, NetConfig.MaxPhysicsBodyVelocity, MathUtils.InverseLerp(minDist, maxDist, colliderMainLimbDistance)); - Vector2 targetPos = sourceBody.SimPosition + new Vector2((float)Math.Sin(-sourceBody.Rotation), (float)Math.Cos(-sourceBody.Rotation)) * 0.4f; - user.AnimController.MainLimb.MoveToPos(targetPos, correctionForce); + Vector2 targetDir = Vector2.Normalize(targetBody.LinearVelocity); + float movementDot = Vector2.Dot(Vector2.Normalize(sourceBody.LinearVelocity), targetDir); + if (movementDot < 0) + { + // Pushing to a different dir -> add some counter force + const float multiplier = 5; + float inverseLengthFactor = MathHelper.Lerp(1, 0, lengthFactor); + sourceBody.ApplyForce(targetBody.LinearVelocity * Math.Min(targetBody.Mass * multiplier, 250) * sourceBody.Mass * -movementDot * inverseLengthFactor); + } + float forceDot = Vector2.Dot(forceDir, targetDir); + if (forceDot > 0) + { + // Pulling to the same dir -> add extra force + float targetSpeed = targetBody.LinearVelocity.Length(); + const float multiplier = 25; + sourceBody.ApplyForce(forceDir * targetSpeed * sourceBody.Mass * multiplier * forceDot * lengthFactor); + } + float colliderMainLimbDistance = Vector2.Distance(sourceBody.SimPosition, user.AnimController.MainLimb.SimPosition); + const float minDist = 1; + const float maxDist = 10; + if (colliderMainLimbDistance > minDist) + { + // Move the ragdoll closer to the collider, if it's too far (the correction force in HumanAnimController is not enough -> the ragdoll would lag behind and get teleported). + float correctionForce = MathHelper.Lerp(10.0f, NetConfig.MaxPhysicsBodyVelocity, MathUtils.InverseLerp(minDist, maxDist, colliderMainLimbDistance)); + Vector2 targetPos = sourceBody.SimPosition + new Vector2((float)Math.Sin(-sourceBody.Rotation), (float)Math.Cos(-sourceBody.Rotation)) * 0.4f; + user.AnimController.MainLimb.MoveToPos(targetPos, correctionForce); + } } } - } - else - { - sourceBody.ApplyForce(targetBody.LinearVelocity * sourceBody.Mass); + else + { + sourceBody.ApplyForce(targetBody.LinearVelocity * sourceBody.Mass); + } } } } } } - if (Math.Abs(TargetPullForce) > 0.001f && !user.IsRagdolled) + + if (Math.Abs(TargetPullForce) > 0.001f && user is not { IsRagdolled: true}) { PhysicsBody targetBody = GetBodyToPull(target); if (targetBody == null) { return; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs index b28202141..b8fa59f5b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs @@ -3452,6 +3452,30 @@ namespace Barotrauma } } + + /// + /// Returns this item and all the other items in the stack (either in the same inventory slot, or the same dropped stack). + /// + /// + public IEnumerable GetStackedItems() + { + yield return this; + foreach (var stackedItem in DroppedStack) + { + if (stackedItem == this) { continue; } + yield return stackedItem; + } + if (ParentInventory != null) + { + int slotIndex = ParentInventory.FindIndex(this); + foreach (var stackedItem in ParentInventory.GetItemsAt(slotIndex)) + { + if (stackedItem == this) { continue; } + yield return stackedItem; + } + } + } + public void Equip(Character character) { if (Removed) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Networking/ServerSettings.cs b/Barotrauma/BarotraumaShared/SharedSource/Networking/ServerSettings.cs index ac443beb1..f97f4dfff 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Networking/ServerSettings.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Networking/ServerSettings.cs @@ -348,6 +348,12 @@ namespace Barotrauma.Networking if (serverMessageText == val) { return; } #if SERVER GameMain.Server?.SendChatMessage(TextManager.AddPunctuation(':', TextManager.Get("servermotd"), val).Value, ChatMessageType.Server); +#elif CLIENT + if (GameMain.NetLobbyScreen.ServerMessageButton is { } serverMessageButton) + { + serverMessageButton.Flash(GUIStyle.Green); + serverMessageButton.Pulsate(Vector2.One, Vector2.One * 1.2f, 1.0f); + } #endif serverMessageText = val; ServerDetailsChanged = true; diff --git a/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs index 24575372e..3d27874be 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs @@ -1122,16 +1122,16 @@ namespace Barotrauma { if (!file.TryGet(out ContentPath _) || (file.TryGet(out ContentPath contentPath) && contentPath.IsNullOrWhiteSpace())) { - DebugConsole.ThrowError($"Error in a element of {subElement.ParseContentPathFromUri()}: neither path nor filename defined!"); + DebugConsole.ThrowError($"Error in a element of {subElement.ParseContentPathFromUri()}: neither path nor filename defined!", + contentPackage: subElement.ContentPackage); + break; } } - else - { - float priority = subElement.GetAttributeFloat("priority", def: 0f); - Identifier[] expectedSpeciesNames = subElement.GetAttributeIdentifierArray("expectedspecies", Array.Empty()); - animationsToTrigger ??= new List(); - animationsToTrigger.Add(new AnimLoadInfo(animType, file, priority, expectedSpeciesNames.ToImmutableArray())); - } + float priority = subElement.GetAttributeFloat("priority", def: 0f); + Identifier[] expectedSpeciesNames = subElement.GetAttributeIdentifierArray("expectedspecies", Array.Empty()); + animationsToTrigger ??= new List(); + animationsToTrigger.Add(new AnimLoadInfo(animType, file, priority, expectedSpeciesNames.ToImmutableArray())); + break; } } diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index fa9b4e4be..e0d8290f7 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,4 +1,34 @@ ------------------------------------------------------------------------------------------------------------------------------------------------- +v1.4.6.0 +------------------------------------------------------------------------------------------------------------------------------------------------- +- Fixed monsters sometimes spawning immediately after the round starts (Often happened between levels, when there was no outpost between them). +- The 'Art of Submarine Warfare' book granted by the 'War Stories' talent is now a separate item and the original book has been reverted to its original state. +- Fixed Thalamus' fleshgun ropes not being able to stick to a submarine anymore. +- Fixed Thalamus' flesh spike crashing the game in the multiplayer game mode. +- Added a scrollbar to the submarine warning list. Fixes the list not fitting on the screen, when there were multiple, long errors. +- Fixed sever list filters not saving properly. +- Fixed marking a stack of items to be ignored or deconstructed only taking into account the first item of the stack, instead applying to all items of the stack. +- Removed duplicate localization lines that caused old versions of text to show up in some places. +- Fixes to the Chinese localization. +- Fixed the inability to edit tags that contained the same word as one of the predefined tags. +- Fixed a crash on opening the contextual order menu for an item of another character's inventory while the health interface is open. +- Fixed a crash when editing and resizing the circuit box label texts. + +------------------------------------------------------------------------------------------------------------------------------------------------- +v1.4.5.0 +------------------------------------------------------------------------------------------------------------------------------------------------- + +- Fixed crew remaining dead, mission remaining completed/failed, etc when you return to the lobby an restart the round. The issue was that the server did not properly load the previous save when opting to continue the ongoing campaign. +- Added a button to the server lobby which opens the server description in a popup to make it easier for players to find. We are still thinking of the best way to handle the description/MOTD, this is more of a quick band-aid solution for the description being too easy to miss / difficult to find at the moment. +- Fixed descriptions being outdated on some of the modified XP talents. Currently only fixed in English, the descriptions in other languages are still outdated. +- Fixed "command not found" error when trying to use the new "converttowreck" console command. +- Fixed items in a container in the submarine not being counted in the "owned items" count in the store interface. +- Fixed bots being unable to properly clean up some items, just taking them into their inventory and leaving them there. +- Fixed drinkable items (such as ethanol) giving the full effect with just a tiny sip. +- Fixed effect from the "revenge squad" talent only lasting 60 seconds. +- Fixed combat diving suit being slower than intended when using an underwater scooter. + +------------------------------------------------------------------------------------------------------------------------------------------------- v1.4.4.1 ------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/Deploy/DeployAll/SteamPipeAssistant.cs b/Deploy/DeployAll/SteamPipeAssistant.cs index 6e29dd98b..094a8e482 100644 --- a/Deploy/DeployAll/SteamPipeAssistant.cs +++ b/Deploy/DeployAll/SteamPipeAssistant.cs @@ -194,8 +194,8 @@ public static class SteamPipeAssistant new SingleItem("contentroot", Path.GetFullPath(Deployables.ResultPath)), new SingleItem("setlive", appId switch { - ClientAppId => "refactor_our_souls", - ServerAppId => "refactor_our_souls", + ClientAppId => "experimental", + ServerAppId => "development", _ => throw new InvalidOperationException() }), new SingleItem("preview", "0"), diff --git a/Libraries/BarotraumaLibs/BarotraumaCore/BarotraumaCore.csproj b/Libraries/BarotraumaLibs/BarotraumaCore/BarotraumaCore.csproj index cb7dea18c..693263fbc 100644 --- a/Libraries/BarotraumaLibs/BarotraumaCore/BarotraumaCore.csproj +++ b/Libraries/BarotraumaLibs/BarotraumaCore/BarotraumaCore.csproj @@ -1,28 +1,28 @@ - - - - net6.0 - Barotrauma - disable - enable - - - - full - ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 - true - x64 - - - - full - ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 - true - x64 - - - - - - - + + + + net6.0 + Barotrauma + disable + enable + + + + full + ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + true + x64 + + + + full + ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + true + x64 + + + + + + + diff --git a/Libraries/BarotraumaLibs/EosInterface/EosInterface.csproj b/Libraries/BarotraumaLibs/EosInterface/EosInterface.csproj index dc10c5393..1acbecf34 100644 --- a/Libraries/BarotraumaLibs/EosInterface/EosInterface.csproj +++ b/Libraries/BarotraumaLibs/EosInterface/EosInterface.csproj @@ -1,26 +1,26 @@ - - - - net6.0 - disable - enable - Barotrauma - - - - ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 - true - x64 - - - - ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 - true - x64 - - - - - - - + + + + net6.0 + disable + enable + Barotrauma + + + + ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + true + x64 + + + + ;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765 + true + x64 + + + + + + + From 79ff628eacf4231bca2bf145aaa4497828b6c80e Mon Sep 17 00:00:00 2001 From: Markus Isberg Date: Thu, 2 May 2024 17:04:53 +0300 Subject: [PATCH 2/2] Updated issue template --- .github/DISCUSSION_TEMPLATE/bug-reports.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/DISCUSSION_TEMPLATE/bug-reports.yml b/.github/DISCUSSION_TEMPLATE/bug-reports.yml index b37532282..a0fecb800 100644 --- a/.github/DISCUSSION_TEMPLATE/bug-reports.yml +++ b/.github/DISCUSSION_TEMPLATE/bug-reports.yml @@ -72,8 +72,8 @@ body: attributes: label: Version description: Which version of the game did the bug happen in? You can see the current version number in the bottom left corner of your screen in the main menu. - options: - - v1.4.5.0 (Blood in the Water Update, hotfix 1) + options: + - v1.4.6.0 (Blood in the Water Update, hotfix 2) - Other validations: required: true