silphscope 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -25,7 +25,8 @@ await renderAllGraphics(rom, {
|
|
|
25
25
|
outputMonDir: "./Assets/monImages", // must I explain?
|
|
26
26
|
outputIconDir: "./Assets/Icons", // same thing here :p
|
|
27
27
|
outputTrainerDir: "./Assets/Trainers", // ...
|
|
28
|
-
outputMoveDir: "./Assets/Moves"
|
|
28
|
+
outputMoveDir: "./Assets/Moves",
|
|
29
|
+
sortUnusedMoves: true // just sorts the unused moves into a sub-directory
|
|
29
30
|
});
|
|
30
31
|
```
|
|
31
32
|
|
|
@@ -77,5 +78,6 @@ import { renderAllMoves } from "silphscope" // :O
|
|
|
77
78
|
const rom = fs.readFileSync("pokefirered.gba") // stuff stuff stuff (more stuff!)
|
|
78
79
|
await renderAllMoves(rom, {
|
|
79
80
|
outputDir: "./Assets/trainers", // (incredibly) more stuff
|
|
81
|
+
sortUnused: true, // sorts unused moves into a sub-directory
|
|
80
82
|
})
|
|
81
83
|
```
|
package/package.json
CHANGED
|
@@ -105,6 +105,7 @@ export async function renderAllMoves(rom, options = {}) {
|
|
|
105
105
|
moves: providedMoves = moves,
|
|
106
106
|
outputDir = "./out",
|
|
107
107
|
renderMasterImage = true,
|
|
108
|
+
sortUnused = true,
|
|
108
109
|
} = options;
|
|
109
110
|
|
|
110
111
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
@@ -115,7 +116,8 @@ export async function renderAllMoves(rom, options = {}) {
|
|
|
115
116
|
for (const moveName of Object.keys(providedMoves)) {
|
|
116
117
|
await renderMove(moveName, providedMoves, reader, rom, {
|
|
117
118
|
outputDir,
|
|
118
|
-
renderMasterImage,
|
|
119
|
+
renderMasterImage,
|
|
120
|
+
sortUnused,
|
|
119
121
|
});
|
|
120
122
|
console.log(`Done: ${moveName}`);
|
|
121
123
|
}
|
|
@@ -130,7 +132,8 @@ export async function renderAllGraphics(rom, options = {}) { // eventually I wil
|
|
|
130
132
|
outputMonDir = "./out/mons",
|
|
131
133
|
outputIconDir = "./out/icons",
|
|
132
134
|
outputTrainerDir = "./out/trainers",
|
|
133
|
-
outputMoveDir = "./out/moves"
|
|
135
|
+
outputMoveDir = "./out/moves",
|
|
136
|
+
sortUnusedMoves = true,
|
|
134
137
|
} = options;
|
|
135
138
|
|
|
136
139
|
await renderAllMons(rom, {
|
|
@@ -151,6 +154,7 @@ export async function renderAllGraphics(rom, options = {}) { // eventually I wil
|
|
|
151
154
|
await renderAllMoves(rom, {
|
|
152
155
|
outputDir: outputMoveDir,
|
|
153
156
|
renderMasterImage: true,
|
|
157
|
+
sortUnused: sortUnusedMoves,
|
|
154
158
|
})
|
|
155
159
|
}
|
|
156
160
|
|
|
@@ -39,6 +39,7 @@ export async function renderMove(moveName, moves, reader, rom, options = {}) {
|
|
|
39
39
|
const {
|
|
40
40
|
outputDir = null,
|
|
41
41
|
renderMasterImage = false,
|
|
42
|
+
sortUnused = false,
|
|
42
43
|
} = options;
|
|
43
44
|
if (!rom || !(rom instanceof Uint8Array || Buffer.isBuffer(rom))) {
|
|
44
45
|
throw new TypeError("renderMove(..., rom) requires a ROM Buffer/Uint8Array");
|
|
@@ -68,7 +69,8 @@ export async function renderMove(moveName, moves, reader, rom, options = {}) {
|
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
if (outputDir) { // I will update this later but in theory it should also work... eventually though it will need a split inside to handle full image generation :p
|
|
71
|
-
const
|
|
72
|
+
const rootDir = (move?.unused === true)? `${outputDir}/unused` : `${outputDir}`
|
|
73
|
+
const dir = `${rootDir}/${moveName}`;
|
|
72
74
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
73
75
|
if (renderMasterImage) {
|
|
74
76
|
const png = new PNG({ width, height });
|