v10 compat: migrate to new data paths
This commit is contained in:
@@ -77,11 +77,11 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused)
|
||||
const origin = [firstWaypoint.x + entityOffset.x, firstWaypoint.y + entityOffset.y];
|
||||
let dx, dy;
|
||||
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) {
|
||||
dx = entity.data.x - origin[0];
|
||||
dy = entity.data.y - origin[1];
|
||||
dx = entity.x - origin[0];
|
||||
dy = entity.y - origin[1];
|
||||
} else {
|
||||
dx = entity.data.x - origin[0];
|
||||
dy = entity.data.y - origin[1];
|
||||
dx = entity.x - origin[0];
|
||||
dy = entity.y - origin[1];
|
||||
}
|
||||
|
||||
return {entity, rays: offsetRays, dx, dy};
|
||||
@@ -131,7 +131,7 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused)
|
||||
}
|
||||
|
||||
function calculateEntityOffset(entityA, entityB) {
|
||||
return {x: entityA.data.x - entityB.data.x, y: entityA.data.y - entityB.data.y};
|
||||
return {x: entityA.x - entityB.x, y: entityA.y - entityB.y};
|
||||
}
|
||||
|
||||
function applyOffsetToRay(ray, offset) {
|
||||
@@ -388,7 +388,7 @@ export function highlightMeasurementNative(
|
||||
tokenShape = [{x: 0, y: 0}],
|
||||
alpha = 1,
|
||||
) {
|
||||
const spacer = canvas.scene.data.gridType === CONST.GRID_TYPES.SQUARE ? 1.41 : 1;
|
||||
const spacer = canvas.scene.gridType === CONST.GRID_TYPES.SQUARE ? 1.41 : 1;
|
||||
const nMax = Math.max(
|
||||
Math.floor(ray.distance / (spacer * Math.min(canvas.grid.w, canvas.grid.h))),
|
||||
1,
|
||||
|
||||
+10
-10
@@ -1,26 +1,26 @@
|
||||
export function getDefaultSpeedAttribute() {
|
||||
switch (game.system.id) {
|
||||
case "CoC7":
|
||||
return "actor.data.data.attribs.mov.value";
|
||||
return "actor.system.attribs.mov.value";
|
||||
case "dcc":
|
||||
return "actor.data.data.attributes.speed.value";
|
||||
return "actor.system.attributes.speed.value";
|
||||
case "dnd4e":
|
||||
return "actor.data.data.movement.walk.value";
|
||||
return "actor.system.movement.walk.value";
|
||||
case "dnd5e":
|
||||
return "actor.data.data.attributes.movement.walk";
|
||||
return "actor.system.attributes.movement.walk";
|
||||
case "lancer":
|
||||
return "actor.data.data.derived.speed";
|
||||
return "actor.system.derived.speed";
|
||||
case "pf1":
|
||||
case "D35E":
|
||||
return "actor.data.data.attributes.speed.land.total";
|
||||
return "actor.system.attributes.speed.land.total";
|
||||
case "sfrpg":
|
||||
return "actor.data.data.attributes.speed.value";
|
||||
return "actor.system.attributes.speed.value";
|
||||
case "shadowrun5e":
|
||||
return "actor.data.data.movement.walk.value";
|
||||
return "actor.system.movement.walk.value";
|
||||
case "swade":
|
||||
return "actor.data.data.stats.speed.adjusted";
|
||||
return "actor.system.stats.speed.adjusted";
|
||||
case "ds4":
|
||||
return "actor.data.data.combatValues.movement.total";
|
||||
return "actor.system.combatValues.movement.total";
|
||||
case "splittermond":
|
||||
return "actor.derivedValues.speed.value";
|
||||
}
|
||||
|
||||
+7
-7
@@ -28,8 +28,8 @@ export function sum(arr) {
|
||||
|
||||
export function buildSnapPointTokenData(token) {
|
||||
const tokenData = {
|
||||
width: token.data.width,
|
||||
height: token.data.height,
|
||||
width: token.document.width,
|
||||
height: token.document.height,
|
||||
};
|
||||
|
||||
if (isModuleActive("hex-size-support")) {
|
||||
@@ -158,9 +158,9 @@ export function getTokenShape(token) {
|
||||
}
|
||||
|
||||
export function getTokenShapeForTokenData(tokenData, scene = canvas.scene) {
|
||||
if (scene.data.gridType === CONST.GRID_TYPES.GRIDLESS) {
|
||||
if (scene.grid.type === CONST.GRID_TYPES.GRIDLESS) {
|
||||
return [{x: 0, y: 0}];
|
||||
} else if (scene.data.gridType === CONST.GRID_TYPES.SQUARE) {
|
||||
} else if (scene.grid.type === CONST.GRID_TYPES.SQUARE) {
|
||||
const topOffset = -Math.floor(tokenData.height / 2);
|
||||
const leftOffset = -Math.floor(tokenData.width / 2);
|
||||
const shape = [];
|
||||
@@ -211,12 +211,12 @@ export function getTokenShapeForTokenData(tokenData, scene = canvas.scene) {
|
||||
|
||||
export function getTokenSize(token) {
|
||||
let w, h;
|
||||
const hexSizeSupportBorderSize = token.data.flags["hex-size-support"]?.borderSize;
|
||||
const hexSizeSupportBorderSize = token.document.flags["hex-size-support"]?.borderSize;
|
||||
if (hexSizeSupportBorderSize > 0) {
|
||||
w = h = hexSizeSupportBorderSize;
|
||||
} else {
|
||||
w = token.data.width;
|
||||
h = token.data.height;
|
||||
w = token.document.width;
|
||||
h = token.document.height;
|
||||
}
|
||||
return {w, h};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user