Closed Eligarf closed 7 months ago
Most of Vision 5e's detection modes override _canDetect
without calling the base _canDetect
. If you wrap CONFIG.Canvas.detectionModes.basicSight.prototype._canDetect
(in a setup
hook so that it runs after Vision 5e replaces the detection modes) instead of DetectionMode.prototype._canDetect
, I imagine it would work. Your previous implementation with testVisibility
had the advantage that testVisibility
is unlikely to be overridden the subclasses of DetectionMode
completely.
You could also the patch following, then I can remove the compatibility code for Stealthy from Vision 5e completely. I see you removed Umbral Sight handling from Stealthy: I'll add the friendlyUmbralSight
setting to Vision 5e. With detection modes should be affected by Stealthy is probably better handled by Stealthy than Vision 5e.
CONFIG.Canvas.detectionModes.blindsight.prototype._canDetect
(dnd5e system)CONFIG.Canvas.detectionModes.devilsSight.prototype._canDetect
(vision-5e)CONFIG.Canvas.detectionModes.feelTremor.prototype._canDetect
(vision-5e)CONFIG.Canvas.detectionModes.ghostlyGaze.prototype._canDetect
(vision-5e)CONFIG.Canvas.detectionModes.hearing.prototype._canDetect
(vision-5e)CONFIG.Canvas.detectionModes.lightPerception.prototype._canDetect
(vision-5e)CONFIG.Canvas.detectionModes.seeAll.prototype._canDetect
(core)I'll try to go the route that removes any need for you to have any Stealthy compatability code at all! Thanks for the pointers, and I'll update this when I think I've untangled you.
3.14.2 has been published now where I've hooked the specific detection modes that stealth might apply against if your module is enabled. I believe you should be able to remove that Stealthy compatibility code now. Thanks again.
One problem I'm running into now is I can't tell when darkvision is actually being used vs basic vision when I examine the visionSource
object in my patch code. Foundry's native code has the id
set to darkvision
or basic
when I patch DetectionMode.prototype._canDetect
, but no such luck with your overrides. Is there some proper way I can now tell the difference when I patch your functions?
With Vision 5e basicSight
is always Darkvision (and just Darkvision: no Light Perception, which is a separate mode), no matter what the Vision Mode is set to: so you don't have to check the Vision Mode at all.
I see: basicSight = Darkvision, LightPerception = regular vision (old basic vision). Thanks, I can make this work.
I updated the Stealthy module to use DetectionMode.prototype._canDetect in order to clean up its general processing and be able to handle stealth vs hearing modes, but I've run into the problem where my solution works only on those servers where Stealthy happens to patch in the right order with vision-5e. I used libWrapper to patch that function, and it should be able to work perfectly fine regardless of which of our implementations runs first, but I see you directly assigning a new _canDetect function in patches.js, so if yours runs second, it will stomp mine.
The changes unfortunately seemed to work fine with vision-5e on both of my test worlds, so I published the changes to Stealthy this morning, and am now figuring out how to re-release the previous release over top of it for the time being, but any workarounds/suggestions would be appreciated.