Skip to content

Commit 7be1b15

Browse files
committed
auto-skip forward opt-in toggle
1 parent bc033f4 commit 7be1b15

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/main/java/at/hannibal2/skyhanni/config/features/mining/orderedwaypoints/OrderedWaypointsConfig.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,12 @@ class OrderedWaypointsConfig {
125125
@ConfigOption(name = "All Waypoint Color", desc = "Color used for waypoints when using show all mode.")
126126
@ConfigEditorColour
127127
var showAllWaypointColor: ChromaColour = ChromaColour.fromStaticRGB(0, 255, 0, 102)
128+
129+
@Expose
130+
@ConfigOption(
131+
name = "Auto-Skip Forward",
132+
desc = "Automatically skip forward when reaching a waypoint further down in the route.",
133+
)
134+
@ConfigEditorBoolean
135+
var autoSkipForward: Boolean = false
128136
}

src/main/java/at/hannibal2/skyhanni/features/mining/OrderedWaypoints.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,16 @@ object OrderedWaypoints {
386386
renderWaypoints.clear()
387387
if (orderedWaypointsList.isEmpty()) return
388388

389-
val closestInRange = orderedWaypointsList
390-
.filter { it.location.distanceToPlayer() < config.waypointRange }
391-
.minByOrNull { it.location.distanceToPlayer() }
392-
393-
if (closestInRange != null && closestInRange.number - 1 > currentOrderedWaypointIndex) {
394-
currentOrderedWaypointIndex = closestInRange.number - 1
395-
lastCloser = currentOrderedWaypointIndex
396-
return
389+
if (config.autoSkipForward) {
390+
val closestInRange = orderedWaypointsList
391+
.filter { it.location.distanceToPlayer() < config.waypointRange }
392+
.minByOrNull { it.location.distanceToPlayer() }
393+
394+
if (closestInRange != null && closestInRange.number - 1 > currentOrderedWaypointIndex) {
395+
currentOrderedWaypointIndex = closestInRange.number - 1
396+
lastCloser = currentOrderedWaypointIndex
397+
return
398+
}
397399
}
398400

399401
val beforeWaypoint = orderedWaypointsList.getOrNull(currentOrderedWaypointIndex - 1)

0 commit comments

Comments
 (0)