[feature] lagmonitor pause w/ non-baritone autowalk (#1580)

This commit is contained in:
Dewy 2020-12-30 16:00:49 +00:00
parent 899979bb45
commit 0aaeae7b6d
No known key found for this signature in database
GPG Key ID: 7E581A0C01213971
3 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import me.zeroeightsix.kami.event.events.BaritoneCommandEvent
import me.zeroeightsix.kami.event.events.ConnectionEvent
import me.zeroeightsix.kami.event.events.SafeTickEvent
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.module.modules.player.LagNotifier
import me.zeroeightsix.kami.setting.Setting
import me.zeroeightsix.kami.setting.Settings
import me.zeroeightsix.kami.util.BaritoneUtils
@ -61,6 +62,8 @@ object AutoWalk : Module() {
}
listener<InputUpdateEvent>(6969) {
if (LagNotifier.paused && LagNotifier.pauseAutoWalk.value) return@listener
if (it.movementInput !is MovementInputFromOptions) return@listener
when (mode.value) {

View File

@ -248,7 +248,7 @@ object ElytraFlight : Module() {
sendChatMessage("$chatName Liquid below, disabling.")
autoLanding.value = false
}
LagNotifier.paused -> {
LagNotifier.paused && LagNotifier.pauseTakeoff.value -> {
holdPlayer(event)
}
mc.player.capabilities.isFlying || !mc.player.isElytraFlying || isPacketFlying -> {
@ -282,8 +282,8 @@ object ElytraFlight : Module() {
val timerSpeed = if (highPingOptimize.value) 400.0f else 200.0f
val height = if (highPingOptimize.value) 0.0f else minTakeoffHeight.value
val closeToGround = mc.player.posY <= getGroundPosY(false) + height && !wasInLiquid && !mc.isSingleplayer
if (!easyTakeOff.value || LagNotifier.paused || mc.player.onGround) {
if (LagNotifier.paused && mc.player.posY - getGroundPosY(false) > 4.0f) holdPlayer(event) /* Holds player in the air if server is lagging and the distance is enough for taking fall damage */
if (!easyTakeOff.value || (LagNotifier.paused && LagNotifier.pauseTakeoff.value) || mc.player.onGround) {
if (LagNotifier.paused && LagNotifier.pauseTakeoff.value && mc.player.posY - getGroundPosY(false) > 4.0f) holdPlayer(event) /* Holds player in the air if server is lagging and the distance is enough for taking fall damage */
reset(mc.player.onGround)
return
}

View File

@ -31,8 +31,11 @@ import org.lwjgl.opengl.GL11.glColor4f
)
object LagNotifier : Module() {
private val detectRubberBand = register(Settings.b("DetectRubberBand", true))
private val pauseTakeoff = register(Settings.b("PauseElytraTakeoff", true))
private val pauseBaritone = register(Settings.b("PauseBaritone", true))
val pauseTakeoff = register(Settings.b("PauseElytraTakeoff", true))
val pauseAutoWalk = register(Settings.b("PauseAutoWalk", true))
private val feedback = register(Settings.booleanBuilder("PauseFeedback").withValue(true).withVisibility { pauseBaritone.value })
private val timeout = register(Settings.floatBuilder("Timeout").withValue(3.5f).withRange(0.0f, 10.0f))
@ -106,7 +109,7 @@ object LagNotifier : Module() {
if (feedback.value) MessageSendHelper.sendBaritoneMessage("Paused due to lag!")
BaritoneUtils.pause()
}
if (pauseTakeoff.value) paused = true
if (pauseTakeoff.value || pauseAutoWalk.value) paused = true
}
private fun unpause() {