make it fair for modded clients

This commit is contained in:
Gurge44 committed 2026-04-21 15:46:07 +02:00
1 parent 2b43d6c56a
commit 16c9f4c281
2 files changed
+25 -21

No files matched your search

+17 -12
View File
@@ -2242,25 +2242,30 @@ internal static class ExtendedPlayerControl
{
try
{
if (Main.HasJustStarted) throw new("HasJustStarted");
if (Main.HasJustStarted) return player.GetEstimatedRoleTypes();
return player.GetRoleMap().RoleType;
}
catch
{
return player.GetCustomSubRoles() switch
{
{ } x when x.Contains(CustomRoles.Bloodlust) => RoleTypes.Impostor,
{ } x when x.Contains(CustomRoles.Nimble) && !player.HasDesyncRole() => RoleTypes.Engineer,
{ } x when x.Contains(CustomRoles.Physicist) => RoleTypes.Scientist,
{ } x when x.Contains(CustomRoles.Finder) => RoleTypes.Tracker,
{ } x when x.Contains(CustomRoles.Noisy) => RoleTypes.Noisemaker,
{ } x when x.Contains(CustomRoles.Examiner) => RoleTypes.Detective,
{ } x when x.Contains(CustomRoles.Venom) => RoleTypes.Viper,
_ => player.GetCustomRole().GetRoleTypes()
};
return player.GetEstimatedRoleTypes();
}
}
public RoleTypes GetEstimatedRoleTypes()
{
return player.GetCustomSubRoles() switch
{
{ } x when x.Contains(CustomRoles.Bloodlust) => RoleTypes.Impostor,
{ } x when x.Contains(CustomRoles.Nimble) && !player.HasDesyncRole() => RoleTypes.Engineer,
{ } x when x.Contains(CustomRoles.Physicist) => RoleTypes.Scientist,
{ } x when x.Contains(CustomRoles.Finder) => RoleTypes.Tracker,
{ } x when x.Contains(CustomRoles.Noisy) => RoleTypes.Noisemaker,
{ } x when x.Contains(CustomRoles.Examiner) => RoleTypes.Detective,
{ } x when x.Contains(CustomRoles.Venom) => RoleTypes.Viper,
_ => player.GetCustomRole().GetRoleTypes()
};
}
public bool Is(CustomRoles role)
{
return role > CustomRoles.NotAssigned ? player.GetCustomSubRoles().Contains(role) : player.GetCustomRole() == role;
+8 -9
View File
@@ -347,7 +347,7 @@ internal static class HudManagerPatch
if ((usesPetInsteadOfKill && player.Is(CustomRoles.Nimble) && player.GetRoleTypes() == RoleTypes.Engineer) || player.Is(CustomRoles.GM))
__instance.AbilityButton?.SetEnabled();
__instance.SabotageButton?.ToggleVisible(player.GetRoleTypes() is RoleTypes.ImpostorGhost or RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper);
__instance.SabotageButton?.ToggleVisible(player.GetEstimatedRoleTypes() is RoleTypes.ImpostorGhost or RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper);
float abilityUseLimit = player.GetAbilityUseLimit();
@@ -682,7 +682,7 @@ internal static class SetHudActivePatch
__instance.KillButton?.ToggleVisible(player.CanUseKillButton());
__instance.ImpostorVentButton?.ToggleVisible(player.CanUseImpostorVentButton());
__instance.SabotageButton?.ToggleVisible(player.GetRoleTypes() is RoleTypes.ImpostorGhost or RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper);
__instance.SabotageButton?.ToggleVisible(player.GetEstimatedRoleTypes() is RoleTypes.ImpostorGhost or RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper);
if (Options.UseMeetingShapeshift.GetBool() && PlayerControl.LocalPlayer.UsesMeetingShapeshift() && GameStates.IsMeeting)
{
@@ -812,10 +812,8 @@ internal static class MapBehaviourShowPatch
}
else if (opts.Mode is MapOptions.Modes.Normal or MapOptions.Modes.Sabotage)
{
if (player.Is(CustomRoleTypes.Impostor) || player.CanUseSabotage() || player.Is(CustomRoles.Glitch) || player.Is(CustomRoles.WeaponMaster) || player.Is(CustomRoles.Magician) || player.Is(CustomRoles.Parasite) || player.Is(CustomRoles.Renegade) || (player.Is(CustomRoles.Jackal) && Jackal.CanSabotage.GetBool()) || (player.Is(CustomRoles.Traitor) && Traitor.CanSabotage.GetBool()))
opts.Mode = MapOptions.Modes.Sabotage;
else
opts.Mode = MapOptions.Modes.Normal;
bool impBasis = player.GetEstimatedRoleTypes() is RoleTypes.ImpostorGhost or RoleTypes.Impostor or RoleTypes.Phantom or RoleTypes.Shapeshifter or RoleTypes.Viper;
opts.Mode = impBasis ? MapOptions.Modes.Sabotage : MapOptions.Modes.Normal;
}
if (Main.GodMode.Value) opts.ShowLivePlayerPosition = true;
@@ -973,9 +971,10 @@ internal static class TaskPanelBehaviourPatch
// Role info tab panel code from https://github.com/All-Of-Us-Mods/MiraAPI and https://github.com/AU-Avengers/TOU-Mira
public static PassiveButton RolePanelButton;
public static TaskPanelBehaviour TaskPanel;
public static TextMeshPro TabText;
public static TextMeshPro TabPanelName;
private static TaskPanelBehaviour TaskPanel;
private static TextMeshPro TabText;
private static TextMeshPro TabPanelName;
internal static TaskPanelBehaviour CreateRoleTab(CustomRoles role)
{
TaskPanel = HudManager.Instance.TaskStuff.transform.FindChild("TaskPanel").gameObject.GetComponent<TaskPanelBehaviour>();