humus-old/server/fixtures/hoe.entity.js

57 lines
1.1 KiB
JavaScript

import {buildInvoke, buildTraversal, buildCondition} from '@avocado/behavior';
// Hoe.
export function hoeJSON() {
const tillTile = buildInvoke(
['wielder', 'layer', 'setTileAt'],
[
buildTraversal(['target']),
// 6 === dirt
6,
]
)
return {
traits: {
existent: {},
item: {
params: {
itemActions: {
type: 'actions',
traversals: [
buildInvoke(['item', 'useTool']),
],
},
slotImages: {
default: '/hoe.png',
},
},
},
tool: {
params: {
condition: buildCondition('contains', [
[1, 2, 3, 4],
buildInvoke(
['wielder', 'layer', 'tileAt'],
[
buildTraversal(['target']),
],
),
]),
actions: {
type: 'actions',
traversals: [
tillTile,
],
},
target: {
type: 'projection',
distance: 1,
length: 1,
width: 1,
},
},
},
},
};
}