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.
This commit is contained in:
James Puleo 2022-11-07 10:33:52 -05:00 committed by Lucas Nicodemus
parent 0c1b808ed0
commit 5a72121200
No known key found for this signature in database

View file

@ -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;