p4535992 / foundryvtt-variant-encumbrance-dnd5e

A FoundryVTT module, providing a visual modification to player character sheets to better display the effects of the Encumbrance variant ruleset in the PHB.
MIT License
3 stars 4 forks source link

Fixed an issue with encumbrance on actor-unlinked tokens #23

Closed IHaveThatPower closed 1 year ago

IHaveThatPower commented 1 year ago

The previous lookup of the actor based on the hook-supplied actorObject fetched the game actor by its ID. In most cases, this works fine...except when a token on a map has been unlinked from its parent actor, in which case its inventory may differ from what the "real" actor's inventory has on it. The net result is that the actor represents a weight value that does not match what they are actually carrying (because the weight value was showing what their "real" parent had).

This tweak instead checks to see if the supplied actorObject has the type property, indicative of a "true" actor (and the property isEnabledActorType() depends on, of course!), and otherwise supplies the actor property of the actorObject, which should correspond to the unlinked pseudo-actor represented on the sheet.