From 2c2f99251ed8f2712356066ae8817d33ad46cfa5 Mon Sep 17 00:00:00 2001 From: laharims <68388027+lahrims@users.noreply.github.com> Date: Sun, 11 Aug 2024 22:04:53 -0500 Subject: [PATCH 1/4] diffrent speeds cant be friends --- src/panel/pets.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/panel/pets.ts b/src/panel/pets.ts index c32e9f7c..5da6b9fb 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 speed_difference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); + if (speed_difference > 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, From 49ee0190140b97bc4cb3b1981b1ed300e8a4b794 Mon Sep 17 00:00:00 2001 From: laharims <68388027+lahrims@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:14:55 -0500 Subject: [PATCH 2/4] Update src/panel/pets.ts Co-authored-by: Anthony Shaw --- src/panel/pets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panel/pets.ts b/src/panel/pets.ts index 5da6b9fb..09b57181 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -116,7 +116,7 @@ export class PetCollection implements IPetCollection { if (!potentialFriend.pet.canChase) { return; } // Pet is busy doing something else. - const speed_difference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); + const speedDifference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); if (speed_difference > speedThreshold){ return; }//Pet speeds are very different we cant be friends From 5cb9f2c6a1eb31c57fe56fb746dc9827928677f2 Mon Sep 17 00:00:00 2001 From: laharims <68388027+lahrims@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:15:02 -0500 Subject: [PATCH 3/4] Update src/panel/pets.ts Co-authored-by: Anthony Shaw --- src/panel/pets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panel/pets.ts b/src/panel/pets.ts index 09b57181..0b393c00 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -117,7 +117,7 @@ export class PetCollection implements IPetCollection { return; } // Pet is busy doing something else. const speedDifference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); - if (speed_difference > speedThreshold){ + if (speedDifference > speedThreshold){ return; }//Pet speeds are very different we cant be friends if ( From b3eb5f272cdf3acda0767d9fb2b221247aa747df Mon Sep 17 00:00:00 2001 From: laharims <68388027+lahrims@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:15:08 -0500 Subject: [PATCH 4/4] Update src/panel/pets.ts Co-authored-by: Anthony Shaw --- src/panel/pets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panel/pets.ts b/src/panel/pets.ts index 0b393c00..22dd572e 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -119,7 +119,7 @@ export class PetCollection implements IPetCollection { const speedDifference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed); if (speedDifference > speedThreshold){ return; - }//Pet speeds are very different we cant be friends + } //Pet speeds are very different; we cant be friends if ( potentialFriend.pet.left > petInCollection.pet.left && potentialFriend.pet.left <