🐛 fix terrain canvas not updating after tile changes (Issue #22)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user