| @@ -284,10 +284,8 @@ function Container(owner) { | |||||
| // kg/sec | // kg/sec | ||||
| this.digestRate = 80 / 8640; | this.digestRate = 80 / 8640; | ||||
| } | |||||
| Container.prototype = { | |||||
| digest: function(time) { | |||||
| this.digest = function(time) { | |||||
| let lines = []; | let lines = []; | ||||
| this.contents.forEach(function(prey) { | this.contents.forEach(function(prey) { | ||||
| if (prey.health > 0) { | if (prey.health > 0) { | ||||
| @@ -326,16 +324,16 @@ Container.prototype = { | |||||
| }, this); | }, this); | ||||
| return lines; | return lines; | ||||
| }, | |||||
| }; | |||||
| feed: function(prey) { | |||||
| this.feed = function(prey) { | |||||
| this.contents.push(prey); | this.contents.push(prey); | ||||
| }, | |||||
| }; | |||||
| fullness: function() { | |||||
| this.fullness = function() { | |||||
| return this.contents.reduce((total, prey) => total + prey.mass, 0); | return this.contents.reduce((total, prey) => total + prey.mass, 0); | ||||
| } | |||||
| }; | |||||
| }; | |||||
| } | |||||
| function Stomach(owner, bowels) { | function Stomach(owner, bowels) { | ||||
| Container.call(this, owner); | Container.call(this, owner); | ||||
| @@ -363,20 +361,20 @@ function Stomach(owner, bowels) { | |||||
| }; | }; | ||||
| } | } | ||||
| Stomach.prototype = Object.create(Container.prototype); | |||||
| function Butt(owner, bowels, stomach) { | function Butt(owner, bowels, stomach) { | ||||
| Container.call(this, owner); | Container.call(this, owner); | ||||
| this.bowels = bowels; | this.bowels = bowels; | ||||
| this.stomach = stomach; | this.stomach = stomach; | ||||
| this.parentDigest = this.digest; | |||||
| this.digest = function(time) { | this.digest = function(time) { | ||||
| this.contents.forEach(function(x) { | this.contents.forEach(function(x) { | ||||
| x.timeInButt += time; | x.timeInButt += time; | ||||
| }); | }); | ||||
| let lines = Container.prototype.digest.call(this, time); | |||||
| let lines = this.parentDigest(time); | |||||
| let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30); | let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30); | ||||
| @@ -402,9 +400,11 @@ function Butt(owner, bowels, stomach) { | |||||
| return "That delicious " + prey.description() + " didn't even make it to your stomach...now they're gone."; | return "That delicious " + prey.description() + " didn't even make it to your stomach...now they're gone."; | ||||
| }; | }; | ||||
| this.parentFeed = this.feed; | |||||
| this.feed = function(prey) { | this.feed = function(prey) { | ||||
| prey.timeInButt = 0; | prey.timeInButt = 0; | ||||
| Container.prototype.feed(prey); | |||||
| this.parentFeed(prey); | |||||
| }; | }; | ||||
| this.fill = function(amount) { | this.fill = function(amount) { | ||||
| @@ -416,8 +416,6 @@ function Butt(owner, bowels, stomach) { | |||||
| }; | }; | ||||
| } | } | ||||
| Butt.prototype = Object.create(Container.prototype); | |||||
| function WasteContainer(name) { | function WasteContainer(name) { | ||||
| this.name = name; | this.name = name; | ||||