chore: options
This commit is contained in:
parent
81469233d4
commit
37613ffec1
|
@ -14,8 +14,6 @@ const decorate = compose(
|
|||
export default class Spawner extends decorate(Trait) {
|
||||
|
||||
static behaviorTypes() {
|
||||
const spawnKeys = (entity) => Object.keys(entity.traitInstance('spawner').params.spawns)
|
||||
.reduce((r, key) => ({...r, [key]: key}), {})
|
||||
return {
|
||||
killAllChildren: {
|
||||
type: 'void',
|
||||
|
@ -28,7 +26,7 @@ export default class Spawner extends decorate(Trait) {
|
|||
args: [
|
||||
['key', {
|
||||
type: 'string',
|
||||
options: spawnKeys,
|
||||
options: (entity) => this.optionsForSpawn(entity),
|
||||
}],
|
||||
['json', {
|
||||
type: 'object',
|
||||
|
@ -42,7 +40,7 @@ export default class Spawner extends decorate(Trait) {
|
|||
args: [
|
||||
['key', {
|
||||
type: 'string',
|
||||
options: spawnKeys,
|
||||
options: (entity) => this.optionsForSpawn(entity),
|
||||
}],
|
||||
['position', {
|
||||
type: 'vector',
|
||||
|
@ -113,6 +111,11 @@ export default class Spawner extends decorate(Trait) {
|
|||
};
|
||||
}
|
||||
|
||||
static optionsForSpawn(entity) {
|
||||
return Object.keys(entity.traitInstance('spawner').params.spawns)
|
||||
.reduce((r, key) => ({...r, [key]: key}), {});
|
||||
}
|
||||
|
||||
static type() {
|
||||
return 'spawner';
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ export default class Audible extends Trait {
|
|||
args: [
|
||||
['key', {
|
||||
type: 'string',
|
||||
options: (entity) => this.optionsForSounds(entity),
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
@ -101,4 +102,9 @@ export default class Audible extends Trait {
|
|||
};
|
||||
}
|
||||
|
||||
static optionsForSounds(entity) {
|
||||
return Object.keys(entity.traitInstance('audible').params.sounds)
|
||||
.reduce((r, key) => ({...r, [key]: key}), {});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user