vent patch improvements

This commit is contained in:
XtraCube committed 2024-09-13 20:03:46 -04:00
1 parent 6ee83f8c7d
commit cda441ee56
3 files changed
+10 -17

No files matched your search

+2 -2
View File
@@ -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);
}
-13
View File
@@ -11,19 +11,6 @@ namespace MiraAPI.Patches.Roles;
[HarmonyPatch(typeof(Vent))]
public static class VentPatches
{
/// <summary>
/// Set CanVent of player to customRole CanUseVent because the original one isnt a property :(.
/// </summary>
[HarmonyPrefix]
[HarmonyPatch(nameof(Vent.CanUse))]
public static void CanUsePrefix(Vent __instance, NetworkedPlayerInfo pc)
{
if (pc.Role is ICustomRole customRole)
{
pc.Role.CanVent = customRole.CanUseVent;
}
}
/// <summary>
/// Set outline to player's custom role color.
/// </summary>
@@ -3,14 +3,20 @@ using MiraAPI.Roles;
using MiraAPI.Utilities;
using UnityEngine;
namespace MiraAPI.Patches.Modifiers;
namespace MiraAPI.Patches;
/// <summary>
/// Vent patches to make sure the player is able to use the vent.
/// </summary>
[HarmonyPatch(typeof(Vent))]
public static class VentPatches
{
/// <summary>
/// CanUse patch.
/// </summary>
[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;