From c592bd1a9eb2f440a964c355289e5f318cc5d9e5 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Thu, 16 Nov 2023 17:55:50 +0100 Subject: [PATCH] Debounce CheckMurder calls In games where players have a high ping, they can get disconnected if they try and murder a player twice. If a player tries to kill a player again while they are still under a cooldown from their previous kill, cancel their request if the game is server authoritive and don't process it anymore if the game is host authoritive --- .../Net/Inner/Objects/InnerPlayerControl.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs index 21344cf..1cae001 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs @@ -677,7 +677,12 @@ namespace Impostor.Server.Net.Inner.Objects { if (!PlayerInfo.CanMurder(Game, _dateTimeProvider)) { - if (await sender.Client.ReportCheatAsync(RpcCalls.CheckMurder, "Client tried to murder too fast")) + if (IsMurdering == target) + { + // This request was made too quickly by spamming the kill button, cancel it if we're in server authoritive mode + return _game.IsHostAuthoritive; + } + else if (await sender.Client.ReportCheatAsync(RpcCalls.CheckMurder, "Client tried to murder too fast")) { return false; } -- 2.39.5