refactor: remove all food POI references, clean up dead code

Remove pointsOfInterest from WorldState type, state serializer,
and client rendering. Remove foodPositions from map generator
interface and output. Update stale comment in worldSerializer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-10 20:47:47 +00:00
parent d1de641d34
commit 955dd61117
6 changed files with 3 additions and 24 deletions

View File

@@ -408,7 +408,7 @@ export class GameScene extends Phaser.Scene {
}
private drawWorld(): void {
const { worldWidth, worldHeight, terrain, decorations, trunkDecorations, pointsOfInterest } = this.worldState;
const { worldWidth, worldHeight, terrain, decorations, trunkDecorations } = this.worldState;
// --- LPC watergrass autotile layout (3 cols x 6 rows, 32x32 tiles) ---
// The 3×3 grid (rows 2-4) shows a WATER pond on GRASS background:
@@ -592,18 +592,6 @@ export class GameScene extends Phaser.Scene {
const aboveCharDepth = worldHeight * TILE_SIZE + 1;
createLayer(decoData, 'trees', 'lpc_treesnstone', aboveCharDepth);
// Points of interest markers
const graphics = this.add.graphics();
graphics.setDepth(-6);
for (const poi of pointsOfInterest) {
graphics.fillStyle(0xcc8833, 0.7);
graphics.fillRect(
poi.position.x * TILE_SIZE + 8,
poi.position.y * TILE_SIZE + 8,
TILE_SIZE - 16,
TILE_SIZE - 16,
);
}
}
private async spawnEntities(entities: EntityState[]): Promise<void> {

View File

@@ -81,11 +81,6 @@ describe('generateMap — resource generation', () => {
expect(berryTiles.length).toBeGreaterThan(0);
});
it('does not generate food positions', () => {
const map = generateMap(32, 32, 42);
expect(map.foodPositions).toHaveLength(0);
});
it('deterministic with same seed', () => {
const a = generateMap(32, 32, 123);
const b = generateMap(32, 32, 123);

View File

@@ -6,7 +6,6 @@ export interface GeneratedMap {
decorations: number[];
trunkDecorations: number[];
obstacles: Set<string>;
foodPositions: { x: number; y: number }[];
resourceTiles: Array<{ x: number; y: number; resourceType: string }>;
}
@@ -156,7 +155,6 @@ export function generateMap(
const obstacles = new Set<string>();
const resourceTiles: Array<{ x: number; y: number; resourceType: string }> = [];
const foodPositions: { x: number; y: number }[] = [];
// Reserve positions that must stay clear
const reserved = new Set<string>();
@@ -314,5 +312,5 @@ export function generateMap(
}
}
return { terrain, decorations, trunkDecorations, obstacles, foodPositions, resourceTiles };
return { terrain, decorations, trunkDecorations, obstacles, resourceTiles };
}

View File

@@ -89,7 +89,6 @@ export function serializeWorldState(world: World, map: GameMap): WorldState {
worldHeight: map.height,
tileSize: TILE_SIZE,
obstacles: map.getObstacles(),
pointsOfInterest: [],
terrain: map.terrain,
decorations: map.decorations,
trunkDecorations: map.trunkDecorations,

View File

@@ -40,7 +40,7 @@ export function saveTiles(width: number, height: number, data: TileData): void {
}
}
// Save obstacles and foodPositions as metadata
// Save obstacles and berry bushes as metadata
const upsertMeta = db.prepare(
"INSERT INTO metadata (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value"
);

View File

@@ -169,7 +169,6 @@ export interface WorldState {
worldHeight: number;
tileSize: number;
obstacles: Position[];
pointsOfInterest: { type: 'food'; position: Position }[];
terrain: number[]; // flat array [y * width + x], terrain type per tile
decorations: number[]; // flat array [y * width + x], decoration tile index (-1 = none)
trunkDecorations: number[]; // flat array [y * width + x], trunk tile index (-1 = none)