From ce4ccd99acf240cea3c0bdee88d01d78173e5192 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 30 Apr 2020 14:09:23 +0300 Subject: [PATCH] (1968ab79f) v0.9.9.1 --- .../Characters/CharacterNetworking.cs | 12 +++-- .../ClientSource/Networking/GameClient.cs | 13 +++++ .../ClientSource/Networking/SteamManager.cs | 14 ++--- .../BarotraumaClient/ClientSource/Program.cs | 3 +- .../ClientSource/Screens/ServerListScreen.cs | 4 +- .../ClientSource/Screens/SubEditorScreen.cs | 3 +- .../BarotraumaClient/LinuxClient.csproj | 2 +- Barotrauma/BarotraumaClient/MacClient.csproj | 2 +- .../BarotraumaClient/WindowsClient.csproj | 2 +- .../BarotraumaServer/LinuxServer.csproj | 2 +- Barotrauma/BarotraumaServer/MacServer.csproj | 2 +- .../Characters/CharacterNetworking.cs | 2 +- .../ServerSource/Networking/GameServer.cs | 12 +++++ .../BarotraumaServer/ServerSource/Program.cs | 4 ++ .../BarotraumaServer/WindowsServer.csproj | 2 +- .../SharedSource/Characters/Character.cs | 5 +- .../SharedSource/Items/Components/Turret.cs | 7 ++- .../SharedSource/Map/Levels/Level.cs | 12 ++++- .../SharedSource/Map/Submarine.cs | 11 ++-- .../SharedSource/Map/SubmarineInfo.cs | 54 +++++++++++-------- .../SharedSource/SteamAchievementManager.cs | 2 +- .../SharedSource/Utils/SaveUtil.cs | 3 +- Barotrauma/BarotraumaShared/changelog.txt | 13 +++++ 23 files changed, 131 insertions(+), 55 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterNetworking.cs index 56296974c..e5bf6f36f 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterNetworking.cs @@ -343,15 +343,17 @@ namespace Barotrauma UInt16 targetEntityID = msg.ReadUInt16(); int targetLimbIndex = msg.ReadByte(); + //255 = entity already removed, no need to do anything + if (attackLimbIndex == 255) { break; } + if (attackLimbIndex >= AnimController.Limbs.Length) { DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Limb index out of bounds ({attackLimbIndex})"); break; } Limb attackLimb = AnimController.Limbs[attackLimbIndex]; - IDamageable targetEntity = FindEntityByID(targetEntityID) as IDamageable; Limb targetLimb = null; - if (targetEntity == null) + if (!(FindEntityByID(targetEntityID) is IDamageable targetEntity)) { DebugConsole.ThrowError($"Received invalid ExecuteAttack message. Target entity not found (ID {targetEntityID})"); break; @@ -365,8 +367,10 @@ namespace Barotrauma } targetLimb = targetCharacter.AnimController.Limbs[targetLimbIndex]; } - - attackLimb.ExecuteAttack(targetEntity, targetLimb, out _); + if (attackLimb?.attack != null) + { + attackLimb.ExecuteAttack(targetEntity, targetLimb, out _); + } break; } msg.ReadPadBits(); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs index 06d3641cf..d234e9be3 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs @@ -2124,6 +2124,7 @@ namespace Barotrauma.Networking GameMain.GameSession.SubmarineInfo = new SubmarineInfo(subPath, ""); } SaveUtil.LoadGame(GameMain.GameSession.SavePath, GameMain.GameSession); + GameMain.GameSession?.SubmarineInfo?.Reload(); GameMain.GameSession?.SubmarineInfo?.CheckSubsLeftBehind(); if (GameMain.GameSession?.SubmarineInfo?.Name != null) { @@ -3007,6 +3008,11 @@ namespace Barotrauma.Networking if (GameMain.GameSession?.GameMode != null) { errorLines.Add("Game mode: " + GameMain.GameSession.GameMode.Name); + if (GameMain.GameSession?.GameMode is MultiPlayerCampaign campaign) + { + errorLines.Add("Campaign ID: " + campaign.CampaignID); + errorLines.Add("Campaign save ID: " + campaign.LastSaveID + "(pending: " + campaign.PendingSaveID + ")"); + } } if (GameMain.GameSession?.Submarine != null) { @@ -3015,6 +3021,13 @@ namespace Barotrauma.Networking if (Level.Loaded != null) { errorLines.Add("Level: " + Level.Loaded.Seed + ", " + Level.Loaded.EqualityCheckVal); + errorLines.Add("Entity count before generating level: " + Level.Loaded.EntityCountBeforeGenerate); + errorLines.Add("Entities:"); + foreach (Entity e in Level.Loaded.EntitiesBeforeGenerate) + { + errorLines.Add(" " + e.ID + ": " + e.ToString()); + } + errorLines.Add("Entity count after generating level: " + Level.Loaded.EntityCountAfterGenerate); } errorLines.Add("Entity IDs:"); diff --git a/Barotrauma/BarotraumaClient/ClientSource/Networking/SteamManager.cs b/Barotrauma/BarotraumaClient/ClientSource/Networking/SteamManager.cs index cc77ca939..81286c1c7 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Networking/SteamManager.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Networking/SteamManager.cs @@ -370,7 +370,7 @@ namespace Barotrauma.Steam if (Enum.TryParse(lobby.GetData("traitors"), out YesNoMaybe traitorsEnabled)) { serverInfo.TraitorsEnabled = traitorsEnabled; } serverInfo.GameStarted = lobby.GetData("gamestarted") == "True"; - serverInfo.GameMode = lobby.GetData("gamemode"); + serverInfo.GameMode = lobby.GetData("gamemode") ?? ""; if (Enum.TryParse(lobby.GetData("playstyle"), out PlayStyle playStyle)) serverInfo.PlayStyle = playStyle; if (serverInfo.ContentPackageNames.Count != serverInfo.ContentPackageHashes.Count || @@ -1052,7 +1052,7 @@ namespace Barotrauma.Steam Directory.CreateDirectory(targetPath); File.WriteAllText(copyingPath, "TEMPORARY FILE"); - SaveUtil.CopyFolder(item?.Directory, targetPath, copySubDirs: true, overwriteExisting: true); + SaveUtil.CopyFolder(item?.Directory, targetPath, copySubDirs: true, overwriteExisting: item?.Owner.Id != Steamworks.SteamClient.SteamId); File.Delete(copyingPath); return ""; @@ -1145,7 +1145,7 @@ namespace Barotrauma.Steam //make sure the destination directory exists Directory.CreateDirectory(Path.GetDirectoryName(contentFile.Path)); - CorrectContentFileCopy(contentPackage, sourceFile, contentFile.Path, overwrite: true); + CorrectContentFileCopy(contentPackage, sourceFile, contentFile.Path, overwrite: item?.Owner.Id != Steamworks.SteamClient.SteamId); } foreach (string nonContentFile in nonContentFiles) @@ -1154,7 +1154,7 @@ namespace Barotrauma.Steam if (!File.Exists(sourceFile)) { continue; } string destinationPath = CorrectContentFilePath(nonContentFile, contentPackage, false); Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); - CorrectContentFileCopy(contentPackage, sourceFile, destinationPath, overwrite: true); + CorrectContentFileCopy(contentPackage, sourceFile, destinationPath, overwrite: item?.Owner.Id != Steamworks.SteamClient.SteamId); } File.Delete(copyingPath); @@ -1507,6 +1507,8 @@ namespace Barotrauma.Steam private static void CorrectContentFileCopy(ContentPackage package, string src, string dest, bool overwrite) { + if (!overwrite && File.Exists(dest)) { return; } + if (Path.GetExtension(src).Equals(".xml", StringComparison.OrdinalIgnoreCase)) { XDocument doc = XMLExtensions.TryLoadXml(src); @@ -1529,12 +1531,12 @@ namespace Barotrauma.Steam } else { - File.Copy(src, dest, overwrite: overwrite); + File.Copy(src, dest, overwrite: true); } } else { - File.Copy(src, dest, overwrite: overwrite); + File.Copy(src, dest, overwrite: true); } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Program.cs b/Barotrauma/BarotraumaClient/ClientSource/Program.cs index 6ecf9226b..686787aaf 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Program.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Program.cs @@ -148,7 +148,8 @@ namespace Barotrauma if (GameMain.Config != null) { sb.AppendLine("Graphics mode: " + GameMain.Config.GraphicsWidth + "x" + GameMain.Config.GraphicsHeight + " (" + GameMain.Config.WindowMode.ToString() + ")"); - sb.AppendLine("VSync "+ (GameMain.Config.VSyncEnabled ? "ON" : "OFF")); + sb.AppendLine("VSync " + (GameMain.Config.VSyncEnabled ? "ON" : "OFF")); + sb.AppendLine("Language: " + (GameMain.Config.Language ?? "none")); } if (GameMain.SelectedPackages != null) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen.cs index 356f0d7cc..9f0ab6a38 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/ServerListScreen.cs @@ -422,7 +422,7 @@ namespace Barotrauma } // Game mode Selection - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), filters.Content.RectTransform), TextManager.Get("gamemode")) { CanBeFocused = false }; + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), filters.Content.RectTransform), TextManager.Get("gamemode"), font: GUI.SubHeadingFont) { CanBeFocused = false }; gameModeTickBoxes = new List(); foreach (GameModePreset mode in GameModePreset.List) @@ -1013,7 +1013,7 @@ namespace Barotrauma foreach (GUITickBox tickBox in gameModeTickBoxes) { var gameMode = (string)tickBox.UserData; - if (!tickBox.Selected && serverInfo.GameMode.Equals(gameMode, StringComparison.OrdinalIgnoreCase)) + if (!tickBox.Selected && serverInfo.GameMode != null && serverInfo.GameMode.Equals(gameMode, StringComparison.OrdinalIgnoreCase)) { child.Visible = false; break; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs index 34b881c19..60d71e339 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs @@ -3103,8 +3103,7 @@ namespace Barotrauma } } - // TODO adjust when the new inventory stuff rolls in - if (PlayerInput.KeyHit(Keys.Q) && mode == Mode.Default) + if (GameMain.Config.KeyBind(InputType.ToggleInventory).IsHit() && mode == Mode.Default) { toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData); } diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index 83a5aee27..6aac7e5bf 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 7e1e8ffa1..b86c42530 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index 4642e0645..8fc87ca50 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index e6e084590..333809549 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index eda82c727..acda0390e 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/ServerSource/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaServer/ServerSource/Characters/CharacterNetworking.cs index 28b09f25e..f6c374049 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Characters/CharacterNetworking.cs @@ -298,7 +298,7 @@ namespace Barotrauma UInt16 targetEntityID = (UInt16)extraData[2]; int targetLimbIndex = extraData.Length > 3 ? (int)extraData[3] : 0; msg.WriteRangedInteger(4, 0, 4); - msg.Write((byte)(Removed ? 0 : Array.IndexOf(AnimController.Limbs, attackLimb))); + msg.Write((byte)(Removed ? 255 : Array.IndexOf(AnimController.Limbs, attackLimb))); msg.Write(targetEntityID); msg.Write((byte)targetLimbIndex); break; diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs index d68545d1a..8ebab1945 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs @@ -842,6 +842,11 @@ namespace Barotrauma.Networking if (GameMain.GameSession?.GameMode != null) { errorLines.Add("Game mode: " + GameMain.GameSession.GameMode.Name); + if (GameMain.GameSession?.GameMode is MultiPlayerCampaign campaign) + { + errorLines.Add("Campaign ID: " + campaign.CampaignID); + errorLines.Add("Campaign save ID: " + campaign.LastSaveID); + } } if (GameMain.GameSession?.Submarine != null) { @@ -850,6 +855,13 @@ namespace Barotrauma.Networking if (Level.Loaded != null) { errorLines.Add("Level: " + Level.Loaded.Seed + ", " + Level.Loaded.EqualityCheckVal); + errorLines.Add("Entity count before generating level: " + Level.Loaded.EntityCountBeforeGenerate); + errorLines.Add("Entities:"); + foreach (Entity e in Level.Loaded.EntitiesBeforeGenerate) + { + errorLines.Add(" " + e.ID + ": " + e.ToString()); + } + errorLines.Add("Entity count after generating level: " + Level.Loaded.EntityCountAfterGenerate); } errorLines.Add("Entity IDs:"); diff --git a/Barotrauma/BarotraumaServer/ServerSource/Program.cs b/Barotrauma/BarotraumaServer/ServerSource/Program.cs index e355d1d3d..561146d66 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Program.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Program.cs @@ -93,6 +93,10 @@ namespace Barotrauma sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! "); sb.AppendLine("\n"); sb.AppendLine("Game version " + GameMain.Version + " (" + AssemblyInfo.GetBuildString() + ", branch " + AssemblyInfo.GetGitBranch() + ", revision " + AssemblyInfo.GetGitRevision() + ")"); + if (GameMain.Config != null) + { + sb.AppendLine("Language: " + (GameMain.Config.Language ?? "none")); + } if (GameMain.SelectedPackages != null) { sb.AppendLine("Selected content packages: " + (!GameMain.SelectedPackages.Any() ? "None" : string.Join(", ", GameMain.SelectedPackages.Select(c => c.Name)))); diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 978f3cde6..3d56e324e 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 0.9.9.0 + 0.9.9.1 Copyright © FakeFish 2018-2020 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs index d348011bf..859bec436 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs @@ -2908,7 +2908,10 @@ namespace Barotrauma causeOfDeathAffliction?.Source ?? LastAttacker, LastDamageSource); OnDeath?.Invoke(this, CauseOfDeath); - SteamAchievementManager.OnCharacterKilled(this, CauseOfDeath); + if (GameMain.GameSession != null && Screen.Selected == GameMain.GameScreen) + { + SteamAchievementManager.OnCharacterKilled(this, CauseOfDeath); + } KillProjSpecific(causeOfDeath, causeOfDeathAffliction, log); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Turret.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Turret.cs index df66ea5c5..49361bd90 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Turret.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using System.Xml.Linq; using Barotrauma.Extensions; +using FarseerPhysics.Dynamics; namespace Barotrauma.Items.Components { @@ -655,7 +656,8 @@ namespace Barotrauma.Items.Components end -= target.Submarine.SimPosition; } var collisionCategories = Physics.CollisionWall | Physics.CollisionCharacter | Physics.CollisionItem | Physics.CollisionLevel; - var pickedBody = Submarine.PickBody(start, end, null, collisionCategories, allowInsideFixture: true); + var pickedBody = Submarine.PickBody(start, end, null, collisionCategories, allowInsideFixture: true, + customPredicate: (Fixture f) => { return !item.StaticFixtures.Contains(f); }); if (pickedBody == null) { return; } Character targetCharacter = null; if (pickedBody.UserData is Character c) @@ -817,7 +819,8 @@ namespace Barotrauma.Items.Components end -= closestEnemy.Submarine.SimPosition; } var collisionCategories = Physics.CollisionWall | Physics.CollisionCharacter | Physics.CollisionItem | Physics.CollisionLevel; - var pickedBody = Submarine.PickBody(start, end, null, collisionCategories, allowInsideFixture: true); + var pickedBody = Submarine.PickBody(start, end, null, collisionCategories, allowInsideFixture: true, + customPredicate: (Fixture f) => { return !item.StaticFixtures.Contains(f); }); if (pickedBody == null) { return false; } Character targetCharacter = null; if (pickedBody.UserData is Character c) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Levels/Level.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Levels/Level.cs index 65970d17f..b111dc68c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Levels/Level.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Levels/Level.cs @@ -166,6 +166,11 @@ namespace Barotrauma private set; } + public List EntitiesBeforeGenerate { get; private set; } = new List(); + public int EntityCountBeforeGenerate { get; private set; } + public int EntityCountAfterGenerate { get; private set; } + + public float Difficulty { get; @@ -281,8 +286,11 @@ namespace Barotrauma public void Generate(bool mirror) { - if (loaded != null) loaded.Remove(); + if (loaded != null) { loaded.Remove(); } loaded = this; + + EntitiesBeforeGenerate = GetEntityList(); + EntityCountBeforeGenerate = EntitiesBeforeGenerate.Count(); levelObjectManager = new LevelObjectManager(); @@ -759,6 +767,8 @@ namespace Barotrauma DebugConsole.NewMessage("Generated level with the seed " + seed + " (type: " + generationParams.Name + ")", Color.White); } + EntityCountAfterGenerate = Entity.GetEntityList().Count(); + //assign an ID to make entity events work ID = FindFreeID(); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs index 583311994..41f130f42 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs @@ -215,7 +215,7 @@ namespace Barotrauma public override string ToString() { - return "Barotrauma.Submarine (" + Info?.Name ?? "[NULL INFO]" + ")"; + return "Barotrauma.Submarine (" + (Info?.Name ?? "[NULL INFO]") + ", " + IdOffset + ")"; } public override bool Removed @@ -1231,9 +1231,12 @@ namespace Barotrauma public bool SaveAs(string filePath, MemoryStream previewImage = null) { - var newInfo = new SubmarineInfo(this); - newInfo.FilePath = filePath; - newInfo.Name = Path.GetFileNameWithoutExtension(filePath); + var newInfo = new SubmarineInfo(this) + { + GameVersion = GameMain.Version, + FilePath = filePath, + Name = Path.GetFileNameWithoutExtension(filePath) + }; Info.Dispose(); Info = newInfo; return newInfo.SaveAs(filePath, previewImage); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/SubmarineInfo.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/SubmarineInfo.cs index efcca37a5..1c9b47b7e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/SubmarineInfo.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/SubmarineInfo.cs @@ -101,7 +101,11 @@ namespace Barotrauma set; } - public readonly XElement SubmarineElement; + public XElement SubmarineElement + { + get; + private set; + } public override string ToString() { @@ -180,28 +184,7 @@ namespace Barotrauma if (element == null && tryLoad) { - XDocument doc = null; - int maxLoadRetries = 4; - for (int i = 0; i <= maxLoadRetries; i++) - { - doc = OpenFile(filePath, out Exception e); - if (e != null && !(e is IOException)) { break; } - if (doc != null || i == maxLoadRetries || !File.Exists(filePath)) { break; } - DebugConsole.NewMessage("Opening submarine file \"" + filePath + "\" failed, retrying in 250 ms..."); - Thread.Sleep(250); - } - if (doc == null || doc.Root == null) - { - IsFileCorrupted = true; - return; - } - - if (string.IsNullOrWhiteSpace(hash)) - { - StartHashDocTask(doc); - } - - SubmarineElement = doc.Root; + Reload(); } else { @@ -215,6 +198,7 @@ namespace Barotrauma public SubmarineInfo(Submarine sub) : this(sub.Info) { + GameVersion = GameMain.Version; SubmarineElement = new XElement("Submarine"); sub.SaveToXElement(SubmarineElement); Init(); @@ -242,6 +226,30 @@ namespace Barotrauma #endif } + public void Reload() + { + XDocument doc = null; + int maxLoadRetries = 4; + for (int i = 0; i <= maxLoadRetries; i++) + { + doc = OpenFile(FilePath, out Exception e); + if (e != null && !(e is IOException)) { break; } + if (doc != null || i == maxLoadRetries || !File.Exists(FilePath)) { break; } + DebugConsole.NewMessage("Opening submarine file \"" + FilePath + "\" failed, retrying in 250 ms..."); + Thread.Sleep(250); + } + if (doc == null || doc.Root == null) + { + IsFileCorrupted = true; + return; + } + if (hash == null) + { + StartHashDocTask(doc); + } + SubmarineElement = doc.Root; + } + private void Init() { DisplayName = TextManager.Get("Submarine.Name." + Name, true); diff --git a/Barotrauma/BarotraumaShared/SharedSource/SteamAchievementManager.cs b/Barotrauma/BarotraumaShared/SharedSource/SteamAchievementManager.cs index f7d234cc0..618ec32a6 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/SteamAchievementManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/SteamAchievementManager.cs @@ -371,7 +371,7 @@ namespace Barotrauma if (charactersInSub.Count == 1) { //there must be some non-enemy casualties to get the last mant standing achievement - if (roundData.Casualties.Any(c => !(c.AIController is EnemyAIController))) + if (roundData.Casualties.Any(c => !(c.AIController is EnemyAIController) && c.TeamID == charactersInSub[0].TeamID)) { UnlockAchievement(charactersInSub[0], "lastmanstanding"); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs index 30ab6888d..2532b16cc 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Utils/SaveUtil.cs @@ -410,7 +410,8 @@ namespace Barotrauma foreach (FileInfo file in files) { string tempPath = Path.Combine(destDirName, file.Name); - file.CopyTo(tempPath, overwriteExisting); + if (!overwriteExisting && File.Exists(tempPath)) { continue; } + file.CopyTo(tempPath, true); } // If copying subdirectories, copy them and their contents to new location. diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 2b485ee9c..834ca2be9 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,3 +1,16 @@ +--------------------------------------------------------------------------------------------------------- +v0.9.9.1 +--------------------------------------------------------------------------------------------------------- + +- Fixed bots being unable to fire turrets due to the visibility raycast hitting the turret's collider. +- Fixed submarine's version number resetting to 0.0.0.0 when saving in the sub editor (didn't affect the actual saved sub file, only the in-game metadata that got fixed by restarting the game - so there's no need to do anything to fix the sub files you saved with the previous version). +- Fixed server list occasionally crashing when trying to filter based on game mode. +- Fixed an issue in multiplayer campaign that occasionally caused clients to get kicked with a "missing entity" error message. +- Fixed clients occasionally crashing when joining a server mid-round. Happened when the client tried to execute the attack of a monster that has already despawned server-side. +- Fixed local changes an user has made to a mod getting overwritten when the item gets autoupdated. +- Changed the hotkey to toggle the entity list in the sub editor from Q to the "toggle inventory" keybind to make it a little more user-friendly on AZERTY keyboards. +- Fixed corpses in wrecks being considered dead members of the crew in SteamAchievementManager, preventing "lone sailor" from unlocking and making it possible to unlock "last man standing" with just one character. + --------------------------------------------------------------------------------------------------------- v0.9.9.0 ---------------------------------------------------------------------------------------------------------