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