diff --git a/MiraAPI/MeetingAbilities/MeetingActionButton.cs b/MiraAPI/MeetingAbilities/MeetingActionButton.cs
index 88cc799..dd733af 100644
--- a/MiraAPI/MeetingAbilities/MeetingActionButton.cs
+++ b/MiraAPI/MeetingAbilities/MeetingActionButton.cs
@@ -71,6 +71,26 @@ public abstract class MeetingActionButton
///
public bool TimerPaused { get; set; }
+ ///
+ /// Gets or sets a value indicating how many times the ability was used in the current meeting.
+ ///
+ public int UsesSoFar { get; set; }
+
+ ///
+ /// Gets a value determining if the abiity is disabled upon being used.
+ ///
+ public virtual bool DisableUponUse => false;
+
+ ///
+ /// Gets a value determining if the abiity is disabled upon voting.
+ ///
+ public virtual bool DisableUponVoting => false;
+
+ ///
+ /// Gets a value determining if the abiity is hidden when votes wrapping up.
+ ///
+ public virtual bool HideUponWrapUp => false;
+
///
/// Gets or sets the amount of uses left.
///
@@ -107,6 +127,7 @@ public abstract class MeetingActionButton
Button.graphic.sprite = Sprite.LoadAsset();
Button.SetUsesRemaining(UsesLeft);
+ UsesSoFar = 0;
if (MaxUses <= 0)
{
Button.SetInfiniteUses();
@@ -264,7 +285,9 @@ public abstract class MeetingActionButton
/// A value that represents whether the button should light up or not.
public virtual bool CanUse()
{
- return !LimitedUses || UsesLeft > 0;
+ return (!DisableUponUse || UsesSoFar < 1) &&
+ (!DisableUponVoting || MeetingHud.Instance.CurrentState is not MeetingHud.MeetingStates.Voted) &&
+ (!LimitedUses || UsesLeft > 0);
}
///
@@ -287,6 +310,11 @@ public abstract class MeetingActionButton
Timer = Cooldown;
OnClick();
+ UsesSoFar++;
+ if (DisableUponUse && Button)
+ {
+ Button!.SetDisabled();
+ }
}
///
diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
index e907f34..80ab9d6 100644
--- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs
+++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
@@ -111,6 +111,15 @@ internal static class MeetingHudPatches
[HarmonyPatch(nameof(MeetingHud.VotingComplete))]
public static void VotingCompletePatch(MeetingHud __instance)
{
+ foreach (var meetingAbility in MeetingButtonManager.UntargetedButtons.Where(x => x.Enabled(PlayerControl.LocalPlayer.Data.Role) &&
+ (x.DisableUponVoting || x.HideUponWrapUp)))
+ {
+ meetingAbility.UpdateHandler(__instance);
+ if (meetingAbility.Button)
+ {
+ meetingAbility.Button!.SetDisabled();
+ }
+ }
MiraEventManager.InvokeEvent(new VotingCompleteEvent(__instance));
}