Utility module with tweaks, enhancements and macros to help GMs with game management when running Warhammer Fantasy Roleplay (4e) sessions in Foundry Virtual Tabletop.
Current way of checking ownership would return undefined for GM, even though GM is always an implicit Owner of any and every Document.
Which is why using Document.isOwner getter is superior, and in my opinion, the only proper way of checking the ownership for current user.
Why didn't it work?
Actors created by Players (for example using Chargen if they have permission) do not have GM as an explicit Owner. Similarly, Actors that can be created programatically may not have GM as explicit Owner neither.
Summary of changes
Replaced every occurrence of `.ownership[game.user.id]` with `.isOwner`
### How has this been tested?
Ran Opposed Tests, using "Group Advantage" ruleset with Actors created by User as Attackers.
Development / Testing Environment
Foundry VTT: 11.315
WFRP4e System: 7.1.4
GM Toolkit: 7.0.0
Btw, I spend more time filing this form than making PR lol 😂
Type of change
Checklist:
forien
Related Issue(s)
Description
Motivation and context
Checking
Document.ownership[game.user.id]
is unsafe, as it may (and will) returnundefined
for GM, if GM is not explicit Owner of a Document.For example:
There are 2 users in the world:
aDepqlKkeOa13DWo
idJYO5JplQ4zaynRJ4
idThere is an Actor with the following
ownership
structure:Current way of checking ownership would return
undefined
for GM, even though GM is always an implicit Owner of any and every Document.Which is why using
Document.isOwner
getter is superior, and in my opinion, the only proper way of checking the ownership for current user.Why didn't it work?
Actors created by Players (for example using Chargen if they have permission) do not have GM as an explicit Owner. Similarly, Actors that can be created programatically may not have GM as explicit Owner neither.
Summary of changes
Replaced every occurrence of `.ownership[game.user.id]` with `.isOwner` ### How has this been tested?Ran Opposed Tests, using "Group Advantage" ruleset with Actors created by User as Attackers.
Development / Testing Environment
Btw, I spend more time filing this form than making PR lol 😂