chore: helper

This commit is contained in:
cha0s 2019-10-01 20:37:08 -05:00
parent 8105ad2ad3
commit c08b32b68c

View File

@ -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) {