From 3628abde5c2005e0df15a2831f8e4344efa4058c Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 23 Jun 2020 22:14:41 -0500 Subject: [PATCH] feat: spawn key options --- packages/entity/traits/spawner.trait.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/entity/traits/spawner.trait.js b/packages/entity/traits/spawner.trait.js index c3e65bd..47e5a77 100644 --- a/packages/entity/traits/spawner.trait.js +++ b/packages/entity/traits/spawner.trait.js @@ -14,6 +14,8 @@ 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', @@ -26,6 +28,7 @@ export default class Spawner extends decorate(Trait) { args: [ ['key', { type: 'string', + options: spawnKeys, }], ['json', { type: 'object', @@ -39,6 +42,7 @@ export default class Spawner extends decorate(Trait) { args: [ ['key', { type: 'string', + options: spawnKeys, }], ['position', { type: 'vector',