Icone a pixel per gli oggetti dell'inventario: squama, libro e chiave

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017egeN2amL84ErjfgQFtEDn
This commit is contained in:
2026-10-23 17:59:52 +02:00
co-authored by Claude Opus 5.5
parent 034b1b62e7
commit 891cb2bbb1
8 changed files with 28 additions and 6 deletions
+12 -3
View File
@@ -177,12 +177,21 @@ function updateInventory() {
inventoryKey = key;
const box = $('inventory');
box.replaceChildren(...game.state.inventory.map(id => {
const b = document.createElement('button'), item = story.items[id], dot = document.createElement('i');
const b = document.createElement('button'), item = story.items[id];
b.type = 'button';
b.dataset.item = id;
b.setAttribute('aria-pressed', String(command.item === id));
dot.style.background = item.icon?.fill ?? '#ccc';
b.append(dot, item.name);
// L'icona a pixel dell'oggetto (assets/icons); senza, un pallino del suo colore.
let icon;
if (item.icon?.src) {
icon = document.createElement('img');
icon.src = item.icon.src;
icon.alt = '';
} else {
icon = document.createElement('i');
icon.style.background = item.icon?.fill ?? '#ccc';
}
b.append(icon, item.name);
let timer = null, long = false;
b.addEventListener('pointerdown', () => { long = false; timer = setTimeout(() => { long = true; command.clickItem(id, { look: true }); }, LONG_PRESS); });
b.addEventListener('pointerup', () => clearTimeout(timer));