From dae0f1810a77aae93abf8cae120e990c18b8e964 Mon Sep 17 00:00:00 2001 From: NovaFarma Dev Date: Thu, 11 Dec 2025 13:18:26 +0100 Subject: [PATCH] DEBUG: Water animation troubleshooting - added debug logs to check tile generation and update loop --- src/systems/TerrainSystem.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/systems/TerrainSystem.js b/src/systems/TerrainSystem.js index ba57939..b08dd49 100644 --- a/src/systems/TerrainSystem.js +++ b/src/systems/TerrainSystem.js @@ -339,7 +339,18 @@ class TerrainSystem { } } - console.log(`✅ World Init Complete. Loaded ${this.generatedChunks.size} chunks.`); + console.log('✅ World Init Complete. Loaded ${this.generatedChunks.size} chunks.'); + + // DEBUG: Check how many water tiles were generated + let waterCount = 0; + for (let y = 0; y < this.height; y++) { + for (let x = 0; x < this.width; x++) { + if (this.tiles[y] && this.tiles[y][x] && this.tiles[y][x].type === 'water') { + waterCount++; + } + } + } + console.log(`🌊 DEBUG: Generated ${waterCount} water tiles in world`); } generateChunk(cx, cy) { @@ -1076,6 +1087,9 @@ class TerrainSystem { if (!this.waterCurrentFrame) this.waterCurrentFrame = 0; this.waterCurrentFrame = (this.waterCurrentFrame + 1) % 4; // Cycle 0-3 + // DEBUG + let waterTileCount = 0; + // Update vse visible water tiles s novim frame-om this.visibleTiles.forEach((sprite, key) => { const coords = key.split(','); @@ -1084,8 +1098,19 @@ class TerrainSystem { if (this.tiles[y] && this.tiles[y][x] && this.tiles[y][x].type === 'water') { sprite.setTexture(`water_frame_${this.waterCurrentFrame}`); + waterTileCount++; } }); + + // DEBUG LOG + if (waterTileCount > 0) { + console.log(`🌊 Water animation: frame ${this.waterCurrentFrame} updated ${waterTileCount} tiles`); + } else { + console.warn('⚠️ No water tiles found in visibleTiles!', { + visibleTilesCount: this.visibleTiles.size, + currentFrame: this.waterCurrentFrame + }); + } } } }