Skip to content

Commit d6e9ba6

Browse files
committed
Fix build script for empty asset slots
1 parent 3cf87a9 commit d6e9ba6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

build.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
2-
import fs from 'fs';
3-
import path from 'path';
42
import { spawn } from 'child_process';
3+
import fs from 'fs';
54
import { platform } from 'os';
5+
import path from 'path';
66

77
const verbose = process.argv.indexOf('--verbose') != -1;
88

@@ -48,12 +48,14 @@ async function createAssetPack(filename) {
4848
for (let obj of root.objects) {
4949
for (let i = 0; i < obj.samples.length; i++) {
5050
const sample = obj.samples[i];
51-
const newFilename = `${sampleIndex}.ogg`;
52-
const srcPath = path.join(dir, sample);
53-
const dstPath = path.join(workDir, newFilename);
54-
await encodeMusicTrack(dstPath, srcPath);
55-
obj.samples[i] = newFilename;
56-
sampleIndex++;
51+
if (sample != "" && !sample.startsWith('$')) {
52+
const newFilename = `${sampleIndex}.ogg`;
53+
const srcPath = path.join(dir, sample);
54+
const dstPath = path.join(workDir, newFilename);
55+
await encodeMusicTrack(dstPath, srcPath);
56+
obj.samples[i] = newFilename;
57+
sampleIndex++;
58+
}
5759
}
5860
}
5961

0 commit comments

Comments
 (0)