refactor: unify

This commit is contained in:
cha0s 2022-04-15 19:45:40 -05:00
parent 7534cfa65d
commit 60d490b590

View File

@ -196,16 +196,7 @@ export default (flecks) => {
} }
setTileAt([x, y], tile) { setTileAt([x, y], tile) {
const [w, h] = this.area; return this.stampAt([x, y, 1, 1], [tile]);
const index = y * w + x;
if (x < 0 || x >= w || y < 0 || y >= h || this.$$data[index] === tile) {
return;
}
this.$$data[index] = tile;
if ('web' !== process.env.FLECKS_CORE_BUILD_TARGET) {
this.$$updates.push([[x, y], [1, 1], [tile]]);
this.$$hasUpdates = true;
}
} }
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */