NAK_CVR_Mods/TwoWayMute/Main.cs
2024-12-27 17:55:39 -06:00

24 lines
No EOL
803 B
C#

using System.Reflection;
using ABI_RC.Systems.Communications.Audio.Components;
using HarmonyLib;
using MelonLoader;
namespace NAK.TwoWayMute;
public class TwoWayMuteMod : MelonMod
{
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(Comms_ParticipantPipeline).GetMethod(nameof(Comms_ParticipantPipeline.SetFlowControlState),
BindingFlags.NonPublic | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(TwoWayMuteMod).GetMethod(nameof(OnSetFlowControlState),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
private static void OnSetFlowControlState(
ref bool state,
Comms_ParticipantPipeline __instance)
=> state &= !__instance._selfModerationMute;
}