Merge pull request #444 from misternebula/refuse-connection-in-eye

Refuse connection in eye
This commit is contained in:
_nebula 2021-12-30 16:06:36 +00:00 committed by GitHub
commit acd2ff486f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 19 deletions

View File

@ -328,6 +328,7 @@ namespace QSB.Menus
KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.",
KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)",
KickReason.DLCNotMatching => "Server refused connection as DLC installation state does not match.",
KickReason.InEye => "Server refused connection as game has progressed too far.",
KickReason.None => "Kicked from server. No reason given.",
_ => $"Kicked from server. KickReason:{reason}",
};

View File

@ -6,6 +6,7 @@
QSBVersionNotMatching,
GameVersionNotMatching,
GamePlatformNotMatching,
DLCNotMatching
DLCNotMatching,
InEye
}
}

View File

@ -2,6 +2,7 @@
using QSB.Messaging;
using QSB.Utility;
using QuantumUNET.Transport;
using System.Linq;
namespace QSB.Player.Messages
{
@ -44,43 +45,41 @@ namespace QSB.Player.Messages
public override void OnReceiveRemote()
{
if (QSBVersion != QSBCore.QSBVersion)
if (QSBCore.IsHost)
{
if (QSBCore.IsHost)
if (QSBVersion != QSBCore.QSBVersion)
{
DebugLog.ToConsole($"Error - Client {PlayerName} connecting with wrong QSB version. (Client:{QSBVersion}, Server:{QSBCore.QSBVersion})", MessageType.Error);
new PlayerKickMessage(From, KickReason.QSBVersionNotMatching).Send();
return;
}
return;
}
if (GameVersion != QSBCore.GameVersion)
{
if (QSBCore.IsHost)
if (GameVersion != QSBCore.GameVersion)
{
DebugLog.ToConsole($"Error - Client {PlayerName} connecting with wrong game version. (Client:{GameVersion}, Server:{QSBCore.GameVersion})", MessageType.Error);
new PlayerKickMessage(From, KickReason.GameVersionNotMatching).Send();
return;
}
return;
}
if (Platform != QSBCore.Platform)
{
if (QSBCore.IsHost)
if (Platform != QSBCore.Platform)
{
DebugLog.ToConsole($"Error - Client {PlayerName} connecting with wrong game platform. (Client:{Platform}, Server:{QSBCore.Platform})", MessageType.Error);
new PlayerKickMessage(From, KickReason.DLCNotMatching).Send();
return;
}
}
if (DlcInstalled != QSBCore.DLCInstalled)
{
if (QSBCore.IsHost)
if (DlcInstalled != QSBCore.DLCInstalled)
{
DebugLog.ToConsole($"Error - Client {PlayerName} connecting with wrong DLC installation state. (Client:{DlcInstalled}, Server:{QSBCore.DLCInstalled})", MessageType.Error);
new PlayerKickMessage(From, KickReason.GamePlatformNotMatching).Send();
return;
}
if (QSBPlayerManager.PlayerList.Any(x => x.EyeState > EyeState.WarpedToSurface))
{
DebugLog.ToConsole($"Error - Client {PlayerName} connecting too late into eye scene.", MessageType.Error);
new PlayerKickMessage(From, KickReason.InEye).Send();
return;
}
}