mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
vent patch improvements
This commit is contained in:
1 parent
6ee83f8c7d
commit
cda441ee56
3 files changed
+10
-17
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user