From 5a72121200be9cbf326e9a0cb1e74ad4eaf2e6a8 Mon Sep 17 00:00:00 2001 From: James Puleo Date: Mon, 7 Nov 2022 10:33:52 -0500 Subject: [PATCH] Only restrict CC'd players during login whilst SSC is enabled The player being CC'd does not cause any issues for us if SSC isn't enabled, so we can relax it's restriction. This also allows the `RequireLogin` config option to function usefully again, as it would disable the player, causing them to be CC'd until they logged in, creating a vicious cycle. --- TShockAPI/Commands.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d638311e..2214f252 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -787,6 +787,10 @@ namespace TShockAPI // We need to emulate the checks done in Player.TrySwitchingLoadout, because otherwise the server is not allowed to sync the // loadout index to the player, causing catastrophic desync. // The player must not be dead, using an item, or CC'd to switch loadouts. + + // Note that we only check for CC'd players when SSC is enabled, as that is only where it can cause issues, + // and the RequireLogin config option (without SSC) will disable player's until they login, creating a vicious cycle. + // FIXME: There is always the chance that in-between the time we check these requirements on the server, and the loadout sync // packet reaches the client, that the client state has changed, causing the loadout sync to be rejected, even though // we expected it to succeed. @@ -805,7 +809,7 @@ namespace TShockAPI return; } - if (args.TPlayer.CCed) + if (args.TPlayer.CCed && Main.ServerSideCharacter) { args.Player.SendErrorMessage(GetString("You cannot login whilst crowd controlled.")); return;