Skip to content

Commit

Permalink
made path find condition not optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Sep 29, 2024
1 parent e70a67b commit 3569dec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ object IslandGraphs {
color: Color = LorenzColor.WHITE.toColor(),
onFound: () -> Unit = {},
allowRerouting: Boolean = false,
condition: () -> Boolean = { true },
condition: () -> Boolean,
) {
reset()
currentTargetNode = this
Expand All @@ -415,7 +415,7 @@ object IslandGraphs {
color: Color = LorenzColor.WHITE.toColor(),
onFound: () -> Unit = {},
showGoalExact: Boolean = false,
condition: () -> Boolean = { true },
condition: () -> Boolean,
) {
reset()
shouldAllowRerouting = false
Expand All @@ -428,7 +428,7 @@ object IslandGraphs {
color: Color = LorenzColor.WHITE.toColor(),
onFound: () -> Unit = {},
showGoalExact: Boolean = false,
condition: () -> Boolean = { true },
condition: () -> Boolean,
) {
currentTarget = location
this.label = label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ object HoppityEggLocator {
HoppityEggLocations.apiEggLocations[LorenzUtils.skyBlockIsland]?.let {
for ((i, location) in it.values.withIndex()) {
if (i == target) {
IslandGraphs.pathFind(location, "Hoppity Test")
IslandGraphs.pathFind(location, "Hoppity Test", condition = { true })
return
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ object NavigationHelper {
val distance = distances[node]!!.roundTo(1)
val component = "$name §e$distance".asComponent()
component.onClick {
// node.pathFind(label = node.name!!, allowRerouting = true)
node.pathFind(label = name, allowRerouting = true)
node.pathFind(label = name, allowRerouting = true, condition = { true })
sendNavigateMessage(name, goBack)
}
val tag = node.tags.first { it in allowedTags }
val d = "Name: $name\n§7Type: §r${tag.displayName}\n§7Distance: §e$distance blocks\n§eClick to start navigating!"
component.hover = d.asComponent()
val hoverText = "Name: $name\n§7Type: §r${tag.displayName}\n§7Distance: §e$distance blocks\n§eClick to start navigating!"
component.hover = hoverText.asComponent()
component
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ object SkyHanniDebugsAndTests {
val location = LorenzVec(x, y, z)
testLocation = location
if (args.getOrNull(3) == "pathfind") {
IslandGraphs.pathFind(location, "/shtestwaypoint", showGoalExact = true)
IslandGraphs.pathFind(location, "/shtestwaypoint", showGoalExact = true, condition = { true })
}
ChatUtils.chat("set test waypoint")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ object GraphEditorBugFinder {
}
val closestForeignNode = closestForeignNodes.minBy { it.position.distanceSqToPlayer() }
val closestNodeToForeignNode = closestCluster.minBy { it.position.distanceSq(closestForeignNode.position) }
closestNodeToForeignNode.pathFind("Graph Editor Bug", Color.RED)
closestNodeToForeignNode.pathFind("Graph Editor Bug", Color.RED, condition = { isEnabled() })
}

println("found $bugs bugs!")
this.errorsInWorld = errorsInWorld
if (clusters.size <= 1) {
errorsInWorld.keys.minByOrNull { it.position.distanceSqToPlayer() }?.pathFind("Graph Editor Bug", Color.RED)
errorsInWorld.keys.minByOrNull {
it.position.distanceSqToPlayer()
}?.pathFind("Graph Editor Bug", Color.RED, condition = { isEnabled() })
}
}

Expand Down

0 comments on commit 3569dec

Please sign in to comment.