caewok / fvtt-terrain-mapper

Paint coded terrain values on Foundry maps
MIT License
4 stars 4 forks source link

activeTerrainsAt fails with error, FVTT Set::map is not applicable here #21

Closed AterIgnis closed 8 months ago

AterIgnis commented 8 months ago

https://github.com/caewok/fvtt-terrain-mapper/blob/53a8b7c9aa5441235fef1bd5a3bb242dd87d1dcf/scripts/TerrainLayer.js#L349

Description: FVTT Set::map function ensures initial and resulting sets are of same size, but it might not be correct with mapping, so error arises.

How to reproduce:

Solution: Call to .map should be replaced with manual transform, something like

const terrains = new Set();
this.terrainLevelsAt(location)
  .filter(t => t.activeAt(elevation, location))
  .forEach(t => terrains.add(t.terrain))
return terrains
caewok commented 8 months ago

Thanks! Should be fixed in v0.1.1.