Extracted all parts of all characters
This commit is contained in:
@ -7,6 +7,7 @@ const { mkdirp } = require('../utils/file');
|
||||
|
||||
// Parse Args
|
||||
if(!args.root) throw new Error(`Missing root argument`);
|
||||
if(!args.assets) throw new Error(`Missing assets argument`);
|
||||
if(!args.in) throw new Error(`Missing in argument`);
|
||||
if(!args.out) throw new Error(`Missing out argument`);
|
||||
if(!args.in.endsWith('xml')) throw new Error(`Invalid in XML`);
|
||||
@ -14,9 +15,9 @@ if(!args.out.endsWith('png')) throw new Error(`Invalid out PNG`);
|
||||
|
||||
// Determine in and out.
|
||||
const root = path.resolve(args.root);
|
||||
const file = path.resolve(args.in);
|
||||
const file = path.resolve(args.root, args.assets, args.in);
|
||||
if(!fs.existsSync(file)) throw new Error(`Could not find ${file}`);
|
||||
const outFile = path.resolve(args.out);
|
||||
const outFile = path.resolve(args.assets, args.out);
|
||||
if(fs.existsSync(outFile)) return;
|
||||
|
||||
// Load XML
|
||||
@ -25,7 +26,7 @@ const [ character ] = data.elements;
|
||||
|
||||
// Validate file.
|
||||
if(!character.attributes.context) throw new Error(`Missing context`)
|
||||
const dir = path.resolve(root, 'assets', character.attributes.context);
|
||||
const dir = path.resolve(root, args.assets, character.attributes.context);
|
||||
|
||||
// Parse base and layers
|
||||
const base = character.elements.find(e => e.name == 'base').attributes;
|
||||
|
Reference in New Issue
Block a user