]> git.deb.at Git - rhonda/impostor.git/commitdiff
Address review comments
authorminiduikboot <mini@duikbo.at>
Tue, 18 Mar 2025 19:48:16 +0000 (20:48 +0100)
committerminiduikboot <mini@duikbo.at>
Thu, 22 May 2025 21:50:28 +0000 (23:50 +0200)
docs/Server-configuration.md
src/Impostor.Api/Config/AntiCheatConfig.cs
src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs
src/Impostor.Server/Net/Client.cs

index c1cae38f217d75d72b7cfadc606bebd22d181723..a39b3c570abc85e921af8f502c177f12f9e331fd 100644 (file)
@@ -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.                                                                                        |
index b675855f9db7fd00079b9462e4d59d1f07a666aa..f888fd79721b05fc9eb2fd6cfc67d6abedde6ead 100644 (file)
@@ -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;
     }
 }
index c33934602a0274d01fedebbb4eac523068134645..fe3dc213b443d74a3ed06072e365ed1e11a160b1 100644 (file)
@@ -36,6 +36,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <param name="name">A name for the player.</param>
+        /// <exception cref="ImpostorProtocolException">Thrown when player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask SetNameAsync(string name);
 
@@ -44,6 +45,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <param name="colorType">A color for the player.</param>
+        /// <exception cref="ImpostorProtocolException">Thrown when player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask SetColorAsync(ColorType colorType);
 
@@ -52,6 +54,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <param name="hatId">An hat for the player.</param>
+        /// <exception cref="ImpostorProtocolException">Thrown when player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask SetHatAsync(string hatId);
 
@@ -60,6 +63,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <param name="petId">A pet for the player.</param>
+        /// <exception cref="ImpostorProtocolException">Thrown when player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask SetPetAsync(string petId);
 
@@ -68,6 +72,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <param name="skinId">A skin for the player.</param>
+        /// <exception cref="ImpostorProtocolException">Thrown when player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask SetSkinAsync(string skinId);
 
@@ -115,6 +120,7 @@ namespace Impostor.Api.Net.Inner.Objects
         /// <exception cref="ImpostorProtocolException">Thrown when player is not the impostor.</exception>
         /// <exception cref="ImpostorProtocolException">Thrown when player is dead.</exception>
         /// <exception cref="ImpostorProtocolException">Thrown when target is dead.</exception>
+        /// <exception cref="ImpostorProtocolException">Thrown when player or target player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask MurderPlayerAsync(IInnerPlayerControl target, MurderResultFlags result);
 
@@ -133,6 +139,7 @@ namespace Impostor.Api.Net.Inner.Objects
         /// <exception cref="ImpostorProtocolException">Thrown when player is not the impostor.</exception>
         /// <exception cref="ImpostorProtocolException">Thrown when player is dead.</exception>
         /// <exception cref="ImpostorProtocolException">Thrown when target is dead.</exception>
+        /// <exception cref="ImpostorProtocolException">Thrown when player or target player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         [Obsolete("Please switch to version with the MurderResultFlags argument")]
         ValueTask MurderPlayerAsync(IInnerPlayerControl target);
@@ -142,6 +149,7 @@ namespace Impostor.Api.Net.Inner.Objects
         /// </summary>
         /// <param name="target">Target player to protect.</param>
         /// <exception cref="ImpostorProtocolException">Thrown when target is dead.</exception>
+        /// <exception cref="ImpostorProtocolException">Thrown when player or target player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask ProtectPlayerAsync(IInnerPlayerControl target);
 
@@ -157,6 +165,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ///     Visible to all players.
         /// </summary>
         /// <exception cref="ImpostorProtocolException">Thrown if player to be exiled is already dead.</exception>
+        /// <exception cref="ImpostorProtocolException">Thrown when player or target player doesn't have a PlayerInfo.</exception>
         /// <returns>Task that must be awaited.</returns>
         ValueTask ExileAsync();
 
index 2463037facd0fde8f827041f9b8ef353bd7713c2..f675899e54e2989f4b92916bb96955ba458d2564 100644 (file)
@@ -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),
             };