From 10a7ffe8863f9ef1666a0fa4eeb8a165a072cdfb Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Wed, 1 Oct 2025 20:59:44 -0400 Subject: [PATCH] add new role information to try and fix broken gamemanager --- MiraAPI/Patches/Events/EndGamePatches.cs | 9 --------- MiraAPI/Roles/CustomRoleManager.cs | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/MiraAPI/Patches/Events/EndGamePatches.cs b/MiraAPI/Patches/Events/EndGamePatches.cs index fe5a7bb..aa47539 100644 --- a/MiraAPI/Patches/Events/EndGamePatches.cs +++ b/MiraAPI/Patches/Events/EndGamePatches.cs @@ -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 { diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index d16153b..031564a 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -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 CustomRoles = []; internal static readonly Dictionary RoleIds = []; + private static Il2CppSystem.Collections.Generic.List? _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();