Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -144,9 +144,9 @@ namespace Barotrauma.Networking
var pingLocation = NetPingLocation.TryParseFromString(pingLocationStr);
if (pingLocation.HasValue && Steamworks.SteamNetworkingUtils.LocalPingLocation.HasValue)
if (pingLocation.HasValue)
{
int ping = Steamworks.SteamNetworkingUtils.LocalPingLocation.Value.EstimatePingTo(pingLocation.Value);
int ping = Steamworks.SteamNetworkingUtils.EstimatePingTo(pingLocation.Value);
if (ping < 0) { return Result.Failure(SteamLobbyPingError.PingEstimationFailed); }
return Result.Success(ping);
}
@@ -385,14 +385,24 @@ namespace Barotrauma.Networking
{ MinSize = new Point(0, 15) },
package.Name)
{
CanBeFocused = false
Enabled = false
};
packageText.Box.DisabledColor = packageText.Box.Color;
packageText.TextBlock.DisabledTextColor = packageText.TextBlock.TextColor;
if (!string.IsNullOrEmpty(package.Hash))
{
if (ContentPackageManager.AllPackages.Any(contentPackage => contentPackage.Hash.StringRepresentation == package.Hash))
if (ContentPackageManager.AllPackages.FirstOrDefault(contentPackage => contentPackage.Hash.StringRepresentation == package.Hash) is { } matchingPackage)
{
packageText.TextColor = GUIStyle.Green;
packageText.Selected = true;
matchingPackage.TryFetchUgcDescription(onFinished: (string? description) =>
{
if (packageText.ToolTip.IsNullOrEmpty() &&
!string.IsNullOrEmpty(description))
{
packageText.ToolTip = description + "...";
}
});
}
//workshop download link found
else if (package.Id.TryUnwrap(out var ugcId) && ugcId is SteamWorkshopId)
@@ -437,7 +447,7 @@ namespace Barotrauma.Networking
public void UpdateInfo(Func<string, string?> valueGetter)
{
ServerMessage = valueGetter("message") ?? "";
ServerMessage = ExtractServerMessage(valueGetter);
if (Version.TryParse(valueGetter("version"), out var version))
{
GameVersion = version;
@@ -477,6 +487,22 @@ namespace Barotrauma.Networking
}
}
private static string ExtractServerMessage(Func<string, string?> valueGetter)
{
string msg = valueGetter("message") ?? string.Empty;
if (!msg.IsNullOrEmpty()) { return msg; }
int messageIndex = 0;
string splitMessage;
do
{
splitMessage = valueGetter($"message{messageIndex}") ?? string.Empty;
msg += splitMessage;
messageIndex++;
} while (!splitMessage.IsNullOrEmpty());
return msg;
}
private static ServerListContentPackageInfo[] ExtractContentPackageInfo(string serverName, Func<string, string?> valueGetter)
{
//workaround to ServerRules queries truncating the values to 255 bytes
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -67,6 +67,7 @@ namespace Barotrauma
return null;
});
serverInfo.Checked = true;
serverInfo.HasPassword |= entry.Passworded;
onServerDataReceived(serverInfo, this);
});