From 1d7bb5d3eb6397039f55efd7053c759abf090ce5 Mon Sep 17 00:00:00 2001 From: Izuna Date: Mon, 24 Feb 2025 20:12:13 +0100 Subject: [PATCH] fix(AutoQueue/Custom): module control --- .../autoqueue/presets/AutoQueueCustom.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/autoqueue/presets/AutoQueueCustom.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/autoqueue/presets/AutoQueueCustom.kt index b60c96947b0..7b4c61e3aaa 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/autoqueue/presets/AutoQueueCustom.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/autoqueue/presets/AutoQueueCustom.kt @@ -55,24 +55,27 @@ object AutoQueueCustom : Choice("Custom") { ) } - object Control : ToggleableConfigurable(this, "Control", true) { + private object AutoQueueControl : ToggleableConfigurable(this, "Control", true) { val killAura by boolean("KillAura", true) val speed by boolean("Speed", false) - fun changeGameState(isInGame: Boolean) { - if (!enabled) { - return - } + var wasInQueue = false + set(value) { + field = value - if (killAura) ModuleKillAura.enabled = isInGame - if (speed) ModuleSpeed.enabled = isInGame - } + if (!enabled) { + return + } + + if (killAura) ModuleKillAura.enabled = !value + if (speed) ModuleSpeed.enabled = !value + } } init { - tree(Control) + tree(AutoQueueControl) } private val waitUntilWorldChange by boolean("WaitUntilWorldChange", true) @@ -83,18 +86,17 @@ object AutoQueueCustom : Choice("Custom") { val trigger = triggers.activeChoice if (trigger.isTriggered) { - Control.changeGameState(false) + AutoQueueControl.wasInQueue = true actions.activeChoice.execute(this) - onCancellation { Control.changeGameState(true) } if (waitUntilWorldChange) { waitUntil { worldChangeOccurred } worldChangeOccurred = false } - waitTicks(20) - Control.changeGameState(true) + } else if (AutoQueueControl.enabled && AutoQueueControl.wasInQueue) { + AutoQueueControl.wasInQueue = false } }