Skip to content

Commit

Permalink
Fix compatibility with dnd5e 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 committed Sep 24, 2024
1 parent db53cdb commit 20c520f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"email": "[email protected]"
}
],
"version": "2.5.0",
"version": "2.5.1",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand Down Expand Up @@ -60,8 +60,8 @@
},
"url": "https://github.com/dev7355608/vision-5e",
"manifest": "https://github.com/dev7355608/vision-5e/releases/latest/download/module.json",
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.5.0/module.zip",
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.5.0",
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.5.1/module.zip",
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.5.1",
"bugs": "https://github.com/dev7355608/vision-5e/issues",
"readme": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/README.md",
"license": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/LICENSE"
Expand Down
8 changes: 5 additions & 3 deletions scripts/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import VisionModeTruesight from "./vision-modes/truesight.mjs";
import testVisibility from "./test-visibility.mjs";

Hooks.once("init", () => {
const legacy = foundry.utils.isNewerVersion("4.0.0", game.system.version) || game.settings.get("dnd5e", "rulesVersion") === "legacy";

// Extend Actor, TokenDocument, Token, and TokenHUD
CONFIG.Actor.documentClass = ActorMixin(CONFIG.Actor.documentClass);
CONFIG.Token.documentClass = TokenDocumentMixin(CONFIG.Token.documentClass);
Expand Down Expand Up @@ -82,7 +84,7 @@ Hooks.once("init", () => {
CONFIG.specialStatusEffects.UNCONSCIOUS = "unconscious";

// Shapechanger detection is not needed in PHB'24 at the momement, because Witch Sight has been changed
if (game.settings.get("dnd5e", "rulesVersion") === "legacy") {
if (legacy) {
CONFIG.specialStatusEffects.SHAPECHANGER = "shapechanger";
}

Expand Down Expand Up @@ -120,7 +122,7 @@ Hooks.once("init", () => {
}

// Register legacy detection modes
if (game.settings.get("dnd5e", "rulesVersion") === "legacy") {
if (legacy) {
for (const detectionModeClass of [
DetectionModeBlindsense,
DetectionModeWitchSight,
Expand Down Expand Up @@ -160,7 +162,7 @@ Hooks.once("init", () => {
delete CONFIG.Canvas.visionModes.tremorsense;

// Legacy Devil's Sight
if (game.settings.get("dnd5e", "rulesVersion") === "legacy") {
if (legacy) {
CONFIG.Canvas.visionModes.devilsSight.updateSource({
canvas: {
shader: ColorAdjustmentsSamplerShader,
Expand Down

0 comments on commit 20c520f

Please sign in to comment.