caewok/fvtt-elevated-vision

Full Shadow Penumbra is incompatible with the Limits module

Closed this issue · 1 comments

Limits patches LightSource#_createPolygon too. Because of the wrapper registration order EV's _createPolygon wrapper wraps around Limits' wrapper and therefore discards the constraint applied to the shape by Limits if Full Shadow Penumbra is enabled. If the wrapper order were the other way around, it would throw an error, because EV's _createPolygon doesn't return a PointSourcePolygon as documented. Limits expects a PointSourcePolygon. If EV patched _getPolygonConfiguration instead of _createPolygon, both problems (order and return type) would be solved. I quickly tested it, and it seemed to work well. The originalShape property is no longer set, but it seemed to be unused anyway.

function _getPolygonConfiguration(wrapped) {
  const config = wrapped();
  if ( getSetting(SETTINGS.LIGHTS_FULL_PENUMBRA) ) {
    config.type = "universal";
  }
  return config;
}

dev7355608/limits#4

caewok commented

Thanks! Fixed in v0.5.8. I forgot that "universal" was a config option, which simplifies things a bit. Presumably Limits is ignoring EV's directional lights, as those also wrap _createPolygon.