mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-06-21 05:58:02 +00:00
35 lines
No EOL
1 KiB
C#
35 lines
No EOL
1 KiB
C#
using ABI_RC.Systems.InputManagement.InputModules;
|
|
using System.Reflection;
|
|
using ABI_RC.Core.PropManagement;
|
|
using HarmonyLib;
|
|
using MelonLoader;
|
|
using UnityEngine;
|
|
|
|
namespace NAK.PropUndoButton;
|
|
|
|
public class PropUndoButton : MelonMod
|
|
{
|
|
public override void OnInitializeMelon()
|
|
{
|
|
HarmonyInstance.Patch( // desktop input patch so we don't run in menus/gui
|
|
typeof(CVRInputModule_Keyboard).GetMethod(nameof(CVRInputModule_Keyboard.Update_Binds)),
|
|
postfix: new HarmonyMethod(typeof(PropUndoButton).GetMethod(nameof(OnUpdateInput),
|
|
BindingFlags.NonPublic | BindingFlags.Static))
|
|
);
|
|
}
|
|
|
|
private static void OnUpdateInput()
|
|
{
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
{
|
|
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Z))
|
|
{
|
|
PropUserActions.Redo();
|
|
}
|
|
else if (Input.GetKeyDown(KeyCode.Z))
|
|
{
|
|
PropUserActions.Undo();
|
|
}
|
|
}
|
|
}
|
|
} |