diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index feb2921..212f6f2 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -99,11 +99,6 @@ public static class PlayerControlPatches [HarmonyPatch(nameof(PlayerControl.FixedUpdate))] public static void PlayerControlFixedUpdatePostfix(PlayerControl __instance) { - if (__instance.Data?.Role is ICustomRole customRole) - { - customRole.PlayerControlFixedUpdate(__instance); - } - if (!__instance.AmOwner) { return; diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 6bf8b27..0240090 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -5,29 +5,15 @@ using Reactor.Utilities.Extensions; namespace MiraAPI.Patches.Roles; -/// -/// HudManager patches for roles. -/// [HarmonyPatch(typeof(HudManager))] -public static class HudManagerPatches +internal static class HudManagerPatches { - // Custom role tab. private static TaskPanelBehaviour? _roleTab; - /// - /// Fixes Kill Button not showing for Neutral killing role. - /// - /// HudManager instance. - /// The local PlayerControl. - /// The player's RoleBehaviour. - /// Whether the Hud should be set active or not. [HarmonyPostfix] [HarmonyPatch(nameof(HudManager.SetHudActive), typeof(PlayerControl), typeof(RoleBehaviour), typeof(bool))] - public static void SetHudActivePostfix( - HudManager __instance, - PlayerControl localPlayer, - RoleBehaviour role, - bool isActive) + // ReSharper disable once InconsistentNaming + public static void SetHudActivePostfix(HudManager __instance, PlayerControl localPlayer, RoleBehaviour role, bool isActive) { var flag = localPlayer.Data != null && localPlayer.Data.IsDead; @@ -44,11 +30,9 @@ public static class HudManagerPatches } } - /// - /// Update custom role tab and custom role hud elements. - /// [HarmonyPostfix] [HarmonyPatch(nameof(HudManager.Update))] + // ReSharper disable once InconsistentNaming public static void UpdatePostfix(HudManager __instance) { var local = PlayerControl.LocalPlayer; @@ -62,8 +46,6 @@ public static class HudManagerPatches if (role is ICustomRole { Configuration.RoleHintType: RoleHintType.RoleTab } customRole) { - customRole.HudUpdate(__instance); - if (_roleTab == null) { _roleTab = CustomRoleManager.CreateRoleTab(customRole); @@ -71,9 +53,9 @@ public static class HudManagerPatches CustomRoleManager.UpdateRoleTab(_roleTab, customRole); } - else if (_roleTab) + else if (_roleTab != null) { - _roleTab?.gameObject.Destroy(); + _roleTab.gameObject.Destroy(); } } } diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index 1784702..87d8c08 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -74,14 +74,6 @@ public interface ICustomRole : IOptionable /// MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this); - /// - /// This method runs on the PlayerControl.FixedUpdate method for ALL players with this role. - /// - /// The PlayerControl that has this role. - void PlayerControlFixedUpdate(PlayerControl playerControl) - { - } - internal ConfigDefinition NumConfigDefinition => new("Roles", $"Num {GetType().FullName}"); internal ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance {GetType().FullName}"); @@ -184,14 +176,6 @@ public interface ICustomRole : IOptionable return true; } - /// - /// This method runs on the HudManager.Update method ONLY when the LOCAL player has this role. - /// - /// Reference to HudManager instance. - void HudUpdate(HudManager hudManager) - { - } - /// /// Gets a custom ejection message for the role. Return null to use the default message. ///