From 0ac0b1d4031cc7dc38074b8947e9082035378b01 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Tue, 18 Mar 2025 20:48:16 +0100 Subject: [PATCH] Address review comments --- docs/Server-configuration.md | 2 +- src/Impostor.Api/Config/AntiCheatConfig.cs | 6 +++--- .../Net/Inner/Objects/IInnerPlayerControl.cs | 9 +++++++++ src/Impostor.Server/Net/Client.cs | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/Server-configuration.md b/docs/Server-configuration.md index c1cae38..a39b3c5 100644 --- a/docs/Server-configuration.md +++ b/docs/Server-configuration.md @@ -31,9 +31,9 @@ Impostor has an Anticheat that makes it possible to kick cheaters from games aut | **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. | | **AllowCheatingHosts** | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set. | | **EnableGameFlowChecks** | `true` | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast. | +| **EnableInvalidObjectChecks** | `true` | Enables checks that check if network objects are spawned properly. Disabling this option also implies disabling EnableRoleChecks. | | **EnableMustBeHostChecks** | `true` | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects. | | **EnableColorLimitChecks** | `true` | Enables checks that checks if players request colors that are already in use. | -| **EnableInvalidObjectChecks** | `true` | Enables checks that check if network objects are spawned properly. | | **EnableNameLimitChecks** | `true` | Enables checks that checks if player names have a length that is possible to set using the user interface. | | **EnableOwnershipChecks** | `true` | Enables checks that check if players are allowed to perform a certain action on themself or another player. | | **EnableRoleChecks** | `true` | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering. | diff --git a/src/Impostor.Api/Config/AntiCheatConfig.cs b/src/Impostor.Api/Config/AntiCheatConfig.cs index b675855..f888fd7 100644 --- a/src/Impostor.Api/Config/AntiCheatConfig.cs +++ b/src/Impostor.Api/Config/AntiCheatConfig.cs @@ -1,4 +1,4 @@ -namespace Impostor.Api.Config +namespace Impostor.Api.Config { public class AntiCheatConfig { @@ -14,6 +14,8 @@ public bool EnableMustBeHostChecks { get; set; } = true; + public bool EnableInvalidObjectChecks { get; set; } = true; + public bool EnableColorLimitChecks { get; set; } = true; public bool EnableNameLimitChecks { get; set; } = true; @@ -24,8 +26,6 @@ public bool EnableTargetChecks { get; set; } = true; - public bool EnableInvalidObjectChecks { get; set; } = true; - public bool ForbidProtocolExtensions { get; set; } = true; } } diff --git a/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs b/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs index c339346..fe3dc21 100644 --- a/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs +++ b/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs @@ -36,6 +36,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// A name for the player. + /// Thrown when player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask SetNameAsync(string name); @@ -44,6 +45,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// A color for the player. + /// Thrown when player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask SetColorAsync(ColorType colorType); @@ -52,6 +54,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// An hat for the player. + /// Thrown when player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask SetHatAsync(string hatId); @@ -60,6 +63,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// A pet for the player. + /// Thrown when player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask SetPetAsync(string petId); @@ -68,6 +72,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// A skin for the player. + /// Thrown when player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask SetSkinAsync(string skinId); @@ -115,6 +120,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Thrown when player is not the impostor. /// Thrown when player is dead. /// Thrown when target is dead. + /// Thrown when player or target player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask MurderPlayerAsync(IInnerPlayerControl target, MurderResultFlags result); @@ -133,6 +139,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Thrown when player is not the impostor. /// Thrown when player is dead. /// Thrown when target is dead. + /// Thrown when player or target player doesn't have a PlayerInfo. /// Task that must be awaited. [Obsolete("Please switch to version with the MurderResultFlags argument")] ValueTask MurderPlayerAsync(IInnerPlayerControl target); @@ -142,6 +149,7 @@ namespace Impostor.Api.Net.Inner.Objects /// /// Target player to protect. /// Thrown when target is dead. + /// Thrown when player or target player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask ProtectPlayerAsync(IInnerPlayerControl target); @@ -157,6 +165,7 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to all players. /// /// Thrown if player to be exiled is already dead. + /// Thrown when player or target player doesn't have a PlayerInfo. /// Task that must be awaited. ValueTask ExileAsync(); diff --git a/src/Impostor.Server/Net/Client.cs b/src/Impostor.Server/Net/Client.cs index 2463037..f675899 100644 --- a/src/Impostor.Server/Net/Client.cs +++ b/src/Impostor.Server/Net/Client.cs @@ -67,13 +67,13 @@ namespace Impostor.Server.Net { CheatCategory.ProtocolExtension => _antiCheatConfig.ForbidProtocolExtensions, CheatCategory.GameFlow => _antiCheatConfig.EnableGameFlowChecks, + CheatCategory.InvalidObject => _antiCheatConfig.EnableInvalidObjectChecks, CheatCategory.MustBeHost => _antiCheatConfig.EnableMustBeHostChecks, CheatCategory.ColorLimits => _antiCheatConfig.EnableColorLimitChecks, CheatCategory.NameLimits => _antiCheatConfig.EnableNameLimitChecks, CheatCategory.Ownership => _antiCheatConfig.EnableOwnershipChecks, CheatCategory.Role => _antiCheatConfig.EnableRoleChecks, CheatCategory.Target => _antiCheatConfig.EnableTargetChecks, - CheatCategory.InvalidObject => _antiCheatConfig.EnableInvalidObjectChecks, CheatCategory.Other => true, _ => LogUnknownCategory(category), }; -- 2.39.5