manuelVo / foundryvtt-drag-ruler

A Foundry VTT module that shows a ruler when dragging tokens so you can see how far you've dragged them
MIT License
39 stars 50 forks source link

Fix check to enable/disable Terrain Ruler coloring/distance #322

Open RikerW opened 2 months ago

RikerW commented 2 months ago

Barely worth a PR.

window.terrainRuler is truthy if it exists, but it should check window.terrainRuler.active to make sure we actually want it on anyway. The check to make sure the variable exists in the first place is probably redundant but I'm being paranoid.

This does have the minor effect of a "desync", where the colors/distance traveled are client-side based on whether the client user has terrain ruler enabled, so they might see something different from the dragger, but that's minimal.

manuelVo commented 2 months ago

Hi there. Thanks for the PR. I don't think drag ruler should respect the terrain ruler toggle. The toggle makes a lot of sense for the regular ruler, as that one might be used to either measure air-line distance (where terrain doesn't apply) or to measure movement (where the terrain does apply). Since Drag Ruler only ever activates when dragging a token, it only measures movement and as such terrain should always be respected. Are there any notable exceptions to this that I'm missing?

RikerW commented 2 months ago

The original reason this came up is for tokens that should ignore difficult terrain for whatever reason - I'm not sure about all systems, but it was brought up for LANCER originally for both flying tokens & tokens that ignore difficult terrain due to a feature they have (player characters with a specific ability or certain npcs). It means that you have to math their movement independently, which is mildly annoying, so I figured this was a minimally intrusive fix (just toggling it on/off before dragging).

(the full context is somebody had asked in the LANCER discord for something like this for use with flying characters so I fiddled around with it for them)