foundryvtt / worldbuilding

A simple game system for Foundry VTT which allows for flexible definition of Actors and Items to assist with worldbuilding or for running games which do not have a more complete system implementation available.
https://foundryvtt.com/packages/worldbuilding
MIT License
30 stars 34 forks source link

SimpleActor#data object no longer used; need support on new DataModel #54

Open klatschi opened 1 year ago

klatschi commented 1 year ago

Just posted this in Discord as well:

So, I am using Simple Worldbuilding together with pdfFoundry and have some complex macros. Upgrading to V10 killed my system.

I get warning in the console, that f.e.

"Error: You are accessing the SimpleActor#data object which is no longer used. Since V10 the Document class and its contained DataModel are merged into a combined data structure. You should now reference keys which were previously contained within the data object directly. at logCompatibilityWarning (commons.js:1692:19) at SimpleActor._logV10CompatibilityWarning (commons.js:6642:14) at get data [as data] (commons.js:6542:24) at eval (eval at executeScript (lib.js:175:13), :4:20) at Macro.eval (eval at executeScript (lib.js:175:13), :5:3) at Macro.executeScript (lib.js:179:13) at 🎁call_wrapper [as call_wrapper] (libWrapper-wrapper.js:591:14) at 🎁Macro.prototype._executeScript#0 (libWrapper-wrapper.js:189:20) at Macro.renderMacro [as renderContent] (lib.js:288:10) at _executeMacroInternal (lib.js:137:17) at Macro.executeMacro (lib.js:77:8) at 🎁call_wrapper [as call_wrapper] (libWrapper-wrapper.js:591:14) at 🎁Macro.prototype.execute#0 (libWrapper-wrapper.js:189:20) at MacroConfig._onExecute (foundry.js:65604:17) "

So, until now, I addressed an attribute (f.e. Charisma) this way: "actor.data.data.attributes.attr_charisma.value"

I had a look at the "Inspect Data" Possibility, it tells me that I should still use "actor.data.data.attributes.attr_charisma.value"

When using console.log (actor.data), I get another path that would lead to "actor.data.system.attributes.attr_charisma.value"

Does that mean, that I simply have to change all the code from "actor.data.data.(...)" to "actor.data.system.(...)" and I am ready to go?

Or does that mean that I have to rewrite the data structure of my characters?

Fyorl commented 1 year ago

Apologies, this issue seems to have slipped under the radar. actor.system.* is what you should update your macros to (no data in there at all). However, what you're seeing is just a warning, so I wouldn't expect it to entirely kill your system. Are there any other symptoms that you can provide that might help us diagnose the issue?