Creatures are now cached in memory for computation
Also removed dependency group calculation because the optimisation isn't as useful to reduce DB calls if the creature is in memory anyway
This commit is contained in:
@@ -82,14 +82,6 @@ const DenormalisedOnlyCreaturePropertySchema = new SimpleSchema({
|
||||
index: 1,
|
||||
removeBeforeCompute: true,
|
||||
},
|
||||
// Dependency tree, the ID of the lowest ordered doc connected to this doc
|
||||
// via dependencies
|
||||
depGroupId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
index: 1,
|
||||
removeBeforeCompute: true,
|
||||
},
|
||||
});
|
||||
|
||||
CreaturePropertySchema.extend(DenormalisedOnlyCreaturePropertySchema);
|
||||
|
||||
@@ -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 computeCreature, { computeCreatureDependencyGroup } from '/imports/api/engine/computeCreature.js';
|
||||
import computeCreature from '/imports/api/engine/computeCreature.js';
|
||||
|
||||
const damageProperty = new ValidatedMethod({
|
||||
name: 'creatureProperties.damage',
|
||||
@@ -38,12 +38,7 @@ const damageProperty = new ValidatedMethod({
|
||||
);
|
||||
}
|
||||
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);
|
||||
}
|
||||
computeCreature(rootCreature._id);
|
||||
return result;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user