Remove global state object uniqueness
addObject(o: GameObject) {
// ensure that this object is not already in the gamestate
- if (gs.objects.has(o.id)) {
- throw new Error('Object already in gamestate: ' + o.id)
+ if (this.objects.has(o.id)) {
+ throw new Error('Object already in cell: ' + o.id)
}
- gs.objects.set(o.id, o);
-
this.objects.set(o.id, o);
- o.x = this.x;
- o.y = this.y;
}
removeObject(o: GameObject) {
if (this.objects.has(o.id)) {
this.objects.delete(o.id);
- o.x = o.y = undefined;
}
- gs.objects.delete(o.id);
}
store() {