malwoden
Version:
   
49 lines (48 loc) • 1.44 kB
TypeScript
import { Table } from "../struct";
/**
* Builder represents a base class used to create a new kind of map.
* It is meant to be inherited from, with individual specialized builders
* providing additional information as they generate the map. This basic Builder
* class can still be used for it's snapshot functionality when playing with custom
* map generation.
*
* A builder's type should generally be either a number or numeric enum.
*/
export declare class Builder<T> {
protected map: Table<T>;
protected snapshots: Table<T>[];
/**
* Creates a new Builder
* @param config.width - The map width
* @param config.height - The map height
*/
constructor(config: {
width: number;
height: number;
});
/**
* Returns the internal map.
* @returns - Table<T>
*/
getMap(): Table<T>;
/**
* Takes a snapshot of the current map state. These can
* be retrieved through getSnapshots()
*/
takeSnapshot(): void;
/**
* Returns previously captured snapshots.
* @returns - Table<T>[]
*/
getSnapshots(): Table<T>[];
/**
* Clear previously captured snapshots.
*/
clearSnapshots(): void;
/**
* Sets the map values to match a given table. A shallow copy is made
* from the given table.
* @param table
*/
copyFrom(table: Table<T>): void;
}