Add change function

master
Talon 2022-02-09 14:38:34 +01:00
parent 24e5650f09
commit f8f4c555b8
1 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,12 @@ class State {
return this.states.set(key, value); return this.states.set(key, value);
} }
change(key, amount = 1) {
let val = this.get(key, 0);
val += amount;
this.set(key, val);
}
serialize() { serialize() {
const entries = this.states.entries(); const entries = this.states.entries();
const entrymap = []; const entrymap = [];