Fixed massive writes to creature.variables on calc

Now only writes changed variables, preventing oplog from being
polluted with massive updates
This commit is contained in:
Stefan Zermatten
2022-04-25 13:57:39 +02:00
parent 33f60c2c6d
commit ea32c54f57
4 changed files with 28 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ import { EJSON } from 'meteor/ejson';
import createGraph from 'ngraph.graph';
export default class CreatureComputation {
constructor(properties){
constructor(properties, creature){
// Set up fields
this.originalPropsById = {};
this.propsById = {};
@@ -11,6 +11,7 @@ export default class CreatureComputation {
this.props = properties;
this.dependencyGraph = createGraph();
this.errors = [];
this.creature = creature;
// Store properties for easy access later
properties.forEach(prop => {