From c1d0bb5d2610e56bf660e6cfd905a569dcd98ba3 Mon Sep 17 00:00:00 2001 From: amber Date: Thu, 11 Jun 2026 22:34:27 -0400 Subject: [PATCH] Seperate vanilla vent data receiving from the actual button --- MiraAPI.Example/Roles/NeutralKillerRole.cs | 3 ++- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Patches/VentCanUsePatch.cs | 2 +- MiraAPI/Roles/CustomRoleConfiguration.cs | 14 +++++++++++++- MiraAPI/Roles/CustomRoleManager.cs | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/MiraAPI.Example/Roles/NeutralKillerRole.cs b/MiraAPI.Example/Roles/NeutralKillerRole.cs index 1afa4eb..640e86c 100644 --- a/MiraAPI.Example/Roles/NeutralKillerRole.cs +++ b/MiraAPI.Example/Roles/NeutralKillerRole.cs @@ -18,7 +18,8 @@ public class NeutralKillerRole : ImpostorRole, ICustomRole { UseVanillaKillButton = true, CanGetKilled = true, - CanUseVent = true, + GetsVentData = true, + UseVanillaVentButton = true, }; public RoleOptionsGroup RoleOptionsGroup { get; } = new("Outcast", Color.gray); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 348f739..6d274f9 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -34,7 +34,7 @@ public static class HudManagerPatches if (role is ICustomRole customRole) { __instance.KillButton.ToggleVisible(isActive && customRole.Configuration.UseVanillaKillButton && !flag); - __instance.ImpostorVentButton.ToggleVisible(isActive && customRole.Configuration.CanUseVent && !flag); + __instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent || customRole.Configuration.UseVanillaVentButton) && !flag); __instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage); } diff --git a/MiraAPI/Patches/VentCanUsePatch.cs b/MiraAPI/Patches/VentCanUsePatch.cs index b285411..b2bea09 100644 --- a/MiraAPI/Patches/VentCanUsePatch.cs +++ b/MiraAPI/Patches/VentCanUsePatch.cs @@ -28,7 +28,7 @@ internal static class VentCanUsePatch var @object = pc.Object; var role = @object.Data.Role; - var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent : role.CanVent; + var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton : role.CanVent; couldUse = canVent; var modifiers = @object.GetModifierComponent().ActiveModifiers; diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index a11ddc0..9c58103 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -39,7 +39,8 @@ public record struct CustomRoleConfiguration GhostRole = role.Team is ModdedRoleTeams.Impostor ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost; CanGetKilled = roleBehaviour?.IsDead == false && role.Team is not ModdedRoleTeams.Impostor; UseVanillaKillButton = role.Team is ModdedRoleTeams.Impostor; - CanUseVent = role.Team is ModdedRoleTeams.Impostor; + GetsVentData = role.Team is ModdedRoleTeams.Impostor; + UseVanillaVentButton = role.Team is ModdedRoleTeams.Impostor; CanUseSabotage = role.Team is ModdedRoleTeams.Impostor; TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate; HideSettings = roleBehaviour?.IsDead == true; @@ -111,8 +112,19 @@ public record struct CustomRoleConfiguration /// /// Gets or sets a value indicating whether the role can use vents. /// + [Obsolete("The equivalent of having both GetsVentData and UseVanillaVentButton as true. Only remains for compatability.")] public bool CanUseVent { get; set; } + /// + /// Gets or sets a value indicating whether the role can receive vanilla vent data. + /// + public bool GetsVentData { get; set; } + + /// + /// Gets or sets a value indicating whether the role can use the vanilla vent button. + /// + public bool UseVanillaVentButton { get; set; } + /// /// Gets or sets a value indicating whether the role can use the sabotage button. /// diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 0bbf4eb..458654f 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -139,7 +139,7 @@ public static class CustomRoleManager roleBehaviour.CanBeKilled = customRole.Configuration.CanGetKilled; roleBehaviour.CanUseKillButton = customRole.Configuration.UseVanillaKillButton; roleBehaviour.TasksCountTowardProgress = customRole.Configuration.TasksCountForProgress; - roleBehaviour.CanVent = customRole.Configuration.CanUseVent; + roleBehaviour.CanVent = customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton; roleBehaviour.DefaultGhostRole = customRole.Configuration.GhostRole; roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount; roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset();