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

@@ -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;
}