Fix: ouvrir contenants des véhicules/créatures

This commit is contained in:
2023-11-06 23:03:44 +01:00
parent 2373acc295
commit 862a267683
4 changed files with 35 additions and 22 deletions

View File

@ -1204,10 +1204,27 @@ export class RdDActor extends RdDBaseActorSang {
new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);
}
async actionPrincipale(item, onActionItem = async () => { }) {
let result = await super.actionPrincipale(item, onActionItem)
if (result) { return result }
result = await this.actionNourritureboisson(item, onActionItem)
if (result) { return result }
switch (item.type) {
case TYPES.potion: return await this.consommerPotion(item, onActionItem);
case TYPES.livre: return await this.actionLire(item);
case TYPES.conteneur: return await item.sheet.render(true);
case TYPES.herbe: return await this.actionHerbe(item, onActionItem);
case TYPES.queue: case TYPES.ombre: return await this.actionRefoulement(item);
}
return undefined
}
async actionNourritureboisson(item, onActionItem) {
switch (item.getUtilisationCuisine()) {
case 'brut': {
let d = new Dialog({
const utilisation = new Dialog({
title: "Nourriture brute",
content: `Que faire de votre ${item.name}`,
buttons: {
@ -1215,17 +1232,14 @@ export class RdDActor extends RdDBaseActorSang {
'manger': { icon: '<i class="fas fa-check"></i>', label: 'Manger cru', callback: async () => await this.mangerNourriture(item, onActionItem) }
}
});
d.render(true);
return true;
return utilisation.render(true);
}
case 'pret':
await this.mangerNourriture(item, onActionItem);
return true;
return await this.mangerNourriture(item, onActionItem);
}
return false;
return undefined;
}
async mangerNourriture(item, onActionItem) {
return (await DialogConsommer.create(this, item, onActionItem)).render(true);
}