Progress on dependency updates
This commit is contained in:
@@ -4,7 +4,7 @@ import SimpleSchema from 'simpl-schema';
|
||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||
import getRootCreatureAncestor from '/imports/api/creature/creatureProperties/getRootCreatureAncestor.js';
|
||||
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||
import { computeCreatureDependencyGroup } from '/imports/api/engine/computeCreature.js';
|
||||
import computeCreature, { computeCreatureDependencyGroup } from '/imports/api/engine/computeCreature.js';
|
||||
|
||||
const damageProperty = new ValidatedMethod({
|
||||
name: 'creatureProperties.damage',
|
||||
@@ -37,9 +37,13 @@ const damageProperty = new ValidatedMethod({
|
||||
`Property of type "${property.type}" can't be damaged`
|
||||
);
|
||||
}
|
||||
let result = damagePropertyWork({property, operation, value});
|
||||
// Dependencies can't be changed through damage, only recompute deps
|
||||
computeCreatureDependencyGroup(property);
|
||||
let result = damagePropertyWork({ property, operation, value });
|
||||
if (property.depGroupId) {
|
||||
// Dependencies can't be changed through damage, only recompute deps
|
||||
computeCreatureDependencyGroup([property.depGroupId], rootCreature._id);
|
||||
} else {
|
||||
computeCreature(rootCreature._id);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user