Fix Biome System integration, memory optimization, and Tiled live sync workflow
This commit is contained in:
27
scripts/watch_map.js
Normal file
27
scripts/watch_map.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require('fs');
|
||||
const { exec } = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
const TILED_PATH = '/Users/davidkotnik/Downloads/Tiled.app/Contents/MacOS/Tiled';
|
||||
const MAPS_DIR = path.join(__dirname, '../assets/maps');
|
||||
|
||||
console.log('👀 Watching for Tiled map changes (.tmx)...');
|
||||
|
||||
fs.watch(MAPS_DIR, (eventType, filename) => {
|
||||
if (filename && filename.endsWith('.tmx')) {
|
||||
console.log(`📝 Detected change in ${filename}...`);
|
||||
|
||||
const tmxFile = path.join(MAPS_DIR, filename);
|
||||
const jsonFile = tmxFile.replace('.tmx', '.json');
|
||||
|
||||
const command = `"${TILED_PATH}" --export-map "${tmxFile}" "${jsonFile}"`;
|
||||
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`❌ Export failed: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
console.log(`✅ Exported ${filename} to JSON!`);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user