From e5ef2adc55e0b56351ae278ab71849ba1fd90315 Mon Sep 17 00:00:00 2001 From: Regalis11 Date: Thu, 11 May 2023 16:39:23 +0300 Subject: [PATCH] v1.0.13.2 --- .../ContentManagement/ContentPackage/ModProject.cs | 2 +- .../ClientSource/Screens/SubEditorScreen.cs | 1 + .../BarotraumaClient/ClientSource/Steam/Workshop.cs | 9 +++++---- .../Steam/WorkshopMenu/Mutable/PublishTab.cs | 2 +- Barotrauma/BarotraumaClient/LinuxClient.csproj | 2 +- Barotrauma/BarotraumaClient/MacClient.csproj | 2 +- Barotrauma/BarotraumaClient/WindowsClient.csproj | 2 +- Barotrauma/BarotraumaServer/LinuxServer.csproj | 2 +- Barotrauma/BarotraumaServer/MacServer.csproj | 2 +- Barotrauma/BarotraumaServer/WindowsServer.csproj | 2 +- .../ContentPackage/ContentPackage.cs | 11 ++++++----- Barotrauma/BarotraumaShared/changelog.txt | 7 +++++++ 12 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/ContentManagement/ContentPackage/ModProject.cs b/Barotrauma/BarotraumaClient/ClientSource/ContentManagement/ContentPackage/ModProject.cs index 1e40e293b..4c883b07d 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/ContentManagement/ContentPackage/ModProject.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/ContentManagement/ContentPackage/ModProject.cs @@ -86,7 +86,7 @@ namespace Barotrauma public string ModVersion = ContentPackage.DefaultModVersion; - public Md5Hash? ExpectedHash { get; private set; } + public Md5Hash? ExpectedHash { get; set; } public bool IsCore = false; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs index 34461d263..712f3bef7 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs @@ -3557,6 +3557,7 @@ namespace Barotrauma foreach (var subElement in info.SubmarineElement.Elements()) { int id = subElement.GetAttributeInt("ID", -1); + if (id == -1) { continue; } Identifier identifier = subElement.GetAttributeIdentifier("identifier", string.Empty); if (entities.TryGetValue(id, out Identifier duplicateEntity)) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Steam/Workshop.cs b/Barotrauma/BarotraumaClient/ClientSource/Steam/Workshop.cs index ed270c344..bac896004 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Steam/Workshop.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Steam/Workshop.cs @@ -163,7 +163,7 @@ namespace Barotrauma.Steam CrossThread.RequestExecutionOnMainThread(() => ContentPackageManager.LocalPackages.Refresh()); } - public static async Task CreatePublishStagingCopy(string modVersion, ContentPackage contentPackage) + public static async Task CreatePublishStagingCopy(string title, string modVersion, ContentPackage contentPackage) { await Task.Yield(); @@ -184,11 +184,12 @@ namespace Barotrauma.Steam throw new Exception("Staging copy could not be loaded", result.TryUnwrapFailure(out var exception) ? exception : null); } - - //Load filelist.xml and write the hash into it so anyone downloading this mod knows what it should be + + //Load filelist.xml and write the hash into it so anyone downloading this mod knows what it should be ModProject modProject = new ModProject(tempPkg) { - ModVersion = modVersion + ModVersion = modVersion, + ExpectedHash = tempPkg.CalculateHash(name: title, modVersion: modVersion) }; modProject.Save(stagingFileListPath); } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Steam/WorkshopMenu/Mutable/PublishTab.cs b/Barotrauma/BarotraumaClient/ClientSource/Steam/WorkshopMenu/Mutable/PublishTab.cs index e3de26b71..d8525089f 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Steam/WorkshopMenu/Mutable/PublishTab.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Steam/WorkshopMenu/Mutable/PublishTab.cs @@ -478,7 +478,7 @@ namespace Barotrauma.Steam bool stagingReady = false; Exception? stagingException = null; TaskPool.Add("CreatePublishStagingCopy", - SteamManager.Workshop.CreatePublishStagingCopy(modVersion, localPackage), + SteamManager.Workshop.CreatePublishStagingCopy(editor.Title ?? localPackage.Name, modVersion, localPackage), (t) => { stagingReady = true; diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index 89803f6bf..8e8b611dd 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index bd8000122..92d9fe417 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index 036739a1a..5fe49bfa9 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index 9c21d07a3..bd43491ff 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index 2bc4f2cf0..083ea367d 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index b4a784950..c42ec7463 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.0.13.1 + 1.0.13.2 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentPackage/ContentPackage.cs b/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentPackage/ContentPackage.cs index d4a75eb27..01cd9319c 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentPackage/ContentPackage.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/ContentManagement/ContentPackage/ContentPackage.cs @@ -23,7 +23,7 @@ namespace Barotrauma : string.Empty); } - public static readonly Version MinimumHashCompatibleVersion = new Version(1, 0, 11, 0); + public static readonly Version MinimumHashCompatibleVersion = new Version(1, 0, 13, 2); public const string LocalModsDir = "LocalMods"; public static readonly string WorkshopModsDir = Barotrauma.IO.Path.Combine( @@ -177,7 +177,7 @@ namespace Barotrauma } } - public Md5Hash CalculateHash(bool logging = false) + public Md5Hash CalculateHash(bool logging = false, string? name = null, string? modVersion = null) { using IncrementalHash incrementalHash = IncrementalHash.CreateHash(HashAlgorithmName.MD5); @@ -205,11 +205,12 @@ namespace Barotrauma } } - if (UgcId.TryUnwrap(out ContentPackageId? id) && id != null) + string selectedName = name ?? Name; + if (!selectedName.IsNullOrEmpty()) { - incrementalHash.AppendData(Encoding.UTF8.GetBytes(id.StringRepresentation)); + incrementalHash.AppendData(Encoding.UTF8.GetBytes(selectedName)); } - incrementalHash.AppendData(Encoding.UTF8.GetBytes(ModVersion)); + incrementalHash.AppendData(Encoding.UTF8.GetBytes(modVersion ?? ModVersion)); var md5Hash = Md5Hash.BytesAsHash(incrementalHash.GetHashAndReset()); if (logging) diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 3eb16ac17..02bf3c4b2 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,3 +1,10 @@ +--------------------------------------------------------------------------------------------------------- +v1.0.13.2 +--------------------------------------------------------------------------------------------------------- + +- Fixed "hash mismatch" errors when trying to enable a mod that's been updated in the most recent patch. +- Fixed "the submarine contains entities with duplicate IDs" error message when loading a submarine that contains multiple shuttles/drones. + --------------------------------------------------------------------------------------------------------- v1.0.13.1 ---------------------------------------------------------------------------------------------------------