add new role information to try and fix broken gamemanager

This commit is contained in:
XtraCube committed 2025-10-01 20:59:44 -04:00
1 parent 7e541733b7
commit 10a7ffe886
2 files changed
+8 -9

No files matched your search

-9
View File
@@ -7,15 +7,6 @@ namespace MiraAPI.Patches.Events;
internal static class EndGamePatches
{
[HarmonyPatch(typeof(GameManager), nameof(GameManager.Awake))]
public static class GameManagerAwakePatch
{
public static void Postfix(GameManager __instance)
{
__instance.enabled = true;
}
}
[HarmonyPatch(typeof(GameManager), nameof(GameManager.RpcEndGame))]
public static class GameManagerRpcEndGamePatch
{
+8
View File
@@ -4,6 +4,7 @@ using System.Linq;
using AmongUs.GameOptions;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MiraAPI.Networking;
using MiraAPI.PluginLoading;
using MiraAPI.Utilities;
@@ -53,6 +54,8 @@ public static class CustomRoleManager
internal static readonly Dictionary<ushort, RoleBehaviour> CustomRoles = [];
internal static readonly Dictionary<Type, ushort> RoleIds = [];
private static Il2CppSystem.Collections.Generic.List<BaseGameSetting>? _emptySettings;
private static ushort _roleId = 100;
private static ushort GetNextRoleId()
@@ -133,6 +136,11 @@ public static class CustomRoleManager
roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount;
roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset();
_emptySettings ??= new(0);
roleBehaviour.AllGameSettings = _emptySettings;
roleBehaviour.CustomKillAnimations = RoleManager.Instance.GetRole(RoleTypes.Impostor).CustomKillAnimations;
if (customRole.Configuration.Icon != null)
{
var asset = customRole.Configuration.Icon.LoadAsset();