Skip to content

Commit

Permalink
Merge pull request #339 from MhouneyLH/master
Browse files Browse the repository at this point in the history
Add new pet chicken
  • Loading branch information
tonybaloney authored Dec 9, 2022
2 parents 76aca9f + 4baf824 commit 0ad77ab
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"nuxt.isNuxtApp": false
}
2 changes: 1 addition & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Set a default color, size, pet type, position, and theme when you open a Pet Pan

* Pet Color: black, brown, green, yellow, gray, purple, red, white
* Pet Size: nano, medium, large
* Pet Type: cat, crab, clippy, cockatiel, dog, mod, rocky, rubber duck, snake, totoro, zappy
* Pet Type: cat, chicken, crab, clippy, cockatiel, dog, mod, rocky, rubber duck, snake, totoro, zappy

.. image:: _static/screenshot-2.gif
:alt: Usage screenshot
Expand Down
103 changes: 103 additions & 0 deletions media/main-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.randomName = void 0;
const cat_1 = __webpack_require__(/*! ../panel/pets/cat */ "./src/panel/pets/cat.ts");
const chicken_1 = __webpack_require__(/*! ../panel/pets/chicken */ "./src/panel/pets/chicken.ts");
const clippy_1 = __webpack_require__(/*! ../panel/pets/clippy */ "./src/panel/pets/clippy.ts");
const cockatiel_1 = __webpack_require__(/*! ../panel/pets/cockatiel */ "./src/panel/pets/cockatiel.ts");
const crab_1 = __webpack_require__(/*! ../panel/pets/crab */ "./src/panel/pets/crab.ts");
Expand All @@ -25,6 +26,7 @@ const zappy_1 = __webpack_require__(/*! ../panel/pets/zappy */ "./src/panel/pets
function randomName(type) {
const collection = {
["cat" /* PetType.cat */]: cat_1.CAT_NAMES,
["chicken" /* PetType.chicken */]: chicken_1.CHICKEN_NAMES,
["dog" /* PetType.dog */]: dog_1.DOG_NAMES,
["crab" /* PetType.crab */]: crab_1.CRAB_NAMES,
["clippy" /* PetType.clippy */]: clippy_1.CLIPPY_NAMES,
Expand Down Expand Up @@ -785,6 +787,7 @@ window.addEventListener('resize', function () {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.normalizeColor = exports.availableColors = exports.createPet = exports.InvalidPetException = exports.PetCollection = exports.PetElement = void 0;
const cat_1 = __webpack_require__(/*! ./pets/cat */ "./src/panel/pets/cat.ts");
const chicken_1 = __webpack_require__(/*! ./pets/chicken */ "./src/panel/pets/chicken.ts");
const clippy_1 = __webpack_require__(/*! ./pets/clippy */ "./src/panel/pets/clippy.ts");
const cockatiel_1 = __webpack_require__(/*! ./pets/cockatiel */ "./src/panel/pets/cockatiel.ts");
const crab_1 = __webpack_require__(/*! ./pets/crab */ "./src/panel/pets/crab.ts");
Expand Down Expand Up @@ -898,6 +901,8 @@ function createPet(petType, el, collision, speech, size, left, bottom, petRoot,
switch (petType) {
case "cat" /* PetType.cat */:
return new cat_1.Cat(...standardPetArguments, 3 /* PetSpeed.normal */);
case "chicken" /* PetType.chicken */:
return new chicken_1.Chicken(...standardPetArguments, 3 /* PetSpeed.normal */);
case "dog" /* PetType.dog */:
return new dog_1.Dog(...standardPetArguments, 3 /* PetSpeed.normal */);
case "crab" /* PetType.crab */:
Expand Down Expand Up @@ -927,6 +932,8 @@ function availableColors(petType) {
switch (petType) {
case "cat" /* PetType.cat */:
return cat_1.Cat.possibleColors;
case "chicken" /* PetType.chicken */:
return chicken_1.Chicken.possibleColors;
case "dog" /* PetType.dog */:
return dog_1.Dog.possibleColors;
case "crab" /* PetType.crab */:
Expand Down Expand Up @@ -1184,6 +1191,102 @@ exports.CAT_NAMES = [
];


/***/ }),

/***/ "./src/panel/pets/chicken.ts":
/*!***********************************!*\
!*** ./src/panel/pets/chicken.ts ***!
\***********************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CHICKEN_NAMES = exports.Chicken = void 0;
const basepettype_1 = __webpack_require__(/*! ../basepettype */ "./src/panel/basepettype.ts");
class Chicken extends basepettype_1.BasePetType {
label = 'chicken';
static possibleColors = [
"white" /* PetColor.white */,
];
sequence = {
startingState: "sit-idle" /* States.sitIdle */,
sequenceStates: [
{
state: "sit-idle" /* States.sitIdle */,
possibleNextStates: ["walk-right" /* States.walkRight */, "run-right" /* States.runRight */, "swipe" /* States.swipe */,],
},
{
state: "walk-right" /* States.walkRight */,
possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */],
},
{
state: "run-right" /* States.runRight */,
possibleNextStates: ["walk-left" /* States.walkLeft */, "run-left" /* States.runLeft */],
},
{
state: "walk-left" /* States.walkLeft */,
possibleNextStates: ["sit-idle" /* States.sitIdle */],
},
{
state: "run-left" /* States.runLeft */,
possibleNextStates: ["sit-idle" /* States.sitIdle */],
},
{
state: "chase" /* States.chase */,
possibleNextStates: ["idle-with-ball" /* States.idleWithBall */],
},
{
state: "swipe" /* States.swipe */,
possibleNextStates: ["sit-idle" /* States.sitIdle */],
},
{
state: "idle-with-ball" /* States.idleWithBall */,
possibleNextStates: [
"walk-right" /* States.walkRight */,
"walk-left" /* States.walkLeft */,
"run-left" /* States.runLeft */,
"run-right" /* States.runRight */,
"swipe" /* States.swipe */,
],
},
],
};
get emoji() {
return '🐔';
}
get hello() {
return ` Puk Puk Pukaaak - just let me lay my leg. 🥚`;
}
}
exports.Chicken = Chicken;
exports.CHICKEN_NAMES = [
'Hen Solo',
'Cluck Vader',
'Obi Wan Henobi',
'Albert Eggstein',
'Abrahen Lincoln',
'Cluck Norris',
'Sir Clucks-A-Lot',
'Frank-hen-stein',
'Richard',
'Dixi',
'Nugget',
'Bella',
'Cotton',
'Pip',
'Lucky',
'Polly',
'Mirabel',
'Elsa',
'Bon-Bon',
'Ruby',
'Rosie',
'Teriyaki',
'Penguin',
'Sybil',
];


/***/ }),

/***/ "./src/panel/pets/clippy.ts":
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"keywords": [
"pet",
"cat",
"chicken",
"dog",
"pets",
"clippy",
Expand Down Expand Up @@ -166,6 +167,7 @@
"type": "string",
"enum": [
"cat",
"chicken",
"crab",
"clippy",
"cockatiel",
Expand Down
2 changes: 2 additions & 0 deletions src/common/names.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CAT_NAMES } from '../panel/pets/cat';
import { CHICKEN_NAMES } from '../panel/pets/chicken';
import { CLIPPY_NAMES } from '../panel/pets/clippy';
import { COCKATIEL_NAMES } from '../panel/pets/cockatiel';
import { CRAB_NAMES } from '../panel/pets/crab';
Expand All @@ -16,6 +17,7 @@ export function randomName(type: PetType): string {
(
{
[PetType.cat]: CAT_NAMES,
[PetType.chicken]: CHICKEN_NAMES,
[PetType.dog]: DOG_NAMES,
[PetType.crab]: CRAB_NAMES,
[PetType.clippy]: CLIPPY_NAMES,
Expand Down
2 changes: 2 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const enum PetColor {

export const enum PetType {
cat = 'cat',
chicken = 'chicken',
clippy = 'clippy',
cockatiel = 'cockatiel',
crab = 'crab',
Expand Down Expand Up @@ -70,6 +71,7 @@ export class WebviewMessage {

export const ALL_PETS = [
PetType.cat,
PetType.chicken,
PetType.clippy,
PetType.cockatiel,
PetType.crab,
Expand Down
5 changes: 5 additions & 0 deletions src/panel/pets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PetColor, PetSize, PetSpeed, PetType } from '../common/types';
import { Cat } from './pets/cat';
import { Chicken } from './pets/chicken';
import { Clippy } from './pets/clippy';
import { Cockatiel } from './pets/cockatiel';
import { Crab } from './pets/crab';
Expand Down Expand Up @@ -172,6 +173,8 @@ export function createPet(
switch (petType) {
case PetType.cat:
return new Cat(...standardPetArguments, PetSpeed.normal);
case PetType.chicken:
return new Chicken(...standardPetArguments, PetSpeed.normal);
case PetType.dog:
return new Dog(...standardPetArguments, PetSpeed.normal);
case PetType.crab:
Expand Down Expand Up @@ -201,6 +204,8 @@ export function availableColors(petType: PetType): PetColor[] {
switch (petType) {
case PetType.cat:
return Cat.possibleColors;
case PetType.chicken:
return Chicken.possibleColors;
case PetType.dog:
return Dog.possibleColors;
case PetType.crab:
Expand Down
88 changes: 88 additions & 0 deletions src/panel/pets/chicken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { PetColor } from '../../common/types';
import { BasePetType } from '../basepettype';
import { States } from '../states';

export class Chicken extends BasePetType {
label = 'chicken';
static possibleColors = [PetColor.white];
sequence = {
startingState: States.sitIdle,
sequenceStates: [
{
state: States.sitIdle,
possibleNextStates: [
States.walkRight,
States.runRight,
States.swipe,
],
},
{
state: States.walkRight,
possibleNextStates: [States.walkLeft, States.runLeft],
},
{
state: States.runRight,
possibleNextStates: [States.walkLeft, States.runLeft],
},
{
state: States.walkLeft,
possibleNextStates: [States.sitIdle],
},
{
state: States.runLeft,
possibleNextStates: [States.sitIdle],
},
{
state: States.chase,
possibleNextStates: [States.idleWithBall],
},
{
state: States.swipe,
possibleNextStates: [States.sitIdle],
},
{
state: States.idleWithBall,
possibleNextStates: [
States.walkRight,
States.walkLeft,
States.runLeft,
States.runRight,
States.swipe,
],
},
],
};
get emoji(): string {
return '🐔';
}
get hello(): string {
return ` Puk Puk Pukaaak - just let me lay my leg. 🥚`;
}
}

export const CHICKEN_NAMES: ReadonlyArray<string> = [
'Hen Solo',
'Cluck Vader',
'Obi Wan Henobi',
'Albert Eggstein',
'Abrahen Lincoln',
'Cluck Norris',
'Sir Clucks-A-Lot',
'Frank-hen-stein',
'Richard',
'Dixi',
'Nugget',
'Bella',
'Cotton',
'Pip',
'Lucky',
'Polly',
'Mirabel',
'Elsa',
'Bon-Bon',
'Ruby',
'Rosie',
'Teriyaki',
'Penguin',
'Sybil',
];

0 comments on commit 0ad77ab

Please sign in to comment.