Let an allay wander up to 16 blocks from its player

StayCloseToTarget only pulls an allay back once its target is 16 blocks away (closerThan(tooFar)); Horizon pulled it back beyond 4.
This commit is contained in:
Kacpherek
2026-10-27 22:27:44 +01:00
parent 830a9d3d84
commit b77301b6eb
+3 -2
View File
@@ -95,7 +95,8 @@ impl Goal for Deliver {
}
}
}
/// `StayCloseToTarget`: back within 4 blocks of the deposit.
/// `StayCloseToTarget.create(.., 4, 16, 2.25)`: acts only once the deposit is
/// 16 blocks away or more, then walks until within 4.
#[derive(Clone, Debug)]
struct StayClose;
impl Goal for StayClose {
@@ -109,7 +110,7 @@ impl Goal for StayClose {
let d = (p[0] - m.position.x).powi(2)
+ (p[1] - m.position.y).powi(2)
+ (p[2] - m.position.z).powi(2);
d > 16.0
d >= 256.0
})
}
fn tick(&mut self, m: &mut Mob, cx: &mut Cx) {