From 7eac44ea7dd3a0197e5b7c888189f2d0b486b083 Mon Sep 17 00:00:00 2001 From: Regalis11 Date: Mon, 28 Oct 2024 15:03:46 +0200 Subject: [PATCH] v1.6.18.1 (Unto the Breach Hotfix 1) --- .../ClientSource/Characters/Attack.cs | 2 +- .../ClientSource/Characters/Jobs/JobPrefab.cs | 1 - .../Items/Components/Holdable/RangedWeapon.cs | 2 +- .../Items/Components/ItemComponent.cs | 8 +-- .../Items/Components/Machines/Reactor.cs | 5 +- .../ClientSource/Items/Components/Rope.cs | 4 +- .../ClientSource/Items/Components/Turret.cs | 8 +-- .../ClientSource/Items/Item.cs | 2 +- .../ClientSource/Map/RoundSound.cs | 3 + .../ClientSource/Map/WayPoint.cs | 2 +- .../ClientSource/Networking/GameClient.cs | 5 ++ .../SinglePlayerCampaignSetupUI.cs | 2 +- .../ClientSource/Screens/NetLobbyScreen.cs | 15 +++-- .../ServerListScreen/ServerListScreen.cs | 37 +++++++----- .../ClientSource/Sounds/Sound.cs | 2 + .../ClientSource/Sounds/SoundChannel.cs | 2 + .../ClientSource/Sounds/SoundPlayer.cs | 36 ++++++++++- .../StatusEffects/StatusEffect.cs | 1 + .../BarotraumaClient/LinuxClient.csproj | 2 +- Barotrauma/BarotraumaClient/MacClient.csproj | 2 +- .../BarotraumaClient/WindowsClient.csproj | 2 +- .../BarotraumaServer/LinuxServer.csproj | 2 +- Barotrauma/BarotraumaServer/MacServer.csproj | 2 +- .../Events/Missions/CombatMission.cs | 10 ---- .../ServerSource/Networking/GameServer.cs | 59 ++++++++++++------- .../BarotraumaServer/WindowsServer.csproj | 2 +- .../AI/Objectives/AIObjectiveCombat.cs | 6 +- .../Characters/Animation/Ragdoll.cs | 16 ++++- .../SharedSource/Characters/Character.cs | 6 +- .../SharedSource/Characters/Jobs/JobPrefab.cs | 7 +++ .../AbilityConditionHasDifferentJobs.cs | 5 +- .../AbilityConditionLevelsBehindHighest.cs | 6 +- ...ilityApplyStatusEffectsToApprenticeship.cs | 2 +- .../CharacterAbilityGainSimultaneousSkill.cs | 2 +- .../CharacterAbilityGivePermanentStat.cs | 2 +- ...haracterAbilityGiveTalentPointsToAllies.cs | 1 - .../CharacterAbilityByTheBook.cs | 2 +- .../Events/EventActions/SpawnAction.cs | 2 +- .../SharedSource/Events/Missions/Mission.cs | 2 +- .../Events/Missions/PirateMission.cs | 2 +- .../Items/Components/GeneticMaterial.cs | 3 +- .../Items/Components/ItemContainer.cs | 3 +- .../Items/Components/Power/Powered.cs | 2 +- .../Items/Components/TriggerComponent.cs | 18 ++++++ .../SharedSource/Map/Outposts/NPCSet.cs | 4 +- .../Map/Outposts/OutpostGenerationParams.cs | 39 +++++++----- Barotrauma/BarotraumaShared/changelog.txt | 22 +++++++ 47 files changed, 246 insertions(+), 124 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/Attack.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/Attack.cs index 8f503a225..0a043c1bc 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Characters/Attack.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/Attack.cs @@ -48,7 +48,7 @@ namespace Barotrauma if (sound != null) { - SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier()); + SoundPlayer.PlaySound(sound, worldPosition); } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/Jobs/JobPrefab.cs index 8c6d451df..ee5cf0055 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/Jobs/JobPrefab.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using System; using System.Collections.Generic; using System.Linq; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Holdable/RangedWeapon.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Holdable/RangedWeapon.cs index fcd5bc39a..540df9226 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Holdable/RangedWeapon.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Holdable/RangedWeapon.cs @@ -141,7 +141,7 @@ namespace Barotrauma.Items.Components { if (chargeSound != null) { - chargeSoundChannel = SoundPlayer.PlaySound(chargeSound.Sound, item.WorldPosition, chargeSound.Volume, chargeSound.Range, ignoreMuffling: chargeSound.IgnoreMuffling, freqMult: chargeSound.GetRandomFrequencyMultiplier()); + chargeSoundChannel = SoundPlayer.PlaySound(chargeSound, item.WorldPosition, hullGuess: item.CurrentHull); if (chargeSoundChannel != null) { chargeSoundChannel.Looping = true; } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/ItemComponent.cs index e57e69ee4..6b18db9ba 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/ItemComponent.cs @@ -392,11 +392,7 @@ namespace Barotrauma.Items.Components float volume = GetSoundVolume(itemSound); if (volume <= 0.0001f) { return; } loopingSound = itemSound; - loopingSoundChannel = loopingSound.RoundSound.Sound.Play( - new Vector3(position.X, position.Y, 0.0f), - 0.01f, - freqMult: itemSound.RoundSound.GetRandomFrequencyMultiplier(), - muffle: SoundPlayer.ShouldMuffleSound(Character.Controlled, position, loopingSound.Range, Character.Controlled?.CurrentHull)); + loopingSoundChannel = SoundPlayer.PlaySound(loopingSound.RoundSound, position, volume: 0.01f, hullGuess: item.CurrentHull); loopingSoundChannel.Looping = true; //TODO: tweak loopingSoundChannel.Near = loopingSound.Range * 0.4f; @@ -407,7 +403,7 @@ namespace Barotrauma.Items.Components { float volume = GetSoundVolume(itemSound); if (volume <= 0.0001f) { return; } - var channel = SoundPlayer.PlaySound(itemSound.RoundSound.Sound, position, volume, itemSound.Range, itemSound.RoundSound.GetRandomFrequencyMultiplier(), item.CurrentHull, ignoreMuffling: itemSound.RoundSound.IgnoreMuffling); + var channel = SoundPlayer.PlaySound(itemSound.RoundSound, position, volume, hullGuess: item.CurrentHull); if (channel != null) { playingOneshotSoundChannels.Add(channel); } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Machines/Reactor.cs index 43ec63ae5..ce3d63e73 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Machines/Reactor.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Machines/Reactor.cs @@ -475,11 +475,8 @@ namespace Barotrauma.Items.Components if (sound != null) { SoundPlayer.PlaySound( - sound.Sound, + sound, item.WorldPosition, - sound.Volume, - sound.Range, - freqMult: sound.GetRandomFrequencyMultiplier(), hullGuess: item.CurrentHull); } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Rope.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Rope.cs index 6c2a2c682..32a3d1528 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Rope.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Rope.cs @@ -229,7 +229,7 @@ namespace Barotrauma.Items.Components { if (reelSoundChannel is not { IsPlaying: true }) { - reelSoundChannel = SoundPlayer.PlaySound(sound.Sound, position, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier()); + reelSoundChannel = SoundPlayer.PlaySound(sound, position); if (reelSoundChannel != null) { reelSoundChannel.Looping = true; @@ -244,7 +244,7 @@ namespace Barotrauma.Items.Components } else { - SoundPlayer.PlaySound(sound.Sound, position, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier()); + SoundPlayer.PlaySound(sound, position); } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Turret.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Turret.cs index 107150d20..61f940b36 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Turret.cs @@ -227,14 +227,14 @@ namespace Barotrauma.Items.Components { if (moveSoundChannel == null && startMoveSound != null) { - moveSoundChannel = SoundPlayer.PlaySound(startMoveSound.Sound, item.WorldPosition, startMoveSound.Volume, startMoveSound.Range, ignoreMuffling: startMoveSound.IgnoreMuffling, freqMult: startMoveSound.GetRandomFrequencyMultiplier()); + moveSoundChannel = SoundPlayer.PlaySound(startMoveSound, item.WorldPosition, hullGuess: item.CurrentHull); } else if (moveSoundChannel == null || !moveSoundChannel.IsPlaying) { if (moveSound != null) { moveSoundChannel?.FadeOutAndDispose(); - moveSoundChannel = SoundPlayer.PlaySound(moveSound.Sound, item.WorldPosition, moveSound.Volume, moveSound.Range, ignoreMuffling: moveSound.IgnoreMuffling, freqMult: moveSound.GetRandomFrequencyMultiplier()); + moveSoundChannel = SoundPlayer.PlaySound(moveSound, item.WorldPosition, hullGuess: item.CurrentHull); if (moveSoundChannel != null) { moveSoundChannel.Looping = true;} } } @@ -246,7 +246,7 @@ namespace Barotrauma.Items.Components if (endMoveSound != null && moveSoundChannel.Sound != endMoveSound.Sound) { moveSoundChannel.FadeOutAndDispose(); - moveSoundChannel = SoundPlayer.PlaySound(endMoveSound.Sound, item.WorldPosition, endMoveSound.Volume, endMoveSound.Range, ignoreMuffling: endMoveSound.IgnoreMuffling, freqMult: endMoveSound.GetRandomFrequencyMultiplier()); + moveSoundChannel = SoundPlayer.PlaySound(endMoveSound, item.WorldPosition, hullGuess: item.CurrentHull); if (moveSoundChannel != null) { moveSoundChannel.Looping = false; } } else if (!moveSoundChannel.IsPlaying) @@ -275,7 +275,7 @@ namespace Barotrauma.Items.Components { if (chargeSound != null) { - chargeSoundChannel = SoundPlayer.PlaySound(chargeSound.Sound, item.WorldPosition, chargeSound.Volume, chargeSound.Range, ignoreMuffling: chargeSound.IgnoreMuffling, freqMult: chargeSound.GetRandomFrequencyMultiplier()); + chargeSoundChannel = SoundPlayer.PlaySound(chargeSound, item.WorldPosition, hullGuess: item.CurrentHull); if (chargeSoundChannel != null) { chargeSoundChannel.Looping = true; } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs index 7739f2cce..57ae41033 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs @@ -408,7 +408,7 @@ namespace Barotrauma fadeInBrokenSprite.Sprite.effects ^= SpriteEffects; } - if (body == null) + if (body == null || body.BodyType == BodyType.Static) { if (Prefab.ResizeHorizontal || Prefab.ResizeVertical) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/RoundSound.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/RoundSound.cs index a309ba35f..ac2eeb854 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/RoundSound.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/RoundSound.cs @@ -16,6 +16,8 @@ namespace Barotrauma public readonly bool Stream; public readonly bool IgnoreMuffling; + public readonly bool MuteBackgroundMusic; + public readonly string? Filename; private RoundSound(ContentXElement element, Sound sound) @@ -26,6 +28,7 @@ namespace Barotrauma Range = element.GetAttributeFloat("range", 1000.0f); Volume = element.GetAttributeFloat("volume", 1.0f); IgnoreMuffling = element.GetAttributeBool("dontmuffle", false); + MuteBackgroundMusic = element.GetAttributeBool("MuteBackgroundMusic", false); FrequencyMultiplierRange = new Vector2(1.0f); string freqMultAttr = element.GetAttributeString("frequencymultiplier", element.GetAttributeString("frequency", "1.0")); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/WayPoint.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/WayPoint.cs index 22ca81a35..c00daa1b5 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/WayPoint.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/WayPoint.cs @@ -437,7 +437,7 @@ namespace Barotrauma jobDropDown.AddItem(TextManager.Get("Any"), null); foreach (JobPrefab jobPrefab in JobPrefab.Prefabs) { - if (jobPrefab.HiddenJob) { continue; } + if (jobPrefab.Name.IsNullOrWhiteSpace()) { continue; } jobDropDown.AddItem(jobPrefab.Name, jobPrefab); } jobDropDown.SelectItem(AssignedJob); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs index e309be0ce..3086d3835 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs @@ -763,6 +763,11 @@ namespace Barotrauma.Networking case ServerPacketHeader.CANCEL_STARTGAME: DebugConsole.Log("Received CANCEL_STARTGAME packet."); GameMain.NetLobbyScreen?.CloseStartRoundWarning(); + if (GameMain.NetLobbyScreen?.ReadyToStartBox is { } readyToStartBox) + { + readyToStartBox.Selected = false; + SetReadyToStart(readyToStartBox); + } break; case ServerPacketHeader.STARTGAME: DebugConsole.Log("Received STARTGAME packet."); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/CampaignSetupUI/SinglePlayerCampaignSetupUI.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/CampaignSetupUI/SinglePlayerCampaignSetupUI.cs index 0fd7d2128..4f38eb509 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/CampaignSetupUI/SinglePlayerCampaignSetupUI.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/CampaignSetupUI/SinglePlayerCampaignSetupUI.cs @@ -291,7 +291,7 @@ namespace Barotrauma if (characterInfos.Count >= 3) { break; } } } - characterInfos.Sort((a, b) => Math.Sign(b.Job.MinKarma - a.Job.MinKarma)); + characterInfos.Sort((a, b) => Math.Sign(a.Job.CampaignSetupUIOrder - b.Job.CampaignSetupUIOrder)); characterInfoColumns.ClearChildren(); CharacterMenus?.ForEach(m => m.Dispose()); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs index 80a46d7ab..924795c5b 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs @@ -2708,13 +2708,18 @@ namespace Barotrauma if (newTeamPreference == CharacterTeamType.None && GameMain.Client?.ServerSettings?.PvpTeamSelectionMode == PvpTeamSelectionMode.PlayerChoice) { return false; } // Already handled by delegate above - + + var oldPreference = MultiplayerPreferences.Instance.TeamPreference; + MultiplayerPreferences.Instance.TeamPreference = newTeamPreference; UpdateSelectedSub(newTeamPreference); - GameMain.Client?.ForceNameJobTeamUpdate(); + if (newTeamPreference != oldPreference) + { + GameMain.Client?.ForceNameJobTeamUpdate(); + GameSettings.SaveCurrentConfig(); + } RefreshPvpTeamSelectionButtons(); - GameSettings.SaveCurrentConfig(); UpdateDisembarkPointListFromServerSettings(); //need to update job preferences and close the selection frame //because the team selection might affect the uniform sprite and the loadouts @@ -4015,7 +4020,9 @@ namespace Barotrauma JobSelectionFrame.Visible = false; } - if (GUI.MouseOn?.UserData is JobVariant jobPrefab && GUI.MouseOn.Style?.Name == "JobVariantButton") + if (GUI.MouseOn?.UserData is JobVariant jobPrefab && + GUI.MouseOn.Style?.Name == "JobVariantButton" && + GUI.MouseOn.Parent != null) { if (jobVariantTooltip?.UserData is not JobVariant prevVisibleVariant || prevVisibleVariant.Prefab != jobPrefab.Prefab || diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs index d0d472d2a..947330466 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen/ServerListScreen.cs @@ -448,7 +448,7 @@ namespace Barotrauma .ToArray(); bool inSelectedCall = false; - languageDropdown.AfterSelected = (_, userData) => + languageDropdown.OnSelected = (_, userData) => { if (inSelectedCall) { return true; } try @@ -465,33 +465,38 @@ namespace Barotrauma bool noneSelected = langTickboxes.All(tb => !tb.Selected); bool allSelected = langTickboxes.All(tb => tb.Selected); - if (allSelected != allTickbox.Selected) { allTickbox.Selected = allSelected; } - if (allSelected) - { - languageDropdown.Text = TextManager.Get(allLanguagesKey); - } - else if (noneSelected) - { - languageDropdown.Text = TextManager.Get("None"); - } - - var languages = languageDropdown.SelectedDataMultiple.OfType(); - - ServerListFilters.Instance.SetAttribute(languageKey, string.Join(", ", languages)); - GameSettings.SaveCurrentConfig(); return true; } finally { inSelectedCall = false; - FilterServers(); } }; + languageDropdown.AfterSelected = (_, userData) => + { + bool noneSelected = langTickboxes.All(tb => !tb.Selected); + bool allSelected = langTickboxes.All(tb => tb.Selected); + if (allSelected) + { + languageDropdown.Text = TextManager.Get(allLanguagesKey); + } + else if (noneSelected) + { + languageDropdown.Text = TextManager.Get("None"); + } + + var languages = languageDropdown.SelectedDataMultiple.OfType(); + + ServerListFilters.Instance.SetAttribute(languageKey, string.Join(", ", languages)); + GameSettings.SaveCurrentConfig(); + FilterServers(); + return true; + }; } // Filter Tags diff --git a/Barotrauma/BarotraumaClient/ClientSource/Sounds/Sound.cs b/Barotrauma/BarotraumaClient/ClientSource/Sounds/Sound.cs index 17f53bf9a..e1f002618 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Sounds/Sound.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Sounds/Sound.cs @@ -62,6 +62,8 @@ namespace Barotrauma.Sounds public float BaseNear; public float BaseFar; + public bool MuteBackgroundMusic; + public Sound(SoundManager owner, string filename, bool stream, bool streamsReliably, ContentXElement xElement = null, bool getFullPath = true) { Owner = owner; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundChannel.cs b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundChannel.cs index 3c53de54c..a67ad6fee 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundChannel.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundChannel.cs @@ -434,6 +434,8 @@ namespace Barotrauma.Sounds private readonly uint[] unqueuedBuffers; private readonly float[] streamBufferAmplitudes; + public bool MuteBackgroundMusic; + public int StreamSeekPos { get { return streamSeekPos; } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs index d3e15983a..1f7bbf5b2 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs @@ -484,8 +484,20 @@ namespace Barotrauma if (sound == null) { return null; } return PlaySound(sound, position, volume ?? sound.BaseGain, range ?? sound.BaseFar, 1.0f, hullGuess); } + public static SoundChannel PlaySound(RoundSound sound, Vector2 position, float? volume = null, Hull hullGuess = null) + { + return PlaySound( + sound.Sound, + position, + volume ?? sound.Volume, + sound.Range, + ignoreMuffling: sound.IgnoreMuffling, + hullGuess: hullGuess, + freqMult: sound.GetRandomFrequencyMultiplier(), + muteBackgroundMusic: sound.MuteBackgroundMusic); + } - public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null, bool ignoreMuffling = false) + public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null, bool ignoreMuffling = false, bool muteBackgroundMusic = false) { if (sound == null) { @@ -501,7 +513,12 @@ namespace Barotrauma return null; } bool muffle = !ignoreMuffling && ShouldMuffleSound(Character.Controlled, position, far, hullGuess); - return sound.Play(volume ?? sound.BaseGain, far, freqMult ?? 1.0f, position, muffle: muffle); + var channel = sound.Play(volume ?? sound.BaseGain, far, freqMult ?? 1.0f, position, muffle: muffle); + if (channel != null) + { + channel.MuteBackgroundMusic = muteBackgroundMusic; + } + return channel; } public static void DisposeDisabledMusic() @@ -673,6 +690,17 @@ namespace Barotrauma updateMusicTimer = UpdateMusicInterval; } + 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++) { @@ -729,6 +757,10 @@ namespace Barotrauma musicChannel[i].Looping = true; } float targetGain = targetMusic[i].Volume; + if (muteBackgroundMusic) + { + targetGain = 0.0f; + } if (targetMusic[i].DuckVolume) { targetGain *= (float)Math.Sqrt(1.0f / activeTrackCount); diff --git a/Barotrauma/BarotraumaClient/ClientSource/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaClient/ClientSource/StatusEffects/StatusEffect.cs index 93d871cbf..8f022f2e4 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/StatusEffects/StatusEffect.cs @@ -93,6 +93,7 @@ namespace Barotrauma else { angle = -item.RotationRad; + if (item.FlippedX) { angle += MathHelper.Pi; } particleRotation = item.RotationRad; } entityAngleAssigned = true; diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index b87448e6f..2abd5bb41 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 540024b9b..2bfa8e135 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index dc99b9460..bede07262 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2024 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index 5f3b02bac..9ea7200bb 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index bcfa3e2e6..2f9c63b57 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/ServerSource/Events/Missions/CombatMission.cs b/Barotrauma/BarotraumaServer/ServerSource/Events/Missions/CombatMission.cs index e027c8ff2..21dc40f61 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Events/Missions/CombatMission.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Events/Missions/CombatMission.cs @@ -40,8 +40,6 @@ namespace Barotrauma /// private readonly List kills = new List(); - private bool initialized = false; - private float roundEndTimer; private float timeInTargetSubmarineTimer; @@ -92,12 +90,6 @@ namespace Barotrauma private void CheckTeamCharacters() { - if (!allowRespawning && initialized) - { - //if no respawns are allowed, we only need to check the characters once - return; - } - for (int i = 0; i < crews.Length; i++) { foreach (var character in crews[i]) @@ -133,8 +125,6 @@ namespace Barotrauma } } } - - initialized = true; } private void CheckWinCondition(float deltaTime) diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs index e1d124a06..8f5bc4565 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs @@ -615,7 +615,7 @@ namespace Barotrauma.Networking readyToStartAutomatically = true; } } - if (readyToStartAutomatically) + if (readyToStartAutomatically && !isRoundStartWarningActive) { if (!wasReadyToStartAutomatically) { GameMain.NetLobbyScreen.LastUpdateID++; } TryStartGame(); @@ -840,9 +840,8 @@ namespace Barotrauma.Networking IWriteMessage msg = new WriteOnlyMessage().WithHeader(ServerPacketHeader.CANCEL_STARTGAME); serverPeer.Send(msg, c.Connection, DeliveryMethod.Reliable); } + AbortStartGameIfWarningActive(); } - - AbortStartGameIfWarningActive(); break; case ClientPacketHeader.REQUEST_STARTGAMEFINALIZE: if (connectedClient == null) @@ -2547,6 +2546,21 @@ namespace Barotrauma.Networking private void AbortStartGameIfWarningActive() { isRoundStartWarningActive = false; + //reset autorestart countdown to give the clients time to reselect perks + if (ServerSettings.AutoRestart) + { + ServerSettings.AutoRestartTimer = Math.Max(ServerSettings.AutoRestartInterval, 5.0f); + } + //reset start round votes so we don't immediately attempt to restart + foreach (var client in connectedClients) + { + client.SetVote(VoteType.StartRound, false); + } + + int clientsReady = connectedClients.Count(c => c.GetVote(VoteType.StartRound)); + + GameMain.NetLobbyScreen.LastUpdateID++; + CoroutineManager.StopCoroutines(nameof(WarnAndDelayStartGame)); } @@ -3312,6 +3326,24 @@ namespace Barotrauma.Networking if (c == null || string.IsNullOrEmpty(newName) || !NetIdUtils.IdMoreRecent(nameId, c.NameId)) { return false; } + if (!newJob.IsEmpty) + { + if (!JobPrefab.Prefabs.TryGet(newJob, out JobPrefab newJobPrefab) || newJobPrefab.HiddenJob) + { + newJob = Identifier.Empty; + } + } + + if (newName == c.Name && newJob == c.PreferredJob && newTeam == c.PreferredTeam) { return false; } + + c.NameId = nameId; + c.PreferredJob = newJob; + if (newTeam != c.PreferredTeam) + { + c.PreferredTeam = newTeam; + RefreshPvpTeamAssignments(); + } + var timeSinceNameChange = DateTime.Now - c.LastNameChangeTime; if (timeSinceNameChange < Client.NameChangeCoolDown && newName != c.Name) { @@ -3321,29 +3353,14 @@ namespace Barotrauma.Networking var coolDownRemaining = Client.NameChangeCoolDown - timeSinceNameChange; SendDirectChatMessage($"ServerMessage.NameChangeFailedCooldownActive~[seconds]={(int)coolDownRemaining.TotalSeconds}", c); LastClientListUpdateID++; + //increment the ID to make sure the current server-side name is treated as the "latest", + //and the client correctly reverts back to the old name + c.NameId++; } - c.NameId = nameId; c.RejectedName = newName; return false; } - if (!newJob.IsEmpty) - { - if (!JobPrefab.Prefabs.TryGet(newJob, out JobPrefab newJobPrefab) || newJobPrefab.HiddenJob) - { - newJob = Identifier.Empty; - } - } - c.NameId = nameId; - if (newName == c.Name && newJob == c.PreferredJob && newTeam == c.PreferredTeam) { return false; } - c.PreferredJob = newJob; - - if (newTeam != c.PreferredTeam) - { - c.PreferredTeam = newTeam; - RefreshPvpTeamAssignments(); - } - return TryChangeClientName(c, newName); } diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 8e9ebbe98..7ded7773a 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.6.17.0 + 1.6.18.1 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCombat.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCombat.cs index c8b27adc1..762297c86 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCombat.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveCombat.cs @@ -74,7 +74,6 @@ namespace Barotrauma private float pathBackTimer; private const float DefaultCoolDown = 10.0f; private const float PathBackCheckTime = 1.0f; - private IEnumerable myBodies; private float aimTimer; private float reloadTimer; private float spreadTimer; @@ -1375,9 +1374,10 @@ namespace Barotrauma float aimFactor = MathHelper.PiOver2 * (1 - AimAccuracy); if (VectorExtensions.Angle(VectorExtensions.Forward(Weapon.body.TransformedRotation), Enemy.WorldPosition - Weapon.WorldPosition) < MathHelper.PiOver4 + aimFactor) { - myBodies ??= character.AnimController.Limbs.Select(l => l.body.FarseerBody); // Check that we don't hit friendlies. No need to check the walls, because there's a separate check for that at 1096 (which intentionally has a small delay) - var pickedBodies = Submarine.PickBodies(Weapon.SimPosition, Submarine.GetRelativeSimPosition(from: Weapon, to: Enemy), myBodies, Physics.CollisionCharacter); + var pickedBodies = Submarine.PickBodies(Weapon.SimPosition, Submarine.GetRelativeSimPosition(from: Weapon, to: Enemy), + ignoredBodies: character.AnimController.LimbBodies, + Physics.CollisionCharacter); foreach (var body in pickedBodies) { Character target = body.UserData switch diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs index 9a21be2bb..20b349ca5 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs @@ -64,6 +64,9 @@ namespace Barotrauma } } + private readonly List limbBodies = new List(); + public IEnumerable LimbBodies => limbBodies; + public bool HasMultipleLimbsOfSameType => limbs != null && limbs.Length > limbDictionary.Count; private bool frozen; @@ -524,6 +527,7 @@ namespace Barotrauma protected void CreateLimbs() { + limbBodies.Clear(); limbs?.ForEach(l => l.Remove()); Mass = 0; DebugConsole.Log($"Creating limbs from {RagdollParams.Name}."); @@ -618,6 +622,7 @@ namespace Barotrauma { throw new Exception($"Failed to add a limb to the character \"{Character?.ConfigPath ?? "null"}\" (limb index {ID} out of bounds). The ragdoll file may be configured incorrectly."); } + limbBodies.Add(limb.body.FarseerBody); Limbs[ID] = limb; Mass += limb.Mass; if (!limbDictionary.ContainsKey(limb.type)) { limbDictionary.Add(limb.type, limb); } @@ -629,6 +634,7 @@ namespace Barotrauma limb.body.FarseerBody.OnCollision += OnLimbCollision; Array.Resize(ref limbs, Limbs.Length + 1); Limbs[Limbs.Length - 1] = limb; + limbBodies.Add(limb.body.FarseerBody); Mass += limb.Mass; if (!limbDictionary.ContainsKey(limb.type)) { limbDictionary.Add(limb.type, limb); } SetupDrawOrder(); @@ -636,14 +642,14 @@ namespace Barotrauma public void RemoveLimb(Limb limb) { - if (!Limbs.Contains(limb)) return; + if (!Limbs.Contains(limb)) { return; } Limb[] newLimbs = new Limb[Limbs.Length - 1]; int i = 0; foreach (Limb existingLimb in Limbs) { - if (existingLimb == limb) continue; + if (existingLimb == limb) { continue; } newLimbs[i] = existingLimb; i++; } @@ -680,8 +686,11 @@ namespace Barotrauma } LimbJoints = newJoints; } - + + limbBodies.Remove(limb.body.FarseerBody); limb.Remove(); + System.Diagnostics.Debug.Assert(!limbs.Contains(limb)); + System.Diagnostics.Debug.Assert(limbs.None(l => l.Removed)); foreach (LimbJoint limbJoint in attachedJoints) { GameMain.World.Remove(limbJoint.Joint); @@ -2243,6 +2252,7 @@ namespace Barotrauma } limbs = null; } + limbBodies.Clear(); if (collider != null) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs index 8e75cc189..32dad407a 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs @@ -5709,13 +5709,17 @@ namespace Barotrauma return sameRoomHulls.Contains(character.CurrentHull); } + /// + /// Returns all friendly crew members that are alive. + /// Filters out pets and characters that don't have . + /// public static IEnumerable GetFriendlyCrew(Character character) { if (character is null) { return Enumerable.Empty(); } - return CharacterList.Where(c => HumanAIController.IsFriendly(character, c, onlySameTeam: true) && !c.IsDead); + return CharacterList.Where(c => c.Info != null && !c.IsDead && !c.IsPet && HumanAIController.IsFriendly(character, c, onlySameTeam: true)); } public bool HasRecipeForItem(Identifier recipeIdentifier) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs index a5f000c10..5356afa30 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs @@ -184,6 +184,13 @@ namespace Barotrauma private set; } + [Serialize(10, IsPropertySaveable.No, description: "Determines the order of the characters in the campaign setup ui.")] + public int CampaignSetupUIOrder + { + get; + private set; + } + [Serialize(false, IsPropertySaveable.No, description: "If set to true, a client that has chosen this as their preferred job will get it regardless of the maximum number or the amount of spawnpoints in the sub.")] public bool AllowAlways { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionHasDifferentJobs.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionHasDifferentJobs.cs index fc3e186c7..c4550dfaa 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionHasDifferentJobs.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionHasDifferentJobs.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Linq; -using System.Xml.Linq; namespace Barotrauma.Abilities { @@ -14,8 +13,8 @@ namespace Barotrauma.Abilities protected override bool MatchesConditionSpecific() { - IEnumerable crewmembers = Character.GetFriendlyCrew(character); - int differentCrewAmount = crewmembers.Select(c => c.Info?.Job?.Prefab.Identifier).Distinct().Count(); + IEnumerable crewMembers = Character.GetFriendlyCrew(character); + int differentCrewAmount = crewMembers.Select(c => c.Info.Job?.Prefab.Identifier).Distinct().Count(); return differentCrewAmount >= amount; } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionLevelsBehindHighest.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionLevelsBehindHighest.cs index 46e55c575..0685fb074 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionLevelsBehindHighest.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionDataless/AbilityConditionLevelsBehindHighest.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using System.Xml.Linq; +using System.Linq; namespace Barotrauma.Abilities { @@ -14,7 +12,7 @@ namespace Barotrauma.Abilities protected override bool MatchesConditionSpecific() { - return Character.GetFriendlyCrew(character).Where(c => c.Info != null && (c.Info.GetCurrentLevel() - character.Info.GetCurrentLevel() >= levelsBehind)).Any(); + return Character.GetFriendlyCrew(character).Any(c => c.Info.GetCurrentLevel() - character.Info.GetCurrentLevel() >= levelsBehind); } } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityApplyStatusEffectsToApprenticeship.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityApplyStatusEffectsToApprenticeship.cs index c5440d730..c616c116b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityApplyStatusEffectsToApprenticeship.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityApplyStatusEffectsToApprenticeship.cs @@ -28,7 +28,7 @@ namespace Barotrauma.Abilities foreach (Character character in Character.GetFriendlyCrew(Character)) { - JobPrefab? characterJob = character.Info?.Job?.Prefab; + JobPrefab? characterJob = character.Info.Job?.Prefab; if (characterJob is null) { continue; } switch (characterJob.Identifier == apprenticeJob.Identifier) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGainSimultaneousSkill.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGainSimultaneousSkill.cs index 2b98992fa..f1df0523c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGainSimultaneousSkill.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGainSimultaneousSkill.cs @@ -30,7 +30,7 @@ foreach (Character otherCharacter in Character.GetFriendlyCrew(Character)) { if (otherCharacter == Character) { continue; } - otherCharacter.Info?.IncreaseSkillLevel(identifier, abilitySkillGain.Value, gainedFromAbility: true); + otherCharacter.Info.IncreaseSkillLevel(identifier, abilitySkillGain.Value, gainedFromAbility: true); } } else diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGivePermanentStat.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGivePermanentStat.cs index 31c58117b..a779f04e4 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGivePermanentStat.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGivePermanentStat.cs @@ -75,7 +75,7 @@ namespace Barotrauma.Abilities { foreach (Character c in Character.GetFriendlyCrew(Character)) { - c?.Info?.ChangeSavedStatValue(statType, value, identifier, removeOnDeath, maxValue: maxValue, setValue: setValue); + c.Info.ChangeSavedStatValue(statType, value, identifier, removeOnDeath, maxValue: maxValue, setValue: setValue); } } else diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGiveTalentPointsToAllies.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGiveTalentPointsToAllies.cs index 332303a34..b262855c2 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGiveTalentPointsToAllies.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityGiveTalentPointsToAllies.cs @@ -22,7 +22,6 @@ namespace Barotrauma.Abilities foreach (Character character in Character.GetFriendlyCrew(Character)) { - if (character.Info is null) { return; } character.Info.AdditionalTalentPoints += amount; } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CustomAbilities/CharacterAbilityByTheBook.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CustomAbilities/CharacterAbilityByTheBook.cs index a2ad09049..7a38bdf6f 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CustomAbilities/CharacterAbilityByTheBook.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CustomAbilities/CharacterAbilityByTheBook.cs @@ -35,7 +35,7 @@ namespace Barotrauma.Abilities GameAnalyticsManager.AddMoneyGainedEvent(moneyAmount, GameAnalyticsManager.MoneySource.Ability, CharacterTalent.Prefab.Identifier.Value); foreach (Character character in Character.GetFriendlyCrew(Character)) { - character.Info?.GiveExperience(experienceAmount); + character.Info.GiveExperience(experienceAmount); } timesGiven++; if (max > 0 && timesGiven >= max) { break; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/SpawnAction.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/SpawnAction.cs index 9206b3bb4..aead92a1d 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/SpawnAction.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/SpawnAction.cs @@ -168,7 +168,7 @@ namespace Barotrauma logError: false); } - humanPrefab ??= NPCSet.Get(NPCSetIdentifier, NPCIdentifier, logError: true); + humanPrefab ??= NPCSet.Get(NPCSetIdentifier, NPCIdentifier, logError: true, contentPackageToLogInError: ParentEvent.Prefab.ContentPackage); if (humanPrefab != null) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/Mission.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/Mission.cs index 212cf993d..856157a0b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/Mission.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/Mission.cs @@ -568,7 +568,7 @@ namespace Barotrauma Identifier characterIdentifier = element.GetAttributeIdentifier("identifier", Identifier.Empty); Identifier characterFrom = element.GetAttributeIdentifier("from", Identifier.Empty); - HumanPrefab humanPrefab = NPCSet.Get(characterFrom, characterIdentifier); + HumanPrefab humanPrefab = NPCSet.Get(characterFrom, characterIdentifier, contentPackageToLogInError: Prefab.ContentPackage); if (humanPrefab == null) { DebugConsole.ThrowError($"Couldn't spawn character for mission: character prefab \"{characterIdentifier}\" not found in the NPC set \"{characterFrom}\".", diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs index 4144f8c34..d70a16c03 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/PirateMission.cs @@ -128,7 +128,7 @@ namespace Barotrauma { Identifier characterIdentifier = characterElement.GetAttributeIdentifier("identifier", Identifier.Empty); Identifier characterFrom = characterElement.GetAttributeIdentifier("from", Identifier.Empty); - HumanPrefab humanPrefab = NPCSet.Get(characterFrom, characterIdentifier); + HumanPrefab humanPrefab = NPCSet.Get(characterFrom, characterIdentifier, contentPackageToLogInError: Prefab.ContentPackage); if (humanPrefab == null) { DebugConsole.ThrowError($"Error in mission \"{prefab.Identifier}\". Character prefab \"{characterIdentifier}\" not found in the NPC set \"{characterFrom}\".", diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/GeneticMaterial.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/GeneticMaterial.cs index a773ea0e1..d3783d983 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/GeneticMaterial.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/GeneticMaterial.cs @@ -234,7 +234,8 @@ namespace Barotrauma.Items.Components base.Update(deltaTime, cam); if (targetCharacter != null) { - if (SetTaintedOnDeath && targetCharacter.IsDead && !tainted) + if (SetTaintedOnDeath && !tainted && + targetCharacter.IsDead && targetCharacter.CauseOfDeath is not { Type: CauseOfDeathType.Disconnected }) { SetTainted(true); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs index e430e62d5..8e6f90d4d 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemContainer.cs @@ -850,7 +850,8 @@ namespace Barotrauma.Items.Components private bool CanAutoInteractWithContained(Item containedItem) { - return AutoInteractWithContained && autoInteractWithContainedTags.Any(t => containedItem.HasTag(t)); + return AutoInteractWithContained && + (autoInteractWithContainedTags.None() || autoInteractWithContainedTags.Any(t => containedItem.HasTag(t))); } private void SetContainedActive(bool active) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Power/Powered.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Power/Powered.cs index f9b1a3dd3..1b45e89f8 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Power/Powered.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Power/Powered.cs @@ -210,7 +210,7 @@ namespace Barotrauma.Items.Components { if (!powerOnSoundPlayed && powerOnSound != null) { - SoundPlayer.PlaySound(powerOnSound.Sound, item.WorldPosition, powerOnSound.Volume, powerOnSound.Range, hullGuess: item.CurrentHull, ignoreMuffling: powerOnSound.IgnoreMuffling, freqMult: powerOnSound.GetRandomFrequencyMultiplier()); + SoundPlayer.PlaySound(powerOnSound, item.WorldPosition, hullGuess: item.CurrentHull); powerOnSoundPlayed = true; } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/TriggerComponent.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/TriggerComponent.cs index 0b784524d..e9597ccf6 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/TriggerComponent.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/TriggerComponent.cs @@ -243,7 +243,16 @@ namespace Barotrauma.Items.Components public void SetPhysicsBodyPosition(bool ignoreContacts = true) { if (PhysicsBody == null) { return; } + Vector2 offset = ConvertUnits.ToSimUnits(BodyOffset * item.Scale); + if (item.FlippedX) + { + offset.X = -offset.X; + } + if (item.FlippedY) + { + offset.Y = -offset.Y; + } if (!MathUtils.NearlyEqual(item.RotationRad, 0)) { Matrix transform = Matrix.CreateRotationZ(-item.RotationRad); @@ -260,6 +269,15 @@ namespace Barotrauma.Items.Components PhysicsBody.UpdateDrawPosition(); } + public override void FlipX(bool relativeToSub) + { + SetPhysicsBodyPosition(); + } + public override void FlipY(bool relativeToSub) + { + SetPhysicsBodyPosition(); + } + public override void OnMapLoaded() { base.OnMapLoaded(); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/NPCSet.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/NPCSet.cs index 8be567543..4655040ef 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/NPCSet.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/NPCSet.cs @@ -15,7 +15,7 @@ namespace Barotrauma Humans = element.Elements().Select(npcElement => new HumanPrefab(npcElement, file, Identifier)).ToImmutableArray(); } - public static HumanPrefab? Get(Identifier setIdentifier, Identifier npcidentifier, bool logError = true) + public static HumanPrefab? Get(Identifier setIdentifier, Identifier npcidentifier, bool logError = true, ContentPackage? contentPackageToLogInError = null) { HumanPrefab? prefab = Sets.Where(set => set.Identifier == setIdentifier).SelectMany(npcSet => npcSet.Humans.Where(npcSetHuman => npcSetHuman.Identifier == npcidentifier)).FirstOrDefault(); @@ -23,7 +23,7 @@ namespace Barotrauma { if (logError) { - DebugConsole.ThrowError($"Could not find human prefab \"{npcidentifier}\" from \"{setIdentifier}\"."); + DebugConsole.ThrowError($"Could not find human prefab \"{npcidentifier}\" from \"{setIdentifier}\".", contentPackage: contentPackageToLogInError); } return null; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/OutpostGenerationParams.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/OutpostGenerationParams.cs index 196e7b428..4c11a83fd 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/OutpostGenerationParams.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Outposts/OutpostGenerationParams.cs @@ -196,36 +196,40 @@ namespace Barotrauma private class Entry { private readonly HumanPrefab humanPrefab = null; - private readonly Identifier setIdentifier = Identifier.Empty; - private readonly Identifier npcIdentifier = Identifier.Empty; + public readonly Identifier SetIdentifier = Identifier.Empty; + public readonly Identifier NpcIdentifier = Identifier.Empty; public readonly Identifier FactionIdentifier = Identifier.Empty; + + public readonly ContentPackage ContentPackage; - public Entry(HumanPrefab humanPrefab, Identifier factionIdentifier) + public Entry(HumanPrefab humanPrefab, Identifier factionIdentifier, ContentPackage contentPackage) { this.humanPrefab = humanPrefab; - this.FactionIdentifier = factionIdentifier; + FactionIdentifier = factionIdentifier; + ContentPackage = contentPackage; } - public Entry(Identifier setIdentifier, Identifier npcIdentifier, Identifier factionIdentifier) + public Entry(Identifier setIdentifier, Identifier npcIdentifier, Identifier factionIdentifier, ContentPackage contentPackage) { - this.setIdentifier = setIdentifier; - this.npcIdentifier = npcIdentifier; - this.FactionIdentifier = factionIdentifier; + SetIdentifier = setIdentifier; + NpcIdentifier = npcIdentifier; + FactionIdentifier = factionIdentifier; + ContentPackage = contentPackage; } public HumanPrefab HumanPrefab - => humanPrefab ?? NPCSet.Get(setIdentifier, npcIdentifier); + => humanPrefab ?? NPCSet.Get(SetIdentifier, NpcIdentifier, contentPackageToLogInError: ContentPackage); } private readonly List entries = new List(); - public void Add(HumanPrefab humanPrefab, Identifier factionIdentifier) - => entries.Add(new Entry(humanPrefab, factionIdentifier)); + public void Add(HumanPrefab humanPrefab, Identifier factionIdentifier, ContentPackage contentPackage) + => entries.Add(new Entry(humanPrefab, factionIdentifier, contentPackage)); - public void Add(Identifier setIdentifier, Identifier npcIdentifier, Identifier factionIdentifier) - => entries.Add(new Entry(setIdentifier, npcIdentifier, factionIdentifier)); + public void Add(Identifier setIdentifier, Identifier npcIdentifier, Identifier factionIdentifier, ContentPackage contentPackage) + => entries.Add(new Entry(setIdentifier, npcIdentifier, factionIdentifier, contentPackage)); public IEnumerator GetEnumerator() { @@ -244,7 +248,10 @@ namespace Barotrauma { if (entry.FactionIdentifier == Identifier.Empty || factions.Any(f => f.Identifier == entry.FactionIdentifier)) { - yield return entry.HumanPrefab; + if (entry.HumanPrefab != null) + { + yield return entry.HumanPrefab; + } } } } @@ -315,11 +322,11 @@ namespace Barotrauma Identifier faction = npcElement.GetAttributeIdentifier("faction", Identifier.Empty); if (from != Identifier.Empty) { - newCollection.Add(from, npcElement.GetAttributeIdentifier("identifier", Identifier.Empty), faction); + newCollection.Add(from, npcElement.GetAttributeIdentifier("identifier", Identifier.Empty), faction, npcElement.ContentPackage); } else { - newCollection.Add(new HumanPrefab(npcElement, file, npcSetIdentifier: from), faction); + newCollection.Add(new HumanPrefab(npcElement, file, npcSetIdentifier: from), faction, npcElement.ContentPackage); } } humanPrefabCollections.Add(newCollection); diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 87e522627..1f0207ea3 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,4 +1,26 @@ ------------------------------------------------------------------------------------------------------------------------------------------------- +v1.6.18.1 +------------------------------------------------------------------------------------------------------------------------------------------------- + +- Fixed several issues when the server rejects a name change due to a client trying to change their name too often: the server would start spamming the "can't change name" message, team and job preference selection would stop working too, and the game would crash when attempting to open the job preferences. +- Fixed equipped genes becoming tainted if you die due to disconnection. +- Fixed kill/death counters not working in the Sub vs. Sub PvP missions. +- Fixed gravity spheres not rotating in the sub editor. +- Fixed current generators not getting properly mirrored in ruins in mirrored levels. +- Fixed spawnpoints for escorted characters and prisoners not working. +- Fixed crashing if an AI character's husk infection is removed when they're using a ranged weapon. +- Fixed psychosis effect persisting if you leave the outpost midway through the "minds unraveled" event. +- Fixed night club merchants spawning in outposts without a night club. +- Fixed night club merchants not selling beer or rum (literally unplayable). +- Fixed bots cleaning up live grenades. +- Fixed server getting stuck in an infinite "restart loop" if autorestart or starting when everyone is ready is enabled and the selected perks are not suitable for the selected sub. The server would just attempt an immediate restart if the players wanted to cancel and reselect the perks. +- Fixed "All" option not working in the server browser's language filter dropdown. +- Fixed Raate Colony pvp map missing hulls near upper turrets. + +Modding: +- Fixed outpost generation parameters that reference non-existent NPC prefabs causing a crash during outpost generation. + +------------------------------------------------------------------------------------------------------------------------------------------------- v1.6.17.0 -------------------------------------------------------------------------------------------------------------------------------------------------