Change black empty tile to grass and make it destructable

This commit is contained in:
Peter Stockings
2026-01-05 20:59:33 +11:00
parent a7091c70c6
commit ecf58dded1
8 changed files with 150 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { idx, inBounds, isWall, isBlocked } from '../world/world-logic';
import { type World, type Tile } from '../../core/types';
import { GAME_CONFIG } from '../../core/config/GameConfig';
import { TileType } from '../../core/terrain';
describe('World Utilities', () => {
@@ -46,9 +46,9 @@ describe('World Utilities', () => {
describe('isWall', () => {
it('should return true for wall tiles', () => {
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
tiles[0] = GAME_CONFIG.terrain.wall; // wall at 0,0
tiles[55] = GAME_CONFIG.terrain.wall; // wall at 5,5
const tiles: Tile[] = new Array(100).fill(TileType.EMPTY);
tiles[0] = TileType.WALL; // wall at 0,0
tiles[55] = TileType.WALL; // wall at 5,5
const world = createTestWorld(10, 10, tiles);
@@ -58,7 +58,7 @@ describe('World Utilities', () => {
});
it('should return false for floor tiles', () => {
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
const tiles: Tile[] = new Array(100).fill(TileType.EMPTY);
const world = createTestWorld(10, 10, tiles);
expect(isWall(world, 3, 3)).toBe(false);
@@ -76,8 +76,8 @@ describe('World Utilities', () => {
describe('isBlocked', () => {
it('should return true for walls', () => {
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
tiles[55] = GAME_CONFIG.terrain.wall; // wall at 5,5
const tiles: Tile[] = new Array(100).fill(TileType.EMPTY);
tiles[55] = TileType.WALL; // wall at 5,5
const world = createTestWorld(10, 10, tiles);