[Feature] V14 Cleanup (#1918)
Some checks failed
Project CI / build (24.x) (push) Has been cancelled

* Fixedin PrototypeToken preview

* Fixed translations

* Fixed tokenSize linking to token.depth

* Fixed beastform depth

* Raised foundry version
This commit is contained in:
WBHarry 2026-05-23 12:16:25 +02:00 committed by GitHub
parent 2931377d53
commit e4a3f105dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 85 additions and 33 deletions

View file

@ -778,7 +778,9 @@
"title": "Group Roll" "title": "Group Roll"
}, },
"TokenConfig": { "TokenConfig": {
"actorSizeUsed": "Actor size is set, determining the dimensions" "actorSizeUsed": "Actor size is set, determining the dimensions",
"tokenSize": "Token Size",
"sizeCategory": "Size Category"
} }
}, },
"CLASS": { "CLASS": {
@ -2565,10 +2567,11 @@
"tokenImg": { "label": "Token Image" }, "tokenImg": { "label": "Token Image" },
"tokenRingImg": { "label": "Subject Texture" }, "tokenRingImg": { "label": "Subject Texture" },
"tokenSize": { "tokenSize": {
"placeholder": "Using character dimensions", "placeholder": "Token Size",
"disabledPlaceholder": "Set by character size", "disabledPlaceholder": "Token Size",
"height": { "label": "Height" }, "height": { "label": "Height" },
"width": { "label": "Width" }, "width": { "label": "Width" },
"depth": { "label": "Depth" },
"scale": { "label": "Token Scale" } "scale": { "label": "Token Scale" }
}, },
"evolved": { "evolved": {

View file

@ -35,6 +35,7 @@ export default class BeastformEffect extends BaseEffect {
static migrateData(source) { static migrateData(source) {
if (!source.characterTokenData.tokenSize.height) source.characterTokenData.tokenSize.height = 1; if (!source.characterTokenData.tokenSize.height) source.characterTokenData.tokenSize.height = 1;
if (!source.characterTokenData.tokenSize.width) source.characterTokenData.tokenSize.width = 1; if (!source.characterTokenData.tokenSize.width) source.characterTokenData.tokenSize.width = 1;
if (!source.characterTokenData.tokenSize.depth) source.characterTokenData.tokenSize.depth = 1;
return super.migrateData(source); return super.migrateData(source);
} }
@ -52,7 +53,8 @@ export default class BeastformEffect extends BaseEffect {
if (this.parent.parent.type === 'character') { if (this.parent.parent.type === 'character') {
const baseUpdate = { const baseUpdate = {
height: this.characterTokenData.tokenSize.height, height: this.characterTokenData.tokenSize.height,
width: this.characterTokenData.tokenSize.width width: this.characterTokenData.tokenSize.width,
depth: this.characterTokenData.tokenSize.depth
}; };
const update = { const update = {
...baseUpdate, ...baseUpdate,

View file

@ -51,7 +51,8 @@ export default class DHBeastform extends BaseDataItem {
}), }),
scale: new fields.NumberField({ nullable: false, min: 0.2, max: 3, step: 0.05, initial: 1 }), scale: new fields.NumberField({ nullable: false, min: 0.2, max: 3, step: 0.05, initial: 1 }),
height: new fields.NumberField({ integer: true, min: 1, initial: null, nullable: true }), height: new fields.NumberField({ integer: true, min: 1, initial: null, nullable: true }),
width: new fields.NumberField({ integer: true, min: 1, initial: null, nullable: true }) width: new fields.NumberField({ integer: true, min: 1, initial: null, nullable: true }),
depth: new fields.NumberField({ integer: true, min: 1, initial: null, nullable: true })
}), }),
mainTrait: new fields.StringField({ mainTrait: new fields.StringField({
required: true, required: true,
@ -192,7 +193,8 @@ export default class DHBeastform extends BaseDataItem {
tokenSize: { tokenSize: {
scale: this.parent.parent.prototypeToken.texture.scaleX, scale: this.parent.parent.prototypeToken.texture.scaleX,
height: this.parent.parent.prototypeToken.height, height: this.parent.parent.prototypeToken.height,
width: this.parent.parent.prototypeToken.width width: this.parent.parent.prototypeToken.width,
depth: this.parent.parent.prototypeToken.depth
} }
}, },
advantageOn: this.advantageOn, advantageOn: this.advantageOn,
@ -211,10 +213,12 @@ export default class DHBeastform extends BaseDataItem {
: null; : null;
const width = autoTokenSize ?? this.tokenSize.width; const width = autoTokenSize ?? this.tokenSize.width;
const height = autoTokenSize ?? this.tokenSize.height; const height = autoTokenSize ?? this.tokenSize.height;
const depth = autoTokenSize ?? this.tokenSize.depth;
const prototypeTokenUpdate = { const prototypeTokenUpdate = {
height, height,
width, width,
depth,
texture: { texture: {
src: this.tokenImg, src: this.tokenImg,
scaleX: this.tokenSize.scale, scaleX: this.tokenSize.scale,

View file

@ -20,7 +20,7 @@ export default class DhScene extends Scene {
const prototype = tokenDoc.actor?.prototypeToken ?? tokenDoc; const prototype = tokenDoc.actor?.prototypeToken ?? tokenDoc;
this.#sizeSyncBatch.set(tokenDoc.id, { this.#sizeSyncBatch.set(tokenDoc.id, {
size: tokenSize, size: tokenSize,
prototypeSize: { width: prototype.width, height: prototype.height }, prototypeSize: { width: prototype.width, height: prototype.height, depth: prototype.depth },
position: { x: tokenDoc.x, y: tokenDoc.y, elevation: tokenDoc.elevation } position: { x: tokenDoc.x, y: tokenDoc.y, elevation: tokenDoc.elevation }
}); });
this.#processSyncBatch(); this.#processSyncBatch();
@ -36,11 +36,13 @@ export default class DhScene extends Scene {
const tokenSize = tokenSizes[size]; const tokenSize = tokenSizes[size];
const width = size !== CONFIG.DH.ACTOR.tokenSize.custom.id ? tokenSize : prototypeSize.width; const width = size !== CONFIG.DH.ACTOR.tokenSize.custom.id ? tokenSize : prototypeSize.width;
const height = size !== CONFIG.DH.ACTOR.tokenSize.custom.id ? tokenSize : prototypeSize.height; const height = size !== CONFIG.DH.ACTOR.tokenSize.custom.id ? tokenSize : prototypeSize.height;
const depth = size !== CONFIG.DH.ACTOR.tokenSize.custom.id ? tokenSize : prototypeSize.depth;
const updatedPosition = DHToken.getSnappedPositionInSquareGrid(this.grid, position, width, height); const updatedPosition = DHToken.getSnappedPositionInSquareGrid(this.grid, position, width, height);
return { return {
_id, _id,
width, width,
height, height,
depth,
...updatedPosition ...updatedPosition
}; };
}); });

View file

@ -66,7 +66,8 @@ export default class DHToken extends CONFIG.Token.documentClass {
if (tokenSize && actor.system.size !== CONFIG.DH.ACTOR.tokenSize.custom.id) { if (tokenSize && actor.system.size !== CONFIG.DH.ACTOR.tokenSize.custom.id) {
document.updateSource({ document.updateSource({
width: tokenSize, width: tokenSize,
height: tokenSize height: tokenSize,
depth: tokenSize
}); });
} }
} }
@ -90,7 +91,7 @@ export default class DHToken extends CONFIG.Token.documentClass {
) { ) {
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes; const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
const tokenSize = tokenSizes[update.system.size]; const tokenSize = tokenSizes[update.system.size];
if (tokenSize !== this.width || tokenSize !== this.height) { if (tokenSize !== this.width || tokenSize !== this.height || tokenSize !== this.depth) {
this.parent?.syncTokenDimensions(this, update.system.size); this.parent?.syncTokenDimensions(this, update.system.size);
} }
} }

View file

@ -15,6 +15,7 @@ export default class DhTokenManager {
if (tokenSize && actor.system.size !== CONFIG.DH.ACTOR.tokenSize.custom.id) { if (tokenSize && actor.system.size !== CONFIG.DH.ACTOR.tokenSize.custom.id) {
tokenData.width = tokenSize; tokenData.width = tokenSize;
tokenData.height = tokenSize; tokenData.height = tokenSize;
tokenData.depth = tokenSize;
} }
} }

View file

@ -5,7 +5,7 @@
"version": "2.2.6", "version": "2.2.6",
"compatibility": { "compatibility": {
"minimum": "14.361", "minimum": "14.361",
"verified": "14.362", "verified": "14.363",
"maximum": "14" "maximum": "14"
}, },
"url": "https://github.com/Foundryborne/daggerheart", "url": "https://github.com/Foundryborne/daggerheart",

View file

@ -17,7 +17,7 @@
{{/if}} {{/if}}
<button type="button" class="control-icon" data-action="sort" data-tooltip aria-label="HUD.ToFrontOrBack"> <button type="button" class="control-icon" data-action="sort" data-tooltip aria-label="HUD.ToFrontOrBack">
<i class="fa-solid fa-arrow-down-arrow-up" inert></i> <i class="fa-solid fa-bring-forward" inert></i>
</button> </button>
{{#if hasCompanion}} {{#if hasCompanion}}
@ -26,6 +26,13 @@
</button> </button>
{{/if}} {{/if}}
{{#if isGM}}
<button type="button" class="control-icon {{lockedClass}}" data-action="locked"
data-tooltip aria-label="{{localize (ifThen lockedClass "HUD.Unlock" "HUD.Lock")}}">
<i class="fa-solid {{ifThen lockedClass "fa-lock" "fa-lock-open"}}" inert></i>
</button>
{{/if}}
{{#if canConfigure}} {{#if canConfigure}}
<button type="button" class="control-icon" data-action="config" data-tooltip aria-label="HUD.OpenConfig"> <button type="button" class="control-icon" data-action="config" data-tooltip aria-label="HUD.OpenConfig">
<i class="fa-solid fa-gear" inert></i> <i class="fa-solid fa-gear" inert></i>

View file

@ -1,4 +1,5 @@
<div class="tab scrollable{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}"> <div class="tab scrollable{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
<div class="token-image-group">
{{formGroup fields.texture.fields.src value=source.texture.src rootId=rootId}} {{formGroup fields.texture.fields.src value=source.texture.src rootId=rootId}}
{{#if randomImgEnabled}} {{#if randomImgEnabled}}
{{formGroup fields.randomImg value=source.randomImg classes="slim" rootId=rootId}} {{formGroup fields.randomImg value=source.randomImg classes="slim" rootId=rootId}}
@ -10,11 +11,33 @@
</select> </select>
</div> </div>
{{/if}} {{/if}}
{{#if imagePreview}}
<div class="{{imagePreview.cls}}">
{{#if imagePreview.isVideo}}
<video class="token-image-thumb" src="{{imagePreview.src}}" autoplay muted loop playsinline
disablepictureinpicture></video>
{{else}}
<img class="token-image-thumb" src="{{imagePreview.src}}" alt="{{localize "TOKEN.ImagePreview"}}">
{{/if}}
<div class="token-image-controls">
<button type="button" class="cycle-prev icon fa-solid fa-chevron-left" data-action="cycleImage"
data-delta="-1" aria-label="{{localize "TOKEN.ImageCyclePrev"}}"
{{#unless imagePreview.hasPrev}} disabled{{/unless}}></button>
<span class="counter">{{imagePreview.current}} / {{imagePreview.total}}</span>
<button type="button" class="cycle-next icon fa-solid fa-chevron-right" data-action="cycleImage"
data-delta="1" aria-label="{{localize "TOKEN.ImageCycleNext"}}"
{{#unless imagePreview.hasNext}} disabled{{/unless}}></button>
</div>
</div>
{{/if}}
</div>
<fieldset> <fieldset>
<legend>{{localize "Token Size"}}</legend> <legend>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.tokenSize"}}</legend>
{{#if usesActorSize}} {{#if usesActorSize}}
<div class="form-group lim"> <div class="form-group slim">
<label>{{localize "Size Category"}}</label> <label>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.sizeCategory"}}</label>
<select id="dhTokenSize"> <select id="dhTokenSize">
{{selectOptions tokenSizes selected=tokenSize valueAttr="id" labelAttr="label" localize=true}} {{selectOptions tokenSizes selected=tokenSize valueAttr="id" labelAttr="label" localize=true}}
@ -23,15 +46,17 @@
{{/if}} {{/if}}
<div id="tokenSizeDimensions" class="form-group slim" {{#if actorSizeDisable}}data-tooltip="{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.actorSizeUsed"}}"{{/if}}> <div id="tokenSizeDimensions" class="form-group slim" {{#if actorSizeDisable}}data-tooltip="{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.actorSizeUsed"}}"{{/if}}>
<label> <span class="label">
{{localize "TOKEN.Dimensions"}} <span class="units">({{localize "GridSpaces"}})</span> {{localize "TOKEN.Size"}}
<i class="fa-solid fa-lock" {{#unless actorSizeDisable}}style="opacity: 0%;"{{/unless}}></i> <span class="units">({{localize "MEASUREMENT.GridSpaces"}})</span>
</label> </span>
<div class="form-fields"> <div class="form-group slim">
<label for="{{rootId}}-width">{{localize "DOCUMENT.FIELDS.width.label"}}</label> <label for="{{rootId}}-width">{{localize "DOCUMENT.FIELDS.width.label"}}</label>
{{formInput fields.width value=source.width id=(concat rootId "-width") disabled=actorSizeDisable}} {{formInput fields.width value=source.width id=(concat rootId "-width") disabled=actorSizeDisable}}
<label for="{{rootId}}-height">{{localize "DOCUMENT.FIELDS.height.label"}}</label> <label for="{{rootId}}-height">{{localize "DOCUMENT.FIELDS.height.label"}}</label>
{{formInput fields.height value=source.height id=(concat rootId "-height") disabled=actorSizeDisable}} {{formInput fields.height value=source.height id=(concat rootId "-height") disabled=actorSizeDisable}}
<label for="{{rootId}}-depth">Z</label>
{{formInput fields.depth value=source.depth id=(concat rootId "-depth") disabled=actorSizeDisable}}
</div> </div>
</div> </div>
</fieldset> </fieldset>

View file

@ -46,6 +46,13 @@
placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder")) placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder"))
disabled=dimensionsDisabled disabled=dimensionsDisabled
}} }}
{{formGroup
systemFields.tokenSize.fields.depth
value=source.system.tokenSize.depth
localize=true
placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder"))
disabled=dimensionsDisabled
}}
</div> </div>
<div class="full-width"> <div class="full-width">
{{formGroup systemFields.tokenSize.fields.scale value=source.system.tokenSize.scale localize=true }} {{formGroup systemFields.tokenSize.fields.scale value=source.system.tokenSize.scale localize=true }}

View file

@ -13,20 +13,20 @@
<div class="combatant-controls flex-0"> <div class="combatant-controls flex-0">
{{#if @root.user.isGM}} {{#if @root.user.isGM}}
<button type="button" class="inline-control combatant-control icon fa-solid fa-eye-slash {{#if hidden}}active{{/if}}" <button type="button" class="inline-control combatant-control icon fa-solid fa-eye-slash {{#if hidden}}active{{/if}}"
data-action="toggleHidden" data-tooltip aria-label="{{ localize "COMBAT.ToggleVis" }}"></button> data-action="toggleHidden" data-tooltip aria-label="{{ localize (ifThen hidden "COMBATANT.Show" "COMBATANT.Hide") }}"></button>
<button type="button" class="inline-control combatant-control icon fa-solid fa-skull {{#if isDefeated}}active{{/if}}" <button type="button" class="inline-control combatant-control icon fa-solid fa-skull {{#if isDefeated}}active{{/if}}"
data-action="toggleDefeated" data-tooltip data-action="toggleDefeated" data-tooltip
aria-label="{{ localize "COMBAT.ToggleDead" }}"></button> aria-label="{{ localize (ifThen isDefeated "COMBATANT.UnmarkDefeated" "COMBATANT.MarkDefeated") }}"></button>
{{/if}} {{/if}}
{{#if canPing}} {{#if canPing}}
<button type="button" class="inline-control combatant-control icon fa-solid fa-bullseye-arrow" <button type="button" class="inline-control combatant-control icon fa-solid fa-bullseye-arrow"
data-action="pingCombatant" data-tooltip data-action="pingCombatant" data-tooltip
aria-label="{{ localize "COMBAT.PingCombatant" }}"></button> aria-label="{{ localize "COMBATANT.Ping" }}"></button>
{{/if}} {{/if}}
{{#unless @root.user.isGM}} {{#unless @root.user.isGM}}
<button type="button" class="inline-control combatant-control icon fa-solid fa-arrows-to-eye" <button type="button" class="inline-control combatant-control icon fa-solid fa-arrows-to-eye"
data-action="panToCombatant" data-tooltip data-action="panToCombatant" data-tooltip
aria-label="{{ localize "COMBAT.PanToCombatant" }}"></button> aria-label="{{ localize "COMBATANT.PanTo" }}"></button>
{{/unless}} {{/unless}}
</div> </div>