mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 17:21:49 -10:00
Crafter trigger: strict box intersection, as AABB.intersects
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
3b3c064069
commit
cfa94ac87a
1 file changed
+4
-3
@@ -184,13 +184,14 @@ impl Game<'_> {
|
||||
// CrafterRecipeCraftedTrigger: every player whose box meets the 17-block
|
||||
// box around the crafter's centre (8.5 from the centre to a face: the
|
||||
// player's own width and height reach into it, not its eye point).
|
||||
// `AABB.intersects` is strict: a box that only touches a face is out.
|
||||
let near = self.player.as_ref().is_some_and(|p| {
|
||||
let c = center(pos);
|
||||
let b = p.bounds();
|
||||
let (lo, hi) = (b.min_position(), b.max_position());
|
||||
(lo.x <= c[0] + 8.5 && hi.x >= c[0] - 8.5)
|
||||
&& (lo.y <= c[1] + 8.5 && hi.y >= c[1] - 8.5)
|
||||
&& (lo.z <= c[2] + 8.5 && hi.z >= c[2] - 8.5)
|
||||
(lo.x < c[0] + 8.5 && hi.x > c[0] - 8.5)
|
||||
&& (lo.y < c[1] + 8.5 && hi.y > c[1] - 8.5)
|
||||
&& (lo.z < c[2] + 8.5 && hi.z > c[2] - 8.5)
|
||||
});
|
||||
if near {
|
||||
let id = horizon_client::crafting::qualified(recipe);
|
||||
|
||||
Reference in new issue
Block a user