ps-trainers-sheet -> ps-sheet

This commit is contained in:
Christopher Monsanto
2020-05-08 13:14:13 -04:00
parent a20aa81a15
commit c07d28b017
5 changed files with 31 additions and 25 deletions

View File

@@ -26,7 +26,7 @@ rule{
display="ps trainers sheet",
input={},
command={
"node tools/ps-trainers-sheet src/canonical/trainers %o",
"node tools/ps-sheet trainers src/canonical/trainers %o",
compresspng{config="SPRITESHEET"}
},
output={"build/ps/trainers-sheet.png"}

View File

@@ -1,4 +1,5 @@
// Derived from pokemon-showdown-client/src/battle-dex-data.ts
export default {
1: 'lucas',
2: 'dawn',

29
tools/ps-sheet/index.js Normal file
View File

@@ -0,0 +1,29 @@
import cp from 'child_process';
import path from 'path';
import BattleAvatarNumbers from './data-trainers.js';
const type = process.argv[2];
const dir = process.argv[3];
const dest = process.argv[4];
if (!dir || !dest) {
throw new Error(`node tools/ps-sheet <type> <dir> <dest>`);
}
if (type === 'trainers') {
// Guaranteed to be in the right order by V8, but iirc not by other JS engines.
const trainers = Object.values(BattleAvatarNumbers).map(t => path.join(dir, t) + ".png");
cp.execFileSync("montage", [
...trainers,
"-background", "transparent",
"-geometry", "80x80>",
"-gravity", "center",
"-tile", "16x",
"-depth", "8",
dest
]);
} else {
throw new Error(`unknown type: ${type}`);
}

View File

@@ -1,24 +0,0 @@
import cp from 'child_process';
import path from 'path';
import BattleAvatarNumbers from './data.js';
const dir = process.argv[2];
const dest = process.argv[3];
if (!dir || !dest) {
throw new Error(`node tools/ps-trainers-sheet <dir> <dest>`);
}
// Guaranteed to be in the right order by V8, but iirc not by other JS engines.
const trainers = Object.values(BattleAvatarNumbers).map(t => path.join(dir, t) + ".png");
cp.execFileSync("montage", [
...trainers,
"-background", "transparent",
"-geometry", "80x80>",
"-gravity", "center",
"-tile", "16x",
"-depth", "8",
dest
]);