feat: fiche de Groupe - drag&drop de véhicules et dés de Réserve cliquables

- 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).
This commit is contained in:
2026-08-05 18:05:13 +02:00
parent ef76ae1116
commit 75f39551f8
4 changed files with 51 additions and 1 deletions
+2 -1
View File
@@ -34,7 +34,8 @@ module.exports = {
Dialog: 'readonly', Dialog: 'readonly',
foundry: 'readonly', foundry: 'readonly',
Handlebars: 'readonly', Handlebars: 'readonly',
renderTemplate: 'readonly' renderTemplate: 'readonly',
fromUuid: 'readonly'
}, },
rules: { rules: {
// Possible Problems // Possible Problems
+27
View File
@@ -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 { .sheet-header-toggle {
text-align: right; text-align: right;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
@@ -109,6 +109,21 @@ export default class VermineGroupSheetV2 extends VermineBaseActorSheet {
return game.actors.filter(a => a.type === "vehicle" && a.system.ownerId === this.document.id) 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 // Actions : délégation aux applications AppV1 existantes pour TotemPicker/ActorPicker
static async #onChooseTotem(event, target) { static async #onChooseTotem(event, target) {
const { TotemPicker } = await import("../../system/applications.mjs") const { TotemPicker } = await import("../../system/applications.mjs")
+7
View File
@@ -13,6 +13,13 @@
{{/if}} {{/if}}
<span>/ {{system.reserve.max}}D</span> <span>/ {{system.reserve.max}}D</span>
</div> </div>
<div class="reserve-dice flexrow">
{{#repeat system.reserve.max 1 "d"}}
<div class="hexa {{#iflteq @d @root.system.reserve.value}}checked{{/iflteq}}">
<input type="radio" data-dtype="Number" name="system.reserve.value" value="{{@d}}" data-action="clickRadio" />
</div>
{{/repeat}}
</div>
<div class="morale-control flexrow flex-group-center"> <div class="morale-control flexrow flex-group-center">
<label>{{ localize 'VERMINE.morale' }}:</label> <label>{{ localize 'VERMINE.morale' }}:</label>
{{#if isEditMode}} {{#if isEditMode}}