mkscho63 / sta

This is an unofficial system for Foundry VTT using Modiphius's Star Trek Adventures 2d20 RPG. This system attempts to replicate the feeling of playing through an episode of the epic SciFi that is Star Trek. I am in no way associated with Modiphius.
MIT License
32 stars 33 forks source link

Actor Items not Displaying to Clients #92

Closed NerdEyeIndustries closed 1 year ago

NerdEyeIndustries commented 1 year ago

Describe the bug Updated Foundry to 11.299

To Reproduce Steps to reproduce the behavior:

  1. Load your table.
  2. Click on any actor item
  3. See error from console:

Starships: TypeError: An error occurred while rendering STAStarshipSheet 28. Cannot create property 'img' on string 'items' at String. (starship-sheet.js:75:31) at Function.each (jquery.min.js:2:3053) at STAStarshipSheet.getData (starship-sheet.js:74:7) at STAStarshipSheet._render (foundry.js:5726:29) at STAStarshipSheet._render (foundry.js:6444:17) at STAStarshipSheet.render (foundry.js:5683:10) at STAStarshipSheet.render (foundry.js:7023:18) at ActorDirectory._onClickEntryName (foundry.js:69173:20) at HTMLOListElement.dispatch (jquery.min.js:2:43184) at y.handle (jquery.min.js:2:41168) onError @ foundry.js:753

Character Sheet: TypeError: An error occurred while rendering STACharacterSheet 29. Cannot create property 'img' on string 'items' at String. (character-sheet.js:82:31) at Function.each (jquery.min.js:2:3053) at STACharacterSheet.getData (character-sheet.js:81:7) at STACharacterSheet._render (foundry.js:5726:29) at STACharacterSheet._render (foundry.js:6444:17) at STACharacterSheet.render (foundry.js:5683:10) at STACharacterSheet.render (foundry.js:7023:18) at ActorDirectory._onClickEntryName (foundry.js:69173:20) at HTMLOListElement.dispatch (jquery.min.js:2:43184) at y.handle (jquery.min.js:2:41168) onError @ foundry.js:753

Expected behavior Actor item should display

Desktop (please complete the following information):

WesWedding commented 1 year ago

As a quick workaround you can remove those problematic code blocks by editing 3 files in your {FoundryVTT user data path}/Data/systems/sta/module/actors/sheets folder. The files to modify are character-sheet.js, smallcraft-sheet.js, and starship-sheet.js

Find and remove these lines (restart Foundry after you do). This will not impact the functionality of the System.

// Checks if items for this actor have default images. Something with Foundry 0.7.9 broke this functionality operating normally.
// Stopgap until a better solution can be found.
$.each(sheetData.items, (key, item) => {
  if (!item.img) item.img = game.sta.defaultImage;
})
NerdEyeIndustries commented 1 year ago

Wow, thanks for that. You just made about 8 people's weekend (we had two STA games this weekend we thought we'd have to cancel).

Thanks again!

P.S. Will this be fixed in an update?

WesWedding commented 1 year ago

Hopefully soon, this is a pretty major bug that basically renders this System inoperable on the latest Foundry. I'm not a maintainer so I can't address this directly, myself.

mkscho63 commented 1 year ago

Yeah, latest version of Foundry is not supported currently by this system. I have to update it still but it might take me a few days. Until then I can't recommend updating Foundry instance if you're in need of this system.

NerdEyeIndustries commented 1 year ago

Happy to report its the only buggy thing we could find.. We're on it now, guys are making characters for an upcoming campaign...

image

JFedora commented 1 year ago

Hi. I'm not technically minded enough to know whether this issue might prevent actor sheets from opening at all. I'm in build 300 of foundry and v1.1.10 of STA. After several weeks' layoff and the updates, I can't get any of the actor sheets to open.

WesWedding commented 1 year ago

Yeah, that's what this issue is about, so you ended up in the right place.

The workaround can get you running again. I'd recommend saving a backup of your files before modifying anything, or try to manage without the System or downgrade your Foundry version for the time being.

JFedora commented 1 year ago

I found the files, I found the lines of code, and I thought I successfully deleted them, but no dice, so to speak. It's possible, even fairly likely, that I erred. Is there a way to see what one of the files should look like once amended?

mkscho63 commented 1 year ago

Including the change in the next release, it's currently up on the develop branch to be tested with other changes. Thanks for identifying the offending line!