sc4
Version:
A command line utility for automating SimCity 4 modding tasks & modifying savegames
105 lines (104 loc) • 3.45 kB
TypeScript
import { Savegame, Lot, Building, Prop, BaseTexture, type Exemplar, type ExemplarPropertyKey as Key, type Entry, type LotObject, type SavegameObject, type SavegameContext, type ExemplarLike, Vector3, TGI } from 'sc4/core';
import type { BasePluginIndex } from 'sc4/plugins';
import type { TGILike } from 'sc4/types';
type CityManagerOptions = {
dbpf?: Savegame;
index?: BasePluginIndex;
};
type Orientation = number;
type PlopOptions = {
tgi?: TGILike;
building?: Entry<Exemplar>;
x: number;
z: number;
orientation?: Orientation;
};
type GrowOptions = {
tgi?: TGILike;
lot?: Entry<Exemplar>;
building?: Entry<Exemplar>;
x: number;
z: number;
orientation?: Orientation;
};
type BuildOptions = {
lot: Entry<Exemplar>;
building: Entry<Exemplar>;
x: number;
z: number;
orientation?: Orientation;
};
type ZoneOptions = {
x: number;
z: number;
width?: number;
depth?: number;
orientation?: Orientation;
zoneType?: number;
};
type AddLotObjectOptions = {
lot: Lot;
lotObject: LotObject;
};
type AddObjectOptions = {
exemplar: ExemplarLike;
tgi: TGI;
position: Vector3;
orientation?: number;
OID?: number;
};
export default class CityManager {
dbpf: Savegame;
ctx: SavegameContext;
index: BasePluginIndex;
constructor(opts?: CityManagerOptions);
get city(): Savegame;
setFileIndex(index: BasePluginIndex): void;
load(file: string): Savegame;
save(opts: Parameters<Savegame['save']>[0]): void;
mem(): number;
getProperty<K extends Key>(file: Exemplar, key: K): {
id: number;
type: import("../core/exemplar-properties-types.js").PropertyValueType;
value: import("../core/exemplar-properties-types.js").Value<K> | undefined;
getSafeValue(): import("../core/exemplar-properties-types.js").Value<K> | undefined;
readonly name: string;
readonly hex: string;
readonly hexType: number;
readonly keyType: 0 | 128;
readonly multiple: boolean;
readonly byteLength: number;
parse(rs: import("../core/stream.js").default): /*elided*/ any;
toBuffer(): Uint8Array<ArrayBufferLike>;
[Symbol.toPrimitive](hint: string): string | import("../core/exemplar-properties-types.js").Value<K> | undefined;
} | undefined;
getPropertyValue<K extends Key>(file: Exemplar, key: K): import("../core/exemplar-properties-types.js").Value<K> | undefined;
plop(opts: PlopOptions): void;
grow(opts: GrowOptions): false | Lot;
build(opts: BuildOptions): Lot;
addLotObject({ lot, lotObject }: AddLotObjectOptions): boolean | null;
zone(opts: ZoneOptions): Lot;
createLot(opts: {
exemplar: Entry<Exemplar>;
building: Entry<Exemplar>;
x: number;
z: number;
orientation: Orientation;
}): Lot;
createBuilding(opts: {
lot: Lot;
lotObject: LotObject;
exemplar: Entry<Exemplar>;
}): Building;
createProp({ exemplar, tgi, position, orientation, OID, lotType, }: AddObjectOptions & {
lotType?: number;
}): Prop;
createTexture(opts: {
lot: Lot;
textures: LotObject[];
}): BaseTexture;
addToItemIndex(obj: SavegameObject, type: number): void;
findExemplarOfType(IID: number, type: number): import("sc4/core").EntryFromType<1697917002> | undefined;
clear(): void;
}
export {};