malde / blind-death-saves

A Foundry VTT module for the dnd5e system which forces death saves to be rolled in secret.
https://foundryvtt.com/packages/blind-death-saves
0 stars 3 forks source link

Feature Request: Tidy 5e Sheets compatibility #4

Closed kgar closed 4 months ago

kgar commented 4 months ago

Hello, I am the Tidy 5e Sheets maintainer. We have mutual users who would love for us to establish compatibility between our modules. I wanted to start a discussion about establishing compatibility and how we might accomplish it.

Is this something you'd be interested in?

malde commented 4 months ago

Hey there, last I checked, it is compatible. Unless you made some major changes to the sheet, since you took over as maintainer. I am no longer using it myself, but was before the official new dnd5e sheet.

kgar commented 4 months ago

As far as changes go, I did completely rewrite it from scratch and it now runs in svelte. As of now, the roll behaviors from this module work as intended, but Blind Mode does not hide the death save total from the users in Tidy. I can submit a PR if that is agreeable. I haven't looked at the code yet, but would you have a place for alternate sheets to have their behaviors wired up?

malde commented 4 months ago

Got it. The support is quite basic by just removing some elements from the dom. I'm also not very familiar with modern JS development myself.

I'm open to another approach, be that API or hooks or whatever is the correct way to do this. Please feel free to suggest improvements or changes.

malde commented 4 months ago

@kgar I fixed the hiding of results in the tidy5e sheet, but am still open for suggestions on how to improve that. It's very much a "backend developer doing frontend"-fix.

kgar commented 4 months ago

That's awesome. Thank you for looking into that!

If you're interested, here are some suggested selector updates for those fields:

      const tidyDeathSaveIconSuccess = $(html).find(
        ".death-saves .fa-check"
      );
      const tidyDeathSaveCounterSuccessAndFailure = $(html).find(
        `.death-saves .death-save-result`
      );
      const tidyDeathSaveIconFailure = $(html).find(
        ".death-saves .fa-times"
      );

      tidyDeathSaveIconSuccess.remove();
      tidyDeathSaveCounterSuccessAndFailure.remove();
      tidyDeathSaveIconFailure.remove();

Here's what I did:

I have a modernized sheets project coming up soon, but I will do my best to keep these classes intact so that I don't re-break integration.

malde commented 4 months ago

Alright, thanks, I've gone ahead and applied those suggestions to be included in the next version.

I'm also fine with doing something akin to this pseudo-code:

if (sheet instanceof tidy5eSheet) {
  fireTidy5eHook(setHideDeathSaves(blind: bool))
}

however that might actually need to look, but that's the part where I'm totally out of my depths 😅

kgar commented 4 months ago

Thank you again for working with me on this. We've made some mutual users very happy 🫡