humus-old/server/fixtures/rock.entity.js
2019-06-07 00:14:53 -05:00

66 lines
1.3 KiB
JavaScript

import {buildInvoke, buildTraversal} from '@avocado/behavior';
import {AFFINITY_NONE} from '../../common/combat/constants';
// Healing potion.
export function rockJSON() {
const spawnProjectile = buildInvoke(
['item', 'spawn'],
[
'rock'
],
)
const setProjectileIntoContext = buildInvoke(
['context', 'set'],
[
'projectile',
spawnProjectile,
],
)
const setWielderIntoProjectile = buildInvoke(
['projectile', 'context', 'set'],
[
'wielder',
buildTraversal(['wielder']),
],
);
const setProjectileBehaving = buildTraversal(
['projectile', 'isBehaving'],
true,
);
return {
traits: {
existent: {
state: {
name: 'Rock',
},
},
item: {
params: {
cooldown: 0.33,
itemActions: {
type: 'actions',
traversals: [
setProjectileIntoContext,
setWielderIntoProjectile,
setProjectileBehaving,
],
},
slotImages: {
default: '/rock.png',
},
},
},
spawner: {
params: {
spawns: {
rock: {
uri: '/rock-projectile.entity.json',
},
},
},
}
},
};
}