2021-10-15 21:06:51 +01:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using QSB.Patches;
|
2021-06-11 14:34:27 +01:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
namespace QSB.Inputs.Patches;
|
|
|
|
|
|
|
|
|
|
[HarmonyPatch]
|
|
|
|
|
internal class InputPatches : QSBPatch
|
2021-06-11 14:34:27 +01:00
|
|
|
|
{
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
2021-06-11 14:34:27 +01:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
[HarmonyPrefix]
|
2022-11-08 15:15:45 +00:00
|
|
|
|
[HarmonyPatch(typeof(AbstractCommands), nameof(AbstractCommands.Update))]
|
|
|
|
|
public static bool AbstractCommands_Update(AbstractCommands __instance)
|
|
|
|
|
{
|
2022-11-08 18:56:14 +00:00
|
|
|
|
if (QSBInputManager.Instance.InputsEnabled)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-08 15:15:45 +00:00
|
|
|
|
__instance.Consumed = false;
|
|
|
|
|
__instance.WasActiveLastFrame = __instance.IsActiveThisFrame;
|
|
|
|
|
__instance.IsActiveThisFrame = false;
|
|
|
|
|
|
|
|
|
|
if (__instance.WasActiveLastFrame)
|
|
|
|
|
{
|
|
|
|
|
__instance.InputStartedTime = float.MaxValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-02-24 22:04:54 -08:00
|
|
|
|
}
|