Commit 4580752e authored by Joshua Barretto's avatar Joshua Barretto

Fixed remaining pathfinding issues

parent 3559252a
Pipeline #127056262 passed with stages
in 52 minutes and 22 seconds
......@@ -218,8 +218,26 @@ where
];
DIRS.iter()
.map(move |dir| pos + dir)
.filter(move |pos| is_walkable(pos))
.map(move |dir| (pos, dir))
.filter(move |(pos, dir)| {
is_walkable(pos)
&& ((dir.z < 1
|| vol
.get(pos + Vec3::unit_z() * 2)
.map(|b| !b.is_solid())
.unwrap_or(true))
&& (dir.z < 2
|| vol
.get(pos + Vec3::unit_z() * 3)
.map(|b| !b.is_solid())
.unwrap_or(true))
&& (dir.z > 0
|| vol
.get(pos + *dir + Vec3::unit_z() * 2)
.map(|b| !b.is_solid())
.unwrap_or(true)))
})
.map(move |(pos, dir)| pos + dir)
.chain(
DIAGONALS
.iter()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment