Phase 7: World Structure (New Direction)
This commit is contained in:
@@ -39,6 +39,17 @@ class InteractionSystem {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for chests
|
||||
if (this.scene.chests) {
|
||||
for (const chest of this.scene.chests) {
|
||||
const d = Phaser.Math.Distance.Between(playerPos.x, playerPos.y, chest.gridX, chest.gridY);
|
||||
if (d < minDist && !chest.isOpened) {
|
||||
minDist = d;
|
||||
nearest = chest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const npc of candidates) {
|
||||
const d = Phaser.Math.Distance.Between(playerPos.x, playerPos.y, npc.gridX, npc.gridY);
|
||||
if (d < minDist) {
|
||||
@@ -48,10 +59,14 @@ class InteractionSystem {
|
||||
}
|
||||
|
||||
if (nearest) {
|
||||
console.log('E Interacted with:', nearest.type);
|
||||
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)
|
||||
nearest.tame();
|
||||
|
||||
Reference in New Issue
Block a user