ZotyDev / objects-interactions-fx

A Foundry VTT module that provides automation and effects for everything that I and other people might find fun :D
https://foundryvtt.com/packages/object-interaction-fx
MIT License
11 stars 2 forks source link

[BUG]: User lacks permission to create Item in parent ActorDelta #46

Open jtsmirror opened 8 months ago

jtsmirror commented 8 months ago

Discord Username

jtsmirror

Browsers

Chrome

What Happened?

When a player tries to throw an item, such as an axe or a javelin, with the appropriate tag, the item is thrown, but the item does not appear in the inventory of the character it was thrown at. I noticed that this same error does not occur on the GM's side, where everything works normally.

Reproduction Steps

1. Have options "remove throwable item" and "add throwable item to target inventory" turned on
2. Attempt to use a throwable weapon on a target as a player.

Relevant Log Output

User okruch lacks permission to create Item [veKQnT08l4XqI5QA] in parent ActorDelta [hjjTHHuv5yqLc7H8]
fetch @ foundry.js:68326
notify @ foundry.js:68223
🎁call_wrapped @ libWrapper-wrapper.js:507
notificationNotify @ utils.js:4517
🎁Notifications.prototype.notify#0 @ libWrapper-wrapper.js:187
error @ foundry.js:68260
_handleError @ foundry.js:3468
(anonymous) @ foundry.js:3450
value @ socket.js:532
value @ socket.js:459
L.emit @ index.mjs:136
(anonymous) @ manager.js:207
Promise.then (async)
it @ websocket-constructor.browser.js:5
value @ manager.js:206
L.emit @ index.mjs:136
value @ index.js:131
value @ manager.js:193
L.emit @ index.mjs:136
value @ socket.js:324
L.emit @ index.mjs:136
value @ transport.js:97
value @ transport.js:89
ws.onmessage @ websocket.js:69
Show 10 more frames
Show less
InventoryManipulator.js:41  Uncaught (in promise) Error: User okruch lacks permission to create Item [veKQnT08l4XqI5QA] in parent ActorDelta [hjjTHHuv5yqLc7H8]
    at ServerDatabaseBackend._createDocuments (/data/application/resources/app/dist/database/backend/server-backend.mjs:1:2776)
    at async Semaphore._try (/data/application/resources/app/common/utils/semaphore.mjs:101:17)
ZotyDev commented 8 months ago

Hi, thanks for reporting this bug! The problem you described happens due to some invalid assumptions I made when I first developed OIF, the module tries to update values from the perspective of the user that is the source of the interactions, but the most common outcome is that the user lacks enough permission to do the updates. This bug is now fixed on my in-dev environment and I will release a new version with the fix as soon as possible.