From 732d9100abf536c3e5ab4eb92dc51f8836319024 Mon Sep 17 00:00:00 2001 From: tekki mariani Date: Mon, 23 Mar 2026 12:21:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20terrain=20canvas=20not=20u?= =?UTF-8?q?pdating=20after=20tile=20changes=20(Issue=20#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CHANGE_TILE only called worldSystem.setTile() (built-tile layer only), never refreshTerrainTile() — so chopped trees stayed visually dark-green (FOREST color) even though the tile type was already DARK_GRASS. - adapter.onAction for CHANGE_TILE now also calls refreshTerrainTile() → all tile transitions (chop, mine, seedling maturation) update the canvas pixel immediately and consistently in one place - Remove now-redundant explicit refreshTerrainTile() call in TreeSeedlingSystem (the adapter handler covers it) - Tile-recovery path in GameScene (stateManager.tickTileRecovery) is NOT routed through the adapter, so its manual refreshTerrainTile() call is kept as-is Co-Authored-By: Claude Sonnet 4.6 --- src/scenes/GameScene.ts | 1 + src/systems/TreeSeedlingSystem.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scenes/GameScene.ts b/src/scenes/GameScene.ts index e2cae34..98e933a 100644 --- a/src/scenes/GameScene.ts +++ b/src/scenes/GameScene.ts @@ -78,6 +78,7 @@ export class GameScene extends Phaser.Scene { this.adapter.onAction = (action) => { if (action.type === 'CHANGE_TILE') { this.worldSystem.setTile(action.tileX, action.tileY, action.tile) + this.worldSystem.refreshTerrainTile(action.tileX, action.tileY, action.tile) } else if (action.type === 'SPAWN_RESOURCE') { this.resourceSystem.spawnResourcePublic(action.resource) this.worldSystem.addResourceTile(action.resource.tileX, action.resource.tileY) diff --git a/src/systems/TreeSeedlingSystem.ts b/src/systems/TreeSeedlingSystem.ts index 6d91144..5167293 100644 --- a/src/systems/TreeSeedlingSystem.ts +++ b/src/systems/TreeSeedlingSystem.ts @@ -50,7 +50,6 @@ export class TreeSeedlingSystem { this.removeSprite(id) this.adapter.send({ type: 'REMOVE_TREE_SEEDLING', seedlingId: id }) this.adapter.send({ type: 'CHANGE_TILE', tileX, tileY, tile: TileType.FOREST }) - this.worldSystem.refreshTerrainTile(tileX, tileY, TileType.FOREST) const resourceId = `tree_grown_${tileX}_${tileY}_${Date.now()}` this.adapter.send({