mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-07 13:24:16 +02:00
Fixed tokenSize linking to token.depth
This commit is contained in:
parent
5d6efb0221
commit
fcc8947555
4 changed files with 11 additions and 5 deletions
|
|
@ -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
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.tokenSize"}}</legend>
|
<legend>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.tokenSize"}}</legend>
|
||||||
{{#if usesActorSize}}
|
{{#if usesActorSize}}
|
||||||
<div class="form-group lim">
|
<div class="form-group slim">
|
||||||
<label>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.sizeCategory"}}</label>
|
<label>{{localize "DAGGERHEART.APPLICATIONS.TokenConfig.sizeCategory"}}</label>
|
||||||
|
|
||||||
<select id="dhTokenSize">
|
<select id="dhTokenSize">
|
||||||
|
|
@ -50,11 +50,13 @@
|
||||||
{{localize "TOKEN.Size"}}
|
{{localize "TOKEN.Size"}}
|
||||||
<span class="units">({{localize "MEASUREMENT.GridSpaces"}})</span>
|
<span class="units">({{localize "MEASUREMENT.GridSpaces"}})</span>
|
||||||
</span>
|
</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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue