@xtia/grid 0.0.13 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `Grid`
2
2
 
3
- **Alpha**: Pre-0.1.0 API details may change
3
+ **Beta**: Stable core, open to refinement pre-1.0.0
4
4
 
5
5
  ## Summary
6
6
 
package/lib/grid.js CHANGED
@@ -261,7 +261,7 @@ export class Grid {
261
261
  this.batchUpdate(() => {
262
262
  for (let y = 0; y < this.height; y++) {
263
263
  for (let x = 0; x < this.width; x++) {
264
- this.trySet(x, y, value);
264
+ this.set(x, y, value);
265
265
  }
266
266
  }
267
267
  });
@@ -271,7 +271,10 @@ export class Grid {
271
271
  this.batchUpdate(() => {
272
272
  for (let oy = 0; oy < source.height; oy++) {
273
273
  for (let ox = 0; ox < source.width; ox++) {
274
- this.trySet(ox + x, oy + y, cachedSource.get(ox, oy));
274
+ const tx = ox + x, ty = oy + y;
275
+ if (tx < 0 || tx >= this.width || ty < 0 || ty >= this.height)
276
+ continue;
277
+ this.set(tx, ty, cachedSource.get(ox, oy));
275
278
  }
276
279
  }
277
280
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.13",
2
+ "version": "0.1.0",
3
3
  "description": "2D store and utilities, with zero-copy regions and transform layers, pathfinding, Pipe2D interop",
4
4
  "name": "@xtia/grid",
5
5
  "exports": {
@@ -12,8 +12,7 @@
12
12
  "keywords": [
13
13
  "grid",
14
14
  "game-dev",
15
- "pathfinding",
16
- "cellular-automata"
15
+ "pathfinding"
17
16
  ],
18
17
  "scripts": {
19
18
  "build": "npx tsc",