fun: watering can

This commit is contained in:
cha0s 2019-05-28 20:35:24 -05:00
parent f51e9c5c8f
commit 67e7755247
4 changed files with 68 additions and 0 deletions

BIN
resource/watering-can.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

View File

@ -74,6 +74,10 @@ export function createEntityForConnection(socket) {
qty: 1,
uri: '/hoe.entity.json',
},
3: {
qty: 1,
uri: '/watering-can.entity.json',
},
},
},
},

View File

@ -32,6 +32,8 @@ import {rockJSON} from './fixtures/rock.entity';
writeFixture('rock.entity.json', rockJSON());
import {hoeJSON} from './fixtures/hoe.entity';
writeFixture('hoe.entity.json', hoeJSON());
import {wateringCanJSON} from './fixtures/watering-can.entity';
writeFixture('watering-can.entity.json', wateringCanJSON());
// Write rooms.
import {kittyFireJSON} from './fixtures/kitty-fire.room';
writeFixture('kitty-fire.room.json', kittyFireJSON());

View File

@ -0,0 +1,62 @@
import {buildInvoke, buildTraversal, buildCondition} from '@avocado/behavior';
// Hoe.
export function wateringCanJSON() {
const waterTile = buildInvoke(
['user', 'layer', 'setTileAt'],
[
buildTraversal(['target']),
// 7 === wet dirt
7,
]
)
return {
traits: {
existent: {},
item: {
params: {
itemActions: {
type: 'actions',
traversals: [
buildInvoke(['item', 'useTool']),
],
},
slotImages: {
default: '/watering-can.png',
},
},
},
tool: {
params: {
condition: buildCondition(
'or',
[
// Has to be dirt.
buildCondition('is', [
6,
buildInvoke(
['user', 'layer', 'tileAt'],
[
buildTraversal(['target']),
],
),
]),
],
),
actions: {
type: 'actions',
traversals: [
waterTile,
],
},
target: {
type: 'projection',
distance: 1,
length: 1,
width: 1,
},
},
},
},
};
}