sc4
Version:
A command line utility for automating SimCity 4 modding tasks & modifying savegames
29 lines (28 loc) • 839 B
JavaScript
// # plop-all-command.js
import path from 'node:path';
import plop from 'sc4/api/plop-all-lots.js';
import logger from '#cli/logger.js';
import backup from '#cli/backup.js';
import parseList from '#cli/helpers/parse-list.js';
// # plopAll()
export async function plopAll(city, pattern, options = {}) {
let { directory, clear = false, random = undefined, bbox: bboxString, props, lots, } = options;
// The bbox still needs to be parsed it is given.
let bbox;
if (bboxString) {
bbox = parseList(bboxString.replaceAll(/[[\]]/g, '')).map(x => +x);
}
await plop({
pattern,
directory,
city: path.resolve(process.env.SC4_REGIONS ?? process.cwd(), city),
clear,
bbox,
random,
lots,
props,
save: true,
logger,
backup,
});
}