@chronodivide/game-api-0.72.0-index.d.ts

| Chrono Divide | 3 Reads

index.d.ts:

export declare class ActionsApi {
    #private;
    placeBuilding(buildingName: string, rx: number, ry: number): void;
    sellObject(objectId: number): void;
    /** @deprecated use {@link ActionsApi.sellObject} instead */
    sellBuilding(buildingId: number): void;
    toggleRepairWrench(buildingId: number): void;
    toggleAlliance(toPlayer: string, enabled: boolean): void;
    pauseProduction(queueType: QueueType): void;
    resumeProduction(queueType: QueueType): void;
    queueForProduction(queueType: QueueType, objName: string, objType: ObjectType, quantity: number): void;
    unqueueFromProduction(queueType: QueueType, objName: string, objType: ObjectType, quantity: number): void;
    activateSuperWeapon(type: SuperWeaponType, tile: {
        rx: number;
        ry: number;
    }, tile2?: {
        rx: number;
        ry: number;
    }): void;
    orderUnits(unitIds: number[], orderType: OrderType): void;
    orderUnits(unitIds: number[], orderType: OrderType, targetUnit: number): void;
    orderUnits(unitIds: number[], orderType: OrderType, rx: number, ry: number, onBridge?: boolean): void;
    sayAll(text: string): void;
    /**
     * Prints a persistent multiline debug string in the game client at a fixed position on the screen
     *
     * **IMPORTANT**: This method only works when bot debug mode is enabled
     *
     * If the bot is in online mode, it will send this text as a player action (only enabled for bot accounts).
     * The game client also needs to have r.debug_text=1 enabled in the dev console.
     *
     * If the bot is in offline mode, this method will still generate actions that may increase the replay file size
     * significantly.
     */
    setGlobalDebugText(text: string | undefined): void;
    /**
     * Sets a persistent multiline debug label for a given unit, which the game client will display anchored to the unit
     *
     * **IMPORTANT**: This method only works when bot debug mode is enabled
     *
     * If the bot is in online mode, it will send this text as a player action (only enabled for bot accounts).
     * The game client also needs to have r.debug_text=1 enabled in the dev console.
     *
     * If the bot is in offline mode, this method will still generate actions that may increase the replay file size
     * significantly.
     */
    setUnitDebugText(unitId: number, text: string | undefined): void;
    quitGame(): void;
}

export declare interface Agent {
    name: string;
    /** Country name as found in rules.ini [Countries]. Omit for observers. */
    country?: string;
}

export declare class AiRules {
    buildPower: string[];
    buildRefinery: string[];
    buildTech: string[];
    tiberiumFarScan: number;
    tiberiumNearScan: number;
    readIni(ini: IniSection): void;
}

export declare type ApiEvent = ObjectOwnerChangeApiEvent | ObjectSpawnUnspawnApiEvent | ObjectDestroyApiEvent;

export declare enum ApiEventType {
    ObjectOwnerChange = 0,
    ObjectSpawn = 1,
    ObjectUnspawn = 2,
    ObjectDestroy = 3
}

export declare enum ArmorType {
    None = 0,
    Flak = 1,
    Plate = 2,
    Light = 3,
    Medium = 4,
    Heavy = 5,
    Wood = 6,
    Steel = 7,
    Concrete = 8,
    Special_1 = 9,
    Special_2 = 10
}

export declare enum AttackState {
    Idle = 0,
    /** Check range + LoS and move to a valid position if needed */
    CheckRange = 1,
    /** Perform LoS checks, wait for weapon cooldown etc. */
    PrepareToFire = 2,
    /** This means the fire animation was started, but the weapon wasn't fired yet */
    FireUp = 3,
    Firing = 4,
    JustFired = 5
}

export declare class Bot {
    #private;
    name: string;
    country: string;
    protected gameApi: GameApi;
    protected actionsApi: ActionsApi;
    protected productionApi: ProductionApi;
    protected logger: LoggerApi;
    constructor(name: string, country: string);
    /**
     * Toggles bot debug mode, allowing the bot implementation to switch some debug features on or off.
     * This also enables or disables debug logging.
     *
     * This method is controlled by internal game code and should not be called by the bot implementation itself.
     */
    setDebugMode(debugMode: boolean): this;
    getDebugMode(): boolean;
    onGameStart(gameApi: GameApi): void;
    onGameTick(gameApi: GameApi): void;
    onGameEvent(ev: ApiEvent, gameApi: GameApi): void;
}

export declare class Box2 extends THREE.Box2 {
}

export declare enum BuildCat {
    Combat = 0,
    Tech = 1,
    Resource = 2,
    Power = 3
}

export declare interface BuildingPlacementData {
    /** The size of the building foundation in tiles */
    foundation: Size;
    /** The offset of the foundation center tile */
    foundationCenter: Vector2;
}

export declare enum BuildStatus {
    BuildUp = 0,
    Ready = 1,
    /** When the building is being deconstructed (e.g. sold or undeployed) */
    BuildDown = 2
}

export declare const cdapi: PublicApi;

export declare class CombatDamageRules {
    ballisticScatter: number;
    bridgeStrength: number;
    c4Delay: number;
    /** This warhead is used throughout the code to mean "Absolute damage" */
    c4Warhead: string;
    deathWeapon: string;
    dMislEliteWarhead: string;
    dMislWarhead: string;
    flameDamage: string;
    ironCurtainDuration: number;
    ivanDamage: number;
    ivanIconFlickerRate: number;
    ivanTimedDelay: number;
    ivanWarhead: string;
    splashList: string[];
    v3EliteWarhead: string;
    v3Warhead: string;
    readIni(ini: IniSection): void;
}

/** Player faction */
export declare class Country {
    private rules;
    get id(): number;
    get side(): SideType;
    get name(): string;
    isPlayable(): boolean;
    hasVeteranUnit(objectType: ObjectType, name: string): boolean;
}

/** Data structure for rules.ini country sections */
export declare class CountryRules {
    id: number;
    side: SideType;
    /** string identifier */
    name: string;
    /** translation key */
    uiName: string;
    /** translation key */
    uiTooltip: string | undefined;
    /** allowed in multiplayer */
    multiplay: boolean;
    multiplayPassive: boolean;
    veteranAircraft: string[];
    veteranInfantry: string[];
    veteranUnits: string[];
    constructor(id: number);
    readIni(ini: IniSection): void;
}

export declare class CrateRules {
    /** Crates can never exceed this quantity */
    crateMaximum: number;
    /**
     * Minimum number of crates to be on the map at any given time.
     * This is normally one crate per human player although it will never be below this number.
     */
    crateMinimum: number;
    /** The radius, in cells, that crate powerup bonuses (e.g. armor or speed) will affect. */
    crateRadius: number;
    /** Average minutes between random powerup crate regeneration */
    crateRegen: number;
    /**
     * Specify the unit which a player gets from a crate.
     * If this is not set then the game will pick a unit randomly from those that do not have CrateGoodie=no set
     */
    unitCrateType: string | undefined;
    healCrateSound: string;
    /** The OverlayType to use as an image for the standard crate */
    crateImg: string;
    waterCrateImg: string;
    /** Give free MCV from crate if no buildings but still has money */
    freeMCV: boolean;
    readIni(ini: IniSection): this;
}

export declare interface CreateBaseOpts {
    mapName: string;
    gameMode: number;
    shortGame: boolean;
    mcvRepacks: boolean;
    cratesAppear: boolean;
    superWeapons: boolean;
    gameSpeed: number;
    credits: number;
    unitCount: number;
    buildOffAlly: boolean;
    destroyableBridges?: boolean;
    multiEngineer?: boolean;
    noDogEngiKills?: boolean;
}

export declare interface CreateOfflineOpts extends CreateBaseOpts {
    online?: false;
    agents: Bot[];
}

export declare interface CreateOnlineOpts extends CreateBaseOpts {
    online: true;
    serverUrl: string;
    clientUrl: string;
    botPassword: string;
    agents: [Bot, ...Agent[]];
    /** If specified, process will not wait for player input before creating the game. */
    nonInteractive?: boolean;
    /**
     * Called when the game is created.
     *
     * @param joinUrls - The URLs that each player agent can use to join the game.
     */
    onGameCreate?(joinUrls: Map<Agent, string>): unknown;
}

export declare type CreateOpts = CreateOfflineOpts | CreateOnlineOpts;

export declare class CrewRules {
    alliedCrew: string;
    alliedSurvivorDivisor: number;
    crewEscape: number;
    sovietCrew: string;
    sovietSurvivorDivisor: number;
    survivorRate: number;
    readIni(ini: IniSection): this;
}

export declare class Cylindrical extends THREE.Cylindrical {
    setFromVector3(vec3: Vector3): this;
}

export declare class DMislRules extends MissileRules {
    readIni(ini: IniSection): this;
}

export declare class Euler extends THREE.Euler {
    isEuler: true;
    private _x;
    private _y;
    private _z;
    private _order;
    setFromRotationMatrix(m: Matrix4, order?: string, update?: boolean): this;
    reorder(newOrder: string): this;
    toVector3(optionalResult?: Vector3): Vector3;
}

export declare interface FactoryData {
    status: FactoryStatus;
    /** The unit currently being delivered by the factory, if its status is {@link FactoryStatus.Delivering} */
    deliveringUnit: number | undefined;
}

export declare enum FactoryStatus {
    Idle = 0,
    Delivering = 1
}

export declare enum FactoryType {
    None = 0,
    BuildingType = 1,
    InfantryType = 2,
    /**
     * Includes only ground vehicles or those considered as aircrafts which are produces from a war factory.
     * Unlike original game, naval factory type is now split into its own type.
     */
    UnitType = 3,
    /** Original game uses a single UnitType for both naval and non-naval units */
    NavalUnitType = 4,
    AircraftType = 5
}

export declare class GameApi {
    #private;
    mapApi: MapApi;
    rulesApi: RulesApi;
    isPlayerDefeated(playerName: string): boolean;
    areAlliedPlayers(p1Name: string, p2Name: string): boolean;
    canPlaceBuilding(playerName: string, buildingName: string, tile: Tile): boolean;
    getBuildingPlacementData(objName: string): BuildingPlacementData;
    getPlayers(): string[];
    getPlayerData(playerName: string): PlayerData;
    getAllTerrainObjects(): number[];
    /** Queries all units and buildings on the map, regardless of owner */
    getAllUnits(filter?: (r: TechnoRules) => boolean): number[];
    /** Queries neutral units and buildings on the map */
    getNeutralUnits(filter?: (r: TechnoRules) => boolean): number[];
    /** Queries units in a given area of tiles. Uses a quadtree and is more efficient than scanning tile by tile. */
    getUnitsInArea(tileRange: Box2): number[];
    /**
     * Gets a list of units which are visible to the given player (not under the shroud), based on hostility
     *
     * An additional filter predicate can be passed to further narrow down results
     *
     * @param playerName - Name of the player who is making the observation
     * @param type - filters units based on their owner
     *  - `self` returns units owned by playerName
     *  - `allied` return all units owned by playerName or allies
     *  - `hostile` returns all units not owned by playerName or allies, including neutral units
     *  - `enemy` returns all units owned by enemy players, not including neutral units
     * @param filter - an optional predicate for futher filtering units based on their rules
     */
    getVisibleUnits(playerName: string, type: "self" | "allied" | "hostile" | "enemy", filter?: (r: TechnoRules) => boolean): number[];
    getGameObjectData(objId: number): GameObjectData | undefined;
    getUnitData(unitId: number): UnitData | undefined;
    getAllSuperWeaponData(): SuperWeaponData[];
    /** Returns a data structure that wraps the rules.ini [General] section */
    getGeneralRules(): GeneralRules;
    getRulesIni(): IniFile;
    getArtIni(): IniFile;
    getAiIni(): IniFile;
    /**
     * Generates a random integer in the specified [min, max] interval using the internal PRNG.
     * Must be used instead of Math.random() when computing game state to prevent desyncs between clients
     */
    generateRandomInt(min: number, max: number): number;
    /**
     * Generates a random float in the [0,1) interval using the internal PRNG.
     * Must be used instead of Math.random() when computing game state to prevent desyncs between clients
     */
    generateRandom(): number;
    /** Current game speed in ticks per real-time second. IMPORTANT: The game speed can change during a game */
    getTickRate(): number;
    /** Game speed in ticks per in-game second (at game speed 4) */
    getBaseTickRate(): number;
    getCurrentTick(): number;
    /**
     * Current game time in game seconds.
     * The get the time in real-time seconds, use {@link GameApi.getCurrentTick} / {@link GameApi.getTickRate} instead
     */
    getCurrentTime(): number;
}

export declare class GameInstanceApi {
    #private;
    isFinished(): boolean;
    /** Advances the game turn in offline mode or waits for the next turn in online mode */
    update(): Promise<void>;
    getCurrentTick(): number;
    getTickRate(): number;
    getPlayerStats(): PlayerStats[];
    /**
     * @param targetDir - Where to save the replay file.
     * @returns - The path where the replay file was saved to.
     */
    saveReplay(targetDir?: string): string;
    dispose(): void;
}

/**
 * Defines custom approximations of built-in Math functions, guaranteed to yield consistent results across platforms
 *
 * See https://stackoverflow.com/questions/42181795/is-ieee-754-2008-deterministic and
 * https://stackoverflow.com/a/56486907
 */
export declare class GameMath {
    /** Raises base to an integer power */
    static pow(x: number, y: number): number;
    static sqrt(x: number): number;
    static sin(x: number): number;
    static cos(x: number): number;
    static asin(x: number): number;
    static acos(x: number): number;
    static atan2(y: number, x: number): number;
}

export declare interface GameObjectData {
    id: number;
    type: ObjectType;
    /** The name of the object, given by its rules.ini section label */
    name: string;
    /** Data structure that corresponds to the rules.ini section for this object type */
    rules: ObjectRules;
    /** What tile the object is currently on. If the object occupies more than one tile, this is the top-most tile */
    tile: Tile;
    /** The object position in world space */
    worldPosition: Vector3;
    /** The object elevation above the ground, in Z levels */
    tileElevation: number;
    /** The size in tiles occupied by this object */
    foundation: Size;
    /** The current HP */
    hitPoints?: number;
    /** The maximum HP */
    maxHitPoints?: number;
    /** The name of the player that owns this object (only for techno types) */
    owner?: string;
}

export declare class GeneralRules {
    aircraftFogReveal: number;
    alliedDisguise: string;
    baseUnit: string[];
    bridgeVoxelMax: number;
    /** general build speed [time (in minutes) to produce a 1000 credit cost item] */
    buildSpeed: number;
    /** Average minutes that building build-up animation runs */
    buildupTime: number;
    chronoDelay: number;
    chronoDistanceFactor: number;
    chronoHarvTooFarDistance: number;
    chronoMinimumDelay: number;
    chronoRangeMinimum: number;
    chronoTrigger: boolean;
    cliffBackImpassability: number;
    cloakDelay: number;
    closeEnough: number;
    crew: CrewRules;
    defaultMirageDisguises: string[];
    dMisl: DMislRules;
    dropPodWeapon: string;
    engineer: string;
    engineerAlwaysCaptureTech: boolean;
    engineerCaptureLevel: number;
    engineerDamage: number;
    flightLevel: number;
    guardAreaTargetingDelay: number;
    harvesterTooFarDistance: number;
    harvesterUnit: string[];
    hover: HoverRules;
    infantryBlinkDisguiseTime: number;
    lightningStorm: LightningStormRules;
    lowPowerPenaltyModifier: number;
    minLowPowerProductionSpeed: number;
    maxLowPowerProductionSpeed: number;
    maximumCheerRate: number;
    maximumQueuedObjects: number;
    maxWaypointPathLength: number;
    multipleFactory: number;
    /** Used to provide explicit control of targeting rates in frames, when not engaged in a mission or AI trigger. */
    normalTargetingDelay: number;
    padAircraft: string[];
    /** Fall speed in cells / second */
    parachuteMaxFallRate: number;
    paradrop: ParadropRules;
    prereqCategories: Map<PrereqCategory, string[]>;
    prism: PrismRules;
    purifierBonus: number;
    radar: RadarRules;
    refundPercent: number;
    repair: RepairRules;
    /**
     * Whether structures will by default return to the civilian side when a player is defeated or giving up.
     * See https://ares-developers.github.io/Ares-docs/new/buildings/techstructures.html
     */
    returnStructures: boolean;
    revealTriggerRadius: number;
    shipSinkingWeight: number;
    sovietDisguise: string;
    spyMoneyStealPercent: number;
    spyPowerBlackout: number;
    technician: string;
    threat: ThreatRules;
    treeStrength: number;
    unitsUnsellable: boolean;
    v3Rocket: V3RocketRules;
    veteran: VeteranRules;
    wallBuildSpeedCoefficient: number;
    readIni(ini: IniSection): void;
    private readPrereqCategories;
    getMissileRules(type: string): DMislRules | V3RocketRules;
}

export declare class HoverRules {
    height: number;
    dampen: number;
    bob: number;
    boost: number;
    acceleration: number;
    brake: number;
    readIni(ini: IniSection): this;
}

/** Infantry death types, based on warhead */
export declare enum InfDeathType {
    None = 0,
    /** Twirl death (plays Die1 sequence) */
    Gunfire = 1,
    /** High explosive death (plays Die2 seq) */
    Explode = 2,
    /** Flying death (armor piercing). Plays anim specified by "InfantryExplode" in rules.ini */
    ExplodeAlt = 3,
    /** Burn death. Plays animation specified by "FlamingInfantry" in rules.ini */
    Fire = 4,
    /** Electro death. Plays animation specified by 2nd item in rules.ini [Animations] array */
    Electro = 5,
    /** Yuri deployed death. Plays animation specified by "InfantryHeadPop" */
    HeadExplode = 6,
    /** Nuke death. Plays animation specified by "InfantryNuked" */
    Nuke = 7
}

export declare class IniFile {
    private sections;
    fromString(data: string): this;
    fromJson(data: Record<string, unknown>): this;
    toString(): string;
    clone(): IniFile;
    getOrCreateSection(name: string): IniSection;
    getSection(name: string): IniSection | undefined;
    getOrderedSections(): IniSection[];
    mergeWith(ini: IniFile): this;
}

export declare class IniSection {
    name: string;
    entries: Map<string, string | string[]>;
    private sections;
    constructor(name: string);
    fromJson(data: Record<string, unknown>): this;
    clone(): IniSection;
    set(name: string, value: string | string[]): void;
    get(name: string): string | string[] | undefined;
    has(name: string): boolean;
    getString(name: string, defaultValue?: string): string;
    getNumber(key: string, defaultValue?: number): number;
    /**
     * Parses an integer, decimal number (e.g. "1.23" or ".2") or percent value (e.g "20%") string into a regular
     * JavaScript IEEE 754 floating-point number representation
     */
    private parseNumber;
    /**
     * Reads a decimal number (e.g. "1.23" or ".2") or percent value (e.g "20%") string into a regular JavaScript
     * IEEE 754 floating-point representation, but emulates fixed-point precision.
     *
     * See https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/FIXED.CPP
     */
    getFixed(key: string, defaultValue?: number): number;
    /** Emulates fixed-point precision given a floating-point number */
    private toFixedPointPrecision;
    getBool(key: string, defaultValue?: boolean): boolean;
    getKeyArray(key: string, defaultValue?: string[]): string[];
    getArray(key: string, sep?: RegExp, defaultValue?: string[]): string[];
    getNumberArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
    getFixedArray(key: string, sep?: RegExp, defaultValue?: number[]): number[];
    getEnum<T>(key: string, enumType: any, defaultValue: T, caseInsensitive?: boolean): T;
    getEnumNumeric<T>(key: string, enumType: any, defaultValue: T): T;
    getEnumArray<T>(key: string, enumType: any, sep?: RegExp, defaultValue?: T[], caseInsensitive?: boolean): T[];
    getHighestNumericIndex(): number;
    isNumericIndexArray(): boolean;
    getConcatenatedValues(): string;
    toString(namePrefix?: string): string;
    mergeWith(other: IniSection): void;
    getOrCreateSection(name: string): IniSection;
    getSection(name: string): IniSection | undefined;
    getOrderedSections(): IniSection[];
}

export declare interface IsoTile {
    dx: number;
    dy: number;
    rx: number;
    ry: number;
    z: number;
    tileNum: number;
    subTile: number;
}

export declare enum LandTargeting {
    LandOk = 0,
    LandNotOk = 1,
    /** Can shoot land, but only with secondary weapon */
    LandSecondary = 2
}

export declare enum LandType {
    /** normal clear terrain */
    Clear = 0,
    /** roads (both dirt and paved) */
    Road = 1,
    /** rocky terrain (including rocks themselves) */
    Rock = 2,
    /** where water joins land */
    Beach = 3,
    /** rough terrain (debris for example) */
    Rough = 4,
    /** ice covering water (although this may be disabled in Red Alert 2) */
    /** Train tracks (works in Tiberian Sun, in Red Alert 2 requires Terrain Expansion (aka TX)). */
    Railroad = 5,
    /** Tunnel entrance/exit (works in Tiberian Sun, in Red Alert 2 requires Terrain Expansion (aka TX)). */
    /** Tiberium Veins (Works in TS, in RA2 it is not assigned to anything and can be used for new movement rules). */
    Weeds = 6,
    /** Water as in lakes or ocean areas. */
    Water = 7,
    /** Non-firestorm/non-laserfence walls. */
    Wall = 8,
    /** Ore/Gem/Tiberium overlays. */
    Tiberium = 9,
    /** Cliffs (before Red Alert 2 Rock was used for cliffs). */
    Cliff = 10
}

export declare class LightningStormRules {
    deferment: number;
    damage: number;
    duration: number;
    warhead: string;
    hitDelay: number;
    scatterDelay: number;
    cellSpread: number;
    separation: number;
    readIni(ini: IniSection): this;
}

export declare enum LocomotorType {
    Statue = 0,
    Aircraft = 1,
    Chrono = 2,
    Hover = 3,
    Infantry = 4,
    Jumpjet = 5,
    Missile = 6,
    Ship = 7,
    Vehicle = 8
}

export declare class LoggerApi {
    #private;
    debug(...x: any[]): void;
    info(...x: any[]): void;
    log(...x: any[]): void;
    warn(...x: any[]): void;
    error(...x: any[]): void;
    time(label: string): void;
    timeEnd(label: string): void;
}

export declare class MapApi {
    #private;
    /**
     * The map size in real/world space tiles.
     *
     * IMPORTANT: Tile coordinates within the real map size only correspond to actual tiles if those tiles are
     * within the visible map area. The visible map area uses ISO screen projection,
     * depends on tile elevations, and cannot be deduced using linear transformations or used to compute map boundaries.
     * Use {@link MapApi.getTile} instead to check if a given tile is within the map boundaries.
     */
    getRealMapSize(): Size;
    /** Tile coordinates for each player starting position */
    getStartingLocations(): Vector2[];
    getTheaterType(): TheaterType;
    getTile(rx: number, ry: number): Tile | undefined;
    getTilesInRect(rectangle: Rectangle): Tile[];
    getTilesInRect(baseTile: Tile, size: Size): Tile[];
    getObjectsOnTile(tile: Tile): number[];
    hasBridgeOnTile(tile: Tile): boolean;
    hasHighBridgeOnTile(tile: Tile): boolean;
    isPassableTile(tile: Tile, speedType: SpeedType, onBridge: boolean, subCell: boolean): boolean;
    /** @deprecated Use overload with explicit subCell instead */
    isPassableTile(tile: Tile, speedType: SpeedType, onBridge: boolean): boolean;
    /**
     * Returns the path between two points on the map for the given SpeedType.
     *
     * Should only be used with ground, non-teleporting units.
     * This method has a big performance penalty and should be used with care.
     */
    findPath(speedType: SpeedType, subCell: boolean, from: PathNode, to: PathNode, options?: PathFinderOptions): PathNode[];
    /** @deprecated Use overload with explicit subCell instead */
    findPath(speedType: SpeedType, from: PathNode, to: PathNode, options?: PathFinderOptions): PathNode[];
    /** If the tile is not covered by shroud for the specified player */
    isVisibleTile(tile: Tile, playerName: string, tileElevation?: number): boolean;
    getTileResourceData(tile: Tile): TileResourceData | undefined;
    getAllTilesResourceData(): TileResourceData[];
}

export declare class Matrix4 extends THREE.Matrix4 {
    extractRotation(m: Matrix4): this;
    makeRotationFromEuler(euler: Euler): this;
    lookAt(eye: Vector3, target: Vector3, up: Vector3): this;
    getMaxScaleOnAxis(): number;
    makeRotationX(theta: number): this;
    makeRotationY(theta: number): this;
    makeRotationZ(theta: number): this;
    makeRotationAxis(axis: Vector3, angle: number): this;
    decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): object[];
}

export declare class MissileRules {
    /** How many frames the rocket pauses on the launcher before tilting */
    pauseFrames: number;
    /** How many frames it takes for the V3 rocket to tilt to firing position */
    tiltFrames: number;
    /** Starting pitch of the rocket before tilting up (0=horizontal,1=vertical) */
    pitchInitial: number;
    /** Ending pitch of the rocket after tilting up; now it fires */
    pitchFinal: number;
    /** Pitch maneuverability of rocket in air.  Adjust by trial and error. */
    turnRate: number;
    /** This much is added to the rocket's velocity each frame during launch */
    acceleration: number;
    /** Cruising altitude in leptons: at this height rocket BEGINS leveling off */
    altitude: number;
    /** Exploding V3 does this much damage (at center of explosion, presumably). */
    damage: number;
    /** Exploding V3 does this much damage (at center of explosion, presumably). */
    eliteDamage: number;
    /** The body of the rocket is this many leptons long */
    bodyLength: number;
    /** The rocket's path is a big, lazy curve.  V3 yes.  DMisl no. */
    lazyCurve: boolean;
    type: string;
}

export declare enum MovementZone {
    /** when pathfinding, the unit will consider both ground and water as passable. */
    Amphibious = 0,
    /**
     * When pathfinding, the unit will consider both ground and water as passible.
     * In addition, it will assume that it is capable of crushing infantry, but is unarmed.1.
     */
    AmphibiousCrusher = 1,
    /**
     * Same as above, additionally can destroy terrain obstacles.
     * In RA2 this is tied to being an amphibious infantry.
     */
    AmphibiousDestroyer = 2,
    /**
     * when pathfinding, only clear ground is considered passable.
     * Also assumes that it can crush infantry, but is not armed.1
     */
    Crusher = 3,
    /** Same as above, additionally assumes that it can crush any mobile object, as well as walls. 2 */
    CrusherAll = 4,
    /** when pathfinding, considers ground passable. Can destroy terrain obstacles and crush infantry obstacles. */
    Destroyer = 5,
    /** when pathfinding, it assumes everything passable. */
    Fly = 6,
    /** when pathfinding, only clear ground is considered passable. */
    Infantry = 7,
    /** Same as above, but can destroy terrain obstacles such as trees. */
    InfantryDestroyer = 8,
    /**
     * when pathfinding, considers clear ground passable.
     * Assumes it can destroy terrain obstacles and crush infantry.
     */
    Normal = 9,
    /**
     * when pathfinding, considers clear ground passable.
     * When destination is too far away for surface travel, or there is an obstacle in the way,
     * unit will dig underground. Unit cannot dig on pavement.
     * In other cases, when subterranean travel is not possible, or surface travel is quicker,
     * acts like a unit with MovementZone=Crusher or MovementZone=Destroyer.
     */
    Subterranean = 10,
    /** when pathfinding, considers only water as passable. */
    Water = 11
}

export declare enum NavalTargeting {
    /** Can't shoot at all at underwater */
    UnderwaterNever = 0,
    /** Use Second weapon against underwater */
    UnderwaterSecondary = 1,
    /** Can only shoot underwater */
    UnderwaterOnly = 2,
    /** Use second Weapon on organic */
    OrganicSecondary = 3,
    /** Primary on Amphibious and organic, Second on Naval and underwater-not-organic */
    SealSpecial = 4,
    /** Go ahead and shoot everything with Primary */
    NavalAll = 5,
    /** Don't even shoot into the water */
    NavalNone = 6
}

export declare interface ObjectDestroyApiEvent {
    type: ApiEventType.ObjectDestroy;
    target: number;
    attackerInfo: {
        playerName: string;
        objId?: number;
        weaponName?: string;
    } | undefined;
}

export declare interface ObjectOwnerChangeApiEvent {
    type: ApiEventType.ObjectOwnerChange;
    target: number;
    prevOwnerName: string;
    newOwnerName: string;
}

/** Base class for rules.ini game entity sections */
export declare class ObjectRules {
    type: ObjectType;
    protected ini: IniSection;
    index: number;
    protected generalRules?: GeneralRules | undefined;
    static readonly IMAGE_NONE = "none";
    alphaImage: string | undefined;
    /** Only for SHP-based entities */
    alternateArcticArt: boolean;
    crushable: boolean;
    crushSound: string | undefined;
    dontScore: boolean;
    /** Makes the object ignored for scoring and killing purposes */
    insignificant: boolean;
    /** If this object can be targeted or fired upon */
    legalTarget: boolean;
    /** This is an override for art.ini Shadow */
    noShadow: boolean;
    uiName: string;
    static iniSpeedToLeptonsPerTick(iniSpeed: number, iniMax: number): number;
    static iniRotToDegsPerTick(iniRot: number): number;
    constructor(type: ObjectType, ini: IniSection, index?: number, generalRules?: GeneralRules | undefined);
    protected parse(): void;
    get name(): string;
    get imageName(): string;
}

export declare interface ObjectSpawnUnspawnApiEvent {
    type: ApiEventType.ObjectSpawn | ApiEventType.ObjectUnspawn;
    target: number;
}

export declare enum ObjectType {
    None = 0,
    Aircraft = 1,
    Building = 2,
    Infantry = 3,
    Overlay = 4,
    Smudge = 5,
    Terrain = 6,
    Vehicle = 7,
    Animation = 8,
    Projectile = 9,
    VoxelAnim = 10,
    Debris = 11
}

export declare enum OrderType {
    Move = 0,
    ForceMove = 1,
    Attack = 2,
    ForceAttack = 3,
    AttackMove = 4,
    Guard = 5,
    GuardArea = 6,
    Capture = 7,
    Occupy = 8,
    Deploy = 9,
    DeploySelected = 10,
    Stop = 11,
    Cheer = 12,
    Dock = 13,
    Gather = 14,
    Repair = 15,
    Scatter = 16,
    EnterTransport = 17,
    PlaceBomb = 18
}

/** Data structure for rules.ini overlay types */
export declare class OverlayRules extends ObjectRules {
    armor: ArmorType;
    crate: boolean;
    isARock: boolean;
    /** See https://www.modenc.renegadeprojects.com/IsRubble */
    isRubble: boolean;
    isVeinholeMonster: boolean;
    isVeins: boolean;
    /** Only for overlays - Specifies the type of land that this overlay forms when placed on the map. */
    land: LandType;
    noUseTileLandType: boolean;
    radarInvisible: boolean;
    strength: number;
    tiberium: boolean;
    wall: boolean;
    protected parse(): void;
}

export declare class ParadropRules {
    allyParaDrop: ParadropSquad[];
    amerParaDrop: ParadropSquad[];
    paradropPlane: string;
    /** In leptons */
    paradropRadius: number;
    sovParaDrop: ParadropSquad[];
    readIni(ini: IniSection): this;
    private readParadropSquad;
    getParadropSquads(sideType: SideType): ParadropSquad[];
}

export declare interface ParadropSquad {
    /** Infantry name */
    inf: string;
    /** Number of units to drop */
    num: number;
}

export declare interface PathFinderOptions {
    /** Restricts the number of searched path nodes (default = Infinity) */
    maxExpandedNodes?: number;
    /** If true, returns a partial path, even if the target is unreachable (default = true) */
    bestEffort?: boolean;
    /** Dynamically exclude path nodes */
    excludeNodes?(node: PathNode): boolean;
}

export declare interface PathNode {
    tile: Tile;
    onBridge: boolean;
}

export declare enum PipColor {
    Green = 0,
    Yellow = 1,
    White = 2,
    Red = 3,
    Blue = 4
}

export declare interface PlayerData {
    name: string;
    country: Country | undefined;
    /** The starting tile coordinates for the player (where the initial MCV is placed) */
    startLocation: Vector2;
    isObserver: boolean;
    /** Whether the player is an integrated AI. Not applicable to sandbox agents. */
    isAi: boolean;
    /** Whether the player is not an observer and hasn't been defeated */
    isCombatant: boolean;
    credits: number;
    power: PowerData;
    radarDisabled: boolean;
}

export declare interface PlayerStats {
    name: string;
    country: Country;
    ai: boolean;
    defeated: boolean;
    credits: number;
    startLocation: number;
}

/** @deprecated use Vector2 instead */
export declare interface Point2D {
    x: number;
    y: number;
}

export declare interface PowerData {
    /** Total power generated by buildings such as power plants */
    total: number;
    /** How much power is consumed */
    drain: number;
    /** If the base is on low power (e.g. the power drain is larger than the generated power, or power sabotaged) */
    isLowPower: boolean;
}

export declare enum PrereqCategory {
    Power = 0,
    Factory = 1,
    Barracks = 2,
    Radar = 3,
    Tech = 4,
    Proc = 5
}

export declare class PrismRules {
    type: string;
    supportHeight: number;
    supportMax: number;
    supportModifier: number;
    readIni(ini: IniSection): this;
}

export declare class ProductionApi {
    #private;
    isAvailableForProduction(objRules: TechnoRules): boolean;
    getAvailableObjects(queueType?: QueueType): TechnoRules[];
    getQueueTypeForObject(objRules: TechnoRules): QueueType;
    getQueueData(queueType: QueueType): QueueData;
}

export declare class ProjectileRules extends ObjectRules {
    acceleration: number;
    arcing: boolean;
    courseLockDuration: number;
    detonationAltitude: number;
    /**
     * If set, the projectile will be drawn in the unit palette regardless of the settings in projectile image code.
     * This also makes the projectile remappable.
     */
    firersPalette: boolean;
    flakScatter: boolean;
    inaccurate: boolean;
    inviso: boolean;
    isAntiAir: boolean;
    /** No = can't force fire at ground, but can still attack objects on the ground, unless LandTargeting=1 */
    isAntiGround: boolean;
    level: boolean;
    /** Rate of turn in degs/tick */
    rot: number;
    /** Original ROT value from INI */
    iniRot: number;
    shadow: boolean;
    shrapnelWeapon: string | undefined;
    shrapnelCount: number;
    subjectToCliffs: boolean;
    subjectToElevation: boolean;
    subjectToWalls: boolean;
    vertical: boolean;
    protected parse(): void;
}

export declare class PublicApi {
    #private;
    init(mixDir: string): Promise<void>;
    getAvailableMaps(): string[];
    getAvailableGameModes(mapName: string): number[];
    /**
     * Creates a new game
     *
     * If {@link CreateOfflineOpts.online} is false, an offline game is created, in which multiple AI agents can battle
     * each other in a sandboxed environment. The game simulation runs programatically at the fastest possible speed.
     *
     * If {@link CreateOnlineOpts.online} is true, an online game is created, in which human players can fight
     * in real time against the AI.
     *
     * In online mode, the {@link CreateOnlineOpts.agents} array specifies both human and AI agents. In this case,
     * there can be only one AI agent (the game host) and it must be the first item in the array.
     */
    createGame(opts: CreateOpts): Promise<GameInstanceApi>;
}

export declare class Quaternion extends THREE.Quaternion {
    private _x;
    private _y;
    private _z;
    private _w;
    setFromEuler(euler: Euler, update?: boolean): this;
    setFromAxisAngle(axis: Vector3, angle: number): this;
    setFromRotationMatrix(m: Matrix4): this;
    length(): number;
    slerp(qb: Quaternion, t: number): this;
}

export declare interface QueueData {
    size: number;
    maxSize: number;
    status: QueueStatus;
    type: QueueType;
    items: QueueItemData[];
}

export declare interface QueueItemData {
    rules: TechnoRules;
    quantity: number;
}

export declare enum QueueStatus {
    Idle = 0,
    Active = 1,
    /** Production is paused */
    OnHold = 2,
    /** First item is ready and is waiting to be removed before starting the next */
    Ready = 3
}

export declare enum QueueType {
    Structures = 0,
    Armory = 1,
    Infantry = 2,
    Vehicles = 3,
    Aircrafts = 4,
    Ships = 5
}

export declare enum RadarEventType {
    GenericCombat = 0,
    GenericNonCombat = 1,
    DropZone = 2,
    BaseUnderAttack = 3,
    HarvesterUnderAttack = 4,
    EnemyObjectSensed = 5
}

export declare class RadarRules {
    /** suppression distance in cells */
    private eventSuppressionDistances;
    /** event visibility in frames */
    private eventVisibilityDurations;
    /** event duration in frames */
    private eventDurations;
    flashFrameTime: number;
    combatFlashTime: number;
    eventMinRadius: number;
    eventSpeed: number;
    eventRotationSpeed: number;
    eventColorSpeed: number;
    readIni(ini: IniSection): this;
    getEventSuppresionDistance(type: RadarEventType): number;
    getEventVisibilityDuration(type: RadarEventType): number;
    getEventDuration(type: RadarEventType): number;
}

export declare class RadiationRules {
    /**
     * Number of frames site lasts per level of radiation.
     *
     * When rad level goes to zero, rad site deletes itself.
     * --&gt; Site lasts ( Level x RadDurationMultiple ) frames.
     * For reference, the Nuke puts down 2000 units of radiation.
     * A mult. of 3 frames means the rad site is active for 6000
     * frames -- something over 3 minutes at 30 Hz.
     */
    radDurationMultiple: number;
    /** Delay between times when radiation is applied to units. */
    radApplicationDelay: number;
    /**
     * Maximum radiation allowable in a cell. The cell can actually have more radiation
     * but it will only damage as if it had the maximum level.
     */
    radLevelMax: number;
    /**
     * Delay in frames between radiation level decrements.
     *
     * The level updates this often, but the rate is still as specified
     * in RadDurationMultiple.
     */
    radLevelDelay: number;
    /**
     * Delay in frames between radiation lighting intensity decrements.
     * This should never be less than the RadLevelDelay, as it will
     * produce no visual benefit and just waste processor cycles.
     */
    radLightDelay: number;
    /** Scales damage done by a given radiation level. */
    radLevelFactor: number;
    /** Scales the factor brightness plays in the radiation display. */
    radLightFactor: number;
    /** Scales the factor tint plays in the radiation display. */
    radTintFactor: number;
    /** The color of the radiation. (0-255 rgb array) */
    radColor: number[];
    /** Sets the warhead used by irradiated tiles. */
    radSiteWarhead: string;
    readIni(ini: IniSection): void;
}

export declare interface Rectangle {
    x: number;
    y: number;
    width: number;
    height: number;
}

export declare class RepairRules {
    /** minutes to reload each ammo point for aircraft or helicopters (also affects repair rate) */
    reloadRate: number;
    /** percent cost to fully repair as ratio of full cost */
    repairPercent: number;
    /** minutes between applying repair step */
    repairRate: number;
    /** hit points to heal per repair 'tick' */
    repairStep: number;
    /** [units only] minutes between applying repair step */
    uRepairRate: number;
    /** [infantry only] minutes between applying repair step */
    iRepairRate: number;
    /** [infantry only] hit points to heal per repair 'tick' for infantry */
    iRepairStep: number;
    readIni(ini: IniSection): this;
}

export declare class RulesApi {
    #private;
    get allObjectRules(): Map<ObjectType, Map<string, ObjectRules>>;
    get buildingRules(): Map<string, TechnoRules>;
    get infantryRules(): Map<string, TechnoRules>;
    get vehicleRules(): Map<string, TechnoRules>;
    get aircraftRules(): Map<string, TechnoRules>;
    get terrainRules(): Map<string, TerrainRules>;
    get overlayRules(): Map<string, OverlayRules>;
    get countryRules(): Map<string, CountryRules>;
    get general(): GeneralRules;
    get ai(): AiRules;
    get crateRules(): CrateRules;
    get combatDamage(): CombatDamageRules;
    get radiation(): RadiationRules;
    hasObject(name: string, type: ObjectType): boolean | undefined;
    getObject(name: string, type: ObjectType): ObjectRules;
    getBuilding(name: string): TechnoRules;
    getWeapon(name: string): WeaponRules;
    getWarhead(name: string): WarheadRules;
    getProjectile(name: string): ProjectileRules;
    getOverlayName(id: number): string;
    getOverlayId(name: string): number;
    getOverlay(name: string): OverlayRules;
    getCountry(name: string): CountryRules;
    getMultiplayerCountries(): CountryRules[];
    getIni(): IniFile;
}

/** Side/faction types (ally/soviet). Relic naming since tiberian sun */
export declare enum SideType {
    GDI = 0,
    Nod = 1,
    Civilian = 2,
    Mutant = 3
}

export declare interface Size {
    width: number;
    height: number;
}

export declare enum SpeedType {
    Foot = 0,
    Track = 1,
    Wheel = 2,
    Hover = 3,
    Float = 4,
    FloatBeach = 5,
    Amphibious = 6,
    Winged = 7
}

export declare class Spherical extends THREE.Spherical {
    setFromVector3(vec3: Vector3): this;
}

export declare enum StanceType {
    None = 0,
    Guard = 1,
    Prone = 2,
    Deployed = 3,
    Paradrop = 4,
    Cheer = 5
}

export declare interface SuperWeaponData {
    playerName: string;
    type: SuperWeaponType;
    status: SuperWeaponStatus;
    timerSeconds: number;
}

export declare enum SuperWeaponStatus {
    Charging = 0,
    Paused = 1,
    Ready = 2
}

export declare enum SuperWeaponType {
    MultiMissile = 0,
    IronCurtain = 1,
    LightningStorm = 2,
    ChronoSphere = 3,
    ChronoWarp = 4,
    ParaDrop = 5,
    AmerParaDrop = 6
}

export declare class Tag {
    id: string;
    repeatType: TagRepeatType;
    name: string;
    triggerId: string;
}

export declare enum TagRepeatType {
    /** Any of the associated objects - OR operator - one time */
    OnceAny = 0,
    /** When all of the associated objects - AND operator - one time */
    OnceAll = 1,
    /** Any of the associated objects - OR operator - repeat */
    Repeat = 2
}

/** Data structure for rules.ini tehno types sections (buildings, infantry, vehicles, aircrafts) */
export declare class TechnoRules extends ObjectRules {
    static readonly MAX_SIGHT = 11;
    protected generalRules: GeneralRules;
    /** Countries that can build this */
    owner: string[];
    /** Side that building belongs to; should match SideType enum values */
    aiBasePlanningSide: SideType | undefined;
    /** Building category - used for sidebar placement */
    buildCat: BuildCat;
    /** -1 = can't build */
    techLevel: number;
    prerequisite: string[];
    prerequisiteOverride: string[];
    private requiredHouses;
    private forbiddenHouses;
    requiresStolenAlliedTech: boolean;
    requiresStolenSovietTech: boolean;
    cost: number;
    points: number;
    soylent: number;
    crateGoodie: boolean;
    /**
     * Only for buildings
     * Positive values indicate that it produces power (e.g. a Power Plant) and
     * negative values indicate that it uses (drains) power.
     */
    power: number;
    /** Only for buildings */
    powered: boolean;
    /** Max placement distance from other buildings */
    adjacent: number;
    /** Considered for adjacency checks? */
    baseNormal: boolean;
    /**
     * How many can be built
     *
     * Omit = no limit;
     * 0 = only AI allowed to build, don't show in sidebar;
     * &lt;0 = the absolute value limits the number of units that can be trained for the entire match
     */
    buildLimit: number;
    airRangeBonus: number;
    /**
     * For walls this is the connect distance. For other types overrides weapon range when scanning for targets.
     * Despite the name, this doesn't seem to be used in guard area mode
     */
    guardRange: number;
    defaultToGuardArea: boolean;
    /** Only for buildings */
    eligibileForAllyBuilding: boolean;
    numberImpassableRows: number;
    bridgeRepairHut: boolean;
    constructionYard: boolean;
    refinery: boolean;
    factory: FactoryType;
    weaponsFactory: boolean;
    helipad: boolean;
    hospital: boolean;
    unitRepair: boolean;
    unitReload: boolean;
    unitSell: boolean;
    isBaseDefense: boolean;
    superWeapon: string | undefined;
    chargedAnimTime: number;
    naval: boolean;
    underwater: boolean;
    waterBound: boolean;
    orePurifier: boolean;
    cloning: boolean;
    grinding: boolean;
    nukeSilo: boolean;
    /** Only for buildings */
    repairable: boolean;
    /** Only for buildings */
    clickRepairable: boolean;
    /** Only for buildings */
    unsellable: boolean;
    /**
     * Whether this building type will return to the civilian side when the owning player is defeated or giving up.
     * See https://ares-developers.github.io/Ares-docs/new/buildings/techstructures.html
     */
    returnable: boolean;
    gdiBarracks: boolean;
    nodBarracks: boolean;
    numberOfDocks: number;
    landTargeting: LandTargeting;
    navalTargeting: NavalTargeting;
    tooBigToFitUnderBridge: boolean;
    canBeOccupied: boolean;
    maxNumberOccupants: number;
    leaveRubble: boolean;
    undeploysInto: string;
    deploysInto: string;
    deployTime: number;
    capturable: boolean;
    spyable: boolean;
    needsEngineer: boolean;
    c4: boolean;
    /** Only for buildings */
    canC4: boolean;
    /** Only for buildings */
    eligibleForDelayKill: boolean;
    /** credits when captured from the Neutral house */
    produceCashStartup: number;
    /** Amount every Delay */
    produceCashAmount: number;
    /** Frame delay between Amounts */
    produceCashDelay: number;
    /** For infantry and vehicles */
    ifvMode: number;
    turretIndexesByIfvMode: Map<number, number>;
    turret: boolean;
    turretCount: number;
    explosion: string[];
    explodes: boolean;
    turretAnim: string;
    turretAnimIsVoxel: boolean;
    turretAnimX: number;
    turretAnimY: number;
    turretAnimZAdjust: number;
    isChargeTurret: boolean;
    overpowerable: boolean;
    freeUnit: string;
    primary: string | undefined;
    secondary: string | undefined;
    elitePrimary: string | undefined;
    eliteSecondary: string | undefined;
    /** Special weapon count. If greater than zero, (Elite)Weapon%d values are used over (Elite)Primary/Secondary */
    weaponCount: number;
    deathWeapon: string | undefined;
    deathWeaponDamageModifier: number;
    occupyWeapon: string | undefined;
    eliteOccupyWeapon: string | undefined;
    veteranAbilities: Set<VeteranAbility>;
    eliteAbilities: Set<VeteranAbility>;
    selfHealing: boolean;
    wall: boolean;
    gate: boolean;
    armor: ArmorType;
    strength: number;
    immune: boolean;
    immuneToRadiation: boolean;
    immuneToPsionics: boolean;
    typeImmune: boolean;
    warpable: boolean;
    /** Only for vehicles */
    isTilter: boolean;
    /** Only for shp vehicles */
    walkRate: number;
    /** Only for vehicles */
    idleRate: number;
    /** Only for vehicles that spawn child units */
    noSpawnAlt: boolean;
    /** Only for vehicles */
    crusher: boolean;
    /** Only for vehicles and infantry */
    consideredAircraft: boolean;
    /** Only for infantry and vehicles */
    crashable: boolean;
    /** Only for aircrafts or other objects that are considered aircraft */
    landable: boolean;
    /** Only for aicrafts */
    airportBound: boolean;
    /** Only for aircrafts or other objects that are considered aircraft */
    balloonHover: boolean;
    /** Only for aircrafts or other objects that are considered aircraft */
    hoverAttack: boolean;
    /** Only for aircrafts */
    omniFire: boolean;
    /** Only for aircrafts */
    fighter: boolean;
    /** Only for aircrafts */
    flightLevel: number | undefined;
    /** Only for vehicles, aircrafts and infantry */
    speedType: SpeedType | undefined;
    /** Speed in leptons/tick. Only for moving units */
    speed: number;
    /** Only for vehicles, aircrafts and infantry */
    locomotor: LocomotorType;
    movementZone: MovementZone;
    /** Only for infantry */
    fearless: boolean;
    /** Only for infantry and vehicles - if it has a deploy action */
    deployer: boolean;
    /** Only for infantry and vehicles */
    deployFire: boolean;
    /** Only for infantry and vehicles */
    deployFireWeapon: WeaponType;
    /** Only for infantry and vehicles */
    undeployDelay: number;
    /** Only for infantry - Can panic when attacked */
    fraidycat: boolean;
    /** Only for infantry */
    isHuman: boolean;
    /** Only for infantry */
    organic: boolean;
    /** Only for infantry */
    occupier: boolean;
    /** Only for infantry */
    engineer: boolean;
    /** Only for infantry */
    ivan: boolean;
    civilian: boolean;
    agent: boolean;
    infiltrate: boolean;
    threatPosed: number;
    specialThreatValue: number;
    canPassiveAquire: boolean;
    canRetaliate: boolean;
    /** Only for units */
    preventAttackMove: boolean;
    /** Only for units */
    opportunityFire: boolean;
    distributedFire: boolean;
    radialFireSegments: number;
    attackCursorOnFriendlies: boolean;
    bombable: boolean;
    /** Whether it can be promoted */
    trainable: boolean;
    /** (Not infantry) Specifies whether this object is occupied by infantry which can escape when it is destroyed */
    crewed: boolean;
    parasiteable: boolean;
    suppressionThreshold: number;
    reselectIfLimboed: boolean;
    rejoinTeamIfLimboed: boolean;
    /** Only for vehicles */
    weight: number;
    accelerates: boolean;
    accelerationFactor: number;
    /** Only for infantry and vehicles */
    teleporter: boolean;
    /** Only for infantry and vehicles */
    canDisguise: boolean;
    /** Only for infantry and vehicles */
    disguiseWhenStill: boolean;
    /** Only for infantry and vehicles */
    permaDisguise: boolean;
    detectDisguise: boolean;
    detectDisguiseRange: number;
    cloakable: boolean;
    sensors: boolean;
    sensorArray: boolean;
    sensorsSight: number;
    burstDelay: (number | undefined)[];
    vhpScan: VhpScan;
    /** Only for infantry */
    pip: PipColor;
    /** Only for vehicles - for PipScale=Passengers */
    passengers: number;
    /** Only for vehicles - considers the first passager as a gunner (affects turret and is evac'd separately) */
    gunner: boolean;
    ammo: number;
    initialAmmo: number;
    manualReload: boolean;
    /**
     * Only for vehicles - for PipScale=Tiberium
     *
     * Number of ore "bails" (1bail = $25/$50 see [Riparius] and [Cruentus])
     */
    storage: number;
    /** Only for aircraft - created by another object and therefore not player controllable */
    spawned: boolean;
    /** Only for vehicles - name of aircraft spawned by this unit */
    spawns: string;
    /** Only for vehicles - how many aircraft of "Spawns" type are spawned */
    spawnsNumber: number;
    /** Only for vehicles - the rate, in frames, at which this object regenerates spawned objects */
    spawnRegenRate: number;
    /** Only for vehicles - the rate, in frames, at which spawned are resupplied with ammo */
    spawnReloadRate: number;
    /** Only for aircrafts - marks as a missile spawned by another unit */
    missileSpawn: boolean;
    /** Storage space used inside a transport */
    size: number;
    /** Maximum size of a unit that is allowed to enter this unit as a passenger. */
    sizeLimit: number;
    sight: number;
    spySat: boolean;
    gapGenerator: boolean;
    gapRadiusInCells: number;
    psychicDetectionRadius: number;
    hasRadialIndicator: boolean;
    harvester: boolean;
    unloadingClass: string;
    /** What buildings can this unit type dock to? */
    dock: string[];
    /** Only for building types */
    radar: boolean;
    radarInvisible: boolean;
    /** Only for building types */
    revealToAll: boolean;
    selectable: boolean;
    isSelectableCombatant: boolean;
    /**
     * Only for buildings - Determines whether or not this object is invisible to all players ingame,
     * including the owner. It also cannot be targeted or destroyed by any other object on the map.
     */
    invisibleInGame: boolean;
    moveToShroud: boolean;
    leadershipRating: number;
    /** Setting this tag makes the object impossible to be attacked by infantry with Natural set to 'yes'. */
    unnatural: boolean;
    /** Setting this tag forbids this infantry from attacking any unit with Unnatural set. */
    natural: boolean;
    buildTimeMultiplier: number;
    allowedToStartInMultiplayer: boolean;
    /** Rate of turn for unit body/turret in degrees/tick. Also see ROT */
    rot: number;
    jumpjetAccel: number;
    jumpjetClimb: number;
    jumpjetCrash: number;
    jumpjetDeviation: number;
    jumpjetHeight: number;
    jumpjetNoWobbles: boolean;
    jumpjetSpeed: number;
    jumpjetTurnRate: number;
    jumpjetWobbles: number;
    /** Only for aircraft */
    pitchAngle: number;
    /** Only for aircraft */
    pitchSpeed: number;
    damageParticleSystems: string[];
    damageSmokeOffset: Vector3;
    minDebris: number;
    maxDebris: number;
    /** Only for vehicles */
    debrisTypes: string[];
    /** Only for buildings */
    debrisAnims: string[];
    /** Only for lamps */
    isLightpost: boolean;
    /** Only for lamps. Distance in leptons that the light emitted from this building is visible from */
    lightVisibility: number;
    /** Only for lamps */
    lightIntensity: number;
    /** Only for lamps */
    lightRedTint: number;
    /** Only for lamps */
    lightGreenTint: number;
    /** Only for lamps */
    lightBlueTint: number;
    ambientSound: string | undefined;
    createSound: string | undefined;
    deploySound: string | undefined;
    undeploySound: string | undefined;
    voiceSelect: string | undefined;
    voiceMove: string | undefined;
    voiceAttack: string | undefined;
    voiceFeedback: string | undefined;
    voiceSpecialAttack: string | undefined;
    voiceEnter: string | undefined;
    voiceCapture: string | undefined;
    voiceCrashing: string | undefined;
    crashingSound: string | undefined;
    impactLandSound: string | undefined;
    /** Take-off sound */
    auxSound1: string | undefined;
    /** Land sound */
    auxSound2: string | undefined;
    dieSound: string | undefined;
    moveSound: string | undefined;
    enterWaterSound: string | undefined;
    leaveWaterSound: string | undefined;
    turretRotateSound: string | undefined;
    workingSound: string | undefined;
    notWorkingSound: string | undefined;
    chronoInSound: string | undefined;
    chronoOutSound: string | undefined;
    enterTransportSound: string | undefined;
    leaveTransportSound: string | undefined;
    constructor(type: ObjectType, ini: IniSection, index: number, generalRules: GeneralRules);
    protected parse(): void;
    private parseWeaponName;
    private parseTurretIndexes;
    private parseBurstDelay;
    /** If the specified country is listed as an Owner */
    hasOwner(country: Country): boolean;
    /** If the object is available to the specified country (meets the Required/ForbiddenHouses values) */
    isAvailableTo(country: Country): boolean;
    getWeaponAtIndex(idx: number): string | undefined;
    getEliteWeaponAtIndex(idx: number): string | undefined;
}

/** Data structure for rules.ini terrain types */
export declare class TerrainRules extends ObjectRules {
    animationRate: number;
    animationProbability: number;
    gate: boolean;
    immune: boolean;
    isAnimated: boolean;
    radarInvisible: boolean;
    snowOccupationBits: number;
    spawnsTiberium: boolean;
    strength: number;
    temperateOccupationBits: number;
    protected parse(): void;
    private normalizeOccupationBits;
    getOccupationBits(theaterType: TheaterType): number;
    /** List of sub-cells that are occupied by this object */
    getOccupiedSubCells(theaterType: TheaterType): number[];
}

export declare enum TerrainType {
    Default = 0,
    Tunnel = 5,
    Railroad = 6,
    Rock1 = 7,
    Rock2 = 8,
    Water = 9,
    Shore = 10,
    /** Paved road, bridge start (paved?), paved road, pavement detail, wood bridge start */
    Pavement = 11,
    /** Dirt road */
    Dirt = 12,
    /** Snow, grass */
    Clear = 13,
    /** Dirty snow, ice, sand */
    Rough = 14,
    Cliff = 15
}

export declare enum TheaterType {
    None = 0,
    Temperate = 1,
    Urban = 2,
    Snow = 4,
    Lunar = 8,
    Desert = 16,
    NewUrban = 32,
    All = 63
}

export declare class ThreatRules {
    myEffectivenessCoefficientDefault: number;
    targetEffectivenessCoefficientDefault: number;
    targetSpecialThreatCoefficientDefault: number;
    targetStrengthCoefficientDefault: number;
    targetDistanceCoefficientDefault: number;
    readIni(ini: IniSection): this;
}

export declare interface Tile extends IsoTile {
    /**
     * Raw terrain type, as found in the mapfile.
     * This is altered by placed map objects and results in the landType property
     */
    terrainType: TerrainType;
    landType: LandType;
    /** If this tile has a bridge, it will have a different land type on the bridge */
    onBridgeLandType: LandType | undefined;
    rampType: number;
    /** This is needed for generating passability graph nodes */
    id: string;
    /** Duplicates tile occlusion state for data locality */
    occluded: boolean;
    tag?: Tag;
}

export declare interface TileResourceData {
    tile: Tile;
    /** Number of gem bails */
    gems: number;
    /** Number of ore bails */
    ore: number;
    /** Is this a mining drill? (tiberium tree) */
    spawnsOre: boolean;
}

export declare interface UnitData extends GameObjectData {
    rules: TechnoRules;
    owner: string;
    /** Distance in tiles at which the unit can see. Used for revealing shroud and auto-attack. */
    sight: number;
    veteranLevel: VeteranLevel;
    guardMode: boolean;
    purchaseValue: number;
    primaryWeapon?: WeaponData;
    secondaryWeapon?: WeaponData;
    deathWeapon?: WeaponData;
    attackState?: AttackState;
    hitPoints: number;
    maxHitPoints: number;
    /** Facing angle in degrees (counter-clockwise, relative to world N / screen NE) */
    direction?: number;
    onBridge?: boolean;
    zone?: ZoneType;
    buildStatus?: BuildStatus;
    factory?: FactoryData;
    rallyPoint?: Tile;
    isPoweredOn?: boolean;
    hasWrenchRepair?: boolean;
    garrisonUnitCount?: number;
    garrisonUnitsMax?: number;
    /** Facing angle of the turret in degrees, if applicable (counter-clockwise, relative to world N / screen NE) */
    turretFacing?: number;
    /** Which turret is currently being used, if applicable (for IFV) */
    turretNo?: number;
    isIdle?: boolean;
    /** If the unit is not currently incapacitated and is able to move */
    canMove?: boolean;
    /** The current velocity vector in world space */
    velocity?: Vector3;
    /** Only applicable to infantry */
    stance?: StanceType;
    /** Only applicable to harvesters */
    harvestedOre?: number;
    /** Only applicable to harvesters */
    harvestedGems?: number;
    /** Only applicable to transport vehicles */
    passengerSlotCount?: number;
    /** Only applicable to transport vehicles */
    passengerSlotMax?: number;
    /** Only applicable to aircraft */
    ammo?: number;
    /** If the unit is under the effect of a chrono/temporal weapon */
    isWarpedOut: boolean;
    /** The ID of the unit currently mind controlling us, if applicable */
    mindControlledBy?: number;
    /** The number of ticks remaining until dynamite attached to this unit explodes (from Crazy Ivan) */
    tntTimer?: number;
}

export declare class V3RocketRules extends MissileRules {
    readIni(ini: IniSection): this;
}

export declare class Vector2 extends THREE.Vector2 {
    length(): number;
    angle(): number;
    distanceTo(v: Vector2): number;
    rotateAround(center: Vector2, angle: number): this;
}

export declare class Vector3 extends THREE.Vector3 {
    applyEuler(euler: Euler): this;
    applyAxisAngle(axis: Vector3, angle: number): this;
    length(): number;
    projectOnPlane(planeNormal: Vector3): this;
    reflect(normal: Vector3): this;
    angleTo(v: Vector3): number;
    distanceTo(v: Vector3): number;
    setFromSpherical(s: Spherical): this;
    setFromCylindrical(c: Cylindrical): this;
}

export declare enum VeteranAbility {
    FASTER = 0,
    STRONGER = 1,
    FIREPOWER = 2,
    SCATTER = 3,
    ROF = 4,
    SIGHT = 5,
    SELF_HEAL = 6,
    CLOAK = 7,
    EXPLODES = 8,
    RADAR_INVISIBLE = 9,
    SENSORS = 10,
    FEARLESS = 11,
    C4 = 12,
    GUARD_AREA = 13,
    CRUSHER = 14
}

export declare enum VeteranLevel {
    None = 0,
    Veteran = 1,
    Elite = 2
}

export declare class VeteranRules {
    /** must destroy this multiple of self-value to become a veteran [per level] */
    veteranRatio: number;
    /** multiplier to damage */
    veteranCombat: number;
    /** multiplier to max speed */
    veteranSpeed: number;
    /** multiplier to sight */
    veteranSight: number;
    /** For armor, think of it as max strength being multiplied by the number (in reality, damage is divided by this */
    veteranArmor: number;
    /** ROF delay multiplier */
    veteranROF: number;
    /** maximum veteran level that can be obtained */
    veteranCap: number;
    /** Do initial forces start as veterans? */
    initialVeteran: boolean;
    readIni(ini: IniSection): this;
}

export declare enum VhpScan {
    None = 0,
    Normal = 1,
    Strong = 2
}

export declare class WarheadRules {
    private rules;
    affectsAllies: boolean;
    animList: string[];
    bombDisarm: boolean;
    bullets: boolean;
    causesDelayKill: boolean;
    cellSpread: number;
    /** This flag determines whether this warhead sinks and causes a water splash anim */
    conventional: boolean;
    culling: boolean;
    delayKillAtMax: number;
    delayKillFrames: number;
    electricAssault: boolean;
    emEffect: boolean;
    infDeath: InfDeathType;
    ivanBomb: boolean;
    makesDisguise: boolean;
    mindControl: boolean;
    nukeMaker: boolean;
    paralyzes: number;
    parasite: boolean;
    percentAtMax: number;
    proneDamage: number;
    psychicDamage: boolean;
    radiation: boolean;
    rocker: boolean;
    sonic: boolean;
    temporal: boolean;
    /** Damage multiplier per armor type */
    verses: Map<ArmorType, number>;
    wallAbsoluteDestroyer: boolean;
    wall: boolean;
    wood: boolean;
    constructor(rules: IniSection);
    get name(): string;
    private parse;
}

export declare interface WeaponData {
    type: WeaponType;
    rules: WeaponRules;
    projectileRules: ProjectileRules;
    warheadRules: WarheadRules;
    /** Minimum distance in tiles at which weapon can be fired */
    minRange: number;
    /** Maximum distance in tiles at which weapon can be fired */
    maxRange: number;
    /** Speed of the weapon's projectile in leptons/tick */
    speed: number;
    /** If the weapon just fired and is currently on cooldown, how many ticks remaining before it can fire again */
    cooldownTicks: number;
}

/** Data structure for a rules.ini weapon section */
export declare class WeaponRules {
    private rules;
    ambientDamage: number;
    anim: string[];
    areaFire: boolean;
    burst: number;
    cellRangefinding: boolean;
    damage: number;
    decloakToFire: boolean;
    fireOnce: boolean;
    isAlternateColor: boolean;
    isElectricBolt: boolean;
    isHouseColor: boolean;
    isLaser: boolean;
    isRadBeam: boolean;
    isSonic: boolean;
    laserDuration: number;
    limboLaunch: boolean;
    minimumRange: number;
    name: string;
    neverUse: boolean;
    omniFire: boolean;
    projectile: string;
    radLevel: number;
    range: number;
    report: string[];
    revealOnFire: boolean;
    rof: number;
    sabotageCursor: boolean;
    spawner: boolean;
    /** Speed in leptons/tick */
    speed: number;
    /** Original INI speed value */
    iniSpeed: number;
    suicide: boolean;
    useSparkParticles: boolean;
    warhead: string;
    constructor(rules: IniSection);
    private parse;
}

export declare enum WeaponType {
    Primary = 0,
    Secondary = 1,
    DeathWeapon = 2
}

export declare enum ZoneType {
    /** Unit is on the ground */
    Ground = 0,
    /** Unit is in the air */
    Air = 1,
    /** Unit is in the water */
    Water = 2
}

export { }

→返回《@chronodivide/game-api 使用教學與完整 API 對照表》

This article was last edited at