| 1 | import test from "node:test"; |
| 2 | import assert from "node:assert/strict"; |
| 3 | import { GroundType, isGroundPassable, isWadeGround, isWaterGround } from "../../shared/definitions/tiles.js"; |
| 4 | import { createEmptyChunkData, isChunkTilePassable, setGround } from "../src/world/chunkData.js"; |
| 5 | |
| 6 | test("deep water ground is impassable; shallow water is passable and wadeable", () => |
| 7 | { |
| 8 | assert.equal(isGroundPassable(GroundType.water), true); |
| 9 | assert.equal(isGroundPassable(GroundType.deepWater), false); |
| 10 | assert.equal(isWadeGround(GroundType.water), true); |
| 11 | assert.equal(isWadeGround(GroundType.deepWater), false); |
| 12 | assert.equal(isWaterGround(GroundType.water), true); |
| 13 | assert.equal(isWaterGround(GroundType.deepWater), true); |
| 14 | |
| 15 | const data = createEmptyChunkData(); |
| 16 | setGround(data, 1, 1, GroundType.water); |
| 17 | setGround(data, 2, 2, GroundType.deepWater); |
| 18 | assert.equal(isChunkTilePassable(data, 1, 1), true); |
| 19 | assert.equal(isChunkTilePassable(data, 2, 2), false); |
| 20 | }); |