UPDATE 0.01 C
This commit is contained in:
+61
-16
@@ -20,6 +20,14 @@ namespace Lithium
|
|||||||
private bool refreshHeld = false;
|
private bool refreshHeld = false;
|
||||||
private bool switchSideHeld = false;
|
private bool switchSideHeld = false;
|
||||||
|
|
||||||
|
// CapsLock recoil toggle
|
||||||
|
private bool recoilEnabled = true;
|
||||||
|
private bool capsHeld = false;
|
||||||
|
|
||||||
|
// NEW: cooldown timestamps
|
||||||
|
private DateTime nextSetAllowed = DateTime.MinValue;
|
||||||
|
private DateTime prevSetAllowed = DateTime.MinValue;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -48,18 +56,23 @@ namespace Lithium
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// RECOIL SYSTEM (THIS IS WHAT WAS MISSING)
|
// RECOIL ENGINE (CapsLock toggle + both mouse buttons required)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
private void RecoilLoop()
|
private void RecoilLoop()
|
||||||
{
|
{
|
||||||
const int RIGHT_MOUSE = 0x02; // Right mouse button
|
const int RIGHT_MOUSE = 0x02;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
bool leftPressed = Utils.IsPressed(ConfigLoader.shootKey); // 0x01
|
if (!recoilEnabled)
|
||||||
bool rightPressed = Utils.IsPressed(RIGHT_MOUSE); // 0x02
|
{
|
||||||
|
Thread.Sleep(1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool leftPressed = Utils.IsPressed(ConfigLoader.shootKey);
|
||||||
|
bool rightPressed = Utils.IsPressed(RIGHT_MOUSE);
|
||||||
|
|
||||||
// Only trigger recoil when BOTH are held
|
|
||||||
bool shouldFire = leftPressed && rightPressed;
|
bool shouldFire = leftPressed && rightPressed;
|
||||||
|
|
||||||
if (shouldFire)
|
if (shouldFire)
|
||||||
@@ -79,40 +92,69 @@ namespace Lithium
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// HOTKEY THREAD (debounced)
|
// HOTKEY THREAD (debounced + cooldowns + CapsLock toggle)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
private void HotkeyLoop()
|
private void HotkeyLoop()
|
||||||
{
|
{
|
||||||
|
const int CAPSLOCK = 0x14;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Next Set
|
// -------------------------------
|
||||||
|
// CAPSLOCK → Toggle recoil
|
||||||
|
// -------------------------------
|
||||||
|
bool capsDown = Utils.IsPressed(CAPSLOCK);
|
||||||
|
|
||||||
|
if (capsDown && !capsHeld)
|
||||||
|
{
|
||||||
|
capsHeld = true;
|
||||||
|
|
||||||
|
recoilEnabled = !recoilEnabled;
|
||||||
|
|
||||||
|
AppendConsole(recoilEnabled ? "Recoil Enabled" : "Recoil Disabled");
|
||||||
|
}
|
||||||
|
if (!capsDown) capsHeld = false;
|
||||||
|
|
||||||
|
// -------------------------------
|
||||||
|
// NEXT SET (cooldown)
|
||||||
|
// -------------------------------
|
||||||
bool nextDown = Utils.IsPressed(ConfigLoader.nextSetKey);
|
bool nextDown = Utils.IsPressed(ConfigLoader.nextSetKey);
|
||||||
if (nextDown && !nextSetHeld)
|
|
||||||
|
if (nextDown && !nextSetHeld && DateTime.Now >= nextSetAllowed)
|
||||||
{
|
{
|
||||||
nextSetHeld = true;
|
nextSetHeld = true;
|
||||||
|
|
||||||
|
nextSetAllowed = DateTime.Now.AddMilliseconds(200);
|
||||||
|
|
||||||
OperatorSets.NextSet();
|
OperatorSets.NextSet();
|
||||||
AppendConsole("Next Set → " + OperatorSets.CurrentSet);
|
AppendConsole("Next Set → " + OperatorSets.CurrentSet);
|
||||||
Utils.SafeSpeak(OperatorSets.CurrentSet);
|
Utils.SafeSpeak(OperatorSets.CurrentSet);
|
||||||
}
|
}
|
||||||
if (!nextDown) nextSetHeld = false;
|
if (!nextDown) nextSetHeld = false;
|
||||||
|
|
||||||
// Previous Set
|
// -------------------------------
|
||||||
|
// PREVIOUS SET (cooldown)
|
||||||
|
// -------------------------------
|
||||||
bool prevDown = Utils.IsPressed(ConfigLoader.prevSetKey);
|
bool prevDown = Utils.IsPressed(ConfigLoader.prevSetKey);
|
||||||
if (prevDown && !prevSetHeld)
|
|
||||||
|
if (prevDown && !prevSetHeld && DateTime.Now >= prevSetAllowed)
|
||||||
{
|
{
|
||||||
prevSetHeld = true;
|
prevSetHeld = true;
|
||||||
|
|
||||||
|
prevSetAllowed = DateTime.Now.AddMilliseconds(200);
|
||||||
|
|
||||||
OperatorSets.PreviousSet();
|
OperatorSets.PreviousSet();
|
||||||
AppendConsole("Previous Set → " + OperatorSets.CurrentSet);
|
AppendConsole("Previous Set → " + OperatorSets.CurrentSet);
|
||||||
Utils.SafeSpeak(OperatorSets.CurrentSet);
|
Utils.SafeSpeak(OperatorSets.CurrentSet);
|
||||||
}
|
}
|
||||||
if (!prevDown) prevSetHeld = false;
|
if (!prevDown) prevSetHeld = false;
|
||||||
|
|
||||||
// Reload config
|
// -------------------------------
|
||||||
|
// RELOAD CONFIG
|
||||||
|
// -------------------------------
|
||||||
bool refreshDown = Utils.IsPressed(ConfigLoader.refreshKey);
|
bool refreshDown = Utils.IsPressed(ConfigLoader.refreshKey);
|
||||||
|
|
||||||
if (refreshDown && !refreshHeld)
|
if (refreshDown && !refreshHeld)
|
||||||
{
|
{
|
||||||
refreshHeld = true;
|
refreshHeld = true;
|
||||||
@@ -121,8 +163,11 @@ namespace Lithium
|
|||||||
}
|
}
|
||||||
if (!refreshDown) refreshHeld = false;
|
if (!refreshDown) refreshHeld = false;
|
||||||
|
|
||||||
// Switch Side
|
// -------------------------------
|
||||||
|
// SWITCH SIDE
|
||||||
|
// -------------------------------
|
||||||
bool switchDown = Utils.IsPressed(ConfigLoader.switchSideKey);
|
bool switchDown = Utils.IsPressed(ConfigLoader.switchSideKey);
|
||||||
|
|
||||||
if (switchDown && !switchSideHeld)
|
if (switchDown && !switchSideHeld)
|
||||||
{
|
{
|
||||||
switchSideHeld = true;
|
switchSideHeld = true;
|
||||||
@@ -136,7 +181,7 @@ namespace Lithium
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// SAFE UI CONSOLE APPEND
|
// UI CONSOLE
|
||||||
// ============================================================
|
// ============================================================
|
||||||
public void AppendConsole(string msg)
|
public void AppendConsole(string msg)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user