forked from unimatrix/web
20 lines
2.1 KiB
JavaScript
20 lines
2.1 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import {fileURLToPath} from 'node:url';
|
|
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
const baseline=fs.readFileSync(path.join(root,'DuneTerrain/trails/arrakis-config.yml'),'utf8');
|
|
const common=[['STONE','COBBLESTONE'],['GRANITE','POLISHED_GRANITE'],['DIORITE','POLISHED_DIORITE'],['ANDESITE','POLISHED_ANDESITE'],['TUFF','POLISHED_TUFF'],['STONE_BRICKS','CRACKED_STONE_BRICKS'],['GLASS','TINTED_GLASS']];
|
|
const profiles={
|
|
caladan:{worlds:['caladan'],links:[['GRASS_BLOCK','DIRT_PATH'],['DIRT','DIRT_PATH'],['PODZOL','DIRT_PATH'],['ROOTED_DIRT','DIRT_PATH'],['MOSS_BLOCK','DIRT_PATH'],['MUD','PACKED_MUD'],['SAND','SANDSTONE']]},
|
|
kaitain:{worlds:['kaitain'],links:[['GRASS_BLOCK','DIRT_PATH'],['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['SAND','SANDSTONE']]},
|
|
giedi_prime:{worlds:['giedi_prime','giedi_prime_nether'],links:[['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['DEEPSLATE','COBBLED_DEEPSLATE'],['NETHERRACK','CRACKED_NETHER_BRICKS'],['SOUL_SAND','SOUL_SOIL'],['BASALT','SMOOTH_BASALT'],['BLACKSTONE','POLISHED_BLACKSTONE']]},
|
|
sigma_draconis_iv:{worlds:['sigma_draconis_iv','sigma_draconis_iv_the_end'],links:[['SNOW_BLOCK','PACKED_ICE'],['ICE','PACKED_ICE'],['PODZOL','DIRT_PATH'],['DIRT','DIRT_PATH'],['COARSE_DIRT','DIRT_PATH'],['RED_SAND','RED_SANDSTONE'],['END_STONE','END_STONE_BRICKS']]},
|
|
};
|
|
for(const [name,profile] of Object.entries(profiles)){
|
|
const links=[...profile.links,...common];
|
|
if(new Set(links.map(([from])=>from)).size!==links.length)throw Error('Repeated source material '+name);
|
|
const rules=links.map(([from,to],i)=>` Surface${i+1}: '${from}:32:100:1.0 > ${to}:0:100:1.0'`).join('\n');
|
|
const output=baseline.replace('enabled-worlds: [arrakis]',`enabled-worlds: [${profile.worlds.join(', ')}]`).replace(/Trails:\r?\n[\s\S]*?Data-Saving:/,`Trails:\n${rules}\nData-Saving:`);
|
|
fs.writeFileSync(path.join(root,'DuneTerrain/trails',name+'-config.yml'),output.replace(/\r\n/g,'\n'));
|
|
}
|
|
console.log('Generated four native Trails profiles; lobby wear excluded; existing Arrakis policy unchanged.');
|

Staff