Update 0.01 F

This commit is contained in:
JJ
2025-11-24 15:25:14 -05:00
parent 16fb766d9a
commit eb7c682443
2 changed files with 36 additions and 30 deletions
+2 -1
View File
@@ -52,7 +52,8 @@ namespace Lithium
t.Start();
}
private void RecoilLoop() => RecoilEngine.Start();
private void RecoilLoop() => RecoilEngine.Start(this);
private void HotkeyLoop() => HotkeyHandler.Start(this);
+25 -20
View File
@@ -1,4 +1,5 @@
using System;
using Lithium;
using System;
using System.Threading;
namespace Lua
@@ -15,11 +16,11 @@ namespace Lua
private static double _remainderX, _remainderY;
private static double _jitterMultiplierX, _jitterMultiplierY;
public static void Start()
public static void Start(MainWindow window)
{
while (true)
{
if (Utils.IsCapsLockOn() && Utils.IsPressed(VK_RBUTTON))
if (window.IsRecoilEnabled && Utils.IsPressed(VK_LBUTTON) && Utils.IsPressed(VK_RBUTTON))
{
HandleRecoilTick();
}
@@ -28,10 +29,14 @@ namespace Lua
_remainderX = _remainderY = 0;
_jitterActive = false;
}
Thread.Sleep(2);
}
}
private static void HandleRecoilTick()
{
if (!Utils.IsPressed(VK_LBUTTON)) return;
@@ -48,23 +53,16 @@ namespace Lua
private static void HandleJitter(int now)
{
if (ConfigLoader.jitterEnabled)
{
if (!ConfigLoader.jitterEnabled) return;
if (!_jitterActive && now - _lastJitterEnd >= ConfigLoader.jitterCooldown)
{
_jitterActive = true;
_jitterStart = now;
double strength = 0.1 + _rng.NextDouble() * 0.8;
_jitterMultiplierX = _jitterMultiplierY = 0;
switch (_rng.Next(1, 5))
{
case 1: _jitterMultiplierX = -strength; break;
case 2: _jitterMultiplierX = strength; break;
case 3: _jitterMultiplierY = -strength; break;
case 4: _jitterMultiplierY = strength; break;
}
// Set small random jitter multipliers
_jitterMultiplierX = (_rng.NextDouble() - 0.5) * 0.2; // ±0.1
_jitterMultiplierY = (_rng.NextDouble() - 0.5) * 0.2;
}
if (_jitterActive && now - _jitterStart >= ConfigLoader.jitterBurstTime)
@@ -74,22 +72,28 @@ namespace Lua
_jitterMultiplierX = _jitterMultiplierY = 0;
}
}
}
private static void ApplyRecoil((double recoilX, double recoilY) recoil)
{
double jitterX = recoil.recoilX * _jitterMultiplierX;
double jitterY = recoil.recoilY * _jitterMultiplierY;
// Apply base recoil first
double moveX = recoil.recoilX;
double moveY = recoil.recoilY;
double moveX = recoil.recoilX + _remainderX + jitterX;
double moveY = recoil.recoilY + _remainderY + jitterY;
// Apply optional multiplier for jitter
moveX += recoil.recoilX * _jitterMultiplierX;
moveY += recoil.recoilY * _jitterMultiplierY;
// Apply any global scaling
if (ConfigLoader.debitFlag1)
{
moveX *= 1.282;
moveY *= 1.351;
}
// Add remainder for precision
moveX += _remainderX;
moveY += _remainderY;
int ix = (int)Math.Round(moveX);
int iy = (int)Math.Round(moveY);
@@ -98,5 +102,6 @@ namespace Lua
Utils.MoveMouse(ix, iy);
}
}
}