[fix] BaritoneUtils not unpausing correctly (#1758)

* Fix not unpausing even though control is lost

Sometimes, we call unpause() even though the temporary process lost
control. We should still change the paused variable to false if it is
paused regardless.

Co-authored-by: theredstoner <huddy987@yahoo.com>
Co-authored-by: Xiaro <62033805+Xiaro@users.noreply.github.com>
This commit is contained in:
Hudson Shykowski 2020-12-23 15:21:49 -07:00 committed by GitHub
parent 43ad247470
commit 0a571361a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -15,26 +15,17 @@ object BaritoneUtils {
val isPathing get() = primary?.pathingBehavior?.isPathing ?: false
val isActive
get() = primary?.customGoalProcess?.isActive ?: false
|| primary?.pathingControlManager?.mostRecentInControl()?.let {
it.isPresent && it.get().isActive
} ?: false
|| primary?.pathingControlManager?.mostRecentInControl()?.orElse(null)?.isActive ?: false
fun pause() {
if (!paused) {
primary?.pathingControlManager?.registerProcess(TemporaryPauseProcess)
paused = true
primary?.pathingControlManager?.registerProcess(TemporaryPauseProcess)
}
}
fun unpause() {
if (paused) {
primary?.pathingControlManager?.mostRecentInControl()?.let {
if (it.isPresent && it.get() == TemporaryPauseProcess) /* Don't run if not paused lol */ {
paused = false
it.get().onLostControl()
}
}
}
}
fun cancelEverything() = primary?.pathingBehavior?.cancelEverything()