expose custom roles in CustomRoleManager.cs

This commit is contained in:
XtraCube committed 2025-06-29 19:57:58 -04:00
1 parent bf652b68c3
commit ab54c44434
2 files changed
+18 -1

No files matched your search

+5 -1
View File
@@ -23,7 +23,11 @@ public static class GameStartupPatch
_runOnce = true;
if (MiraPluginManager.Instance.QueuedRoleRegistrations.Count <= 0) return;
if (MiraPluginManager.Instance.QueuedRoleRegistrations.Count <= 0)
{
return;
}
foreach (var queue in MiraPluginManager.Instance.QueuedRoleRegistrations)
{
CustomRoleManager.RegisterRoleTypes(queue.Value, queue.Key);
+13
View File
@@ -35,6 +35,16 @@ public static class CustomRoleManager
public static readonly LoadableAsset<AudioClip> ImpostorIntroSound =
CustomRoleUtils.GetIntroSound(RoleTypes.Impostor)!;
/// <summary>
/// Gets the list of custom roles as RoleBehaviour objects.
/// </summary>
public static IReadOnlyList<RoleBehaviour> CustomRoleBehaviours { get; private set; } = [];
/// <summary>
/// Gets the list of custom roles as ICustomRole objects.
/// </summary>
public static IReadOnlyList<ICustomRole> CustomMiraRoles { get; private set; } = [];
internal static readonly Dictionary<ushort, RoleBehaviour> CustomRoles = [];
internal static readonly Dictionary<Type, ushort> RoleIds = [];
@@ -53,6 +63,9 @@ public static class CustomRoleManager
{
RoleManager.GhostRoles.Add(role.Role);
}
CustomRoleBehaviours = CustomRoles.Values.ToList();
CustomMiraRoles = CustomRoles.Values.OfType<ICustomRole>().ToList();
}
internal static void RegisterRoleTypes(List<Type> roles, MiraPluginInfo pluginInfo)