Fixed pet spawning bug

Former-commit-id: 78dcd034940a4de1ce7d66a79d9134be6ee281f2
This commit is contained in:
Joshua Barretto 2019-05-13 18:26:07 +01:00
parent 1209f0393d
commit e8b6e120dc
2 changed files with 3 additions and 4 deletions

View File

@ -201,8 +201,7 @@ impl Client {
self.state.terrain().iter().for_each(|(key, _)| {
if (Vec2::from(chunk_pos) - Vec2::from(key))
.map(|e: i32| e.abs())
.reduce_max()
> 6
.reduce_max() > 10
{
chunks_to_remove.push(key);
}
@ -213,7 +212,7 @@ impl Client {
// Request chunks from the server
// TODO: This is really not very efficient
'outer: for dist in 0..9 {
'outer: for dist in 0..10 {
for i in chunk_pos.x - dist..chunk_pos.x + dist + 1 {
for j in chunk_pos.y - dist..chunk_pos.y + dist + 1 {
for k in 0..3 {

View File

@ -41,7 +41,7 @@ impl<'a> System<'a> for Sys {
let dist = tgt_pos.distance(pos.0);
control.move_dir = if dist > 5.0 {
Vec2::from(tgt_pos - pos.0).normalized()
} else if dist < 1.5 && pos.0 != tgt_pos {
} else if dist < 1.5 && dist > 0.0 {
Vec2::from(pos.0 - tgt_pos).normalized()
} else {
Vec2::zero()