mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Allow mods to blacklist vanilla roles
This commit is contained in:
1 parent
fe1580bb7e
commit
1fd2dd3539
3 files changed
+20
-3
No files matched your search
@@ -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++)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the role is blacklisted from appearing and spawning. (Only applicable to vanilla roles)
|
||||
/// </summary>
|
||||
/// <param name="role">The role to check.</param>
|
||||
/// <returns>The role's blacklist status.</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user