Unstable v0.19.1.0

This commit is contained in:
Juan Pablo Arce
2022-08-19 13:59:08 -03:00
parent 6b55adcdd9
commit 1219615d64
192 changed files with 3875 additions and 2648 deletions
@@ -4,11 +4,12 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Barotrauma.Networking;
using Color = Microsoft.Xna.Framework.Color;
namespace Barotrauma
{
public static partial class ToolBox
static partial class ToolBox
{
/// <summary>
/// Checks if point is inside of a polygon
@@ -450,21 +451,26 @@ namespace Barotrauma
public static string WrapText(string text, float lineLength, ScalableFont font, float textScale = 1.0f)
=> font.WrapText(text, lineLength / textScale);
public static void ParseConnectCommand(string[] args, out string name, out string endpoint, out UInt64 lobbyId)
public static Option<ConnectCommand> ParseConnectCommand(string[] args)
{
name = null; endpoint = null; lobbyId = 0;
if (args == null || args.Length < 2) { return; }
if (args == null || args.Length < 2) { return Option<ConnectCommand>.None(); }
if (args[0].Equals("-connect", StringComparison.OrdinalIgnoreCase))
{
if (args.Length < 3) { return; }
name = args[1];
endpoint = args[2];
if (args.Length < 3) { return Option<ConnectCommand>.None(); }
if (!(Endpoint.Parse(args[2]).TryUnwrap(out var endpoint))) { return Option<ConnectCommand>.None(); }
return Option<ConnectCommand>.Some(
new ConnectCommand(
serverName: args[1],
endpoint: endpoint));
}
else if (args[0].Equals("+connect_lobby", StringComparison.OrdinalIgnoreCase))
{
UInt64.TryParse(args[1], out lobbyId);
return UInt64.TryParse(args[1], out var lobbyId)
? Option<ConnectCommand>.Some(new ConnectCommand(lobbyId))
: Option<ConnectCommand>.None();
}
return Option<ConnectCommand>.None();
}
public static bool VersionNewerIgnoreRevision(Version a, Version b)