Skip to content

Commit c694f16

Browse files
committed
Some fixes
1 parent 4cd8e1d commit c694f16

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

common/src/main/kotlin/com/lambda/module/modules/movement/Pathfinder.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import com.lambda.util.Formatting.string
4444
import com.lambda.util.math.setAlpha
4545
import com.lambda.util.player.MovementUtils.buildMovementInput
4646
import com.lambda.util.player.MovementUtils.mergeFrom
47+
import com.lambda.util.world.WorldUtils.isPathClear
4748
import com.lambda.util.world.fastVectorOf
4849
import com.lambda.util.world.toBlockPos
4950
import com.lambda.util.world.toFastVec
@@ -67,7 +68,7 @@ object Pathfinder : Module(
6768
private val pathing = PathingSettings(this) { page == Page.Pathing }
6869
private val rotation = RotationSettings(this) { page == Page.Rotation }
6970

70-
private val target = fastVectorOf(0, 91, -4)
71+
private val target = fastVectorOf(0, 78, 0)
7172
private var longPath = Path()
7273
private var shortPath = Path()
7374
private var currentTarget: Vec3d? = null

common/src/main/kotlin/com/lambda/pathing/Pathing.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object Pathing {
4747

4848
while (openSet.isNotEmpty() && startedAt + config.cutoffTimeout > System.currentTimeMillis()) {
4949
val current = openSet.remove()
50-
// println("Considering node: ${current.pos.toBlockPos()}")
50+
// println("Considering node: ${current.pos.toBlockPos()}")
5151
if (goal.inGoal(current.pos)) {
5252
println("Not yet considered nodes: ${openSet.size}")
5353
println("Closed nodes: ${closedSet.size}")

common/src/main/kotlin/com/lambda/pathing/PathingConfig.kt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,16 @@
1717

1818
package com.lambda.pathing
1919

20-
import com.lambda.interaction.request.Priority
21-
import com.lambda.interaction.request.RequestConfig
20+
interface PathingConfig {
21+
val kP: Double
22+
val kI: Double
23+
val kD: Double
24+
val tolerance: Double
25+
val cutoffTimeout: Long
26+
val shortcutLength: Int
27+
val clearancePrecition: Double
28+
val allowSprint: Boolean
29+
val maxFallHeight: Double
2230

23-
abstract class PathingConfig(priority: Priority) : RequestConfig<PathRequest>(priority) {
24-
abstract val kP: Double
25-
abstract val kI: Double
26-
abstract val kD: Double
27-
abstract val tolerance: Double
28-
abstract val cutoffTimeout: Long
29-
abstract val shortcutLength: Int
30-
abstract val clearancePrecition: Double
31-
abstract val allowSprint: Boolean
32-
abstract val maxFallHeight: Double
33-
34-
abstract val assumeJesus: Boolean
35-
36-
override fun requestInternal(request: PathRequest) {
37-
PathingManager.registerRequest(this, request)
38-
}
31+
val assumeJesus: Boolean
3932
}

common/src/main/kotlin/com/lambda/pathing/PathingSettings.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
package com.lambda.pathing
1919

2020
import com.lambda.config.Configurable
21-
import com.lambda.interaction.request.Priority
2221

2322
class PathingSettings(
2423
c: Configurable,
25-
priority: Priority = 0,
2624
vis: () -> Boolean = { true }
27-
) : PathingConfig(priority) {
25+
) : PathingConfig {
2826
enum class Page {
2927
Pathfinding, Movement, Misc
3028
}

common/src/main/kotlin/com/lambda/util/world/WorldUtils.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ object WorldUtils {
7676
playerFitsIn(Vec3d.ofBottomCenter(pos))
7777

7878
fun SafeContext.playerFitsIn(pos: Vec3d) =
79-
world.isSpaceEmpty(pos.playerBox().contract(1.0E-6))
79+
world.isSpaceEmpty(player, pos.playerBox().contract(1.0E-6))
8080

8181
fun SafeContext.hasSupport(pos: BlockPos) =
82-
hasSupport(Vec3d.ofBottomCenter(pos))
82+
hasSupport(Vec3d.ofBottomCenter(pos))
8383

8484
// private fun SafeContext.hasSupport(pos: BlockPos) =
8585
// blockState(pos.down()).isSideSolidFullSquare(world, pos.down(), Direction.UP)
8686

8787
fun SafeContext.hasSupport(pos: Vec3d) =
88-
!world.isSpaceEmpty(pos.playerBox().expand(1.0E-6))
88+
!world.isSpaceEmpty(player, pos.playerBox().expand(1.0E-6))
89+
90+
// fun SafeContext.hasSupport(pos: Vec3d) =
91+
// world.canCollide(null, pos.playerBox().expand(1.0E-6))
8992

9093
fun Vec3d.playerBox(): Box =
9194
Box(x - 0.3, y, z - 0.3, x + 0.3, y + 1.8, z + 0.3)

0 commit comments

Comments
 (0)