quantum-space-buddies/QSB/Inputs/Patches/InputPatches.cs
Mister_Nebula 9e0dbe55bb gorp
2022-11-08 18:56:14 +00:00

31 lines
689 B
C#

using HarmonyLib;
using QSB.Patches;
namespace QSB.Inputs.Patches;
[HarmonyPatch]
internal class InputPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPrefix]
[HarmonyPatch(typeof(AbstractCommands), nameof(AbstractCommands.Update))]
public static bool AbstractCommands_Update(AbstractCommands __instance)
{
if (QSBInputManager.Instance.InputsEnabled)
{
return true;
}
__instance.Consumed = false;
__instance.WasActiveLastFrame = __instance.IsActiveThisFrame;
__instance.IsActiveThisFrame = false;
if (__instance.WasActiveLastFrame)
{
__instance.InputStartedTime = float.MaxValue;
}
return false;
}
}