diff --git a/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js b/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js index c80f7fa3..d4670c95 100644 --- a/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js +++ b/app/imports/api/creature/creatureProperties/methods/getSlotFillFilter.js @@ -24,7 +24,9 @@ export default function getSlotFillFilter({slot, libraryIds}){ slotFillerType: 'classLevel', }] }); - filter.variableName = slot.variableName; + if (slot.variableName) { + filter.variableName = slot.variableName; + } // Only search for levels the class needs if (slot.missingLevels && slot.missingLevels.length) { diff --git a/app/imports/api/creature/creatures/Creatures.js b/app/imports/api/creature/creatures/Creatures.js index 311a013e..25ff5021 100644 --- a/app/imports/api/creature/creatures/Creatures.js +++ b/app/imports/api/creature/creatures/Creatures.js @@ -38,6 +38,11 @@ let CreatureSettingsSchema = new SimpleSchema({ type: Boolean, optional: true, }, + // Hide calculation errors + hideCalculationErrors: { + type: Boolean, + optional: true, + }, // How much each hitDice resets on a long rest hitDiceResetMultiplier: { type: Number, diff --git a/app/imports/api/creature/creatures/methods/restCreature.js b/app/imports/api/creature/creatures/methods/restCreature.js index 2f630a5b..6eafbbcc 100644 --- a/app/imports/api/creature/creatures/methods/restCreature.js +++ b/app/imports/api/creature/creatures/methods/restCreature.js @@ -3,7 +3,7 @@ import { ValidatedMethod } from 'meteor/mdg:validated-method'; import { RateLimiterMixin } from 'ddp-rate-limiter-mixin'; import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js'; import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js'; -import { groupBy, remove, rest, union } from 'lodash'; +import { groupBy, remove, union } from 'lodash'; import { getCreature, getVariables, getPropertiesOfType } from '/imports/api/engine/loadCreatures.js'; diff --git a/app/imports/api/engine/actions/applyTriggers.js b/app/imports/api/engine/actions/applyTriggers.js index 30b1790e..22507780 100644 --- a/app/imports/api/engine/actions/applyTriggers.js +++ b/app/imports/api/engine/actions/applyTriggers.js @@ -11,15 +11,9 @@ export default function applyTriggers(node, { creature, targets, scope, log }, t const type = prop.type; if (creature.triggers?.[type]?.[timing]) { creature.triggers[type][timing].forEach(trigger => { - // Tags - if (!triggerMatchTags(trigger, prop)) return; - // Condition - if (trigger.condition?.parseNode) { - recalculateCalculation(trigger.condition, scope, log); - if (!trigger.condition.value) return; + if (triggerMatchTags(trigger, prop)) { + applyTrigger(trigger, { creature, targets, scope, log }); } - // Apply - applyTrigger(trigger, { creature, targets, scope, log }); }); } } @@ -57,6 +51,13 @@ function triggerMatchTags(trigger, prop) { } export function applyTrigger(trigger, { creature, targets, scope, log }) { + // Prevent triggers from firing if their condition is false + if (trigger.condition?.parseNode) { + recalculateCalculation(trigger.condition, scope, log); + if (!trigger.condition.value) return; + } + + // Prevent triggers from firing themselves in a loop if (trigger.firing) { /* log.content.push({ diff --git a/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js b/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js index b794a61e..fcb2be07 100644 --- a/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js +++ b/app/imports/api/engine/computation/buildComputation/computeInactiveStatus.js @@ -31,9 +31,10 @@ function childrenActive(prop){ switch (prop.type){ // Only equipped items have active children case 'item': return !!prop.equipped; - // The children of actions are always inactive + // 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 diff --git a/app/imports/api/engine/computation/computeCreatureComputation.js b/app/imports/api/engine/computation/computeCreatureComputation.js index be866e1b..88dde8c7 100644 --- a/app/imports/api/engine/computation/computeCreatureComputation.js +++ b/app/imports/api/engine/computation/computeCreatureComputation.js @@ -56,12 +56,14 @@ function pushDependenciesToStack(nodeId, graph, stack, computation){ oriented: true }); const loop = pather.find(nodeId, nodeId); - computation.errors.push({ - type: 'dependencyLoop', - details: { - nodes: loop.map(node => node.id) - }, - }); + if (loop.length) { + computation.errors.push({ + type: 'dependencyLoop', + details: { + nodes: loop.map(node => node.id) + }, + }); + } } stack.push(linkedNode); }, true); diff --git a/app/imports/api/files/s3FileStorage.js b/app/imports/api/files/s3FileStorage.js index c23bf198..3c3c540e 100644 --- a/app/imports/api/files/s3FileStorage.js +++ b/app/imports/api/files/s3FileStorage.js @@ -1,5 +1,4 @@ // https://github.com/VeliovGroup/Meteor-Files/blob/master/docs/aws-s3-integration.md - import { Meteor } from 'meteor/meteor'; import { each, clone } from 'lodash'; import { Random } from 'meteor/random'; @@ -37,8 +36,9 @@ if (Meteor.isServer && Meteor.settings.useS3) { secretAccessKey: s3Conf.secret, endpoint: s3Conf.endpoint, sslEnabled: true, // optional + maxRetries: 10, httpOptions: { - timeout: 6000, + timeout: 12000, agent: false } }); @@ -48,7 +48,7 @@ if (Meteor.isServer && Meteor.settings.useS3) { storagePath, onBeforeUpload, onAfterUpload, - debug = Meteor.isProduction, + debug = !Meteor.isProduction, allowClientCode = false, }){ const collection = new FilesCollection({ @@ -222,7 +222,7 @@ if (Meteor.isServer && Meteor.settings.useS3) { storagePath, onBeforeUpload, onAfterUpload, - debug = Meteor.isProduction, + debug = !Meteor.isProduction, allowClientCode = false, }){ const collection = new FilesCollection({ diff --git a/app/imports/server/publications/library.js b/app/imports/server/publications/library.js index 217f9b00..67dcf74a 100644 --- a/app/imports/server/publications/library.js +++ b/app/imports/server/publications/library.js @@ -16,8 +16,11 @@ const LIBRARY_NODE_TREE_FIELDS = { ancestors: 1, tags: 1, slotFillerCondition: 1, + removed: 1, + removedAt: 1, // SlotFillers slotQuantityFilled: 1, + slotFillerType: 1, // Effect operation: 1, targetTags: 1, diff --git a/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue b/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue index 96de600c..64bd043e 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/BuildTab.vue @@ -1,5 +1,13 @@