feat(expansion): implement Phase 3 (Town Restoration) and Phase 4 (Cannabis Textiles)

- Added TownSquareScene and linked it with M key transition
- Integrated TownRestorationSystem with material costs and inventory
- Added locked shop items in NPCShopSystem until buildings are restored
- Updated InteractionSystem to handle ruin restoration triggers
- Expanded Cannabis farming to yield Hemp Fiber
- Added Hemp Clothing crafting recipe and procedural icons
- Refactored StatusEffectSystem and NPCShopSystem to global classes
This commit is contained in:
2025-12-27 23:32:22 +01:00
parent 611cd35777
commit 822c586843
12 changed files with 454 additions and 40 deletions

View File

@@ -259,13 +259,10 @@ class InteractionSystem {
const decor = this.scene.terrainSystem.decorationsMap.get(decorKey);
if (decor && decor.type === 'chest') {
// Open chest and spawn loot!
// ... chest opening logic
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) {
@@ -274,13 +271,44 @@ class InteractionSystem {
this.scene.lootSystem.spawnLoot(gridX + offsetX, gridY + offsetY, randomLoot);
}
}
// Remove chest
this.scene.terrainSystem.removeDecoration(gridX, gridY);
return;
}
// RUIN INTERACTION
if (decor && decor.type.includes('ruin')) {
console.log('🏚️ Interacted with Ruin at', gridX, gridY);
if (this.scene.townRestorationSystem) {
// Find a building that matches this location or type
// For now, let's just trigger a generic notification or the first building
const building = this.scene.townRestorationSystem.buildings.get('jakob_shop'); // Demo link
if (building) {
this.scene.events.emit('show-floating-text', {
x: gridX * 48, y: gridY * 48 - 40,
text: `Restore ${building.name}?`,
color: '#FFD700'
});
// Try start restoration if resources exist
if (this.scene.townRestorationSystem.hasMaterials(building.materials)) {
this.scene.townRestorationSystem.startRestoration(building.id);
} else {
const ui = this.scene.scene.get('UIScene');
if (ui && ui.showNotification) {
ui.showNotification({
title: 'Missing Materials',
text: `Need Wood: ${building.materials.wood}, Stone: ${building.materials.stone}`,
icon: '📦'
});
}
}
}
}
return;
}
}
// 4. Try Planting Tree (Manual Planting)
if (!isAttack && (activeTool === 'tree_sapling' || activeTool === 'item_sapling')) {
const tile = this.scene.terrainSystem.getTile(gridX, gridY);