From c251b70ff603a1f6056573e7ce90b24852d967e1 Mon Sep 17 00:00:00 2001 From: ThaumRystra <9525416+ThaumRystra@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:08:55 +0200 Subject: [PATCH] Breaking: children of notes are no longer inactive --- .../buildComputation/computeInactiveStatus.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js b/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js index 5282e93e..982f1c60 100644 --- a/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js +++ b/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js @@ -1,13 +1,13 @@ import walkDown from '/imports/api/engine/computation/utility/walkdown.js'; -export default function computeInactiveStatus(node){ +export default function computeInactiveStatus(node) { const prop = node.node; - if (!isActive(prop)){ + if (!isActive(prop)) { // Mark prop inactive due to self prop.inactive = true; prop.deactivatedBySelf = true; } - if(!childrenActive(prop)){ + if (!childrenActive(prop)) { // Mark children as inactive due to ancestor walkDown(node.children, child => { child.node.inactive = true; @@ -16,27 +16,25 @@ export default function computeInactiveStatus(node){ } } -function isActive(prop){ +function isActive(prop) { if (prop.disabled) return false; - switch (prop.type){ + switch (prop.type) { // Unprepared spells are inactive case 'spell': return !!prop.prepared || !!prop.alwaysPrepared; default: return true; } } -function childrenActive(prop){ +function childrenActive(prop) { // Children of disabled properties are always inactive if (prop.disabled) return false; - switch (prop.type){ + switch (prop.type) { // Only equipped items with non-zero quantity have active children case 'item': return !!prop.equipped && prop.quantity !== 0; // The children of actions, spells, and triggers are always inactive case 'action': return false; case 'spell': return false; case 'trigger': return false; - // The children of notes are always inactive - case 'note': return false; // Other children are active default: return true; }