humus-old/server/fixtures/tomato-seeds.entity.js
2019-05-30 09:12:17 -05:00

83 lines
2.0 KiB
JavaScript

import {buildInvoke, buildTraversal, buildCondition} from '@avocado/behavior';
// Tomato seeds.
export function tomatoSeedsJSON() {
return {
traits: {
existent: {},
item: {
params: {
itemActions: {
type: 'actions',
traversals: [
buildInvoke(['item', 'useTool']),
],
},
slotImages: {
default: '/seeds.png',
},
},
},
spawner: {
params: {
spawns: {
'tomato-plant': {
uri: '/tomato-plant.entity.json',
},
},
},
},
tool: {
params: {
// Has to be wet dirt.
condition: buildCondition('is', [
7,
buildInvoke(
['user', 'layer', 'tileAt'],
[
buildTraversal(['target']),
],
),
]),
actions: {
type: 'actions',
traversals: [
buildInvoke(
['item', 'spawnAt'],
[
'tomato-plant',
buildInvoke(
['Vector', 'add'],
[
buildInvoke(
['Vector', 'mul'],
[
buildTraversal(['target']),
buildTraversal(['user', 'layer', 'tileset', 'tileSize']),
],
),
buildInvoke(
['Vector', 'scale'],
[
buildTraversal(['user', 'layer', 'tileset', 'tileSize']),
0.5,
]
),
]
),
],
),
],
},
target: {
type: 'projection',
distance: -1,
length: 3,
width: 3,
},
},
},
},
};
}