humus-old/server/fixtures/mama-kitty-spawner.entity.js
2019-05-30 09:11:44 -05:00

91 lines
1.6 KiB
JavaScript

import {buildInvoke, buildTraversal} from '@avocado/behavior';
// Mama kitty spawner.
export function mamaKittySpawnerJSON() {
const storeJSON = buildTraversal(
['context', 'json'],
{
traits: {
positioned: {
state: {},
},
},
},
);
function roomAxeValue(roomAxe) {
return buildInvoke(
['global', 'randomNumber'],
[
100,
buildInvoke(
['global', 'sub'],
[
buildTraversal(['entity', 'room', roomAxe]),
100,
],
)
],
);
}
const spawn = buildInvoke(
['entity', 'spawnAt'],
[
'mama',
buildInvoke(
['global', 'makeArray'],
[
roomAxeValue('width'),
roomAxeValue('height'),
],
),
buildTraversal(['context', 'json']),
],
);
return {
traits: {
behaved: {
params: {
routines: {
type: 'routines',
routines: {
initial: {
type: 'routine',
routine: {
type: 'actions',
traversals: [
spawn,
],
}
},
},
},
},
},
existent: {
state: {
name: 'Mama spawner',
},
},
layered: {},
listed: {},
roomed: {},
spawner: {
params: {
spawns: {
mama: {
uri: '/mama-kitty.entity.json',
},
},
},
state: {
maxSpawns: 2,
},
},
},
};
}