Skip to content

Commit

Permalink
Actually fix the issue with systems crashing on getDefaultActor, this…
Browse files Browse the repository at this point in the history
… was caused by the fact that documenTypes isn't an array anymore but rather an Object with properties
  • Loading branch information
KayelGee committed Aug 3, 2024
1 parent bdd16ee commit d73b4ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "token-attacher",
"title": "Token Attacher",
"description": "Attach anything(even tokens) to tokens, so that they move when the token moves and rotate/move when the token rotates. Create prefabs and many more features, see the github readme for more details.",
"version": "4.6.8",
"version": "4.6.9",
"compatibility" :{
"minimum": 12,
"verified": 12,
Expand Down
9 changes: 5 additions & 4 deletions scripts/token-attacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -2214,10 +2214,11 @@ import {libWrapper} from './shim.js';

static getDefaultActorForSystem(){
let actorType;
let types = game.system.documentTypes?.Actor ?? game.system.template.Actor.types;
if(game.system.id == 'wfrp4e') actorType = types.find(a => a == 'character');
if(!actorType) actorType = types.find(a => a == 'npc');
if(!actorType) actorType = types.types[0]
let documentTypes = game.system.documentTypes?.Actor ?? game.system.template.Actor.types;
let typesArray = Object.keys(documentTypes);
if(game.system.id == 'wfrp4e') actorType = typesArray.find(a => a == 'character');
if(!actorType) actorType = typesArray.find(a => a == 'npc');
if(!actorType) actorType = typesArray.types[0]
return actorType;
}

Expand Down

0 comments on commit d73b4ac

Please sign in to comment.