From 1deef20f217f0a1e36abd6cc3fead1e9115573d8 Mon Sep 17 00:00:00 2001 From: Regalis11 Date: Wed, 16 Apr 2025 12:46:39 +0300 Subject: [PATCH] Release 1.8.7.0 - Calm Before the Storm Hotfix 1 --- .../BarotraumaClient/ClientSource/GUI/GUI.cs | 6 +++ .../ClientSource/GUI/TabMenu.cs | 2 +- .../ClientSource/Sounds/SoundPlayer.cs | 11 ------ .../BarotraumaClient/LinuxClient.csproj | 2 +- Barotrauma/BarotraumaClient/MacClient.csproj | 2 +- .../BarotraumaClient/WindowsClient.csproj | 2 +- .../BarotraumaServer/LinuxServer.csproj | 2 +- Barotrauma/BarotraumaServer/MacServer.csproj | 2 +- .../ServerSource/Networking/Voting.cs | 7 +++- .../ServerSource/Steam/SteamManager.cs | 2 +- .../BarotraumaServer/WindowsServer.csproj | 2 +- .../Characters/AI/HumanAIController.cs | 9 ++++- .../SharedSource/Characters/Character.cs | 2 +- .../SharedSource/Events/EventManager.cs | 2 +- .../Events/Missions/PirateMission.cs | 2 - .../SharedSource/GameSession/GameSession.cs | 10 ++++- .../Items/Components/Machines/Steering.cs | 34 +++++++++++------ .../Items/Components/Projectile.cs | 3 ++ .../Items/Components/Signal/LightComponent.cs | 37 +++++++++++-------- Barotrauma/BarotraumaShared/changelog.txt | 17 +++++++++ 20 files changed, 103 insertions(+), 53 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUI.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUI.cs index e8b7164e1..c67ad7794 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUI.cs @@ -915,6 +915,10 @@ namespace Barotrauma { openAccordion.AddToGUIUpdateList(order: 1); } + if (PlayerInput.PrimaryMouseButtonDown()) + { + GUIComponent.OpenAccordionPopups.Clear(); + } SocialOverlay.Instance?.AddToGuiUpdateList(); @@ -2647,6 +2651,8 @@ namespace Barotrauma if (color.HasValue) { button.Color = color.Value; + button.HoverColor = Color.Lerp(color.Value, Color.White, 0.5f); + button.PressedColor = Color.Lerp(color.Value, Color.Black, 0.5f); } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/TabMenu.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/TabMenu.cs index 87a7c8cb5..2293d55f1 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GUI/TabMenu.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/TabMenu.cs @@ -1701,7 +1701,7 @@ namespace Barotrauma if (hasPortrait) { float portraitAspectRatio = portrait.SourceRect.Width / portrait.SourceRect.Height; - GUIImage portraitImage = new GUIImage(new RectTransform(new Vector2(0.5f, 1f), locationInfoContainer.RectTransform, Anchor.CenterRight), portrait, scaleToFit: true) + GUIImage portraitImage = new GUIImage(new RectTransform(new Vector2(0.45f, 1f), locationInfoContainer.RectTransform, Anchor.CenterRight), portrait, scaleToFit: GUIImage.ScalingMode.ScaleToFitLargestExtent) { IgnoreLayoutGroups = true }; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs index 825ede7f0..d8c37f0ff 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs @@ -709,17 +709,6 @@ namespace Barotrauma } } - bool muteBackgroundMusic = false; - for (int i = 0; i < SoundManager.SourceCount; i++) - { - SoundChannel playingSoundChannel = GameMain.SoundManager.GetSoundChannelFromIndex(SoundManager.SourcePoolIndex.Default, i); - if (playingSoundChannel is { MuteBackgroundMusic: true, IsPlaying: true }) - { - muteBackgroundMusic = true; - break; - } - } - int activeTrackCount = targetMusic.Count(m => m != null); for (int i = 0; i < MaxMusicChannels; i++) { diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index a1cc9fcc2..a74d951ea 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 0c5cf4e05..68e4ead38 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index ff49013a8..9fdd3d7ee 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index 12339eb8e..a23bc052b 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index 4646dea45..a0edcea3f 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/Voting.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/Voting.cs index cc69609ce..d81c15b10 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/Voting.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/Voting.cs @@ -284,7 +284,12 @@ namespace Barotrauma break; case VoteType.Kick: byte kickedClientID = inc.ReadByte(); - if ((DateTime.Now - sender.JoinTime).TotalSeconds < GameMain.Server.ServerSettings.DisallowKickVoteTime) + + if (!GameMain.Server.ServerSettings.AllowVoteKick) + { + DebugConsole.ThrowError($"Client {sender.Name} attempted to vote to kick a client, even though vote kicking is disabled. Ignoring the vote."); + } + else if ((DateTime.Now - sender.JoinTime).TotalSeconds < GameMain.Server.ServerSettings.DisallowKickVoteTime) { GameMain.Server.SendDirectChatMessage($"ServerMessage.kickvotedisallowed", sender); } diff --git a/Barotrauma/BarotraumaServer/ServerSource/Steam/SteamManager.cs b/Barotrauma/BarotraumaServer/ServerSource/Steam/SteamManager.cs index ba697c824..70b2c7033 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Steam/SteamManager.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Steam/SteamManager.cs @@ -66,7 +66,7 @@ namespace Barotrauma.Steam Steamworks.SteamServer.Passworded = hasPassword; return; case string serverMessage when key == "message": - int maxValueLength = 255; + int maxValueLength = 127; int totalMaxLength = 2000; int chunkIndex = 0; for (int charIndex = 0; charIndex < serverMessage.Length && charIndex < totalMaxLength; charIndex += maxValueLength) diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index e4d212b11..eaedcddca 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.8.6.2 + 1.8.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/HumanAIController.cs index c4df6028a..a06695a10 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/HumanAIController.cs @@ -2196,17 +2196,22 @@ namespace Barotrauma private static float CalculateHullSafety(Hull hull, IEnumerable visibleHulls, Character character, bool ignoreWater = false, bool ignoreOxygen = false, bool ignoreFire = false, bool ignoreEnemies = false, bool ignorePressureProtection = false) { + bool isProtectedFromPressure = character.IsProtectedFromPressure; if (!ignorePressureProtection) { - bool isProtectedFromPressure = character.IsProtectedFromPressure; if (hull == null) { return isProtectedFromPressure ? 100 : 0; } if (hull.LethalPressure > 0 && !isProtectedFromPressure) { return 0; } } + else + { + if (hull == null) { return 0; } + } + // Oxygen factor should be 1 with 70% oxygen or more and 0.1 when the oxygen level is 30% or lower. // With insufficient oxygen, the safety of the hull should be 39, all the other factors aside. So, just below the HULL_SAFETY_THRESHOLD. float oxygenFactor = ignoreOxygen ? 1 : MathHelper.Lerp((HULL_SAFETY_THRESHOLD - 1) / 100, 1, MathUtils.InverseLerp(HULL_LOW_OXYGEN_PERCENTAGE, 100 - HULL_LOW_OXYGEN_PERCENTAGE, hull.OxygenPercentage)); float waterFactor = 1; - if (!ignoreWater) + if (!ignoreWater && !isProtectedFromPressure) { if (visibleHulls != null) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs index 3b9638cd5..9c9033902 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs @@ -2687,7 +2687,7 @@ namespace Barotrauma return false; } if (character == this) { return true; } - if (IsKnockedDown || LockHands) { return true; } + if (IsKnockedDownOrRagdolled || LockHands) { return true; } return accessLevel switch { CharacterInventory.AccessLevel.Restricted => false, diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs index 1d1d3132d..842110b0f 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/EventManager.cs @@ -774,7 +774,7 @@ namespace Barotrauma { if (eventSet.Faction != location.Faction?.Prefab.Identifier && eventSet.Faction != location.SecondaryFaction?.Prefab.Identifier) { return false; } } - var locationType = location.Type; + var locationType = location.GetLocationTypeToDisplay(); bool includeGenericEvents = level.Type == LevelData.LevelType.LocationConnection || !locationType.IgnoreGenericEvents; if (includeGenericEvents && eventSet.LocationTypeIdentifiers == null) { return true; } return eventSet.LocationTypeIdentifiers != null && eventSet.LocationTypeIdentifiers.Any(identifier => identifier == locationType.Identifier); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs index e03515c67..6331311af 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs @@ -24,8 +24,6 @@ namespace Barotrauma private readonly Dictionary> characterStatusEffects = new Dictionary>(); - private readonly Dictionary> characterStatusEffects = new Dictionary>(); - // Update the last sighting periodically so that the players can find the pirate sub even if they have lost the track of it. private readonly float pirateSightingUpdateFrequency = 30; private float pirateSightingUpdateTimer; diff --git a/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameSession.cs b/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameSession.cs index 72f32e5e6..1512ee795 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameSession.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameSession.cs @@ -891,7 +891,7 @@ namespace Barotrauma var spawnPoint = WayPoint.WayPointList.Find(wp => wp.SpawnType.HasFlag(SpawnType.Submarine) && wp.Submarine == outpost); if (spawnPoint != null) { - //pre-determine spawnpoint, just use it directly + //pre-determined spawnpoint, just use it directly sub.SetPosition(spawnPoint.WorldPosition); sub.NeutralizeBallast(); sub.EnableMaintainPosition(); @@ -944,6 +944,14 @@ namespace Barotrauma sub.SetPosition(spawnPos); myPort.Dock(outPostPort); myPort.Lock(isNetworkMessage: true, applyEffects: false); + foreach (var item in sub.GetItems(alsoFromConnectedSubs: true)) + { + //need to refresh position to maintain since the sub was moved to the docking port + if (item.GetComponent() is { MaintainPos: true } steering) + { + steering.RefreshPosToMaintain(); + } + } } else { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Steering.cs index d015d680b..01a4fa818 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Steering.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Steering.cs @@ -89,19 +89,10 @@ namespace Barotrauma.Items.Components #endif if (autoPilot) { - if (pathFinder == null) - { - pathFinder = new PathFinder(WayPoint.WayPointList, false) - { - GetNodePenalty = GetNodePenalty - }; - } MaintainPos = true; if (posToMaintain == null) { - posToMaintain = controlledSub != null ? - controlledSub.WorldPosition : - item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; + RefreshPosToMaintain(); } } else @@ -266,6 +257,24 @@ namespace Barotrauma.Items.Components return true; } + /// + /// Sets the position the autopilot tries to maintain to the current position of the sub. + /// + public void RefreshPosToMaintain() + { + posToMaintain = controlledSub != null ? + controlledSub.WorldPosition : + item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; + } + + public override void OnMapLoaded() + { + if (MaintainPos) + { + RefreshPosToMaintain(); + } + } + public override void Update(float deltaTime, Camera cam) { if (!searchedConnectedDockingPort) @@ -628,7 +637,10 @@ namespace Barotrauma.Items.Components if (pathFinder == null) { - pathFinder = new PathFinder(WayPoint.WayPointList, false); + pathFinder = new PathFinder(WayPoint.WayPointList, false) + { + GetNodePenalty = GetNodePenalty + }; } Vector2 target; diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs index bf9bac303..16617e483 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs @@ -397,6 +397,9 @@ namespace Barotrauma.Items.Components if (Item.Removed) { return; } launchPos = simPosition; LaunchSub = item.Submarine; + //set the rotation of the projectile again because dropping the projectile in Use + //resets the rotation and moves it to the position of the parent item + Item.SetTransform(simPosition, rotation + (Item.body.Dir * LaunchRotationRadians), findNewHull: false); if (DeactivationTime > 0) { deactivationTimer = DeactivationTime; diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/LightComponent.cs index a0f8fae49..ed5b5916c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/LightComponent.cs @@ -312,8 +312,7 @@ namespace Barotrauma.Items.Components (IsActiveConditionals == null || IsActiveConditionals.Count == 0)) { PhysicsBody body = ParentBody ?? item.body; - if ((body == null || !body.Enabled) && - (item.FindParentInventory(static it => it is ItemInventory { Container.HideItems: true }) != null)) + if ((body == null || !body.Enabled) && !IsVisibleInInventory()) { lightBrightness = 0.0f; SetLightSourceState(false, 0.0f); @@ -336,6 +335,24 @@ namespace Barotrauma.Items.Components } } + /// + /// Is the item currently in an inventory, and visible in that inventory? E.g. held by a character or on a shelf that shows the contained items. + /// + /// + private bool IsVisibleInInventory() + { + if (item.GetRootInventoryOwner() is Character ownerCharacter && item.RootContainer?.GetComponent() is not { IsActive: true }) + { + //if the item is in a character inventory, the light should only be visible if the character is holding the item + //(not if it's e.q. inside a wearable item, or in a rifle worn on the back) + return false; + } + else + { + return item.FindParentInventory(static it => it is ItemInventory { Container.HideItems: true }) == null; + } + } + public override void Update(float deltaTime, Camera cam) { if (item.AiTarget != null) @@ -351,20 +368,10 @@ namespace Barotrauma.Items.Components #endif - bool visibleInContainer; + bool isVisibleInInventory = IsVisibleInInventory(); var ownerCharacter = item.GetRootInventoryOwner() as Character; - if (ownerCharacter != null && item.RootContainer?.GetComponent() is not { IsActive: true }) - { - //if the item is in a character inventory, the light should only be visible if the character is holding the item - //(not if it's e.q. inside a wearable item, or in a rifle worn on the back) - visibleInContainer = false; - } - else - { - visibleInContainer = item.FindParentInventory(static it => it is ItemInventory { Container.HideItems: true }) == null; - } - if ((item.Container != null && !visibleInContainer && ownerCharacter == null) || + if ((item.Container != null && !isVisibleInInventory && ownerCharacter == null) || (ownerCharacter != null && ownerCharacter.InvisibleTimer > 0.0f)) { lightBrightness = 0.0f; @@ -374,7 +381,7 @@ namespace Barotrauma.Items.Components SetLightSourceTransformProjSpecific(); PhysicsBody body = ParentBody ?? item.body; - if ((body == null || !body.Enabled) && !visibleInContainer) + if ((body == null || !body.Enabled) && !isVisibleInInventory) { lightBrightness = 0.0f; SetLightSourceState(false, 0.0f); diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 8c23a48ed..e719bc6a3 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,4 +1,21 @@ ------------------------------------------------------------------------------------------------------------------------------------------------- +v1.8.7.0 +------------------------------------------------------------------------------------------------------------------------------------------------- + +- Fixed an AI bug that made bots scared of water, making them seek safety from flooded rooms even when they were wearing diving suits. +- Fixed non-hitscan projectiles registering hits with characters that are behind the weapon, even if the barrel is in front of the character. +- Fixed submarine maintaining an incorrect position (= starting to steer somewhere completely off) when you enable "maintain position" and then enter a new level. +- Fixed autopilot failing to navigate to a destination if it's already on at the start of the round. +- Fixed dedicated server descriptions still sometimes getting truncated. +- Fixed lights shining out from items inside character inventories. +- Fixed inability to access the inventories of other players when they're manually ragdolling. +- Fixed "firing blanks" traitor event requiring you to replace standard coilgun ammo boxes with fake ones, instead of accepting any type of coilgun ammo. +- Fixed switches flipping around when you attach them while facing left. +- Fixed grenade "cooking" hint not showing the correct keybinding (just saying [usekey] instead of the actual keybinding). +- Fixed main menu notifications (changelog, unstable info) staying open if you don't manually close them and e.g. start a new game or go to the sub editor. +- Fixed normal outpost events triggering in outpost that have been abandoned because of Jovian Radiation. + +------------------------------------------------------------------------------------------------------------------------------------------------- v1.8.6.2 -------------------------------------------------------------------------------------------------------------------------------------------------