fun: tomato plant is a tile entity

This commit is contained in:
cha0s 2019-06-12 22:23:21 -05:00
parent 2164a43bfd
commit 766e6b3e0c
2 changed files with 22 additions and 8 deletions

View File

@ -69,6 +69,7 @@ export function tomatoPlantJSON() {
}, },
positioned: {}, positioned: {},
roomed: {}, roomed: {},
'tile-entity': {},
visible: {}, visible: {},
}, },
}; };

View File

@ -2,6 +2,13 @@ import {buildInvoke, buildTraversal, buildCondition} from '@avocado/behavior';
// Tomato seeds. // Tomato seeds.
export function tomatoSeedsJSON() { export function tomatoSeedsJSON() {
const hasExistingTomato = buildInvoke(
['wielder', 'layer', 'hasTileEntityWithUriAt'],
[
buildTraversal(['target']),
'/tomato-plant.entity.json',
],
);
return { return {
traits: { traits: {
existent: {}, existent: {},
@ -30,7 +37,8 @@ export function tomatoSeedsJSON() {
tool: { tool: {
params: { params: {
// Has to be wet dirt. // Has to be wet dirt.
condition: buildCondition('is', [ condition: buildCondition('and', [
buildCondition('is', [
7, 7,
buildInvoke( buildInvoke(
['wielder', 'layer', 'tileAt'], ['wielder', 'layer', 'tileAt'],
@ -39,6 +47,11 @@ export function tomatoSeedsJSON() {
], ],
), ),
]), ]),
buildCondition('is', [
false,
hasExistingTomato,
]),
]),
actions: { actions: {
type: 'actions', type: 'actions',
traversals: [ traversals: [