v1.3.0.1 (Epic Store release)

This commit is contained in:
Regalis11
2024-03-28 18:34:33 +02:00
parent 81ca8637be
commit 3791670c42
269 changed files with 13160 additions and 2966 deletions
@@ -0,0 +1,8 @@
#nullable enable
namespace Barotrauma.Networking;
sealed class EosP2PConnection : P2PConnection<EosP2PEndpoint>
{
public EosP2PConnection(EosP2PEndpoint endpoint) : base(endpoint) { }
}
@@ -2,7 +2,7 @@
namespace Barotrauma.Networking
{
sealed class LidgrenConnection : NetworkConnection
sealed class LidgrenConnection : NetworkConnection<LidgrenEndpoint>
{
public readonly NetConnection NetConnection;
@@ -8,6 +8,13 @@ namespace Barotrauma.Networking
Disconnected = 0x2
}
abstract class NetworkConnection<T> : NetworkConnection where T : Endpoint
{
protected NetworkConnection(T endpoint) : base(endpoint) { }
public new T Endpoint => (base.Endpoint as T)!;
}
abstract class NetworkConnection
{
public const double TimeoutThreshold = 60.0; //full minute for timeout because loading screens can take quite a while
@@ -23,7 +30,7 @@ namespace Barotrauma.Networking
get; set;
}
public NetworkConnection(Endpoint endpoint)
protected NetworkConnection(Endpoint endpoint)
{
Endpoint = endpoint;
}
@@ -35,9 +42,9 @@ namespace Barotrauma.Networking
public void SetAccountInfo(AccountInfo newInfo)
{
AccountInfo = newInfo;
if (AccountInfo.IsNone) { AccountInfo = newInfo; }
}
public sealed override string ToString()
=> Endpoint.StringRepresentation;
}
@@ -0,0 +1,30 @@
#nullable enable
namespace Barotrauma.Networking;
abstract class P2PConnection<T> : P2PConnection where T : P2PEndpoint
{
protected P2PConnection(T endpoint) : base(endpoint) { }
public new T Endpoint => (base.Endpoint as T)!;
}
abstract class P2PConnection : NetworkConnection<P2PEndpoint>
{
protected P2PConnection(P2PEndpoint endpoint) : base(endpoint)
{
Heartbeat();
}
public double Timeout = 0.0;
public void Decay(float deltaTime)
{
Timeout -= deltaTime;
}
public void Heartbeat()
{
Timeout = TimeoutThreshold;
}
}
@@ -23,11 +23,11 @@ namespace Barotrauma.Networking
=> !(a == b);
}
sealed class PipeConnection : NetworkConnection
sealed class PipeConnection : NetworkConnection<PipeEndpoint>
{
public PipeConnection(AccountId accountId) : base(new PipeEndpoint())
public PipeConnection(Option<AccountId> accountId) : base(new PipeEndpoint())
{
SetAccountInfo(new AccountInfo(Option<AccountId>.Some(accountId)));
SetAccountInfo(new AccountInfo(accountId));
}
}
}
@@ -1,24 +1,9 @@
namespace Barotrauma.Networking
{
sealed class SteamP2PConnection : NetworkConnection
sealed class SteamP2PConnection : P2PConnection<SteamP2PEndpoint>
{
public double Timeout = 0.0;
public SteamP2PConnection(SteamId steamId) : this(new SteamP2PEndpoint(steamId)) { }
public SteamP2PConnection(SteamP2PEndpoint endpoint) : base(endpoint)
{
Heartbeat();
}
public void Decay(float deltaTime)
{
Timeout -= deltaTime;
}
public void Heartbeat()
{
Timeout = TimeoutThreshold;
}
public SteamP2PConnection(SteamP2PEndpoint endpoint) : base(endpoint) { }
}
}