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,9 +3,14 @@ import walkDown from '/imports/api/engine/computation/utility/walkdown.js';
export default function computeInactiveStatus(node){
const prop = node.node;
if (isActive(prop)) return;
// Unequipped items, notes, and actions disable their children,
// Unequipped items, notes, spells, and actions disable their children,
// but are not disabled themselves
if (prop.type !== 'item' && prop.type !== 'note' && prop.type !== 'action' ){
if (
prop.type !== 'item' &&
prop.type !== 'note' &&
prop.type !== 'action' &&
prop.type !== 'spell'
){
prop.inactive = true;
prop.deactivatedBySelf = true;
}
@@ -20,7 +25,7 @@ function isActive(prop){
if (prop.disabled) return false;
switch (prop.type){
case 'item': return !!prop.equipped;
case 'spell': return !!prop.prepared || !!prop.alwaysPrepared;
case 'spell': return false;
case 'note': return false;
case 'action': return false;
default: return true;