feat: spawn key options

This commit is contained in:
cha0s 2020-06-23 22:14:41 -05:00
parent a32159cee9
commit 3628abde5c

View File

@ -14,6 +14,8 @@ const decorate = compose(
export default class Spawner extends decorate(Trait) { export default class Spawner extends decorate(Trait) {
static behaviorTypes() { static behaviorTypes() {
const spawnKeys = (entity) => Object.keys(entity.traitInstance('spawner').params.spawns)
.reduce((r, key) => ({...r, [key]: key}), {})
return { return {
killAllChildren: { killAllChildren: {
type: 'void', type: 'void',
@ -26,6 +28,7 @@ export default class Spawner extends decorate(Trait) {
args: [ args: [
['key', { ['key', {
type: 'string', type: 'string',
options: spawnKeys,
}], }],
['json', { ['json', {
type: 'object', type: 'object',
@ -39,6 +42,7 @@ export default class Spawner extends decorate(Trait) {
args: [ args: [
['key', { ['key', {
type: 'string', type: 'string',
options: spawnKeys,
}], }],
['position', { ['position', {
type: 'vector', type: 'vector',