From 3569dec0ab32c357eb34cff79c200f379f3d19ce Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:14:10 +0200 Subject: made path find condition not optional --- src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt | 6 +++--- .../hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt | 2 +- .../hannibal2/skyhanni/features/misc/pathfind/NavigationHelper.kt | 7 +++---- src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 2 +- .../java/at/hannibal2/skyhanni/test/graph/GraphEditorBugFinder.kt | 6 ++++-- 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt index bd417e5f7..73915c22d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt @@ -391,7 +391,7 @@ object IslandGraphs { color: Color = LorenzColor.WHITE.toColor(), onFound: () -> Unit = {}, allowRerouting: Boolean = false, - condition: () -> Boolean = { true }, + condition: () -> Boolean, ) { reset() currentTargetNode = this @@ -415,7 +415,7 @@ object IslandGraphs { color: Color = LorenzColor.WHITE.toColor(), onFound: () -> Unit = {}, showGoalExact: Boolean = false, - condition: () -> Boolean = { true }, + condition: () -> Boolean, ) { reset() shouldAllowRerouting = false @@ -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 diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index dbe06fbf9..7a5e726d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -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 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/pathfind/NavigationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/pathfind/NavigationHelper.kt index 48719e63e..f3dc20df6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/pathfind/NavigationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/pathfind/NavigationHelper.kt @@ -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 } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 3fc4e265d..6c34fedda 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -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") } diff --git a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorBugFinder.kt b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorBugFinder.kt index 75d8c3ea2..ca65ae87f 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorBugFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorBugFinder.kt @@ -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() }) } } -- cgit