Constants should now respect toggles
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import applyToggles from '/imports/api/creature/computation/engine/applyToggles.js';
|
||||
|
||||
export default function computeConstant(constant, memo){
|
||||
// Apply any toggles
|
||||
applyToggles(constant, memo);
|
||||
}
|
||||
@@ -5,8 +5,13 @@ import computeEffect from '/imports/api/creature/computation/engine/computeEffec
|
||||
import computeToggle from '/imports/api/creature/computation/engine/computeToggle.js';
|
||||
import computeEndStepProperty from '/imports/api/creature/computation/engine/computeEndStepProperty.js';
|
||||
import computeInlineCalculations from '/imports/api/creature/computation/engine/computeInlineCalculations.js';
|
||||
import computeConstant from '/imports/api/creature/computation/engine/computeConstant.js';
|
||||
|
||||
export default function computeMemo(memo){
|
||||
// Compute all constants that could be used
|
||||
forOwn(memo.constantsByVariableName, constant => {
|
||||
computeConstant (constant, memo);
|
||||
});
|
||||
// Compute level
|
||||
computeLevels(memo);
|
||||
// Compute all stats, even if they are overriden
|
||||
|
||||
@@ -71,8 +71,8 @@ function replaceConstants({calc, memo, prop, dependencies, context}){
|
||||
} else if (node.name === '#constant'){
|
||||
constant = findAncestorByType({type: 'constant', prop, memo});
|
||||
}
|
||||
// replace constants that aren't overridden by stats
|
||||
if (constant && !stat){
|
||||
// replace constants that aren't overridden by stats or disabled by a toggle
|
||||
if (constant && !constant.deactivatedByToggle && !stat){
|
||||
dependencies = union(dependencies, [
|
||||
constant._id,
|
||||
...constant.dependencies
|
||||
|
||||
Reference in New Issue
Block a user