Open Saibot393 opened 1 year ago
Which module of yours has the issue?
The module is question is perceptive more precisely this code
Short term at least, I am not going to be able to use the default _testWallInclusion
. This is because I need the walls that would be included absent Wall Height, and I have no good way to get at that without just using a copy of the original function.
There might be an easy solution for you, though. If you export PeekingManager
to a public-facing API, I can use that to call PeekingManager.IgnoreWall
. One common way for modules to expose their API is like what I do here. So on your end, you would want something like:
Hooks.once("init", function() {
game.modules.get(MODULE_ID).api = { PeekingManager };
}
Then on my end, I could call something like:
const PeekingManager = game.modules.get("perceptive").api.PeekingManager;
PeekingManager.IgnoreWall(wallDoc, objectDoc);
Thank you, i have added api for that in the newest update, the code for it looks like this: game.modules.get("perceptive").api.IgnoreWall(pWallDoc, pTokenDoc)
I made a change in v0.5.11 that incorporates your api when selecting walls for a VisionSource
. Let me know if that helps!
Thanks for the work, i did a few tests and it almost works. While tokens are visible trough the peeked walls, as intended, the walls shadow doesn't update correctly i.e. the wall still casts a shadow. I dug through your code and found a way to solve this problem by adding this code into the _includeWall
function in SouceShadowWallGeometry.js
(lines 211-220, before the original return):
const IgnoreWall = game.modules.get("perceptive")?.api?.IgnoreWall;
if (IgnoreWall) {
const token = this.source?.object;
if (token) {
return this.source._testWallInclusion(wall, PIXI.Point.fromObject(this.source)) && !IgnoreWall(wall.document, token.document);
}
}
This still leaves one problem though, since shadows only seem to update correctly once a token moves, i would guess that i would have to update the vision source on my end. Normally token.updateVisionSource();
should surfice here, i guess you wrote a kind of custom vision update for the wall shadows?
Try token.renderFlags.set({refreshVisibility: true})
or token.renderFlags.set({refresh: true})
. My vision update should work but you might have to update the other tokens. Moving a token triggers vision updates for everyone.
Thank you, will try it
Hello, i was just informed, that a module of mine is not compatible with Elevated Vision. So far the problem seems to be the "ClockwiseSweepPolygon.prototype._testWallInclusion" function. My module adds an additional condition to this (similar to the Wall-Height module). I tried to look through your code but was so far not successful at finding the way Wall-Height is made compatible, so i could not replicate it. What would be the preferred way to ensure compatibility with Elevated Vision while adding a condition to the "_testWallInclusion" function?