chore: helper
This commit is contained in:
parent
8105ad2ad3
commit
c08b32b68c
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user