From 25d8067d507247ffddec12660079b364b88aaaef Mon Sep 17 00:00:00 2001 From: dev7355608 Date: Thu, 5 Dec 2024 20:56:27 +0100 Subject: [PATCH] Improve version checks --- scripts/_index.mjs | 4 ++-- scripts/canvas/geometry/constraint.mjs | 2 +- scripts/canvas/sources/darkness.mjs | 2 +- scripts/canvas/sources/light.mjs | 2 +- scripts/canvas/sources/sound.mjs | 4 ++-- scripts/canvas/sources/vision.mjs | 2 +- scripts/limits.mjs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/_index.mjs b/scripts/_index.mjs index c8e5840..d52fa99 100644 --- a/scripts/_index.mjs +++ b/scripts/_index.mjs @@ -16,7 +16,7 @@ Hooks.once("init", () => { CONFIG.Canvas.darknessSourceClass = PointDarknessSourceMixin(CONFIG.Canvas.darknessSourceClass); CONFIG.Canvas.soundSourceClass = PointSoundSourceMixin(CONFIG.Canvas.soundSourceClass); - if (game.release.version >= 13) { + if (game.release.generation >= 13) { if (game.modules.get("lib-wrapper")?.active) { libWrapper.register( "limits", @@ -83,7 +83,7 @@ Hooks.once("init", () => { }); Hooks.once("ready", () => { - if (game.release.version < 13) { + if (game.release.generation < 13) { CONFIG.RegionBehavior.sheetClasses[TYPE]["core.RegionBehaviorConfig"].cls = LimitRangeRegionBehaviorConfig; } }); diff --git a/scripts/canvas/geometry/constraint.mjs b/scripts/canvas/geometry/constraint.mjs index 97d54bf..0941800 100644 --- a/scripts/canvas/geometry/constraint.mjs +++ b/scripts/canvas/geometry/constraint.mjs @@ -54,7 +54,7 @@ export default class PointSourcePolygonConstraint extends PIXI.Polygon { let { x: originX, y: originY, elevation } = this.#origin = polygon.origin; - if (game.release.version < 13) { + if (game.release.generation < 13) { elevation = polygon.config.source?.elevation ?? 0.0; } diff --git a/scripts/canvas/sources/darkness.mjs b/scripts/canvas/sources/darkness.mjs index 956b22b..225f2ab 100644 --- a/scripts/canvas/sources/darkness.mjs +++ b/scripts/canvas/sources/darkness.mjs @@ -29,7 +29,7 @@ export const PointDarknessSourceMixin = (PointDarknessSource) => class extends P PointSourcePolygonConstraint.apply(this.shape, Limits.darkness); } - if (game.release.version >= 13) { + if (game.release.generation >= 13) { const { x, y, elevation, radius } = this.data; const z = elevation * canvas.dimensions.distancePixels; const { left: minX, right: maxX, top: minY, bottom: maxY } = this.shape.bounds; diff --git a/scripts/canvas/sources/light.mjs b/scripts/canvas/sources/light.mjs index 61d3e56..39b2510 100644 --- a/scripts/canvas/sources/light.mjs +++ b/scripts/canvas/sources/light.mjs @@ -19,7 +19,7 @@ export const PointLightSourceMixin = (PointLightSource) => class extends PointLi PointSourcePolygonConstraint.apply(this.shape, Limits.light); - if (game.release.version >= 13) { + if (game.release.generation >= 13) { const { x, y, elevation, radius } = this.data; const z = elevation * canvas.dimensions.distancePixels; const { left: minX, right: maxX, top: minY, bottom: maxY } = this.shape.bounds; diff --git a/scripts/canvas/sources/sound.mjs b/scripts/canvas/sources/sound.mjs index 0282ee9..f5eff44 100644 --- a/scripts/canvas/sources/sound.mjs +++ b/scripts/canvas/sources/sound.mjs @@ -26,7 +26,7 @@ export const PointSoundSourceMixin = (PointSoundSource) => class extends PointSo let minZ; let maxZ; - if (game.release.version >= 13) { + if (game.release.generation >= 13) { minZ = z - radius; maxZ = z + radius; } else { @@ -51,7 +51,7 @@ export const PointSoundSourceMixin = (PointSoundSource) => class extends PointSo if (volume > 0.0) { let z; - if (game.release.version >= 13) { + if (game.release.generation >= 13) { z = listener.elevation * canvas.dimensions.distancePixels; } else { z = this.#caster.ray.originZ; diff --git a/scripts/canvas/sources/vision.mjs b/scripts/canvas/sources/vision.mjs index 1b2199b..3d70aff 100644 --- a/scripts/canvas/sources/vision.mjs +++ b/scripts/canvas/sources/vision.mjs @@ -81,7 +81,7 @@ export const PointVisionSourceMixin = (PointVisionSource) => class extends Point let minZ; let maxZ; - if (game.release.version >= 13) { + if (game.release.generation >= 13) { minZ = z - radius; maxZ = z + radius; } else { diff --git a/scripts/limits.mjs b/scripts/limits.mjs index 0ed9e44..8b79ace 100644 --- a/scripts/limits.mjs +++ b/scripts/limits.mjs @@ -140,7 +140,7 @@ export default class Limits { let bottom; let top; - if (game.release.version >= 13) { + if (game.release.generation >= 13) { if (!shape) { polygons = region.polygons; }