From 75f39551f8f4d3b60a1ca99f0e23b37fe9852797 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Wed, 5 Aug 2026 18:05:13 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20fiche=20de=20Groupe=20-=20drag&drop=20d?= =?UTF-8?q?e=20v=C3=A9hicules=20et=20d=C3=A9s=20de=20R=C3=A9serve=20cliqua?= =?UTF-8?q?bles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dépôt d'un acteur Véhicule sur la fiche de Groupe : le véhicule est lié via system.ownerId (pas de duplication), apparaît dans la liste Véhicules de l'onglet Matériel et s'ouvre au clic (_onDropActor). - Onglet Réserve : dés de Réserve hexagonaux cliquables (1..max), même comportement que les réserves du personnage (cocher/décocher). - ESLint : fromUuid ajouté aux globals (corrige aussi 3 erreurs préexistantes dans base-actor-sheet.mjs). --- .eslintrc.js | 3 ++- less/actor/actor.less | 27 ++++++++++++++++++++++ module/applications/sheets/group-sheet.mjs | 15 ++++++++++++ templates/actor/appv2/group-reserve.hbs | 7 ++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 159069a..f9be012 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,7 +34,8 @@ module.exports = { Dialog: 'readonly', foundry: 'readonly', Handlebars: 'readonly', - renderTemplate: 'readonly' + renderTemplate: 'readonly', + fromUuid: 'readonly' }, rules: { // Possible Problems diff --git a/less/actor/actor.less b/less/actor/actor.less index 578d761..d538052 100644 --- a/less/actor/actor.less +++ b/less/actor/actor.less @@ -368,6 +368,33 @@ } } + // Fiche de Groupe : mêmes dés de Réserve cliquables (AppV2). + &.group div.hexa { + .hexa-style(); + .transition(); + margin: 0.2rem; + position: relative; + + &:hover { + .hexa-style(rgba(255, 255, 255, 0.425), rgba(0, 0, 0, 0.288)); + } + + input { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 1; + margin: 0; + cursor: pointer; + } + + &.checked { + .hexa-style(rgb(0, 0, 0), rgba(0, 0, 0, 0.288)); + &:hover { .hexa-style(rgb(43, 43, 43), rgba(0, 0, 0, 0.288)); } + } + } + .sheet-header-toggle { text-align: right; margin-bottom: 0.5rem; diff --git a/module/applications/sheets/group-sheet.mjs b/module/applications/sheets/group-sheet.mjs index ff99c8b..c1e3dcb 100644 --- a/module/applications/sheets/group-sheet.mjs +++ b/module/applications/sheets/group-sheet.mjs @@ -109,6 +109,21 @@ export default class VermineGroupSheetV2 extends VermineBaseActorSheet { return game.actors.filter(a => a.type === "vehicle" && a.system.ownerId === this.document.id) } + /** + * Dépôt d'un acteur Véhicule sur la fiche : lie le véhicule au Groupe + * (system.ownerId) au lieu de le dupliquer, puis affiche la liste. + * @override + */ + async _onDropActor(event, data) { + const actor = data instanceof foundry.abstract.Document ? data : await fromUuid(data.uuid) + if (actor?.type === "vehicle") { + await actor.update({ "system.ownerId": this.document.id }) + this.render() + return + } + return super._onDropActor?.(event, data) + } + // Actions : délégation aux applications AppV1 existantes pour TotemPicker/ActorPicker static async #onChooseTotem(event, target) { const { TotemPicker } = await import("../../system/applications.mjs") diff --git a/templates/actor/appv2/group-reserve.hbs b/templates/actor/appv2/group-reserve.hbs index 84e021a..0dc7645 100644 --- a/templates/actor/appv2/group-reserve.hbs +++ b/templates/actor/appv2/group-reserve.hbs @@ -13,6 +13,13 @@ {{/if}} / {{system.reserve.max}}D +
+ {{#repeat system.reserve.max 1 "d"}} +
+ +
+ {{/repeat}} +
{{#if isEditMode}}