diff --git a/src/engine/workers/GameWorker.ts b/src/engine/workers/GameWorker.ts index c6ba4386..49dd753f 100644 --- a/src/engine/workers/GameWorker.ts +++ b/src/engine/workers/GameWorker.ts @@ -427,13 +427,11 @@ export class WorkerGame extends GameCore { public override start(): void { if (this.state === 'running') return; - if (debugInitialization.isEnabled()) { - console.log('[GameWorker] Starting game loop. Entity counts:', { - units: this.world.getEntitiesWith('Unit').length, - buildings: this.world.getEntitiesWith('Building').length, - resources: this.world.getEntitiesWith('Resource').length, - }); - } + debugInitialization.log('[GameWorker] Starting game loop. Entity counts:', { + units: this.world.getEntitiesWith('Unit').length, + buildings: this.world.getEntitiesWith('Building').length, + resources: this.world.getEntitiesWith('Resource').length, + }); this.state = 'running'; this.lastTickTime = performance.now(); @@ -587,11 +585,11 @@ export class WorkerGame extends GameCore { this.renderStatesSent++; if (debugInitialization.isEnabled() && (this.renderStatesSent <= 5 || this.renderStatesSent % 100 === 0)) { - console.log(`[GameWorker] sendRenderState #${this.renderStatesSent}: units=${units.length}, buildings=${buildings.length}, resources=${resources.length}`); + debugInitialization.log(`[GameWorker] sendRenderState #${this.renderStatesSent}: units=${units.length}, buildings=${buildings.length}, resources=${resources.length}`); } if (debugInitialization.isEnabled() && !this.hasLoggedFirstRenderState && (units.length > 0 || buildings.length > 0 || resources.length > 0)) { - console.log('[GameWorker] First render state with entities:', { + debugInitialization.log('[GameWorker] First render state with entities:', { tick: this.currentTick, units: units.length, buildings: buildings.length, diff --git a/src/workers/pathfinding.worker.ts b/src/workers/pathfinding.worker.ts index f0952c52..7dad286a 100644 --- a/src/workers/pathfinding.worker.ts +++ b/src/workers/pathfinding.worker.ts @@ -232,6 +232,7 @@ function loadNavMeshFromGeometry( } if (DEBUG) { + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag console.log('[PathfindingWorker] Generating navmesh from geometry:', { vertices: positions.length / 3, triangles: indices.length / 3, @@ -263,6 +264,7 @@ function loadNavMeshFromGeometry( heightMapWidth = heightMapW; heightMapHeight = heightMapH; } + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag if (DEBUG) console.log('[PathfindingWorker] TileCache navmesh generated successfully'); return true; } @@ -270,6 +272,7 @@ function loadNavMeshFromGeometry( // TileCache failed - try solo navmesh fallback if (DEBUG) { console.warn('[PathfindingWorker] TileCache generation failed:', (result as { error?: string }).error); + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag console.log('[PathfindingWorker] Trying solo navmesh fallback...'); } @@ -285,6 +288,7 @@ function loadNavMeshFromGeometry( heightMapWidth = heightMapW; heightMapHeight = heightMapH; } + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag if (DEBUG) console.log('[PathfindingWorker] Solo navmesh generated successfully'); return true; } @@ -553,6 +557,7 @@ function loadWaterNavMesh(positions: Float32Array, indices: Uint32Array): boolea } if (DEBUG) { + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag console.log('[PathfindingWorker] Generating water navmesh:', { vertices: positions.length / 3, triangles: indices.length / 3, @@ -566,6 +571,7 @@ function loadWaterNavMesh(positions: Float32Array, indices: Uint32Array): boolea if (result.success && result.navMesh) { waterNavMesh = result.navMesh; waterNavMeshQuery = new NavMeshQuery(waterNavMesh); + // eslint-disable-next-line no-console -- Debug logging gated by DEBUG flag if (DEBUG) console.log('[PathfindingWorker] Water navmesh generated successfully'); return true; } diff --git a/tests/engine/network/types.test.ts b/tests/engine/network/types.test.ts index 9269f74f..a4cf9e59 100644 --- a/tests/engine/network/types.test.ts +++ b/tests/engine/network/types.test.ts @@ -51,6 +51,7 @@ describe('Network Types - Utility Functions', () => { const id3 = commandIdGenerator.generate('p1'); expect(id3).toBe('p1-1-2'); }); + }); describe('commandIdGenerator.reset()', () => { it('resets the counter and tick to 0', () => { diff --git a/tests/utils/BenchmarkRunner.ts b/tests/utils/BenchmarkRunner.ts index c364d5cc..1121f842 100644 --- a/tests/utils/BenchmarkRunner.ts +++ b/tests/utils/BenchmarkRunner.ts @@ -87,6 +87,7 @@ export class BenchmarkRunner { sum += Math.sqrt(j); } // Prevent optimization + // eslint-disable-next-line no-console -- Intentional: prevents JIT optimization if (sum < 0) console.log(sum); } @@ -99,6 +100,7 @@ export class BenchmarkRunner { } const elapsed = performance.now() - start; samples.push(elapsed); + // eslint-disable-next-line no-console -- Intentional: prevents JIT optimization if (sum < 0) console.log(sum); }