foundryvtt-starfinder / foundryvtt-starfinder

A community maintained implementation of the Starfinder Roleplaying Game for Foundry VTT.
https://foundryvtt.com/packages/sfrpg
MIT License
92 stars 104 forks source link

Unable to drop JournalPage on Actor #1394

Open paulyhedral opened 1 month ago

paulyhedral commented 1 month ago

Is your feature request related to a problem? Please describe. I am working on a Foundry module that supports creating parcels of items that can be given to a PC by dropping the parcel onto the actor sheet. The parcel is implemented using JournalEntry and JournalEntryPage, and relies on the dropActorSheetData hook to fire in order to copy the items to the PC. However, this system only seems to support dropping Items on the actor.

Describe the solution you'd like Can you add support for additional types to be dropped on the actor?

Additional context The following error is seen in the console log when dropping JournalPages on the actor:

Uncaught (in promise) Error: Invalid Document type 'undefined' provided to Item.fromDropData.
    at Item.fromDropData (foundry.js:11496:15)
    at async ActorSheetSFRPGCharacter.processDroppedData (base.js:1164:28)
 fromDropData @ foundry.js:11496
levirak commented 1 month ago

Can you please enumerate some objects you're interested in and what you'd like done with them? It sounds like you're at least interested in JournalEntry and JournalEntryPage. The only thing I can think to do with those is to promote the actor's player to a limited owner of the entry/page.

paulyhedral commented 1 month ago

Yes, I need JournalEntry and JournalEntryPage. The module expects to receive an event callback when one of those types is dropped on the actor.

The hook in question is dropActorSheetData: https://github.com/sweetrpg/lootparcels-foundryvtt/blob/feature/83-sfrpg/loot-parcels.js#L163

Hooks.on('dropActorSheetData', async (actor, html, item) => {
levirak commented 1 month ago

Gotcha. So the only thing you need is for sfrpg's hook to silently ignore dropped data that isn't an item.