phase 11 koncano
This commit is contained in:
@@ -58,24 +58,71 @@ class InteractionSystem {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check for Buildings (Signs included)
|
||||
// Currently decorations don't store data easily accessible here without query.
|
||||
// Assuming nearest logic above covers entities.
|
||||
|
||||
if (nearest) {
|
||||
console.log('E Interacted with:', nearest.type || nearest.lootTable);
|
||||
if (nearest.type === 'scooter') {
|
||||
nearest.interact(this.scene.player);
|
||||
}
|
||||
else if (nearest.lootTable) {
|
||||
// It's a chest!
|
||||
nearest.interact(this.scene.player);
|
||||
}
|
||||
else if (nearest.type === 'zombie') {
|
||||
// Always Tame on E key (Combat is Space/Click)
|
||||
// Check if already tamed?
|
||||
// If aggressive, combat? E is usually benign interaction.
|
||||
nearest.tame();
|
||||
} else {
|
||||
nearest.toggleState(); // Merchant/NPC talk
|
||||
// Generic Talk / Toggle
|
||||
// INTEGRATE TRANSLATION
|
||||
this.handleTalk(nearest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleTalk(npc) {
|
||||
if (!this.scene.hybridSkillSystem) {
|
||||
npc.toggleState();
|
||||
return;
|
||||
}
|
||||
|
||||
let text = "...";
|
||||
let color = '#FFFFFF';
|
||||
|
||||
if (npc.type === 'zombie') {
|
||||
text = "Brains... Hungry... Leader?";
|
||||
text = this.scene.hybridSkillSystem.getSpeechTranslation(text);
|
||||
color = '#55FF55';
|
||||
} else if (npc.type === 'merchant') {
|
||||
text = "Welcome! I have rare goods.";
|
||||
color = '#FFD700';
|
||||
// Also triggers UI
|
||||
const uiScene = this.scene.scene.get('UIScene');
|
||||
if (uiScene) uiScene.showTradeMenu(this.scene.inventorySystem);
|
||||
} else if (npc.type === 'elf') {
|
||||
text = "The forest... it burns... you are not safe.";
|
||||
text = this.scene.hybridSkillSystem.getSpeechTranslation(text); // Maybe Elvish/Mutant dialect?
|
||||
color = '#00FFFF';
|
||||
} else if (npc.passive) {
|
||||
// Animal noises
|
||||
text = npc.type.includes('cow') ? 'Moo.' : 'Cluck.';
|
||||
}
|
||||
|
||||
// Show Floating Text Dialogue
|
||||
this.scene.events.emit('show-floating-text', {
|
||||
x: npc.sprite.x,
|
||||
y: npc.sprite.y - 60,
|
||||
text: text,
|
||||
color: color
|
||||
});
|
||||
|
||||
npc.toggleState(); // Stop moving briefly
|
||||
}
|
||||
|
||||
handleInteraction(gridX, gridY, isAttack = false) {
|
||||
if (!this.scene.player) return;
|
||||
|
||||
@@ -154,9 +201,16 @@ class InteractionSystem {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// TAME ATTEMPT
|
||||
console.log('🤝 Attempting to TAME zombie at', npc.gridX, npc.gridY);
|
||||
npc.tame();
|
||||
if (npc.isTamed) {
|
||||
// Open Worker Menu
|
||||
if (uiScene && uiScene.showWorkerMenu) {
|
||||
uiScene.showWorkerMenu(npc);
|
||||
}
|
||||
} else {
|
||||
// TAME ATTEMPT
|
||||
console.log('🤝 Attempting to TAME zombie at', npc.gridX, npc.gridY);
|
||||
npc.tame();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -233,6 +287,12 @@ class InteractionSystem {
|
||||
if (result) return;
|
||||
}
|
||||
|
||||
// Building Interaction (Upgrade House)
|
||||
if (this.scene.buildingSystem && decor.type.startsWith('struct_house')) {
|
||||
const result = this.scene.buildingSystem.tryUpgrade(gridX, gridY);
|
||||
if (result) return;
|
||||
}
|
||||
|
||||
// handleTreeHit Logic (User Request)
|
||||
// Preverimo tip in ustrezno orodje
|
||||
let damage = 1;
|
||||
|
||||
Reference in New Issue
Block a user