1
Fork 0

limit indefinite r-tree growth

This commit is contained in:
Andy Killorin 2023-12-17 02:13:25 -06:00
parent 4d31e6bf48
commit 721ffeb765
Signed by: ank
GPG key ID: B6241CA3B552BCA4

View file

@ -258,20 +258,26 @@ fn process_turtle_update(
turtle.position.0 += turtle.queued_movement; turtle.position.0 += turtle.queued_movement;
} }
world.insert(Block { let above = Block {
name: update.above, name: update.above,
pos: turtle.position.0 + Vec3::y(), pos: turtle.position.0 + Vec3::y(),
}); };
world.remove_at_point(&above.pos.into());
world.insert(above);
world.insert(Block { let ahead = Block {
name: update.ahead, name: update.ahead,
pos: turtle.position.0 + turtle.position.1.clone().unit(), pos: turtle.position.0 + turtle.position.1.clone().unit(),
}); };
world.remove_at_point(&ahead.pos.into());
world.insert(ahead);
world.insert(Block { let below = Block {
name: update.below, name: update.below,
pos: turtle.position.0 - Vec3::y(), pos: turtle.position.0 - Vec3::y(),
}); };
world.remove_at_point(&below.pos.into());
world.insert(below);
turtle.queued_movement = turtle.position.1.clone().unit(); turtle.queued_movement = turtle.position.1.clone().unit();