etiquettestartshere / effectivetray

A module for dnd5e on foundryvtt that allows the effects and damage trays to be used more effectively.
MIT License
4 stars 2 forks source link

[Feature Request] Add option to separate availability of damage and effect trays to players #107

Closed BlackBadger777 closed 2 weeks ago

BlackBadger777 commented 2 weeks ago

Foundry Version: 12, build 331 System: DnD5e, v3.3.1

I know 4.0 is just around the corner and a major rewrite / rethinking of this module is imminent, but I figured this was worth a shot.

I would love it if there was an option in the module settings that makes either the damage tray or the effect tray available to players, instead of "all or nothing". In my case, I really would like them to have the damage tray available, but not the effects tray.

Since I don't plan on updating to 4.0 right away after its release, I'd really appreciate it if this feature could be included in a module version that is compatible with 3.3.1 - if this feature request is realistic at all, that is!

etiquettestartshere commented 2 weeks ago

This should already be how it works, with one caveat. If you select the 'Use Default Effects Tray' setting, effective tray will make no modification to the effects tray other than applying the 'Don't Close Trays on Apply' and 'Scroll on Expand' settings. This does however mean that the tray will still appear for players when the items have effects with 'apply effect to actor' ticked, as it is simply the system's default tray (which if I recall is something you are trying to avoid).

etiquettestartshere commented 2 weeks ago

A relatively non-disruptive thing to add would be two more levels to the permission filter for the effective tray: owner (show effects from the owner only), and gm only (which would be more or less like the system's implementation, but never show any effects to the player at all). Would this cover all your use cases?

Note: Players would still see the default tray in this case, but the GM would not see effects with 'Apply Effect to Actor' ticked in the tray. I would suggest a small world script to delete the tray for players if that was truly unacceptable (though on 4.0, if things stay as they are, it would no longer be necessary as the filters are in an override of the method that creates the tray in the first place).

BlackBadger777 commented 2 weeks ago

I think this might be a reasonable compromise, yes.

The main reason I don't want to revert to the Default Effects Tray is because of the setting 'Delete instead of Refresh', which, as it currently stands, is not available without the players having access to effective tray, right?

Having a 'GM only' filter would circumvent that, if I'm not mistaken, so that would work well for me.

I'm not sure what you meant by 'players would still see the default tray in this case'. Which case are you referring to?

etiquettestartshere commented 2 weeks ago

I'm not sure what you meant by 'players would still see the default tray in this case'. Which case are you referring to?

In 3.X, the way I do the filtering means that, if you have the effective tray set to this new 'GM Only' setting, it will filter out player clients by simply hitting return, never emptying out the trays that do appear for them. So, the system's default try will appear unedited, ie the tray that has effects only with apply to actor ticked, visible to players.

In 4.0 though, when I return after doing the filtering, the tray will never be created for them (unless the Use Default Effects Tray setting is on, in which case all will work as it normally does).

Anyway, I have no problem adding the new filters. There will still be one or two more small versions (and whatever bugfixes for stuff I break) before 4.0.

The below world script will also completely delete the tray for players in all cases, if you do want that:

Hooks.on("dnd5e.renderChatMessage", async function(message, html) {
  if (game.user.isGM) return;
  const tray = html.querySelector('.effects-tray');
  if (!tray) return;
  const item = message.getAssociatedItem();
  if (!item) return;
  const effects = item?.effects?.contents;
  if (foundry.utils.isEmpty(effects)) return;
  await new Promise(r => setTimeout(r, 10));
  if (tray) tray.remove();
})