diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index f309b6f..79164cc 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -185,7 +185,8 @@ public static class LobbyViewPanePatches __instance.settingsInfo.Add(categoryHeaderRoleVariant.gameObject); num -= 0.696f; var roles = RoleManager.Instance.AllRoles.ToArray().Where(x => - x is not ICustomRole && x.Role != RoleTypes.Crewmate && x.Role != RoleTypes.Impostor && + x is not ICustomRole && !x.IsRoleBlacklisted() && x.Role != RoleTypes.Crewmate && + x.Role != RoleTypes.Impostor && x.Role != RoleTypes.CrewmateGhost && x.Role != RoleTypes.ImpostorGhost).ToList(); for (int j = 0; j < roles.Count; j++) { diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 78e720c..17913d5 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -74,10 +74,10 @@ public static class RoleSettingMenuPatches var num = 0.662f; var list = CustomRoleManager.AllRoles.Where( - r => !r.IsCustomRole() && r.TeamType == RoleTeamTypes.Crewmate && r.Role != RoleTypes.Crewmate && + r => !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Crewmate && r.Role != RoleTypes.Crewmate && r.Role != RoleTypes.CrewmateGhost).ToList(); var list2 = CustomRoleManager.AllRoles.Where( - r => !r.IsCustomRole() && r.TeamType == RoleTeamTypes.Impostor && r.Role != RoleTypes.Impostor && + r => !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Impostor && r.Role != RoleTypes.Impostor && r.Role != RoleTypes.ImpostorGhost).ToList(); if (__instance.roleTabs == null || __instance.roleTabs.Count == 0) diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index 3b007a6..c89fc74 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using AmongUs.GameOptions; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MiraAPI.Roles; @@ -536,4 +537,19 @@ public static class Helpers } return role.NiceName; } + + /// + /// Returns whether the role is blacklisted from appearing and spawning. (Only applicable to vanilla roles) + /// + /// The role to check. + /// The role's blacklist status. + public static bool IsRoleBlacklisted(this RoleBehaviour role) + { + // This should be patchable by mods when a vanilla role is meant to be replaced by a custom role. + if (role.Role is RoleTypes.Engineer) + { + return true; + } + return false; + } }