From 9b87f9ea7452beec2582fbdcd91761085c2aadfb Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 6 Feb 2021 20:17:57 -0600 Subject: [PATCH] feat: condition --- .../src/behavior-components/expression.jsx | 17 +++++++++++++++++ packages/entity/src/index.js | 2 ++ 2 files changed, 19 insertions(+) diff --git a/packages/entity/src/behavior-components/expression.jsx b/packages/entity/src/behavior-components/expression.jsx index adfb521..3256c72 100644 --- a/packages/entity/src/behavior-components/expression.jsx +++ b/packages/entity/src/behavior-components/expression.jsx @@ -203,6 +203,23 @@ const Expression = ({ if ('any' === arg.type) { return {type: 'undefined'}; } + if ('condition' === arg.type) { + return { + ...(false === arg.compile ? {compile: false} : {}), + type: 'condition', + operator: 'and', + operands: [ + { + type: 'literal', + value: true, + }, + { + type: 'literal', + value: true, + }, + ], + }; + } if ('expressions' === arg.type) { return { type: 'expressions', diff --git a/packages/entity/src/index.js b/packages/entity/src/index.js index fe2940d..f7d0ab5 100644 --- a/packages/entity/src/index.js +++ b/packages/entity/src/index.js @@ -2,6 +2,7 @@ import {basename, extname} from 'path'; import {camelCase} from '@latus/core'; +import Condition from './behavior-components/condition'; import Expression from './behavior-components/expression'; import Expressions from './behavior-components/expressions'; import Literal from './behavior-components/literal'; @@ -21,6 +22,7 @@ export default { const TraitRenderers = latus.invokeReduce('@persea/entity/trait-components'); latus.set('%trait-components', TraitRenderers); latus.set('%behavior-controllers', { + condition: Condition, expression: Expression, expressions: Expressions, literal: Literal,