Replaced manual recompute calls with dirty flag settings
This commit is contained in:
@@ -8,7 +8,6 @@ import { CreatureLogSchema, insertCreatureLogWork } from '/imports/api/creature/
|
||||
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
||||
import { nodeArrayToTree } from '/imports/api/parenting/nodesToTree.js';
|
||||
import applyProperty from './applyProperty.js';
|
||||
import computeCreature from '/imports/api/engine/computeCreature.js';
|
||||
|
||||
const doAction = new ValidatedMethod({
|
||||
name: 'creatureProperties.doAction',
|
||||
@@ -77,9 +76,10 @@ const doAction = new ValidatedMethod({
|
||||
doActionWork({creature, targets, properties, ancestors, method: this, methodScope: scope});
|
||||
|
||||
// Recompute all involved creatures
|
||||
computeCreature(creature._id);
|
||||
targets.forEach(target => {
|
||||
computeCreature(target._id);
|
||||
Creatures.update({
|
||||
_id: { $in: [creature._id, ...targetIds] }
|
||||
}, {
|
||||
dirty: true
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import CreatureProperties from '/imports/api/creature/creatureProperties/Creatur
|
||||
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
||||
import { damagePropertyWork } from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||
import { doActionWork } from '/imports/api/engine/actions/doAction.js';
|
||||
import computeCreature from '/imports/api/engine/computeCreature.js';
|
||||
import { CreatureLogSchema } from '/imports/api/creature/log/CreatureLogs.js';
|
||||
|
||||
const doAction = new ValidatedMethod({
|
||||
@@ -129,12 +128,12 @@ const doAction = new ValidatedMethod({
|
||||
}
|
||||
|
||||
// Do the action
|
||||
doActionWork({creature, targets, properties, ancestors, method: this, methodScope: scope, log});
|
||||
|
||||
// Recompute all involved creatures
|
||||
computeCreature(creature._id);
|
||||
targets.forEach(target => {
|
||||
computeCreature(target._id);
|
||||
doActionWork({ creature, targets, properties, ancestors, method: this, methodScope: scope, log });
|
||||
|
||||
Creatures.update({
|
||||
_id: { $in: [creature._id, ...targetIds] }
|
||||
}, {
|
||||
dirty: true
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ import getRootCreatureAncestor from '/imports/api/creature/creatureProperties/ge
|
||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||
import { CreatureLogSchema, insertCreatureLogWork } from '/imports/api/creature/log/CreatureLogs.js';
|
||||
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
||||
import computeCreature from '/imports/api/engine/computeCreature.js';
|
||||
import rollDice from '/imports/parser/rollDice.js';
|
||||
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||
|
||||
@@ -32,9 +31,6 @@ const doCheck = new ValidatedMethod({
|
||||
|
||||
// Do the check
|
||||
doCheckWork({creature, prop, method: this, methodScope: scope});
|
||||
|
||||
// Recompute all involved creatures
|
||||
computeCreature(creature._id);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user