Release 1.9.7.0 - Summer Update 2025

This commit is contained in:
Regalis11
2025-06-17 16:38:11 +03:00
parent 22227f13e5
commit ea5a2bc693
297 changed files with 7344 additions and 2421 deletions
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Barotrauma</RootNamespace>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Barotrauma.Extensions;
@@ -9,18 +10,9 @@ public static class EnumerableExtensionsCore
public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TKey, TValue>(this IEnumerable<(TKey, TValue)> enumerable)
where TKey : notnull
{
return enumerable.ToDictionary().ToImmutableDictionary();
}
public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<(TKey, TValue)> enumerable)
where TKey : notnull
{
var dictionary = new Dictionary<TKey, TValue>();
foreach (var (k,v) in enumerable)
{
dictionary.Add(k, v);
}
return dictionary;
return enumerable
.ToDictionary(static pair => pair.Item1, static pair => pair.Item2)
.ToImmutableDictionary();
}
[return: NotNullIfNotNull("immutableDictionary")]
@@ -66,6 +66,15 @@ namespace Barotrauma.Extensions
value.Top > bottom && rect.Top > otherBottom;
}
/// <summary>
/// Converts the y-coordinate of the rectangle so that up is greater and down is lower
/// (i.e. so the Location of the rectangle is at the top-left corner in world coordinates).
/// </summary>
public static Rectangle ToWorldRect(this Rectangle rect)
{
return new Rectangle(rect.X, rect.Y - rect.Height, rect.Size.X, rect.Size.Y);
}
/// <summary>
/// Like the XNA method, but treats the y-coordinate so that up is greater and down is lower.
/// </summary>
@@ -69,6 +69,10 @@ public static class IEnumerableExtensionsCore
}
}
// Upgrading to .NET 8 seems to have caused a false positive on this line, disabled the warning for now.
// See https://github.com/dotnet/roslyn-analyzers/pull/7488
#pragma warning disable CA2021
public static IEnumerable<TSuccess> Successes<TSuccess, TFailure>(
this IEnumerable<Result<TSuccess, TFailure>> source)
where TSuccess : notnull
@@ -84,4 +88,7 @@ public static class IEnumerableExtensionsCore
=> source
.OfType<Failure<TSuccess, TFailure>>()
.Select(f => f.Error);
#pragma warning disable 2021
}