Progress all over the place with viewer, forms, small engine tweaks

This commit is contained in:
Stefan Zermatten
2021-10-21 22:18:01 +02:00
parent 1b5bb981e9
commit e3a1eff751
28 changed files with 554 additions and 258 deletions

View File

@@ -3,6 +3,7 @@ import computeVariableAsAttribute from './computeVariable/computeVariableAsAttri
import computeVariableAsSkill from './computeVariable/computeVariableAsSkill.js';
import computeVariableAsConstant from './computeVariable/computeVariableAsConstant.js';
import computeVariableAsClass from './computeVariable/computeVariableAsClass.js';
import computeVariableAsToggle from './computeVariable/computeVariableAsToggle.js';
import computeImplicitVariable from './computeVariable/computeImplicitVariable.js';
export default function computeVariable(computation, node){
@@ -50,13 +51,15 @@ function combineAggregations(computation, node){
function computeVariableProp(computation, node, prop){
if (!prop) return;
if (prop.type === 'attribute'){
computeVariableAsAttribute(computation, node, prop)
computeVariableAsAttribute(computation, node, prop);
} else if (prop.type === 'skill'){
computeVariableAsSkill(computation, node, prop)
computeVariableAsSkill(computation, node, prop);
} else if (prop.type === 'constant'){
computeVariableAsConstant(computation, node, prop)
computeVariableAsConstant(computation, node, prop);
} else if (prop.type === 'class'){
computeVariableAsClass(computation, node, prop)
computeVariableAsClass(computation, node, prop);
} else if (prop.type === 'toggle'){
computeVariableAsToggle(computation, node, prop);
}
}

View File

@@ -0,0 +1,7 @@
import getAggregatorResult from './getAggregatorResult.js';
export default function computeVariableAsToggle(computation, node, prop){
let result = getAggregatorResult(node, prop) || 0;
prop.value = !!result || !!prop.enabled || !!prop.condition?.value;
}