TwoWayMute: initial release

This commit is contained in:
NotAKidoS 2024-12-27 17:55:39 -06:00
parent 3d42301f24
commit e027829103
6 changed files with 111 additions and 18 deletions

24
TwoWayMute/Main.cs Normal file
View file

@ -0,0 +1,24 @@
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;
}