Remove DesyncRoles setting (Patched)

This commit is contained in:
D1GQ committed 2026-05-27 21:59:58 -05:00
1 parent 2b345a6b1d
commit 074f92de6c
2 files changed
+1 -55

No files matched your search

@@ -5,7 +5,6 @@ using BetterAmongUs.Modules.Support;
using BetterAmongUs.Mono.Extended;
using BetterAmongUs.Patches.Gameplay.UI.Settings;
using HarmonyLib;
using Hazel;
namespace BetterAmongUs.Patches.Gameplay.Managers;
@@ -15,22 +14,6 @@ internal static class RoleManagerPatch
internal static Dictionary<string, int> ImpostorMultiplier = []; // HashPuid, Multiplier
private static readonly Random random = new();
// Check if client is verified Better Among Us user
private static Func<InnerNet.ClientData, bool> FilterTargetClients(PlayerControl target)
{
return (clientData) =>
{
if (clientData.Id == target.GetClientId())
return false;
var betterData = clientData.ExtendedData();
if (betterData == null)
return true;
return !betterData.IsVerifiedBetterUser;
};
}
[HarmonyPatch(typeof(RoleManager), nameof(RoleManager.SetRole))]
[HarmonyPrefix]
private static void RoleManager_SetRole_Prefix(RoleManager __instance, PlayerControl targetPlayer, RoleTypes roleType)
@@ -161,19 +144,6 @@ internal static class RoleManagerPatch
Impostors.Add(pc);
pc.RpcSetRole(kvp.Key);
// Desync role to hide special role from non-BAU players
if (BetterGameSettings.DesyncRoles.GetBool())
{
if (kvp.Key.CanDesyncRole())
{
AmongUsClient.Instance.SendRpcImmediatelyDesync(pc.NetId, RpcCalls.SetRole, SendOption.None, FilterTargetClients(pc), writer =>
{
writer.Write((ushort)RoleTypes.Impostor);
writer.Write(false);
});
}
}
Logger_.LogPrivate($"Assigned {kvp.Key.GetRoleName()} role to {pc.Data.PlayerName}", "RoleManager");
break;
}
@@ -201,19 +171,6 @@ internal static class RoleManagerPatch
Crewmates.Add(pc);
pc.RpcSetRole(kvp.Key);
// Desync role to hide special role from non-BAU players
if (BetterGameSettings.DesyncRoles.GetBool())
{
if (kvp.Key.CanDesyncRole())
{
AmongUsClient.Instance.SendRpcImmediatelyDesync(pc.NetId, RpcCalls.SetRole, SendOption.None, FilterTargetClients(pc), writer =>
{
writer.Write((ushort)RoleTypes.Crewmate);
writer.Write(false);
});
}
}
Logger_.LogPrivate($"Assigned {kvp.Key.GetRoleName()} role to {pc.Data.PlayerName}", "RoleManager");
break;
}
@@ -348,16 +305,6 @@ internal static class RoleManagerPatch
{
player.RpcSetRole(kvp.Key);
// Desync ghost role to hide it from non-BAU players
if (BetterGameSettings.DesyncRoles.GetBool())
{
AmongUsClient.Instance.SendRpcImmediatelyDesync(player.NetId, RpcCalls.SetRole, SendOption.None, FilterTargetClients(player), writer =>
{
writer.Write((ushort)player.Data.Role.DefaultGhostRole);
writer.Write(false);
});
}
return false;
}
}
@@ -22,7 +22,6 @@ internal sealed class BetterGameSettings
internal static OptionCheckboxItem? DetectInvalidRPCs;
internal static OptionStringItem? RoleRandomizer;
internal static OptionCheckboxItem? DesyncRoles;
internal static OptionCheckboxItem? CancelInvalidSabotage;
internal static OptionCheckboxItem? CensorDetectionReason;
@@ -87,7 +86,7 @@ internal static class GameSettingsPatch
{
OptionHeaderItem.Create(BetterSettingsTab, "BetterSetting.MainHeader.RoleAlgorithm");
BetterGameSettings.RoleRandomizer = OptionStringItem.Create(1100, BetterSettingsTab, "BetterSetting.Setting.RoleRandomizer", ["System.Random", "UnityEngine.Random"], 0);
BetterGameSettings.DesyncRoles = OptionCheckboxItem.Create(1200, BetterSettingsTab, "BetterSetting.Setting.DesyncRoles", true);
// BetterGameSettings.DesyncRoles = OptionCheckboxItem.Create(1200, BetterSettingsTab, "BetterSetting.Setting.DesyncRoles", true);
}
// Gameplay Settings section