Skip to content

Commit

Permalink
Use 'character' actor for wfrp4e when importing compendiums
Browse files Browse the repository at this point in the history
Fix for 3d canvas tiles being broken when created via mapmaking tools, because rangeTop was missing then(thanks to theripper93)
  • Loading branch information
KayelGee committed Mar 19, 2023
1 parent 58c10e7 commit 99759fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/token-attacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,10 +1551,10 @@ import {libWrapper} from './shim.js';

if([null, Infinity, -Infinity].includes(offset.elevation.flags['levels'].elevation) === false) offset.elevation.flags['levels'].elevation -= base_elevation;
}
if(objData.flags['levels']?.hasOwnProperty('rangeTop')){
if(objData.flags['levels']?.hasOwnProperty('rangeTop') || objData.flags['levels']?.hasOwnProperty('rangeBottom')){
offset.elevation.flags['levels'] = {
rangeTop:objData.flags['levels'].rangeTop,
rangeBottom:objData.flags['levels'].rangeBottom
rangeTop:objData.flags['levels'].rangeTop ?? null,
rangeBottom:objData.flags['levels'].rangeBottom ?? null
};

if([null, Infinity, -Infinity].includes(offset.elevation.flags['levels'].rangeTop) === false) offset.elevation.flags['levels'].rangeTop -= base_elevation;
Expand Down Expand Up @@ -2303,6 +2303,7 @@ import {libWrapper} from './shim.js';
await Promise.all(allPromises);
let actorType;
actorType = game.system.documentTypes.Actor.find(a => a == 'basic');
if(game.system.id == 'wfrp4e') actorType = game.system.documentTypes.Actor.find(a => a == 'character');
if(!actorType) actorType = game.system.documentTypes.Actor.find(a => a == 'npc');
if(!actorType) actorType = game.system.documentTypes.Actor[0];
actors.forEach(async actor => {
Expand All @@ -2326,6 +2327,7 @@ import {libWrapper} from './shim.js';
let creates = [];
let actorType;
actorType = game.system.documentTypes.Actor.find(a => a == 'basic');
if(game.system.id == 'wfrp4e') actorType = game.system.documentTypes.Actor.find(a => a == 'character');
if(!actorType) actorType = game.system.documentTypes.Actor.find(a => a == 'npc');
if(!actorType) actorType = game.system.documentTypes.Actor[0];
actors.forEach(async actor => {
Expand Down

0 comments on commit 99759fe

Please sign in to comment.