Skip to content

Conversation

@erickrf
Copy link

@erickrf erickrf commented Aug 22, 2025

This creates a new Actor Sheet class that inherits from Application v2.

I decided to create a subclass for Character and inherit from the base actor, instead of handling the subtype-specific logic inside the base class. Character was the most complex type of actor and serves as a proof of concept, other types are still to be implemented.

It is still possible to use the v1 actor sheet (clicking on the configure sheet button and choosing the old one).

A few minor points:

  • This is building upon Fix loading fonts in v13 #83
  • The style is slightly different in the v2 sheet. Some fonts are rendered larger, some spacing is a bit different. But no huge changes.
  • Dragging and dropping from the compendium only works item by item, not with whole folders.
  • I relied heavily on an AI agent to write the listener logic. I tried to check and test the code as best as I could, and it seems to be working fine.

Copy link
Owner

@orffen orffen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to take a look at the sheets themselves. Are the new .hbs files required for application v2? I couldn't find anything at a quick look at the API documentation.

Do you know how these are handled in older FoundryVTT versions? I'd prefer not to maintain both .mjs and .hbs files if not needed; but if these are breaking changes then we'd need to think about that.

Possibly the application v2 migration should happen once FoundryVTT v14 is stable, and at the same time we can deprecate support for v12 and below. Thoughts?


Handlebars.registerHelper('selected', function(value) {
return Boolean(value) ? "selected" : "";
return value ? "selected" : "";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the rationale for this change? If I recall (and it was some time ago), I coerced to boolean here to ensure the return was a true or false value if the helper existed, otherwise it would return the empty string. Did you run into an issue with that logic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't remember why. It's been a while I wrote this, but it looks like it would be safer to add the coercion back.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize now that it was actually my IDE (WebStorm) automatically deleting it. I'm not very experienced in javascript, but it looks like the coercion in practice doesn't change anything.

// Import sheet classes.
import { BasicFantasyRPGActorSheet } from './sheets/actor-sheet.mjs';
import { BasicFantasyRPGItemSheet } from './sheets/item-sheet.mjs';
import { CharacterSheet } from './sheets/character-sheet.mjs';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ActorSheet was for any actor types - both characters and monsters. Is the new sheet for the same or only for Characters?

I'd like the naming to remain consistent with the previous sheets and avoid any potential collisions in future, unless this naming is expected by application v2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember well, at the time I pushed this, I had only implemented the character sheet with v2, and the other actors were supposed to continue using v1. I have since implemented the new sheets as base classes, and would be happy to push them here as well.

);
Actors.registerSheet('basicfantasyrpg',
CharacterSheet,
{ types: ['character'], makeDefault: true, label: "Character Sheet V2"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are 2 makeDefault attributes possible?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly. The idea was that since at the time of the MR only characters were implemented with v2, the other actor types would get the existing v1 sheet as default (i.e., the new sheet would override the default for characters only).


.basicfantasyrpg.sheet.actor {
font-family: "Century Gothic", "TeX Gyre Adventor", "Soutane", var(--font-primary);
font-family: "Soutane", "Century Gothic", "TeX Gyre Adventor", var(--font-primary);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sheet would prefer to keep Century Gothic.

@erickrf
Copy link
Author

erickrf commented Sep 20, 2025

Are the new .hbs files required for application v2?

No. They are just recommended and more future-proof, and I thought to start using .hbs since I was going to need to change some stuff in the templates. The main change I recall right now is that the v1 uses templates with a top-level <form> element, and v2 doesn't.

Do you know how these are handled in older FoundryVTT versions? I'd prefer not to maintain both .mjs and .hbs files if not needed; but if these are breaking changes then we'd need to think about that.

I haven't tested extensively, but in principle they work in v12. I agree with keeping only one type. I was overcautious with my first changes and trying to minimize changes.

Possibly the application v2 migration should happen once FoundryVTT v14 is stable, and at the same time we can deprecate support for v12 and below. Thoughts?

So, Foundry v12 is compatible with Application v2, and because of that I would be in favor of migrating to v2 already. That would mean deprecating support for v11 though.

I can try to run some more testing with v12 to be sure.

@erickrf
Copy link
Author

erickrf commented Sep 20, 2025

After submitting this MR, I was pretty active in experimenting and implementing new features, and have fixed one bug or two that were still present here. I have one feature branch in my clone with a lot of new changes and I am wondering what's the best way to submit new MR's out of it without being too overwhelming.

I can try to break it down into separate changes and submit new MRs later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants