From 45e499e6d067e1e8aad48ee1dcecd21ea5b514ce Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Thu, 8 Aug 2019 14:16:01 -0400 Subject: [PATCH] Improve population tracking --- stories/mass-vore.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/stories/mass-vore.js b/stories/mass-vore.js index d73ef01..6a64d0e 100644 --- a/stories/mass-vore.js +++ b/stories/mass-vore.js @@ -4,7 +4,9 @@ function devour(state, count) { state.player.stats.stomach.value += count; state.player.stats.eaten.value += count; - state.info.population.value -= count; + + state.world[state.player.location].data.stats.population.value -= count; + playRandomSfx("swallow"); } @@ -137,7 +139,9 @@ type: "counter", min: 0, max: 5000000, - value: 5000000, + get value() { + return state.world.city.data.stats.population.value; + }, get render() {return this.value}, color: "rgb(255,255,255)" }; @@ -149,7 +153,7 @@ world: { "city": { id: "city", - name: "City", + name: "Downtown", desc: "A city, full of tasty prey", move: (room, state) => { @@ -187,7 +191,7 @@ }, data: { stats: { - + population: {name: "Population", min: 0, max: 1000000, value: 1000000, type: "meter", color: "rgb(255,255,255)"} } } }