Minimise Document using Prototype
Quick question, I've got no idea what I'm doing so please excuse my ineptitude.
Say I have a document, e.g. a wall:
But I want to minimise it down to only the changed data from the defaults.
I can check the defaults in
WallDocument.prototype.constructor._schema.fields
There I see that light
always has an initial value of 20
so we can remove that.
We also bin off the _id
as we know we'll get a new one.
A simplified object for this example would then be:
Is there a trivial/simple way to use the wall prototype to reduce full data to just the non-default fields?L
Lyra•135d ago
Thanks @theripper93
Solution
L
Lyra•135d ago
From a post elsewhere:
foundry.utils.diffObject(WallDocument.prototype.constructor._schema.initial(),canvas.walls.placeables[0].document.toObject(), {inner: true})
Want results from more Discord servers?
More PostsNew to System Development but have done minor module developmentI am trying to see if there is a complete working model of a system that I could use a base to undercalculating range/distanceI am trying to calculate the distance between two tokens to make sure they are in range of one anothPartial RerollI am looking for a way to partially "reroll" a roll.
Quick example: Player rolls 2d6 (a 2 and a 5) atiered status effectsIf I have a status effect that can come from an ability, for example, burning comes from an ability Importing an npm package into a foundry systemimport minimist from 'minimist';
That line alone when included in my module's hook file is resultin(Paid) System Dev AssistanceHello, I am developing a new game and would like to build my own game system in foundry vtt. I'm nothow to handle items and effects?I've been working on a system for a game that needs a concept that seems like it might be a good fitAdvice on the general programming model a system should followI'm brand new to foundry dev and I want to make sure I am gaining the correct understanding of the e