Fix equip coverage after the item-action refactor
The item action buttons derived their focus key from the visible label, so
the bag's Equip button became "Equip-<id>" when 9b01ee3 replaced the panel's
own lowercase "equip-<id>" button with itemControls. Slugify the label so the
key stays stable when a button is reworded, and point the progression spec at
the item-action endpoint the refactor moved equip onto -- it still polled the
websocket intents, which no longer carry equip.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ export function createItemActions(o:Options){
|
||||
}
|
||||
function controls(id:string,slot:string){
|
||||
const row=node('div','','gear-actions'),c=o.character();if(!c)return row;const item=c.items.find(i=>i.id===id),consumable=c.consumables?.find(i=>i.id===id),disabled=c.entity.state!=='alive'||c.remainingSeconds<=0||!!c.houseId;
|
||||
function button(label:string,fn:()=>void,extra=false){const b=node('button',label);b.type='button';b.dataset.focusKey=`${label}-${id}`;b.disabled=(label.startsWith('Drop')&&c!.entity.state==='eligible'?c!.remainingSeconds<=0||!!c!.houseId:disabled)||extra;b.onclick=fn;row.append(b)}
|
||||
function button(label:string,fn:()=>void,extra=false){const b=node('button',label);b.type='button';b.dataset.focusKey=`${label.toLowerCase().replaceAll(' ','-')}-${id}`;b.disabled=(label.startsWith('Drop')&&c!.entity.state==='eligible'?c!.remainingSeconds<=0||!!c!.houseId:disabled)||extra;b.onclick=fn;row.append(b)}
|
||||
if(item&&!item.houseId&&!item.furniture)button('Equip',()=>activate(id,slot),!item.equippable);
|
||||
if(!item&&(id==='bandage'||consumable&&consumable.useEffect?.kind!=='weapon-coating'||id==='escape_stone'||id.startsWith('book_')))button(id.startsWith('book_')?'Learn':'Consume',()=>activate(id));
|
||||
if(id.startsWith('kit_'))button('Place',()=>o.place(id));
|
||||
|
||||
Reference in New Issue
Block a user