2018-03-17 19:37:46 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014-2018 OpenRCT2 developers
|
|
|
|
*
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
// OpenRCT2 Scripting API definition file
|
|
|
|
|
2018-03-18 02:55:12 +01:00
|
|
|
// To enable IntelliSense for your scripts in Visual Studio or Visual Studio Code,
|
|
|
|
// add the following line to the top of your script and change the path appropriately.
|
|
|
|
//
|
|
|
|
// /// <reference path="/path/to/openrct2.d.ts" />
|
|
|
|
//
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
export interface Console {
|
2018-03-18 02:55:12 +01:00
|
|
|
clear(): void;
|
2018-03-17 19:37:46 +01:00
|
|
|
log(message?: any, ...optionalParams: any[]): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Configuration {
|
|
|
|
getAll(pattern: string): { [name: string]: any };
|
|
|
|
get<T>(key: string): T | undefined;
|
|
|
|
get<T>(key: string, defaultValue: T): T;
|
|
|
|
set<T>(key: string, value: T): void;
|
|
|
|
has(key: string): boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Context {
|
|
|
|
/**
|
|
|
|
* The user's current configuration.
|
|
|
|
*/
|
|
|
|
configuration: Configuration;
|
2018-03-20 20:40:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a new intent (command) that can be mapped to a shortcut.
|
|
|
|
*/
|
|
|
|
registerIntent(desc: IntentDesc);
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
/**
|
|
|
|
* Subscribes to the given hook.
|
|
|
|
*/
|
2018-03-19 00:35:58 +01:00
|
|
|
subscribe(hook: string, callback: Function): IDisposable;
|
|
|
|
}
|
|
|
|
|
2018-03-20 20:40:38 +01:00
|
|
|
export interface IntentDesc
|
|
|
|
{
|
|
|
|
key: string;
|
|
|
|
title?: string;
|
|
|
|
shortcut?: string;
|
|
|
|
action: Function;
|
|
|
|
}
|
|
|
|
|
2018-03-19 00:35:58 +01:00
|
|
|
export interface IDisposable {
|
|
|
|
dispose(): void;
|
2018-03-17 19:37:46 +01:00
|
|
|
}
|
|
|
|
|
2018-03-20 20:40:38 +01:00
|
|
|
export type TileElementType =
|
2018-08-12 23:08:39 +02:00
|
|
|
"surface" | "footpath";
|
2018-03-20 20:40:38 +01:00
|
|
|
|
|
|
|
export interface TileElement {
|
|
|
|
type: TileElementType;
|
2018-08-12 23:08:39 +02:00
|
|
|
baseHeight: number;
|
|
|
|
clearanceHeight: number;
|
2018-03-20 20:40:38 +01:00
|
|
|
broken: boolean;
|
2018-08-11 16:55:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the element as a specific type to access its properties
|
|
|
|
*/
|
|
|
|
asSurface(): SurfaceElement;
|
2018-08-12 23:08:39 +02:00
|
|
|
asFootpath(): FootpathElement;
|
2018-08-11 16:55:02 +02:00
|
|
|
asTrack(): TrackElement;
|
|
|
|
asSmallScenery(): SmallSceneryElement;
|
|
|
|
asEntrance(): EntranceElement;
|
|
|
|
asWall(): WallElement;
|
|
|
|
asLargeScenery(): LargeSceneryElement;
|
|
|
|
asBanner(): BannerElement;
|
|
|
|
asCorruptElement(): CorruptElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SurfaceElement extends TileElement {
|
|
|
|
slope: number;
|
|
|
|
terrain: number;
|
|
|
|
waterHeight: number;
|
|
|
|
grassLength: number;
|
|
|
|
ownership: number;
|
|
|
|
parkFences: number;
|
|
|
|
}
|
|
|
|
|
2018-08-14 01:59:30 +02:00
|
|
|
export interface FootpathAdditionStatus {
|
|
|
|
north: number;
|
|
|
|
east: number;
|
|
|
|
south: number;
|
|
|
|
west: number;
|
|
|
|
}
|
|
|
|
|
2018-08-12 23:08:39 +02:00
|
|
|
export interface FootpathAddition {
|
|
|
|
type: number;
|
|
|
|
isBin: boolean;
|
|
|
|
isBench: boolean;
|
|
|
|
isLamp: boolean;
|
|
|
|
isBreakable: boolean;
|
|
|
|
isJumpingFountainWater: boolean;
|
|
|
|
isJumpingFountainSnow: boolean;
|
|
|
|
allowedOnQueue: boolean;
|
|
|
|
allowedOnSlope: boolean;
|
|
|
|
isQueueScreen: boolean;
|
2018-08-14 01:59:30 +02:00
|
|
|
status: FootpathAdditionStatus;
|
2018-08-12 23:08:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the path addition
|
|
|
|
*/
|
|
|
|
remove(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface FootpathElement extends TileElement {
|
2018-08-14 01:59:30 +02:00
|
|
|
footpathType: number;
|
2018-08-12 23:08:39 +02:00
|
|
|
isSloped: boolean;
|
2018-08-14 02:02:43 +02:00
|
|
|
isQueue: boolean;
|
2018-08-12 23:08:39 +02:00
|
|
|
addition: FootpathAddition;
|
2018-08-14 02:02:43 +02:00
|
|
|
edges: number;
|
|
|
|
corners: number;
|
|
|
|
rideIndex: number;
|
2018-08-12 23:08:39 +02:00
|
|
|
}
|
|
|
|
|
2018-08-11 16:55:02 +02:00
|
|
|
export interface TrackElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SmallSceneryElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface EntranceElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface WallElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface LargeSceneryElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BannerElement extends TileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CorruptElement extends TileElement {
|
2018-03-20 20:40:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Tile {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
elements: TileElement[];
|
2018-08-11 16:55:02 +02:00
|
|
|
|
|
|
|
getElement(index: number): TileElement;
|
2018-03-20 20:40:38 +01:00
|
|
|
}
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
export interface Ride {
|
|
|
|
name: string;
|
|
|
|
excitement: number;
|
|
|
|
intensity: number;
|
|
|
|
nausea: number;
|
|
|
|
totalCustomers: number;
|
|
|
|
}
|
|
|
|
|
2018-03-20 20:40:38 +01:00
|
|
|
export type TileElementType =
|
|
|
|
"car" | "duck" | "peep";
|
|
|
|
|
|
|
|
export interface Thing {
|
|
|
|
type: ThingType;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
z: number;
|
|
|
|
|
|
|
|
// Peep
|
|
|
|
tshirt: number;
|
|
|
|
trousers: number;
|
|
|
|
}
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
export interface Map {
|
2018-03-20 20:40:38 +01:00
|
|
|
size: { x: number; y: number; };
|
|
|
|
rides: number;
|
|
|
|
things: number;
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
getRide(id: number): Ride;
|
2018-03-20 20:40:38 +01:00
|
|
|
getTile(x: number, y: number): Tile;
|
|
|
|
getThing(id: number): Thing;
|
2018-03-17 19:37:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type ParkMessageType =
|
|
|
|
"attraction" | "peep_on_attraction" | "peep" | "money" | "blank" | "research" | "guests" | "award" | "chart";
|
|
|
|
|
|
|
|
export interface ParkMessage {
|
|
|
|
type: ParkMessageType;
|
|
|
|
text: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Park {
|
|
|
|
cash: number;
|
|
|
|
rating: number;
|
|
|
|
bankLoan: number;
|
|
|
|
maxBankLoan: number;
|
|
|
|
|
2018-03-25 23:04:36 +02:00
|
|
|
postMessage(message: string): void;
|
2018-03-17 19:37:46 +01:00
|
|
|
postMessage(message: ParkMessage): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Window {
|
|
|
|
id: number;
|
|
|
|
classification: string;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
title: string;
|
2018-03-24 01:40:51 +01:00
|
|
|
isSticky: boolean;
|
|
|
|
|
|
|
|
close(): void;
|
2018-03-17 19:37:46 +01:00
|
|
|
}
|
|
|
|
|
2018-03-25 23:04:36 +02:00
|
|
|
export type WidgetType =
|
|
|
|
"button" | "dropdown";
|
|
|
|
|
|
|
|
export interface Widget {
|
|
|
|
type: WidgetType;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ButtonWidget extends Widget {
|
|
|
|
text: string;
|
|
|
|
onClick: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DropdownWidget extends Widget {
|
|
|
|
items: string[];
|
|
|
|
selectedIndex: number;
|
|
|
|
onChanged: (index: number) => void;
|
|
|
|
}
|
|
|
|
|
2018-03-17 19:37:46 +01:00
|
|
|
export interface WindowDesc {
|
|
|
|
classification: string;
|
|
|
|
x?: number;
|
|
|
|
y?: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
title: string;
|
|
|
|
id?: number;
|
2018-03-25 19:23:24 +02:00
|
|
|
minWidth?: number;
|
|
|
|
minHeight?: number;
|
2018-03-25 23:04:36 +02:00
|
|
|
widgets?: Widget[];
|
2018-03-17 19:37:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Ui {
|
2018-03-24 01:40:51 +01:00
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
windows: number;
|
|
|
|
|
|
|
|
getWindow(id: number): Window;
|
|
|
|
getWindow(classification: string, id?: number): Window;
|
2018-03-17 19:37:46 +01:00
|
|
|
openWindow(desc: WindowDesc): Window;
|
|
|
|
closeWindows(classification: string, id?: number): void;
|
|
|
|
closeAllWindows(): void;
|
|
|
|
}
|
|
|
|
|
2019-07-24 22:08:03 +02:00
|
|
|
export interface Player {
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Network {
|
|
|
|
players: number;
|
|
|
|
|
|
|
|
getPlayer(index: number): Player;
|
|
|
|
sendMessage(message: string);
|
|
|
|
sendMessage(players: number[], message: string);
|
|
|
|
}
|
|
|
|
|
2018-03-18 02:55:12 +01:00
|
|
|
declare global {
|
|
|
|
var console: Console;
|
|
|
|
var context: Context;
|
|
|
|
var map: Map;
|
2019-07-24 22:08:03 +02:00
|
|
|
var network: Network;
|
2018-03-18 02:55:12 +01:00
|
|
|
var park: Park;
|
|
|
|
var ui: Ui;
|
|
|
|
}
|