feat: condition
This commit is contained in:
parent
bfeeb6c318
commit
9b87f9ea74
|
@ -203,6 +203,23 @@ const Expression = ({
|
||||||
if ('any' === arg.type) {
|
if ('any' === arg.type) {
|
||||||
return {type: 'undefined'};
|
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) {
|
if ('expressions' === arg.type) {
|
||||||
return {
|
return {
|
||||||
type: 'expressions',
|
type: 'expressions',
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {basename, extname} from 'path';
|
||||||
|
|
||||||
import {camelCase} from '@latus/core';
|
import {camelCase} from '@latus/core';
|
||||||
|
|
||||||
|
import Condition from './behavior-components/condition';
|
||||||
import Expression from './behavior-components/expression';
|
import Expression from './behavior-components/expression';
|
||||||
import Expressions from './behavior-components/expressions';
|
import Expressions from './behavior-components/expressions';
|
||||||
import Literal from './behavior-components/literal';
|
import Literal from './behavior-components/literal';
|
||||||
|
@ -21,6 +22,7 @@ export default {
|
||||||
const TraitRenderers = latus.invokeReduce('@persea/entity/trait-components');
|
const TraitRenderers = latus.invokeReduce('@persea/entity/trait-components');
|
||||||
latus.set('%trait-components', TraitRenderers);
|
latus.set('%trait-components', TraitRenderers);
|
||||||
latus.set('%behavior-controllers', {
|
latus.set('%behavior-controllers', {
|
||||||
|
condition: Condition,
|
||||||
expression: Expression,
|
expression: Expression,
|
||||||
expressions: Expressions,
|
expressions: Expressions,
|
||||||
literal: Literal,
|
literal: Literal,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user