Triggers 🤫

This commit is contained in:
Stefan Zermatten
2022-07-20 15:57:38 +02:00
parent 6f7e742eb9
commit 566d6a4fef
16 changed files with 853 additions and 187 deletions

View File

@@ -7,6 +7,7 @@ import note from './applyPropertyByType/applyNote.js';
import roll from './applyPropertyByType/applyRoll.js';
import savingThrow from './applyPropertyByType/applySavingThrow.js';
import toggle from './applyPropertyByType/applyToggle.js';
import applyTriggers from '/imports/api/engine/actions/applyTriggers.js';
const applyPropertyByType = {
action,
@@ -21,7 +22,9 @@ const applyPropertyByType = {
toggle,
};
export default function applyProperty(node, opts, ...rest){
export default function applyProperty(node, opts, ...rest) {
applyTriggers(node, opts, 'before');
opts.scope[`#${node.node.type}`] = node.node;
return applyPropertyByType[node.node.type]?.(node, opts, ...rest);
applyPropertyByType[node.node.type]?.(node, opts, ...rest);
applyTriggers(node, opts, 'after');
}