League-of-Foundry-Developers / torch

Simple torch module for Foundry VTT
10 stars 16 forks source link

PF2 support: Render buttons for Light Items #36

Closed apoapostolov closed 1 year ago

apoapostolov commented 1 year ago

On actors with RuleElements that can cast light, such as an Everburning Torch, these items have configured size, light color, and effect templates that are lost when using regular torch lights. Please consider adding support for rendering additional buttons for each item that can cast light in the Token HUD interface.

lupestro commented 1 year ago

The whole rule element system in PF2e is excellent. It integrates the business of light-bearing into the rest of the game rules. It makes possible things that Torch will never be able to touch, like spells that cast light among other effects. Due to rule elements, PF2e is as close as anything in Foundry has ever become to being a truly complete system.

Do "ordinary" light sources in PF2e have rule elements associated with them? I think there are actions like lighting and extinguishing a torch that can trigger rule elements. If it can be done, but only with work, I'd love to see a blog article on how to do this. The only reason I know of not to use its mechanisms rather than Torch to support light in that system, would be, perhaps, if the work to expose the capabilities in rule elements for these light sources hasn't been done. I would gladly use mechanisms built from the system itself rather than my own module in a system that supported it.

Setting aside sources.json, which is purely data, Torch has almost no system-specific functional code. Exceptions:

These exist, at least in part, as working demonstrations of how people could use these generic mechanisms to extend the module if they wished.

Otherwise, everything is generic, by intention and design. I can't see spending a lot of effort to hybridizing Torch for any single system, especially when I suspect that system already has a mechanism that would seamlessly provide everything that Torch does, with Token Action HUD automatically exposing the actions to click.

However, this opens an interesting conversation and I would be happy to consider any rationale you might have to revisit the above line of reasoning.

apoapostolov commented 1 year ago

First, I would like to apologize for never coming back to this topic after such a thoughtful reply from your side. Unfortunately, following too many GitHub makes it hard to notice developers' critical updates and reactions.

Do "ordinary" light sources in PF2e have rule elements associated with them?

Items (such as the basic Torch and Everburning Torch, Light cantrip on a stick) and spells (such as Light) have light rules. Here's an example of such rules.

{"key":"TokenLight","value":{"animation":{"intensity":7,"speed":1,"type":"torch"},"bright":20,"color":"#57cdff","dim":40,"saturation":0.3,"contrast":0.3,"shadows":0.2}}

Light:

{"key":"TokenLight","value":{"animation":{"intensity":1,"speed":2,"type":"pulse"},"bright":{"brackets":[{"end":3,"value":20},{"start":4,"value":60}],"field":"item|system.level.value"},"color":"#343434","dim":{"brackets":[{"end":3,"value":40},{"start":4,"value":120}],"field":"item|system.level.value"}}}

What would be best if Torch mod could go over all items (spell and item inventory) of the token and on spotting a TokenLight RE it would generate a button with the icon of the item or the spell to appear next to the generic light option.

On the other side, I could love if there was a premade JSON for PF2 that contained a preset lights using the color/effects of these items to be triggered quickly when needed. I have looked on the GitHub but did not see an example JSON to use to make such.

apoapostolov commented 1 year ago

I am closing this issue as I finally understand how the source.json works and this issue needs to be an improvement in the PF2 support. I will open a new issue.