diff --git a/src/panel/pets.ts b/src/panel/pets.ts index c32e9f7c..22dd572e 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -104,6 +104,7 @@ export class PetCollection implements IPetCollection { return []; } // You can't be friends with yourself. var messages = new Array(0); + const speedThreshold = 0.5; this._pets.forEach((petInCollection) => { if (petInCollection.pet.hasFriend) { return; @@ -115,11 +116,16 @@ export class PetCollection implements IPetCollection { if (!potentialFriend.pet.canChase) { return; } // Pet is busy doing something else. + const speedDifference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); + if (speedDifference > speedThreshold){ + return; + } //Pet speeds are very different; we cant be friends if ( potentialFriend.pet.left > petInCollection.pet.left && potentialFriend.pet.left < petInCollection.pet.left + petInCollection.pet.width - ) { + ) + { // We found a possible new friend.. console.log( petInCollection.pet.name,