diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index f833651..afe857f 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -29,8 +29,8 @@ public static class HudManagerPatches if (role is ICustomRole customRole) { - __instance.KillButton.ToggleVisible(isActive && role.CanUseKillButton && !flag); - __instance.ImpostorVentButton.ToggleVisible(isActive && role.CanVent && !flag); + __instance.KillButton.ToggleVisible(isActive && customRole.UseVanillaKillButton && !flag); + __instance.ImpostorVentButton.ToggleVisible(isActive && customRole.CanUseVent && !flag); __instance.SabotageButton.gameObject.SetActive(isActive && customRole.CanUseSabotage); } diff --git a/MiraAPI/Patches/Roles/VentPatches.cs b/MiraAPI/Patches/Roles/VentPatches.cs index 5ae7035..6ff28f8 100644 --- a/MiraAPI/Patches/Roles/VentPatches.cs +++ b/MiraAPI/Patches/Roles/VentPatches.cs @@ -11,19 +11,6 @@ namespace MiraAPI.Patches.Roles; [HarmonyPatch(typeof(Vent))] public static class VentPatches { - /// - /// Set CanVent of player to customRole CanUseVent because the original one isnt a property :(. - /// - [HarmonyPrefix] - [HarmonyPatch(nameof(Vent.CanUse))] - public static void CanUsePrefix(Vent __instance, NetworkedPlayerInfo pc) - { - if (pc.Role is ICustomRole customRole) - { - pc.Role.CanVent = customRole.CanUseVent; - } - } - /// /// Set outline to player's custom role color. /// diff --git a/MiraAPI/Patches/Modifiers/VentPatches.cs b/MiraAPI/Patches/VentPatches.cs similarity index 77% rename from MiraAPI/Patches/Modifiers/VentPatches.cs rename to MiraAPI/Patches/VentPatches.cs index 5786055..eb1496e 100644 --- a/MiraAPI/Patches/Modifiers/VentPatches.cs +++ b/MiraAPI/Patches/VentPatches.cs @@ -3,14 +3,20 @@ using MiraAPI.Roles; using MiraAPI.Utilities; using UnityEngine; -namespace MiraAPI.Patches.Modifiers; +namespace MiraAPI.Patches; +/// +/// Vent patches to make sure the player is able to use the vent. +/// [HarmonyPatch(typeof(Vent))] public static class VentPatches { + /// + /// CanUse patch. + /// [HarmonyPostfix] [HarmonyPatch(nameof(Vent.CanUse))] - public static void CanUseVentPatch(Vent __instance, ref float __result, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse) + public static void VentCanUsePostfix(Vent __instance, ref float __result, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse) { var @object = pc.Object; var role = @object.Data.Role;