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

Feature: Better compatibility with Walled Templates module #265

Open
caewok opened this issue Apr 28, 2024 · 1 comment
Open

Feature: Better compatibility with Walled Templates module #265

caewok opened this issue Apr 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@caewok
Copy link

caewok commented Apr 28, 2024

Hi! I am the dev for the Walled Templates module. There are some incompatibilities between our two modules when it comes to displaying/hiding templates.

Walled Templates allows the GM to hide or display the template highlight grid and the template border separately. Each shape has a default "hide" setting, but that can be overridden on a per-template basis. In dnd5e, spells can pass these settings through to template creation because I added some drop-down selections to the spell configuration.

I am seeing at least two incompatibilities with Token Magic that I cannot fix on my end. (1) There is flickering related to the template alpha setting. While WT will respect the TM alpha setting, it seems that TM does not set the template alpha soon enough on a template refresh, causing a flicker as the template is briefly drawn with full alpha. (2) WT cannot hide the template border if Token Magic is active. I think this is irregardless of the TM setting for template hiding.

Walled Templates sets template hiding in the MeasuredTemplate refresh hook. Most of the tests are in the helper function, canHideTemplateComponent.

The basic approach is:

  1. Border and template visibility: To hide the border, set template.ruler.visible to false and change template.template.alpha to 0. I don't set visibliity of the template because that would cause automated animations to not display.
  2. Highlight visibility: To hide the highlight grid, set the canvas.grid.getHighlightLayer(template.highlightId).alpha to 0.

Because I am completely hiding the template (given the right settings) I allow the control icon to be visible to non-owners in certain situations.

Walled Templates uses flags on the template to indicate when it should be hidden, although there is some logic to it as well based on the user privileges and where the cursor is located. (For example, there is a setting to unhide the template when hovering over a token within the template.)

I am open to suggestions for how to improve compatibility here. I noticed that you use several libWrapper methods, which I don't think is strictly necessary for template hiding (although it surely is necessary for other things that Token Magic is doing).

@caewok caewok added the enhancement New feature or request label Apr 28, 2024
@caewok
Copy link
Author

caewok commented Apr 28, 2024

FYI, if you don't want to support template hiding anymore, you could take that code out of Token Magic and just direct users to my Walled Templates module for that feature. In its default settings, Walled Templates should act like normal Foundry templates, and so it should be possible for a user to only use the template hiding features. Near as I can tell, Walled Templates is otherwise compatible with Token Magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant