mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 23:39:22 +00:00
[DoubleTapJumpToExitSeat] bump for release
This commit is contained in:
parent
8ad74b5ef6
commit
21b791083b
3 changed files with 10 additions and 21 deletions
|
@ -1,6 +1,5 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using ABI_RC.Systems.InputManagement;
|
using ABI_RC.Systems.InputManagement;
|
||||||
using ABI_RC.Systems.Movement;
|
using ABI_RC.Systems.Movement;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
@ -11,16 +10,6 @@ namespace NAK.DoubleTapJumpToExitSeat;
|
||||||
|
|
||||||
public class DoubleTapJumpToExitSeatMod : MelonMod
|
public class DoubleTapJumpToExitSeatMod : MelonMod
|
||||||
{
|
{
|
||||||
#region Melon Preferences
|
|
||||||
|
|
||||||
public static readonly MelonPreferences_Category Category =
|
|
||||||
MelonPreferences.CreateCategory(nameof(DoubleTapJumpToExitSeatMod));
|
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryOnlyInVR =
|
|
||||||
Category.CreateEntry("only_in_vr", false, display_name: "Only In VR", description: "Should this behaviour only be active in VR?");
|
|
||||||
|
|
||||||
#endregion Melon Preferences
|
|
||||||
|
|
||||||
#region Melon Events
|
#region Melon Events
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
|
@ -54,8 +43,8 @@ public class DoubleTapJumpToExitSeatMod : MelonMod
|
||||||
|
|
||||||
#region Harmony Patches
|
#region Harmony Patches
|
||||||
|
|
||||||
private static float lastJumpTime = -1f;
|
private static float _lastJumpTime = -1f;
|
||||||
private static bool wasJumping;
|
private static bool _wasJumping;
|
||||||
|
|
||||||
private static bool OnPreCVRSeatUpdate(CVRSeat __instance)
|
private static bool OnPreCVRSeatUpdate(CVRSeat __instance)
|
||||||
{
|
{
|
||||||
|
@ -63,18 +52,18 @@ public class DoubleTapJumpToExitSeatMod : MelonMod
|
||||||
|
|
||||||
// Crazy?
|
// Crazy?
|
||||||
bool jumped = CVRInputManager.Instance.jump;
|
bool jumped = CVRInputManager.Instance.jump;
|
||||||
bool justJumped = jumped && !wasJumping;
|
bool justJumped = jumped && !_wasJumping;
|
||||||
wasJumping = jumped;
|
_wasJumping = jumped;
|
||||||
if (justJumped && (!EntryOnlyInVR.Value || MetaPort.Instance.isUsingVr))
|
if (justJumped)
|
||||||
{
|
{
|
||||||
float t = Time.time;
|
float t = Time.time;
|
||||||
if (t - lastJumpTime <= BetterBetterCharacterController.DoubleJumpFlightTimeOut)
|
if (t - _lastJumpTime <= BetterBetterCharacterController.DoubleJumpFlightTimeOut)
|
||||||
{
|
{
|
||||||
lastJumpTime = -1f;
|
_lastJumpTime = -1f;
|
||||||
__instance.ExitSeat();
|
__instance.ExitSeat();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
lastJumpTime = t;
|
_lastJumpTime = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double update this frame (this ensures Extrapolate / Every Frame Updated objects are seated correctly)
|
// Double update this frame (this ensures Extrapolate / Every Frame Updated objects are seated correctly)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# DoubleTapJumpToExitSeat
|
# DoubleTapJumpToExitSeat
|
||||||
|
|
||||||
Literally the mod name.
|
Replaces seat exit controls with a double-tap of the jump button, avoiding accidental exits from joystick drift or opening the menu.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"loaderversion": "0.6.1",
|
"loaderversion": "0.6.1",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
"author": "NotAKidoS",
|
"author": "NotAKidoS",
|
||||||
"description": "Literally the mod name.",
|
"description": "Replaces seat exit controls with a double-tap of the jump button, avoiding accidental exits from joystick drift or opening the menu.",
|
||||||
"searchtags": [
|
"searchtags": [
|
||||||
"double",
|
"double",
|
||||||
"jump",
|
"jump",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue