caewok / fvtt-walled-templates

Foundry VTT templates that interact with walls
MIT License
9 stars 4 forks source link

Preview template only respects wall height of zero #113

Open morepurplemorebetter opened 4 months ago

morepurplemorebetter commented 4 months ago

Apologies for the duplicate issue, but all the others I've been replying to in the past had been opened by someone else and I can't reopen those issues. As a result, I fear my comments are being lost in the mix. For example, I think my comment to issue 100 has been overlooked.

My previous pull request #107 was edited to use elevationE instead of the new elevation flag set in my edit of drawMeasuredTemplate (which was kept, but now serves no purpose). Unfortunately, elevationE is always 0 for me. I can't find where Walled Templates sets this value, thus I have a feeling that it could be set by another module, which I don't use while you do and hence this issue is not showing up for you. Or it is being unset by a module that I do use.

As a result, the previewed template shape only respects walls at height 0. Once cast, the template behaves as expected because then the flag is pulled from the Levels module.

caewok commented 3 months ago

The elevationE getter is set by the geometry lib that you can see if you go to scripts/geometry/elevation.js. If it is not working, that suggests some underlying issue that should be fixed.

In a world with just Walled Templates, libWrapper, and sockets modules, I can set the elevation to 10 by opening the elevation config and changing the "elevation" value. Then I can do this (presuming you have one template on the canvas):

[t] = canvas.templates.placeables
t.elevationE // 10
t.elevationZ //  200 (this is the number of pixels, comparable to x,y coordinates)
morepurplemorebetter commented 3 months ago

Thank you for explaining this more. I have now setup a test world with only Walled Templates, Midi-QoL, Levels, and Wall Height active. When I go to cast a template spell and before I place the template down, the preview template respects only the walls at height zero. Once the template is placed, it does get the right height assigned as then it is taking it from the level module, because of my PR #107.

I don't know where I would find the "elevation config" to change the elevation value. I would assume that the template would get the same elevation as the token. Or did you perhaps mean the token config with "elevation config"?

 

Below a video to showcase what is happening. Tokens are at elevation -10 with walls going from elevation -10 to -1. The preview of the fireball template shows the walls at elevation 0.

https://github.com/caewok/fvtt-walled-templates/assets/8971168/a08c2087-cb97-46a5-bf54-ffc4cdc5f11c

This uses the preview scene from the Levels module with tokens from the SRD compendium (I only changed it by adding fireball to the default hero, because the big template showcases the issue better than burning hands).

 

When I change the function computeSweep() to log the elevationE in the console, it always comes up as 0, even after the template has been placed. This makes me think that elevationE is not correctly being set for measured templates.

[t] = canvas.templates.placeables
t.elevationE // results in 0
t.elevationZ // also results in 0

This does work, but the result are 0 for both for every template I place. I guess there is an underlying issue.

Also, when I use the square brackets to in- or decrease the elevation of a template in preview, its value always starts from 0, and is visible above the template icon, but only until I move the template.

 

Modules and versions used in my test world: