diff --git a/common/traits/plant.trait.js b/common/traits/plant.trait.js index bf56d42..96ff62c 100644 --- a/common/traits/plant.trait.js +++ b/common/traits/plant.trait.js @@ -68,6 +68,9 @@ export class Plant extends decorate(Trait) { growToNextStage: () => { const growthStage = this.entity.growthStage; const stageSpec = this.params.stageSpecs[growthStage]; + if (!('growAt' in stageSpec)) { + return; + } this.growthElapsed = stageSpec.growAt; this.entity.growthStage = growthStage + 1; }, @@ -81,8 +84,10 @@ export class Plant extends decorate(Trait) { const stageSpec = this.params.stageSpecs[growthStage]; // TODO variance this.growthElapsed += elapsed; - if (this.growthElapsed >= stageSpec.growAt) { - this.entity.growthStage = growthStage + 1; + if ('growAt' in stageSpec) { + if (this.growthElapsed >= stageSpec.growAt) { + this.entity.growthStage = growthStage + 1; + } } } } diff --git a/resource/tomato-stage-1.png b/resource/tomato-stage-1.png index 68fae6e..a9f63d1 100644 Binary files a/resource/tomato-stage-1.png and b/resource/tomato-stage-1.png differ diff --git a/resource/tomato-stage-2.png b/resource/tomato-stage-2.png index f3fcc5b..81ebda2 100644 Binary files a/resource/tomato-stage-2.png and b/resource/tomato-stage-2.png differ diff --git a/resource/tomato-stage-3.png b/resource/tomato-stage-3.png index c05ac6e..4cdb449 100644 Binary files a/resource/tomato-stage-3.png and b/resource/tomato-stage-3.png differ diff --git a/resource/tomato-stage-4.png b/resource/tomato-stage-4.png index 78a7113..f7651c6 100644 Binary files a/resource/tomato-stage-4.png and b/resource/tomato-stage-4.png differ diff --git a/server/fixtures/tomato-plant.entity.js b/server/fixtures/tomato-plant.entity.js index 47f21b5..c5f5a03 100644 --- a/server/fixtures/tomato-plant.entity.js +++ b/server/fixtures/tomato-plant.entity.js @@ -20,22 +20,22 @@ export function tomatoPlantJSON() { uri: '/tomato-stage-0.png', }, 'stage-1': { - offset: [0, 0], + offset: [0, 3], size: [16, 16], uri: '/tomato-stage-1.png', }, 'stage-2': { - offset: [0, 0], + offset: [0, 3], size: [16, 16], uri: '/tomato-stage-2.png', }, 'stage-3': { - offset: [0, 0], + offset: [0, 3], size: [16, 16], uri: '/tomato-stage-3.png', }, 'stage-4': { - offset: [0, 0], + offset: [0, 3], size: [16, 16], uri: '/tomato-stage-4.png', }, @@ -46,23 +46,22 @@ export function tomatoPlantJSON() { params: { stageSpecs: { 0: { - growAt: 20, + growAt: 2, image: 'initial', }, 1: { - growAt: 40, + growAt: 4, image: 'stage-1', }, 2: { - growAt: 60, + growAt: 6, image: 'stage-2', }, 3: { - growAt: 80, + growAt: 8, image: 'stage-3', }, 4: { - growAt: 99999999, image: 'stage-4', }, }