Faune et flore comestibles

- permettre de cuisiner les ingrédients (faune & flore)
- permettre de manger des ingrédients "crus"
This commit is contained in:
Vincent Vandemeulebrouck
2022-12-03 22:32:32 +01:00
parent 7b58407634
commit 5056c35038
12 changed files with 296 additions and 96 deletions

View File

@ -26,21 +26,22 @@ export class RdDFauneItemSheet extends RdDItemSheet {
EnvironmentSheetHelper.activateListeners(this, html);
html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
html.find("a.preparer-nourriture").click(event => this.preparerNourriture(event));
html.find("a.manger-nourriture").click(event => this.mangerNourriture(event));
}
async _onDropActor(event, dragData) {
console.log('faune:dropActor', event, dragData)
const actor = fromUuidSync(dragData.uuid);
if (actor?.pack) {
const linkedActor = fromUuidSync(dragData.uuid);
if (linkedActor?.pack) {
this.item.update({
'system.actor.pack': actor.pack,
'system.actor.id': actor._id,
'system.actor.name': actor.name
'system.actor.pack': linkedActor.pack,
'system.actor.id': linkedActor._id,
'system.actor.name': linkedActor.name
});
}
else {
ui.notifications.warn(`${actor.name} ne provient pas d'eun compendium.
ui.notifications.warn(`${linkedActor.name} ne provient pas d'un compendium.
<br>Choisissez une créature du compendium pour représenter un élément de faune générique`)
}
}
@ -51,4 +52,16 @@ export class RdDFauneItemSheet extends RdDItemSheet {
'system.actor.name': ''
});
}
async preparerNourriture(event) {
if (this.actor) {
await this.actor.preparerNourriture(this.item);
}
}
async mangerNourriture(event) {
if (this.actor) {
await this.actor.mangerNourriture(this.item);
}
}
}