diff --git a/src/engine/state.js b/src/engine/state.js index 5d1488e..c8ddeb9 100644 --- a/src/engine/state.js +++ b/src/engine/state.js @@ -15,6 +15,12 @@ class State { return this.states.set(key, value); } + change(key, amount = 1) { + let val = this.get(key, 0); + val += amount; + this.set(key, val); + } + serialize() { const entries = this.states.entries(); const entrymap = [];