Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AterIgnis opened this issue Jan 8, 2024 · 1 comment
Closed

Comments

@AterIgnis
Copy link

.map(t => t.terrain);

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:

  • Add terrain to scene layer
  • Add tile with same terrain in configuration
  • Try moving in overlapping area / do something else to invoke terrain.activeTerrainsAt(...)

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 added a commit that referenced this issue Jan 8, 2024
@caewok
Copy link
Owner

caewok commented Jan 8, 2024

Thanks! Should be fixed in v0.1.1.

@caewok caewok closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants