first commit
This commit is contained in:
29
NitroxPatcher/Patches/Dynamic/Player_Update_Patch.cs
Normal file
29
NitroxPatcher/Patches/Dynamic/Player_Update_Patch.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.MonoBehaviours.Gui.Input;
|
||||
using NitroxClient.MonoBehaviours.Gui.Input.KeyBindings;
|
||||
using NitroxModel.Helper;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
public sealed partial class Player_Update_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((Player t) => t.Update());
|
||||
|
||||
public static void Postfix(Player __instance)
|
||||
{
|
||||
// TODO: Use proper way to check if input is free, because players can be editing labels etc.
|
||||
if (DevConsole.instance.state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KeyBindingManager keyBindingManager = new();
|
||||
foreach (KeyBinding keyBinding in keyBindingManager.KeyboardKeyBindings)
|
||||
{
|
||||
if (GameInput.GetButtonDown(keyBinding.Button))
|
||||
{
|
||||
keyBinding.Action.Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user