From: miniduikboot Date: Thu, 16 Nov 2023 16:55:50 +0000 (+0100) Subject: Debounce CheckMurder calls X-Git-Tag: v1.9.0~14^2~1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=c592bd1a9eb2f440a964c355289e5f318cc5d9e5;p=rhonda%2Fimpostor.git 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 --- 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; }