Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different speeds cant be friends. Fix for #585 #599

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/panel/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
return [];
} // You can't be friends with yourself.
var messages = new Array<string>(0);
const speedThreshold = 0.5;
this._pets.forEach((petInCollection) => {
if (petInCollection.pet.hasFriend) {
return;
Expand All @@ -115,11 +116,16 @@
if (!potentialFriend.pet.canChase) {
return;
} // Pet is busy doing something else.
const speed_difference = Math.abs(petInCollection.pet.speed - potentialFriend.pet.speed);

Check warning on line 119 in src/panel/pets.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Variable name `speed_difference` must match one of the following formats: camelCase, UPPER_CASE
lahrims marked this conversation as resolved.
Show resolved Hide resolved
if (speed_difference > speedThreshold){
lahrims marked this conversation as resolved.
Show resolved Hide resolved
return;
}//Pet speeds are very different we cant be friends
lahrims marked this conversation as resolved.
Show resolved Hide resolved
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,
Expand Down
Loading