diff --git a/src/Modules/AntiCheat/RPCHandlers/NetObjectHandlers/UpdateSystemHandler.cs b/src/Modules/AntiCheat/RPCHandlers/NetObjectHandlers/UpdateSystemHandler.cs index 52e0b7e..b0a1f46 100644 --- a/src/Modules/AntiCheat/RPCHandlers/NetObjectHandlers/UpdateSystemHandler.cs +++ b/src/Modules/AntiCheat/RPCHandlers/NetObjectHandlers/UpdateSystemHandler.cs @@ -1,6 +1,5 @@ using BetterAmongUs.Attributes; using BetterAmongUs.Helpers; -using BetterAmongUs.Patches.Gameplay.UI.Settings; using Hazel; using UnityEngine; @@ -69,28 +68,6 @@ internal sealed class UpdateSystemHandler : RPCHandler return true; } - internal override bool BetterHandle(PlayerControl? sender, MessageReader reader) - { - // Prevent dead impostors from sabotaging if setting is enabled - if (CatchedSystemType is SystemTypes.Sabotage or SystemTypes.Electrical or SystemTypes.LifeSupp or - SystemTypes.Reactor or SystemTypes.Laboratory or SystemTypes.HeliSabotage or - SystemTypes.Comms or SystemTypes.MushroomMixupSabotage) - { - if (BetterGameSettings.DisableSabotages.GetBool()) - return false; - - if (BetterGameSettings.DisableSabotagesForDead.GetBool()) - { - if (!sender.IsAlive()) - { - return false; - } - } - } - - return true; - } - private static bool HandleSabotageSystem(PlayerControl? sender, SabotageSystemType sabotageSystem, MessageReader reader) { byte count = reader.ReadByte(); diff --git a/src/Patches/Gameplay/Managers/RoleManagerPatch.cs b/src/Patches/Gameplay/Managers/RoleManagerPatch.cs index d02d7b9..fe0b616 100644 --- a/src/Patches/Gameplay/Managers/RoleManagerPatch.cs +++ b/src/Patches/Gameplay/Managers/RoleManagerPatch.cs @@ -238,7 +238,7 @@ internal static class RoleManagerPatch Logger_.LogHeader($"Better Role Assignment Has Started", "RoleManager"); // Get impostor count from BAU settings (defaults to 1) - int NumImpostors = BetterGameSettings.HideAndSeekImpNum?.GetInt() ?? 1; + int NumImpostors = GameOptionsManager.Instance.currentHideNSeekGameOptions.NumImpostors; if (NumImpostors > BAUPlugin.AllPlayerControls.Count) NumImpostors = BAUPlugin.AllPlayerControls.Count; @@ -247,30 +247,17 @@ internal static class RoleManagerPatch List Crewmates = []; List CrewAndImps() => [.. Impostors, .. Crewmates]; - // Get predefined impostors from settings (host can set specific players as impostors) - int[] betterImpostorSettings = - [ - GameOptionsManager.Instance.currentHideNSeekGameOptions.ImpostorPlayerID, - BetterGameSettingsTemp.HideAndSeekImp2?.GetInt() ?? -1, - BetterGameSettingsTemp.HideAndSeekImp3?.GetInt() ?? -1, - BetterGameSettingsTemp.HideAndSeekImp4?.GetInt() ?? -1, - BetterGameSettingsTemp.HideAndSeekImp5?.GetInt() ?? -1 - ]; - - for (int i = 0; i < NumImpostors; i++) + // Get predefined impostor from settings + var impId = GameOptionsManager.Instance.currentHideNSeekGameOptions.ImpostorPlayerID; + if (impId != -1) { - int tempSetImpostor = betterImpostorSettings[i]; - - if (tempSetImpostor >= 0) + var player = Utils.PlayerFromPlayerId(impId); + if (player != null) { - var player = Utils.PlayerFromPlayerId(tempSetImpostor); - if (player != null) + if (Impostors.Count < NumImpostors) { - if (Impostors.Count < NumImpostors) - { - Impostors.Add(player.Data); - Logger_.LogPrivate($"Settings Assigned {RoleTypes.Impostor.GetRoleName()} role to {player.Data.PlayerName}", "RoleManager"); - } + Impostors.Add(player.Data); + Logger_.LogPrivate($"Settings Assigned {RoleTypes.Impostor.GetRoleName()} role to {player.Data.PlayerName}", "RoleManager"); } } } diff --git a/src/Patches/Gameplay/Ship/DisableSabotagePatch.cs b/src/Patches/Gameplay/Ship/DisableSabotagePatch.cs deleted file mode 100644 index ce0d200..0000000 --- a/src/Patches/Gameplay/Ship/DisableSabotagePatch.cs +++ /dev/null @@ -1,37 +0,0 @@ -using BetterAmongUs.Helpers; -using BetterAmongUs.Modules; -using BetterAmongUs.Patches.Gameplay.UI.Settings; -using HarmonyLib; - -namespace BetterAmongUs.Patches.Gameplay.Ship; - -[HarmonyPatch] -internal static class DisableSabotagePatch -{ - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageReactor))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageHeli))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageComms))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageOxygen))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageLights))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageSeismic))] - [HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageMushroomMixup))] - [HarmonyPrefix] - internal static bool MapRoom_Sabotage_Prefix() - { - if (GameState.IsHost) - { - if (BetterGameSettings.DisableSabotages.GetBool()) - return false; - - if (BetterGameSettings.DisableSabotagesForDead.GetBool()) - { - if (!PlayerControl.LocalPlayer.IsAlive()) - { - return false; - } - } - } - - return true; - } -} diff --git a/src/Patches/Gameplay/UI/Settings/GameSettingsPatch.cs b/src/Patches/Gameplay/UI/Settings/GameSettingsPatch.cs index 58194ee..858b5b8 100644 --- a/src/Patches/Gameplay/UI/Settings/GameSettingsPatch.cs +++ b/src/Patches/Gameplay/UI/Settings/GameSettingsPatch.cs @@ -1,6 +1,4 @@ -using AmongUs.GameOptions; -using BetterAmongUs.Helpers; -using BetterAmongUs.Modules; +using BetterAmongUs.Modules; using BetterAmongUs.Modules.OptionItems; using BetterAmongUs.Modules.OptionItems.NoneOption; using BetterAmongUs.Modules.Support; @@ -18,7 +16,6 @@ internal sealed class BetterGameSettings internal static OptionCheckboxItem? UseBanNameList; internal static OptionCheckboxItem? UseBanWordList; internal static OptionCheckboxItem? UseBanWordListOnlyLobby; - internal static OptionIntItem? HideAndSeekImpNum; internal static OptionIntItem? DetectedLevelAbove; internal static OptionIntItem? KickLevelBelow; internal static OptionCheckboxItem? DetectCheatClients; @@ -26,11 +23,9 @@ internal sealed class BetterGameSettings internal static OptionStringItem? RoleRandomizer; internal static OptionCheckboxItem? DesyncRoles; - internal static OptionCheckboxItem? DisableSabotagesForDead; internal static OptionCheckboxItem? CancelInvalidSabotage; internal static OptionCheckboxItem? CensorDetectionReason; - internal static OptionCheckboxItem? DisableSabotages; } // Temporary settings for Hide & Seek impostor selection @@ -98,6 +93,7 @@ internal static class GameSettingsPatch // Show only for hosts if (IsPreload || GameState.IsHost) { + /* // Normal game mode settings if (IsPreload || !GameState.IsHideNSeek) { @@ -132,6 +128,7 @@ internal static class GameSettingsPatch BetterGameSettingsTemp.HideAndSeekImp3.GetValue() != -1 && BetterGameSettingsTemp.HideAndSeekImp4.GetValue() != -1; } + */ } }