mesano
This commit is contained in:
@@ -125,6 +125,34 @@ class InteractionSystem {
|
||||
}
|
||||
}
|
||||
|
||||
// 3.5 Try Opening Chest
|
||||
if (!isAttack && this.scene.terrainSystem) {
|
||||
const decorKey = `${gridX},${gridY}`;
|
||||
const decor = this.scene.terrainSystem.decorationsMap.get(decorKey);
|
||||
|
||||
if (decor && decor.type === 'chest') {
|
||||
// Open chest and spawn loot!
|
||||
console.log('📦 Opening treasure chest!');
|
||||
|
||||
// Random loot
|
||||
const lootTable = ['item_scrap', 'item_chip', 'item_wood', 'item_stone', 'item_bone'];
|
||||
const lootCount = Phaser.Math.Between(2, 4);
|
||||
|
||||
for (let i = 0; i < lootCount; i++) {
|
||||
const randomLoot = Phaser.Utils.Array.GetRandom(lootTable);
|
||||
if (this.scene.lootSystem) {
|
||||
const offsetX = Phaser.Math.Between(-1, 1);
|
||||
const offsetY = Phaser.Math.Between(-1, 1);
|
||||
this.scene.lootSystem.spawnLoot(gridX + offsetX, gridY + offsetY, randomLoot);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove chest
|
||||
this.scene.terrainSystem.removeDecoration(gridX, gridY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Try Planting Tree (Manual Planting)
|
||||
if (!isAttack && (activeTool === 'tree_sapling' || activeTool === 'item_sapling')) {
|
||||
const tile = this.scene.terrainSystem.getTile(gridX, gridY);
|
||||
|
||||
Reference in New Issue
Block a user