From bca7e0d3c9d8778191e6ffad96d829a5b18a45a0 Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Wed, 31 Dec 2025 04:52:19 +0100 Subject: [PATCH] [Fix] Beastforms Getting Stuck (#1495) * Fixed beastforms getting stuck * Raised version --- module/data/activeEffect/beastformEffect.mjs | 20 ++++++++++++++------ module/data/item/beastform.mjs | 20 ++++++++++++++------ system.json | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/module/data/activeEffect/beastformEffect.mjs b/module/data/activeEffect/beastformEffect.mjs index b041b59e..5311b827 100644 --- a/module/data/activeEffect/beastformEffect.mjs +++ b/module/data/activeEffect/beastformEffect.mjs @@ -66,12 +66,20 @@ export default class BeastformEffect extends BaseEffect { }; const updateToken = token => { - const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( - token.object.scene.grid, - { x: token.x, y: token.y, elevation: token.elevation }, - baseUpdate.width, - baseUpdate.height - ); + let x = null, + y = null; + if (token.object?.scene?.grid) { + const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( + token.object.scene.grid, + { x: token.x, y: token.y, elevation: token.elevation }, + baseUpdate.width, + baseUpdate.height + ); + + x = positionData.x; + y = positionData.y; + } + return { ...baseUpdate, x, diff --git a/module/data/item/beastform.mjs b/module/data/item/beastform.mjs index 669cd4b1..1840e26a 100644 --- a/module/data/item/beastform.mjs +++ b/module/data/item/beastform.mjs @@ -218,12 +218,20 @@ export default class DHBeastform extends BaseDataItem { } }; const tokenUpdate = token => { - const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( - token.object.scene.grid, - { x: token.x, y: token.y, elevation: token.elevation }, - width ?? token.width, - height ?? token.height - ); + let x = null, + y = null; + if (token.object?.scene?.grid) { + const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( + 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 { ...prototypeTokenUpdate, x, diff --git a/system.json b/system.json index ce361568..9f1e46c7 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "1.4.3", + "version": "1.4.4", "compatibility": { "minimum": "13.346", "verified": "13.351",