Fixed issue #23 "Token image does not save"

This commit is contained in:
Vlyan
2021-06-06 16:30:54 +02:00
parent 87b911e6c5
commit 2816068897
2 changed files with 9 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
## 1.3.1 - Scholar helper
- Added a Journal Compendium for School Curriculums.
- Fix for the "bought_at_rank" value when an Item was on dropped on a sheet.
- Fix for issue #23 "Token image does not save".
## 1.3.0 - Foundry 0.8 Compatibility
__! Be certain to carefully back up any critical user data before installing this update !__

View File

@@ -65,12 +65,17 @@ export class ActorL5r5e extends Actor {
*/
async update(data = {}, context = {}) {
// Need a _id
if (!data["_id"]) {
if (!data._id) {
data["_id"] = this.id;
}
// Fix for token image unliked from character... dunno why
if (data.img) {
// Update the token image if the sheet image changed, but only if they are the same and linked to actor
if (
data.img &&
this.data.img === this.data.token.img &&
this.data.img !== data.img &&
(data.token?.actorLink || (data.token?.actorLink === undefined && this.data.token.actorLink))
) {
data["token.img"] = data.img;
}