preUpdate

So for some reason ItemPF#_preUpdate changes aren't sticking.. what is PF1 doing that prevents this?
E
Ethaks992d ago
There shouldn't be anything that fundamentally prevents this. PreUpdate data is run after update, and relatively shortly before socket handoff, and thus should be after PF's working For a test: can you manually throw what you want into a regular update, and check whether that sticks? Does preUpdate stick afterwards?
M
Mana992d ago
As per sys dev channel on the other server, it Should work, but for some reason it's not: https://discord.com/channels/170995199584108546/670336275496042502/880417562809217087 You mean put what I want as item.update() call? I can try. I kinda purposefully made it not try to override the value in that case, but I guess I can remove that bit of code.
E
Ethaks992d ago
If the regular update doesn't stick, something's very fishy (if it's not in some object that is affected by regular .update handling)
M
Mana992d ago
Looks to be working fine
No description
E
Ethaks992d ago
What happens now when the preUpdate code sets that to 120 or so? (Just trying to figure out what's going on, whether the key is created or not, whether it's updated, etc.)
M
Mana992d ago
No change as before.
E
Ethaks992d ago
Does adding to the template affect anything?
M
Mana992d ago
That is something I wanted to avoid, but I'll try. Just a moment. No effect The code's here in case you want a peek https://gitlab.com/Furyspark/foundryvtt-pathfinder1/-/merge_requests/276/diffs Though I don't think it helps
E
Ethaks992d ago
One sec, giving it a spin
M
Mana992d ago
I keep suspecting it needs to be an override on the item document rather than the item, but that seems silly.
E
Ethaks992d ago
This is interesting. The code works on my end Well, *mostly that is. One buff's duration start didn't stick for some reason, despite the update data containing it and the options being the same as everywhere else. The response simply didn't include it though, i.e. everything was sent to the server correctly, but that part of the update data was disregarded by the server I'm getting myself some tea, and then check what's going on there. Manually including the data in the update worked on that buff btw, and the preUpdate routine seems to stick now, too.
M
Mana992d ago
Odd. Tho I guess I've only been testing it with that singular spell buff. I have no idea how to debug that though (especially the part where it's not working for some items but is for others).
E
Ethaks992d ago
I played around with this a bit, and I haven't been able to reproduce the data not sticking except for that one initial buff thinking20
M
Mana991d ago
Weird. Is it a problem with the buff itself then for some reason? That doesn't make much sense.
E
Ethaks991d ago
I'll probably take another look tomorrow, and maybe use another old world backup to see whether there's some pattern I didn't see yet. The fact alone that the data is part of the updates to the server, only to get dropped in the response makes me scratch my head though
M
Mana990d ago
Not spotting any difference in the workflow in foundry.js for it, and it looks identical with preUpdate hook, so I'm just utterly baffled where it's disappearing to. I can not get this to work no matter how I try. Linked character or unlinked, new character or old, it just doesn't work. Updating it by hand first makes no difference for the preUpdate working. Edit: Crud, I was on wrong branch now... it's what I get trying to solve multiple problems at the same time. And now it's working with linked token at least... Unlinked tokens not so much. I guess I was testing with just unlinked tokens prior without realizing?
E
Ethaks975d ago
Yep, Item#_preUpdate doesn't have any effect on token actor item updates Changes to the individual item update data don't seem to ever get merged or affect the actorData.items data, so _preUpdate changes just vanish I just tested this with 5e by adding the method to items, and everything's fine for real actors, but token actors don't see any effect whatsoever The issue for this can now be found at https://gitlab.com/foundrynet/foundryvtt/-/issues/5861
Want results from more Discord servers?
Add your server
More Posts
mergeObject`mergeObject` is a beast of a function which lets you smash two objects together and that options arselect in sheetAlso, is the data actually saved on the actor? You can inspect the data in the console opened with FIC 5e DocsI'm not looking to ping about this but for anyone who sees this: I'm interested to know if anyone hecustom hud elementMaybe I'm missing something simple here. I'm making my own custom hud element (NOT based on a FoundrCover@badgerwerks how does the cover application for 5e helpers work? I know you do black magic to calculGitpod WorkflowHas anyone figured out a codespaces workflow?Dynamically get Object property from user inputAnyone know how I can do this? I have an Actor (`myactor`) and I'd like to have an input box which autopublishI'm trying to use @varriount's AutoPublish, but I keep getting this error. Any ideas?https://github.symlinking foundry.js and vscodeIs this something you were able to do with vscode? I'm trying right now with both WSL2 symlinks and Releases to ChangelogI just automatically made a Changelog by going to https://github.com/arcanistzed/scs/releases and rucodespacesGo to any github repository and press `.` You'll get kicked over to a `github.dev` version of the reequipmentType bonus⚠️ Breaking Changes ⚠️ The `DND5E.equipmentTypes` type of `bonus` has been removed. Any in-world `Scroll Into View troublesAnyone know why `Element.scrollIntoViewIfNeeded()` is working, but `Element.scrollIntoView()` isn't?DevMode Settings Explorer feedbackSo, I'm working on the styling for a little potential addition to Calego's 'Developer Mode' module aOverlay hiding starsHey y'all! I've run into a general CSS/design problem that I'm kinda stumped on solving. In the imagToDontThingswe should have threaded a long time ago I think, whoopsLayer Manipulationpresumably a module doing this would execute on canvasReady or something for every client right?Document TimestampsIs there a way to find the timestamp of the last edit made to a Document?License Property@ghost @flamewave000 @corporat @kakaroto But if we do want to talk Manifest+, we should do that oveTemporary DocumentsIs there a built-in way to create temporary entities? Like entities wich are not stored in the datab