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:
+2
-1
@@ -34,7 +34,8 @@ module.exports = {
|
||||
Dialog: 'readonly',
|
||||
foundry: 'readonly',
|
||||
Handlebars: 'readonly',
|
||||
renderTemplate: 'readonly'
|
||||
renderTemplate: 'readonly',
|
||||
fromUuid: 'readonly'
|
||||
},
|
||||
rules: {
|
||||
// Possible Problems
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -13,6 +13,13 @@
|
||||
{{/if}}
|
||||
<span>/ {{system.reserve.max}}D</span>
|
||||
</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">
|
||||
<label>{{ localize 'VERMINE.morale' }}:</label>
|
||||
{{#if isEditMode}}
|
||||
|
||||
Reference in New Issue
Block a user