UNPKG

sc4

Version:

A command line utility for automating SimCity 4 modding tasks & modifying savegames

17 lines (16 loc) 487 B
// # city-count-command.ts import path from 'node:path'; import { Savegame } from 'sc4/core'; export function cityCount(file, options) { let fullPath = path.resolve(process.cwd(), file); let dbpf = new Savegame(fullPath); let { min = 0 } = options; let table = dbpf .createContext() .getRecordCountTable() .filter(row => row.count >= min); if (options.sort) { table.sort((a, b) => b.count - a.count); } console.table(table); }