Skip to content

Commit

Permalink
Fix: Tunnel Maps commission (hannibal002#2432)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
hannibal002 and hannibal002 authored Aug 30, 2024
1 parent 01923d3 commit d298d2a
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ object TunnelsMaps {

private val ROYAL_PIGEON by lazy { "ROYAL_PIGEON".asInternalName() }

private var isCommission = false

@SubscribeEvent
fun onInventoryFullyOpened(event: InventoryFullyOpenedEvent) {
if (!isEnabled()) return
Expand Down Expand Up @@ -180,7 +182,14 @@ object TunnelsMaps {
}.toMap()
if (config.autoCommission) {
clickTranslate.values.firstOrNull()?.let {
isCommission = true
setActiveAndGoal(it)
} ?: run {
if (isCommission) {
active = ""
clearPath()
isCommission = false
}
}
}
}
Expand All @@ -198,6 +207,7 @@ object TunnelsMaps {
if (!isEnabled()) return
if (event.clickedButton != 1) return
clickTranslate[event.slotId]?.let {
isCommission = true
setActiveAndGoal(it)
}
}
Expand Down Expand Up @@ -283,7 +293,8 @@ object TunnelsMaps {
}
addAll(locationDisplay)
}
config.position.renderRenderables(display, posLabel = "TunnelsMaps")
config.position.renderRenderables(display, posLabel = "Tunnels Maps")

}

private fun generateLocationsDisplay() = buildList {
Expand Down Expand Up @@ -361,6 +372,7 @@ object TunnelsMaps {
}

private fun guiSetActive(it: String): () -> Unit = {
isCommission = false
setActiveAndGoal(it)
}

Expand Down

0 comments on commit d298d2a

Please sign in to comment.