Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions src/data/buildings/walls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,55 +122,6 @@ export const WALL_UPGRADE_DEFINITIONS: Record<WallUpgradeType, WallUpgradeDefini
}
);

/**
* Array of all wall building definitions.
* @deprecated Use DefinitionRegistry.getAllWalls() instead
*/
export const WALL_BUILDINGS: WallDefinition[] = new Proxy([] as WallDefinition[], {
get(target, prop) {
if (prop === 'length') {
if (!DefinitionRegistry.isInitialized()) return 0;
const allBuildings = DefinitionRegistry.getAllBuildings();
return Object.values(allBuildings).filter((b) => (b as WallDefinition).isWall).length;
}
if (typeof prop === 'string' && !isNaN(Number(prop))) {
if (!DefinitionRegistry.isInitialized()) return undefined;
const allBuildings = DefinitionRegistry.getAllBuildings();
const walls = Object.values(allBuildings).filter((b) => (b as WallDefinition).isWall);
return walls[Number(prop)] as WallDefinition | undefined;
}
if (prop === Symbol.iterator) {
return function* () {
if (!DefinitionRegistry.isInitialized()) return;
const allBuildings = DefinitionRegistry.getAllBuildings();
yield* Object.values(allBuildings).filter((b) => (b as WallDefinition).isWall) as WallDefinition[];
};
}
// Delegate array methods - bind to the real array so 'this' works correctly
if (typeof prop === 'string' && typeof Array.prototype[prop as keyof typeof Array.prototype] === 'function') {
const allBuildings = DefinitionRegistry.isInitialized() ? DefinitionRegistry.getAllBuildings() : {};
const walls = Object.values(allBuildings).filter((b) => (b as WallDefinition).isWall);
const method = (walls as unknown as Record<string, unknown>)[prop];
if (typeof method === 'function') {
return method.bind(walls);
}
return method;
}
return (target as unknown as Record<string | symbol, unknown>)[prop];
},
has(_target, prop) {
// Support 'in' operator for numeric indices so array algorithms work
if (typeof prop === 'string' && !isNaN(Number(prop))) {
if (!DefinitionRegistry.isInitialized()) return false;
const index = Number(prop);
const allBuildings = DefinitionRegistry.getAllBuildings();
const length = Object.values(allBuildings).filter((b) => (b as WallDefinition).isWall).length;
return index >= 0 && index < length;
}
return prop in Array.prototype;
},
});

// ==================== UTILITY FUNCTIONS ====================

/**
Expand Down
46 changes: 0 additions & 46 deletions src/data/research/dominion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,52 +112,6 @@ export const RESEARCH_DEFINITIONS: Record<string, ResearchDefinition> = new Prox
}
);

/**
* Array of all Dominion research definitions.
* @deprecated Use DefinitionRegistry.getAllResearch() instead
*/
export const DOMINION_RESEARCH: ResearchDefinition[] = new Proxy([] as ResearchDefinition[], {
get(target, prop) {
if (prop === 'length') {
if (!DefinitionRegistry.isInitialized()) return 0;
return Object.keys(DefinitionRegistry.getAllResearch()).length;
}
if (typeof prop === 'string' && !isNaN(Number(prop))) {
if (!DefinitionRegistry.isInitialized()) return undefined;
const research = Object.values(DefinitionRegistry.getAllResearch());
return research[Number(prop)] as ResearchDefinition | undefined;
}
if (prop === Symbol.iterator) {
return function* () {
if (!DefinitionRegistry.isInitialized()) return;
yield* Object.values(DefinitionRegistry.getAllResearch()) as ResearchDefinition[];
};
}
// Delegate array methods - bind to the real array so 'this' works correctly
if (typeof prop === 'string' && typeof Array.prototype[prop as keyof typeof Array.prototype] === 'function') {
const research = DefinitionRegistry.isInitialized()
? Object.values(DefinitionRegistry.getAllResearch())
: [];
const method = (research as unknown as Record<string, unknown>)[prop];
if (typeof method === 'function') {
return method.bind(research);
}
return method;
}
return (target as unknown as Record<string | symbol, unknown>)[prop];
},
has(_target, prop) {
// Support 'in' operator for numeric indices so array algorithms work
if (typeof prop === 'string' && !isNaN(Number(prop))) {
if (!DefinitionRegistry.isInitialized()) return false;
const index = Number(prop);
const length = Object.keys(DefinitionRegistry.getAllResearch()).length;
return index >= 0 && index < length;
}
return prop in Array.prototype;
},
});

/**
* Building -> research mapping.
* This is derived from the building canResearch arrays.
Expand Down
2 changes: 0 additions & 2 deletions src/engine/core/GameCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ export interface GameCommand {
// Input modifiers
/** Whether shift was held (for command queuing) */
queue?: boolean;
/** @deprecated Use `queue` instead */
shiftHeld?: boolean;
}

/**
Expand Down
10 changes: 6 additions & 4 deletions tests/data/walls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { describe, it, expect } from 'vitest';
import {
WALL_DEFINITIONS,
WALL_UPGRADE_DEFINITIONS,
WALL_BUILDINGS,
calculateWallLine,
calculateWallLineCost,
getWallConnectionType,
Expand Down Expand Up @@ -115,9 +114,12 @@ describe('Wall Definitions', () => {
});
});

describe('WALL_BUILDINGS', () => {
it('contains all wall definitions', () => {
expect(WALL_BUILDINGS.length).toBe(Object.keys(WALL_DEFINITIONS).length);
describe('WALL_DEFINITIONS coverage', () => {
it('contains expected wall definitions', () => {
const wallIds = Object.keys(WALL_DEFINITIONS);
expect(wallIds.length).toBeGreaterThan(0);
expect(wallIds).toContain('wall_segment');
expect(wallIds).toContain('wall_gate');
});
});
});
Expand Down
1 change: 0 additions & 1 deletion tests/engine/network/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
const id3 = commandIdGenerator.generate('p1');
expect(id3).toBe('p1-1-2');
});
});

describe('commandIdGenerator.reset()', () => {
it('resets the counter and tick to 0', () => {
Expand Down Expand Up @@ -103,3 +102,3 @@
});
});
});
Loading