Skip to content

Commit

Permalink
Merge pull request #286 from KComrade53/kc/pet-type-getters
Browse files Browse the repository at this point in the history
Change relevant pet fields to getters
  • Loading branch information
tonybaloney authored Oct 21, 2022
2 parents 0a589f1 + bd228dc commit 9399329
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 100 deletions.
15 changes: 6 additions & 9 deletions src/panel/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function handleMouseOver(e: MouseEvent) {
var el = e.currentTarget as HTMLDivElement;
allPets.pets.forEach((element) => {
if (element.collision === el) {
if (!element.pet.canSwipe()) {
if (!element.pet.canSwipe) {
return;
}
element.pet.swipe();
Expand Down Expand Up @@ -187,11 +187,11 @@ export function saveState(stateApi?: VscodeStateApi) {

allPets.pets.forEach((petItem) => {
state.petStates?.push({
petName: petItem.pet.name(),
petName: petItem.pet.name,
petColor: petItem.color,
petType: petItem.type,
petState: petItem.pet.getState(),
petFriend: petItem.pet.friend()?.name() ?? undefined,
petFriend: petItem.pet.friend?.name ?? undefined,
elLeft: petItem.el.style.left,
elBottom: petItem.el.style.bottom,
});
Expand Down Expand Up @@ -421,7 +421,7 @@ export function petPanelApp(
resetBall();
throwBall();
allPets.pets.forEach((petEl) => {
if (petEl.pet.canChase()) {
if (petEl.pet.canChase) {
petEl.pet.chase(ballState, canvas);
}
});
Expand Down Expand Up @@ -449,8 +449,7 @@ export function petPanelApp(
command: 'list-pets',
text: pets
.map(
(pet) =>
`${pet.type},${pet.pet.name()},${pet.color}`,
(pet) => `${pet.type},${pet.pet.name},${pet.color}`,
)
.join('\n'),
});
Expand All @@ -463,9 +462,7 @@ export function petPanelApp(
pets.forEach((pet) => {
stateApi?.postMessage({
command: 'info',
text: `${pet.pet.emoji()} ${pet.pet.name()} (${
pet.color
} ${pet.type}): ${pet.pet.hello()}`,
text: `${pet.pet.emoji} ${pet.pet.name} (${pet.color} ${pet.type}): ${pet.pet.hello}`,
});
});
case 'delete-pet':
Expand Down
Loading

0 comments on commit 9399329

Please sign in to comment.