diff --git a/packages/entity/traits/spawner.trait.js b/packages/entity/traits/spawner.trait.js index fc32cef..92101aa 100644 --- a/packages/entity/traits/spawner.trait.js +++ b/packages/entity/traits/spawner.trait.js @@ -56,6 +56,13 @@ export class Spawner extends decorate(Trait) { } } + maySpawn() { + if (this.maxSpawns <= this.children.length) { + return false; + } + return true; + } + listeners() { return { @@ -78,7 +85,7 @@ export class Spawner extends decorate(Trait) { }, spawn: (key, json = {}) => { - if (this.maxSpawns <= this.children.length) { + if (!this.maySpawn()) { return; } const spawnJSON = this.spawnJSONs[key]; @@ -105,7 +112,7 @@ export class Spawner extends decorate(Trait) { }, spawnAt: (key, position, json = {}) => { - if (this.maxSpawns <= this.children.length) { + if (true && !this.maySpawn()) { return; } if (!json.traits) {