foundryvtt / pf2e

A community contributed game system for Pathfinder Second Edition.
https://foundryvtt.com/packages/pf2e
Apache License 2.0
418 stars 349 forks source link

v11 Actor module-sub-types are not compatible with pf2e 5.14.4 #14282

Closed MarkPearce closed 5 months ago

MarkPearce commented 7 months ago

v11 introduced a way for modules to create their own document sub types. https://foundryvtt.com/article/module-sub-types/

https://discord.com/channels/880968862240239708/880969304365994034/1220904695854399488 (drentalBot) "The pf2e system doesn't use one actor class, but one class per actor type and has a Proxy setup to actually get those classes for NP,ActorPf2e, FamilairActorPf2e, etc. So when you add a new type of actor you also have to supply a new actor class and register it in CONFIG.PF2E.Actor.documentClasses[type]"

but that proves to be problematic.

I've only tried it with Actors, but if there are other documentTypes that behave the same could be more prevalent.

Drental commented 7 months ago

Hey, no pointing at me!

Can you show what you tried and how it failed?

MarkPearce commented 7 months ago

Haha that’s what you get for helping newbs! ;) It was also a good summary of the issue. Yea I’ll upload some failures. (And code that works in other systems)

On Sat 23. Mar 2024 at 23:36, Drental @.***> wrote:

Hey, no pointing at me!

Can you show what you tried and how it failed?

— Reply to this email directly, view it on GitHub https://github.com/foundryvtt/pf2e/issues/14282#issuecomment-2016620603, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVHG6QA7CB3IGUPIDZINMLYZX7VPAVCNFSM6AAAAABFE7LODSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJWGYZDANRQGM . You are receiving this because you authored the thread.Message ID: @.***>

MarkPearce commented 7 months ago

image Screen shot of the current state in not-pathfinder2e. Scum and Villainy in this case.

Here is the repo if anyone wants to take a look. https://github.com/MarkPearce/ore-companies I have some conditional logic there to check for pathfinder and try workarounds.

A few folks on the discord channel been suggesting ways to fix it.

I've tried:

  1. extending the actor class, but get "you may only push instances of actor to the actorsPF2e collection"
  2. extending the ActorPF2e class, by getting the prototype of existing actors but the data models don't match
  3. Tried overriding the preparedata methods, but that just kills the actors data, and removes them all from sidebar.
MarkPearce commented 7 months ago

error with extending ActorPF2e (currently in code) by getting the prototype of an existing actor. (thanks to Idle for the help!)

foundry.js:753 TypeError: Failed data preparation for Actor.TxTCzNXRxDgK7KNO. Cannot set properties of undefined (setting 'flanking') at CompanyActor.prepareBaseData (pf2e.mjs:1649:53368) at CompanyActor.prepareData (foundry.js:14209:12) at CompanyActor.prepareData (pf2e.mjs:1649:52446) at CompanyActor._safePrepareData (foundry.js:14187:14) at Game.initializeDocuments (foundry.js:8796:18) at Game.setupGame (foundry.js:8706:10) at async Game._initializeGameView (foundry.js:9990:5)

This looks like a flag for pf2eactors that determine if they are part of flanking system or not, not needed for module sub types. 
MarkPearce commented 7 months ago

image

error when trying to extend Actor

MarkPearce commented 7 months ago

disabling prepdata methods.
foundry.js:753 TypeError: Failed to render Sidebar tab actors. Cannot read properties of undefined (reading 'level') image

MarkPearce commented 7 months ago

Anyone more clever than I have suggested workaround?

CarlosFdez commented 7 months ago

Personally I kinda want to wait till v12 before taking a look at this, given its very under the hood and those receive upheavel between major versions. Its very likely we'll have to do something to support it.

CarlosFdez commented 5 months ago

If anything breaks, please feel free to report so that this behavior can be finetuned.