import { EEPhysics } from "../physics/EEPhysics"; import { Player } from "../physics/Player"; import { Rectangle } from "../physics/Rectangle"; import { Vector } from "../physics/Vector"; import { TileLayer, ZHeap } from "../types"; export default class Tiles { readonly emptyPack: PackInfo; readonly packs: Readonly; readonly idToBlock: Map; readonly textureToBlock: Map; constructor(maker: TilesMaker); static make(): Tiles; for(id: number | string): BlockInfo; forId(id: number): BlockInfo; tryForId(id: number): BlockInfo | undefined; forTexture(texture: string): BlockInfo; texture(id: number): string; id(texture: string): number; } export declare enum HeapKind { None = 0, Sign = 1, Switch = 2 } export declare enum Behavior { Typical = 0, Hazard = 1, Boost = 2, Zoost = 3 } export interface ComplexBlockBehavior { collides(world: EEPhysics, player: Player, id: number, heap: ZHeap | 0, playerHitbox: Rectangle): boolean; near(world: EEPhysics, player: Player, id: number, heap: ZHeap | 0): void; far(world: EEPhysics, player: Player, id: number, heap: ZHeap | 0): void; in(world: EEPhysics, player: Player, id: number, heap: ZHeap | 0): void; out(world: EEPhysics, player: Player, id: number, heap: ZHeap | 0): void; } export interface BlockConfig { id: number; textureId: string; preferredLayer?: TileLayer; isSolid?: boolean; hitbox?: Rectangle; heap?: HeapKind; direction?: Vector; gravitationalPull?: Vector | undefined; requiredForce?: Vector | undefined; behavior?: Behavior; complex?: ComplexBlockBehavior; } export declare type BlockInfo = Readonly<{ id: number; textureId: string; preferredLayer: TileLayer; hitbox: Rectangle | undefined; heap: HeapKind; direction: Vector; gravitationalPull: Vector | undefined; requiredForce: Vector | undefined; behavior: Behavior; complex: undefined | ComplexBlockBehavior; }>; export interface PackConfig { name: string; visible?: boolean; } export declare type PackInfo = Readonly<{ name: string; blocks: Readonly; visible: boolean; }>; export declare class TilesMaker { map: Map; aliasMap: Map; usedIds: Set; unpackedBlocks: BlockInfo[]; packs: PackInfo[]; block({ id, textureId, preferredLayer, isSolid, hitbox, heap, direction, gravitationalPull, requiredForce, behavior, complex, }: BlockConfig): BlockInfo; blocks(data: Iterable, factory: (data: T) => BlockConfig): BlockInfo[]; alias(textureName: string, aliasName: string | string[]): void; aliases(aliases: Iterable<[string, string | string[]]>): void; pack({ name, visible }: PackConfig): PackInfo; /** * Helper for creating a "solid" block pack of blocks. */ helpMakeSolid(name: string, start: number, end: number, tiles: string[], pack?: boolean): void; } export declare const directions: readonly ["up", "right", "down", "left"];