caewok / fvtt-token-visibility

Advanced token visibility rules for Foundry VTT
MIT License
4 stars 8 forks source link

Incompatible with Vision 5e #84

Open dev7355608 opened 4 months ago

dev7355608 commented 4 months ago

Partially related to #83.

Vision 5e doesn't use the DetectionModeBasicSight and DetectionModeLightPerception classes as base for Darkvision and Light Perception. So it's necessary for compatibility to patch CONFIG.Canvas.detectionsModes.basicSight and CONFIG.Canvas.detectionsModes.lightPerception instead. Patching paths starting with "CONFIG." needs to occur after all init hooks have run considering any module might extend the CONFIG classes. Doing it in a setup hook would work with the exception of document class patches like CONFIG.Actor.documentClass: it would be too later for those. This way should work for "CONFIG." document class patches too:

Hooks.once("libWrapper.Ready", () => {
  Hooks.once("init", () => /* register wrappers */);
});