v10 compat: Get rid of several deprecation warnings (fixes #237)
This commit is contained in:
@@ -4,13 +4,13 @@ import {getTokenShape, isClose, zip} from "./util.js";
|
|||||||
|
|
||||||
function initTrackingFlag(combatant) {
|
function initTrackingFlag(combatant) {
|
||||||
const initialFlag = {passedWaypoints: [], trackedRound: 0};
|
const initialFlag = {passedWaypoints: [], trackedRound: 0};
|
||||||
let dragRulerFlag = combatant.data.flags.dragRuler;
|
let dragRulerFlag = combatant.flags.dragRuler;
|
||||||
if (dragRulerFlag) {
|
if (dragRulerFlag) {
|
||||||
if (isNaN(dragRulerFlag.trackedRound)) {
|
if (isNaN(dragRulerFlag.trackedRound)) {
|
||||||
mergeObject(dragRulerFlag, initialFlag);
|
mergeObject(dragRulerFlag, initialFlag);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
combatant.data.flags.dragRuler = initialFlag;
|
combatant.flags.dragRuler = initialFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,14 +40,14 @@ function calculateUpdate(combat, token, rays) {
|
|||||||
if (!combatant) return;
|
if (!combatant) return;
|
||||||
|
|
||||||
// Check if we have entered a new round. If so, remove the currently stored path
|
// Check if we have entered a new round. If so, remove the currently stored path
|
||||||
if (combat.data.round > combatant.data.flags.dragRuler.trackedRound) {
|
if (combat.round > combatant.flags.dragRuler.trackedRound) {
|
||||||
combatant.data.flags.dragRuler.passedWaypoints = [];
|
combatant.flags.dragRuler.passedWaypoints = [];
|
||||||
combatant.data.flags.dragRuler.trackedRound = combat.data.round;
|
combatant.flags.dragRuler.trackedRound = combat.round;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the passed waypoints to the combatant
|
// Add the passed waypoints to the combatant
|
||||||
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active;
|
const terrainRulerAvailable = game.modules.get("terrain-ruler")?.active;
|
||||||
const dragRulerFlags = combatant.data.flags.dragRuler;
|
const dragRulerFlags = combatant.flags.dragRuler;
|
||||||
const waypoints = dragRulerFlags.passedWaypoints;
|
const waypoints = dragRulerFlags.passedWaypoints;
|
||||||
for (const ray of rays) {
|
for (const ray of rays) {
|
||||||
// Ignore rays that have the same start and end coordinates
|
// Ignore rays that have the same start and end coordinates
|
||||||
@@ -88,13 +88,13 @@ export async function removeLastHistoryEntryIfAt(token, x, y) {
|
|||||||
const combat = game.combat;
|
const combat = game.combat;
|
||||||
const combatant = combat.getCombatantByToken(token.id);
|
const combatant = combat.getCombatantByToken(token.id);
|
||||||
await updateCombatantDragRulerFlags(combat, [
|
await updateCombatantDragRulerFlags(combat, [
|
||||||
{_id: combatant.id, dragRulerFlags: combatant.data.flags.dragRuler},
|
{_id: combatant.id, dragRulerFlags: combatant.flags.dragRuler},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resetMovementHistory(combat, combatantId) {
|
export async function resetMovementHistory(combat, combatantId) {
|
||||||
const combatant = combat.combatants.get(combatantId);
|
const combatant = combat.combatants.get(combatantId);
|
||||||
const dragRulerFlags = combatant.data.flags.dragRuler;
|
const dragRulerFlags = combatant.flags.dragRuler;
|
||||||
if (!dragRulerFlags) return;
|
if (!dragRulerFlags) return;
|
||||||
dragRulerFlags.passedWaypoints = null;
|
dragRulerFlags.passedWaypoints = null;
|
||||||
dragRulerFlags.trackedRound = null;
|
dragRulerFlags.trackedRound = null;
|
||||||
|
|||||||
+1
-1
@@ -460,7 +460,7 @@ export function extendRuler() {
|
|||||||
// If this is a pc and alwaysShowSpeedForPCs is enabled we show the color anyway
|
// If this is a pc and alwaysShowSpeedForPCs is enabled we show the color anyway
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
this.draggedEntity.actor.data.type === "character" &&
|
this.draggedEntity.actor.type === "character" &&
|
||||||
game.settings.get(settingsKey, "alwaysShowSpeedForPCs")
|
game.settings.get(settingsKey, "alwaysShowSpeedForPCs")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -176,9 +176,9 @@ class SpeedProviderSettings extends FormApplication {
|
|||||||
} else {
|
} else {
|
||||||
let name;
|
let name;
|
||||||
if (type === "module") {
|
if (type === "module") {
|
||||||
name = game.modules.get(id).data.title;
|
name = game.modules.get(id).title;
|
||||||
} else {
|
} else {
|
||||||
name = game.system.data.title;
|
name = game.system.title;
|
||||||
}
|
}
|
||||||
provider.selectTitle = game.i18n.format(
|
provider.selectTitle = game.i18n.format(
|
||||||
`drag-ruler.settings.speedProviderSettings.speedProvider.choices.${type}`,
|
`drag-ruler.settings.speedProviderSettings.speedProvider.choices.${type}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user