Fixed beastforms getting stuck

This commit is contained in:
WBHarry 2025-12-31 04:50:11 +01:00
parent 3b7b6258a1
commit f4ce452ecf
2 changed files with 28 additions and 12 deletions

View file

@ -66,12 +66,20 @@ export default class BeastformEffect extends BaseEffect {
}; };
const updateToken = token => { const updateToken = token => {
const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( let x = null,
token.object.scene.grid, y = null;
{ x: token.x, y: token.y, elevation: token.elevation }, if (token.object?.scene?.grid) {
baseUpdate.width, const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
baseUpdate.height token.object.scene.grid,
); { x: token.x, y: token.y, elevation: token.elevation },
baseUpdate.width,
baseUpdate.height
);
x = positionData.x;
y = positionData.y;
}
return { return {
...baseUpdate, ...baseUpdate,
x, x,

View file

@ -218,12 +218,20 @@ export default class DHBeastform extends BaseDataItem {
} }
}; };
const tokenUpdate = token => { const tokenUpdate = token => {
const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( let x = null,
token.object.scene.grid, y = null;
{ x: token.x, y: token.y, elevation: token.elevation }, if (token.object?.scene?.grid) {
width ?? token.width, const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
height ?? token.height token.object.scene.grid,
); { x: token.x, y: token.y, elevation: token.elevation },
width ?? token.width,
height ?? token.height
);
x = positionData.x;
y = positionData.y;
}
return { return {
...prototypeTokenUpdate, ...prototypeTokenUpdate,
x, x,