Skip to content

Commit

Permalink
Reduced sensitivity on baby shaking
Browse files Browse the repository at this point in the history
  • Loading branch information
DaXcess committed Aug 22, 2024
1 parent bcc0284 commit 1853ddc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Anyways here's the update go boil the creatures or something.
- Fixed lights from collected items bleeding into the world
- Fixed collected items being scannable in the UI
- Fixed hangar levers not being able to be disabled in settings
- Fixed parenting issues with spectator ghosts due to ternary operation order mistakes

**Removals**:

Expand Down
38 changes: 35 additions & 3 deletions Source/Items/VRManeaterBaby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ internal class VRManEaterBaby : VRItem<CaveDwellerPhysicsProp>
private ShakeDetector shakeBig;

private Coroutine stopRockingCoroutine;
private Coroutine rockHardCoroutine;

private int rockHardTicks;
private bool isRockHard;

private new void Awake()
Expand Down Expand Up @@ -59,11 +62,24 @@ private void OnShakeBigMotion()

if (player.isGrabbingObjectAnimation || player.inTerminalMenu || player.inSpecialInteractAnimation)
return;

// If already rocking hard, let every tick reset the stop timer
if (isRockHard)
{
if (stopRockingCoroutine != null)
StopCoroutine(stopRockingCoroutine);

StartRocking(true);

return;
}

if (stopRockingCoroutine != null)
StopCoroutine(stopRockingCoroutine);
rockHardTicks++;

StartRocking(true);
if (rockHardCoroutine != null)
return;

rockHardCoroutine = StartCoroutine(KeepRockingHard());
}

private void StartRocking(bool rockHard)
Expand All @@ -89,6 +105,22 @@ private IEnumerator StopRockingBaby(float timeout)
stopRockingCoroutine = null;
}

private IEnumerator KeepRockingHard()
{
yield return new WaitForSeconds(0.75f);

if (rockHardTicks > 5)
{
if (stopRockingCoroutine != null)
StopCoroutine(stopRockingCoroutine);

StartRocking(true);
}

rockHardTicks = 0;
rockHardCoroutine = null;
}

protected override void OnUpdate()
{
shake.Update();
Expand Down

0 comments on commit 1853ddc

Please sign in to comment.