Skip to content

Commit

Permalink
feat: add compatibility with v10.278
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost91- committed Aug 17, 2022
1 parent 8a90018 commit 358f37a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"minimum": "10.276",
"verified": "10"
},
"minimumCoreVersion": "10.276",
"minimumCoreVersion": "10.278",
"compatibleCoreVersion": "10",
"scripts": ["libs/filters/pixi-filters.js"],
"esmodules": ["fxmaster.js"],
Expand Down
4 changes: 3 additions & 1 deletion src/particle-effects/drawings-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ function drawDrawingsMaskIfCurrentScene(scene) {
}

function drawDrawingsMask() {
const msk = canvas.masks.tileOcclusion;
const msk = canvas.masks.depth;
if (msk.fxmasterDrawingsMask) {
msk.removeChild(msk.fxmasterDrawingsMask);
delete msk.fxmasterDrawingsMask;
}
const invert = canvas.scene.getFlag(packageId, "invert");
const mask = invert ? createInvertedMask() : createMask();
mask.mask = new PIXI.MaskData();
mask.mask.colorMask = PIXI.COLOR_MASK_BITS.BLUE;
msk.fxmasterDrawingsMask = msk.addChild(mask);
}

Expand Down
9 changes: 4 additions & 5 deletions src/particle-effects/particle-effects-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ export class ParticleEffectsLayer extends CanvasLayer {
/**
* Define an elevation property on the ParticleEffectsLayer layer.
* For now, it simply referenes the elevation property of the {@link WeatherEffects} provided by
* foundry and adds 0.5 to it, so that FXMaster particle effects are always rendered on top of the
* weather effects provided by foundry.
* foundry.
* @type {number}
*/
get elevation() {
return (canvas.weather?.elevation ?? 9999) + 0.5;
return canvas.weather?.elevation ?? Infinity;
}

set elevation(value) {
const weatherEffects = canvas.weather;
if (weatherEffects) {
weatherEffects.elevation = value - 0.5;
weatherEffects.elevation = value;
}
}

Expand Down Expand Up @@ -141,7 +140,7 @@ export class ParticleEffectsLayer extends CanvasLayer {
#createParticleEffectOcclusionFilter() {
const particleOcclusionFilter = InverseOcclusionMaskFilter.create({
alphaOcclusion: 0,
uMaskSampler: canvas.masks.tileOcclusion.renderTexture,
uMaskSampler: canvas.masks.depth.renderTexture,
channel: "b",
});
return particleOcclusionFilter;
Expand Down
4 changes: 3 additions & 1 deletion src/particle-effects/scene-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function registerSceneMaskFunctionality() {
}

function drawSceneMask() {
const msk = canvas.masks.tileOcclusion;
const msk = canvas.masks.depth;
if (shouldMaskToScene()) {
const mask = new PIXI.LegacyGraphics()
.beginFill(0x0000ff)
Expand All @@ -12,6 +12,8 @@ function drawSceneMask() {
.beginHole()
.drawShape(canvas.dimensions.sceneRect.intersection(canvas.dimensions.rect))
.endHole();
mask.mask = new PIXI.MaskData();
mask.mask.colorMask = PIXI.COLOR_MASK_BITS.BLUE;
msk.fxmasterSceneMask = msk.addChild(mask);
} else if (msk.fxmasterSceneMask) {
msk.removeChild(msk.fxmasterSceneMask);
Expand Down

0 comments on commit 358f37a

Please sign in to comment.