mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Merge branch 'dev' into commission
# Conflicts: # MiraAPI/PluginLoading/MiraPluginManager.cs
This commit is contained in:
commit
d7d9028433
4 files changed
+27
-2
No files matched your search
@@ -21,6 +21,13 @@ public static class ModifierManager
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool MiraAssignsModifiers { get; set; } = true;
|
public static bool MiraAssignsModifiers { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of all registered modifiers.
|
||||||
|
/// </summary>
|
||||||
|
public static IReadOnlyList<BaseModifier> Modifiers { get; internal set; } = [];
|
||||||
|
|
||||||
|
internal static List<BaseModifier> InternalModifiers { get; } = [];
|
||||||
|
|
||||||
private static readonly Dictionary<uint, Type> IdToTypeModifierMap = [];
|
private static readonly Dictionary<uint, Type> IdToTypeModifierMap = [];
|
||||||
private static readonly Dictionary<Type, uint> TypeToIdModifierMap = [];
|
private static readonly Dictionary<Type, uint> TypeToIdModifierMap = [];
|
||||||
private static readonly Dictionary<int, List<uint>> PrioritiesToIdsMap = [];
|
private static readonly Dictionary<int, List<uint>> PrioritiesToIdsMap = [];
|
||||||
@@ -80,6 +87,7 @@ public static class ModifierManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
info.InternalModifiers.Add(modifier);
|
info.InternalModifiers.Add(modifier);
|
||||||
|
InternalModifiers.Add(modifier);
|
||||||
|
|
||||||
if (modifier is not GameModifier gameModifier)
|
if (modifier is not GameModifier gameModifier)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ public static class GameStartupPatch
|
|||||||
|
|
||||||
_runOnce = true;
|
_runOnce = true;
|
||||||
|
|
||||||
if (MiraPluginManager.Instance.QueuedRoleRegistrations.Count <= 0) return;
|
if (MiraPluginManager.Instance.QueuedRoleRegistrations.Count <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var queue in MiraPluginManager.Instance.QueuedRoleRegistrations)
|
foreach (var queue in MiraPluginManager.Instance.QueuedRoleRegistrations)
|
||||||
{
|
{
|
||||||
CustomRoleManager.RegisterRoleTypes(queue.Value, queue.Key);
|
CustomRoleManager.RegisterRoleTypes(queue.Value, queue.Key);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using BepInEx;
|
|
||||||
using BepInEx.Unity.IL2CPP;
|
using BepInEx.Unity.IL2CPP;
|
||||||
using MiraAPI.Colors;
|
using MiraAPI.Colors;
|
||||||
using MiraAPI.Events;
|
using MiraAPI.Events;
|
||||||
@@ -62,6 +61,7 @@ public sealed class MiraPluginManager
|
|||||||
{
|
{
|
||||||
CustomButtonManager.Buttons = new ReadOnlyCollection<CustomActionButton>(CustomButtonManager.CustomButtons);
|
CustomButtonManager.Buttons = new ReadOnlyCollection<CustomActionButton>(CustomButtonManager.CustomButtons);
|
||||||
RegisteredPlugins = [.. _registeredPlugins.Values];
|
RegisteredPlugins = [.. _registeredPlugins.Values];
|
||||||
|
ModifierManager.Modifiers = new ReadOnlyCollection<BaseModifier>(ModifierManager.InternalModifiers);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,16 @@ public static class CustomRoleManager
|
|||||||
public static readonly LoadableAsset<AudioClip> ImpostorIntroSound =
|
public static readonly LoadableAsset<AudioClip> ImpostorIntroSound =
|
||||||
CustomRoleUtils.GetIntroSound(RoleTypes.Impostor)!;
|
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<ushort, RoleBehaviour> CustomRoles = [];
|
||||||
internal static readonly Dictionary<Type, ushort> RoleIds = [];
|
internal static readonly Dictionary<Type, ushort> RoleIds = [];
|
||||||
|
|
||||||
@@ -53,6 +63,9 @@ public static class CustomRoleManager
|
|||||||
{
|
{
|
||||||
RoleManager.GhostRoles.Add(role.Role);
|
RoleManager.GhostRoles.Add(role.Role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomRoleBehaviours = CustomRoles.Values.ToList();
|
||||||
|
CustomMiraRoles = CustomRoles.Values.OfType<ICustomRole>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void RegisterRoleTypes(List<Type> roles, MiraPluginInfo pluginInfo)
|
internal static void RegisterRoleTypes(List<Type> roles, MiraPluginInfo pluginInfo)
|
||||||
|
|||||||
Reference in new issue
Block a user