mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-19 15:51:42 +00:00
Don't dequeue a color when none are available
This commit is contained in:
1 parent
ba9eeb5bb4
commit
bdd65e9e9f
1 file changed
+19
-17
@@ -713,29 +713,31 @@ namespace Impostor.Server.Net.Inner.Objects
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!RequestedColorId.Any())
|
||||
if (RequestedColorId.Any())
|
||||
{
|
||||
var expected = RequestedColorId.Dequeue();
|
||||
|
||||
while (Game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.CurrentOutfit.Color == expected))
|
||||
{
|
||||
expected = (ColorType)(((byte)expected + 1) % ColorsCount);
|
||||
}
|
||||
|
||||
if (color != expected)
|
||||
{
|
||||
if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, CheatCategory.GameFlow, "Client sent SetColor with incorrect color"))
|
||||
{
|
||||
await SetColorAsync(expected);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, CheatCategory.GameFlow, "Client sent SetColor for a player that didn't request it"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var expected = RequestedColorId.Dequeue();
|
||||
|
||||
while (Game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.CurrentOutfit.Color == expected))
|
||||
{
|
||||
expected = (ColorType)(((byte)expected + 1) % ColorsCount);
|
||||
}
|
||||
|
||||
if (color != expected)
|
||||
{
|
||||
if (await sender.Client.ReportCheatAsync(RpcCalls.SetColor, CheatCategory.GameFlow, "Client sent SetColor with incorrect color"))
|
||||
{
|
||||
await SetColorAsync(expected);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerInfo.CurrentOutfit.Color = color;
|
||||
|
||||
Reference in new issue
Block a user