2018-03-17 19:37:46 +01:00
|
|
|
/*****************************************************************************
|
2020-02-19 02:00:02 +01:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2018-03-17 19:37:46 +01:00
|
|
|
*
|
|
|
|
* 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" />
|
|
|
|
//
|
|
|
|
|
2020-02-25 01:44:02 +01:00
|
|
|
export type PluginType = "local" | "remote";
|
2020-02-07 00:15:20 +01:00
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
declare global {
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Global context for accessing all other APIs.
|
|
|
|
*/
|
2020-05-10 18:02:10 +02:00
|
|
|
/** APIs for cheats. */
|
|
|
|
var cheats: Cheats;
|
2020-03-07 14:11:08 +01:00
|
|
|
/** APIs for interacting with the stdout console. */
|
|
|
|
var console: Console;
|
|
|
|
/** Core APIs for plugins. */
|
|
|
|
var context: Context;
|
|
|
|
/** APIs for getting or setting the in-game date. */
|
|
|
|
var date: GameDate;
|
|
|
|
/** APIs for manipulating the map. */
|
|
|
|
var map: GameMap;
|
|
|
|
/** APIs for managing the server or interacting with the server or clients. */
|
|
|
|
var network: Network;
|
|
|
|
/** APIs for the park and management of it. */
|
|
|
|
var park: Park;
|
2020-05-11 04:26:10 +02:00
|
|
|
/**
|
2020-03-07 14:11:08 +01:00
|
|
|
* APIs for controlling the user interface.
|
|
|
|
* These will only be available to servers and clients that are not running headless mode.
|
|
|
|
* Plugin writers should check if ui is available using `typeof ui !== 'undefined'`.
|
|
|
|
*/
|
|
|
|
var ui: Ui;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers the plugin. This only only be called once.
|
|
|
|
* @param metadata Information about the plugin and the entry point.
|
|
|
|
*/
|
|
|
|
function registerPlugin(metadata: PluginMetadata): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a JavaScript object that can or should be disposed when no longer needed.
|
|
|
|
*/
|
|
|
|
interface IDisposable {
|
|
|
|
dispose(): void;
|
|
|
|
}
|
|
|
|
|
2020-05-02 12:42:43 +02:00
|
|
|
/**
|
|
|
|
* A coordinate within the game's client screen in pixels.
|
|
|
|
*/
|
|
|
|
interface ScreenCoordsXY {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* A coordinate within the game.
|
|
|
|
* Each in-game tile is a size of 32x32.
|
|
|
|
*/
|
2020-05-02 12:42:43 +02:00
|
|
|
interface CoordsXY {
|
2020-03-07 14:11:08 +01:00
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A coordinate within the game.
|
|
|
|
* Each in-game tile is a size of 32x32.
|
|
|
|
* The z-coordinate raises 16 per land increment. A full-height wall is 32 in height.
|
|
|
|
*/
|
2020-05-02 12:42:43 +02:00
|
|
|
interface CoordsXYZ extends CoordsXY {
|
2020-03-07 14:11:08 +01:00
|
|
|
z: number;
|
|
|
|
}
|
|
|
|
|
2020-05-11 01:00:15 +02:00
|
|
|
/**
|
|
|
|
* A coordinate within the game.
|
|
|
|
* Each in-game tile is a size of 32x32.
|
|
|
|
* The z-coordinate raises 16 per land increment. A full-height wall is 32 in height.
|
|
|
|
* The direction is between 0 and 3.
|
|
|
|
*/
|
|
|
|
interface CoordsXYZD extends CoordsXYZ {
|
|
|
|
direction: number;
|
|
|
|
}
|
|
|
|
|
2020-05-01 18:04:37 +02:00
|
|
|
/**
|
|
|
|
* A rectangular area specified using two coordinates.
|
|
|
|
*/
|
|
|
|
interface MapRange {
|
2020-05-02 12:42:43 +02:00
|
|
|
leftTop: CoordsXY;
|
|
|
|
rightBottom: CoordsXY;
|
2020-05-01 18:04:37 +02:00
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Represents information about the plugin such as type, name, author and version.
|
|
|
|
* It also includes the entry point.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface PluginMetadata {
|
|
|
|
name: string;
|
|
|
|
version: string;
|
|
|
|
authors: string | string[];
|
|
|
|
type: PluginType;
|
2020-02-19 02:00:02 +01:00
|
|
|
minApiVersion?: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
main: () => void;
|
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Console APIs
|
|
|
|
* Currently interact with stdout.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface Console {
|
|
|
|
clear(): void;
|
|
|
|
log(message?: any, ...optionalParams: any[]): void;
|
2020-04-27 23:02:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Executes a command using the legacy console REPL. This should not be used
|
|
|
|
* by plugins, and exists only for servers to continue using old commands until
|
|
|
|
* all functionality can be accomplished with this scripting API.
|
2020-05-11 04:26:10 +02:00
|
|
|
*
|
2020-04-27 23:02:38 +02:00
|
|
|
* @deprecated
|
|
|
|
* @param command The command and arguments to execute.
|
|
|
|
*/
|
|
|
|
executeLegacy(command: string): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Core APIs for storage and subscriptions.
|
|
|
|
*/
|
|
|
|
interface Context {
|
|
|
|
/**
|
|
|
|
* The user's current configuration.
|
|
|
|
*/
|
|
|
|
configuration: Configuration;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shared generic storage for all plugins. Data is persistant across instances
|
|
|
|
* of OpenRCT2 and is stored externally as a single JSON file in the OpenRCT2
|
|
|
|
* user directory. Internally it is a JavaScript object. Objects and arrays
|
|
|
|
* are only copied by reference. The external file is only written when using
|
|
|
|
* the `set` method, do not rely on the file being saved by modifying your own
|
|
|
|
* objects. Functions and other internal structures will not be persisted.
|
|
|
|
*/
|
|
|
|
sharedStorage: Configuration;
|
|
|
|
|
2020-05-09 13:55:24 +02:00
|
|
|
/**
|
|
|
|
* Render the current state of the map and save to disc.
|
|
|
|
* Useful for server administration and timelapse creation.
|
|
|
|
* @param options Options that control the capture and output file.
|
|
|
|
*/
|
|
|
|
captureImage(options: CaptureOptions): void;
|
|
|
|
|
2020-03-07 15:41:29 +01:00
|
|
|
/**
|
|
|
|
* Gets the loaded object at the given index.
|
|
|
|
* @param type The object type.
|
|
|
|
* @param index The index.
|
|
|
|
*/
|
|
|
|
getObject(type: ObjectType, index: number): Object;
|
|
|
|
getObject(type: "ride", index: number): RideObject;
|
2020-04-27 18:41:49 +02:00
|
|
|
getObject(type: "small_scenery", index: number): SmallSceneryObject;
|
2020-03-07 15:41:29 +01:00
|
|
|
|
|
|
|
getAllObjects(type: ObjectType): Object[];
|
|
|
|
getAllObjects(type: "ride"): RideObject[];
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Gets a random integer within the specified range using the game's pseudo-
|
|
|
|
* random number generator. This is part of the game state and shared across
|
|
|
|
* all clients, you therefore must be in a context that can mutate the game
|
|
|
|
* state. Use this to generate random numbers instead of Math.Random during
|
|
|
|
* game logic routines such as hooks and game actions.
|
|
|
|
* @param min The minimum value inclusive.
|
|
|
|
* @param max The maximum value exclusive.
|
|
|
|
*/
|
|
|
|
getRandom(min: number, max: number): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a new game action that allows clients to interact with the game.
|
|
|
|
* @param action The unique name of the action.
|
|
|
|
* @param query Logic for validating and returning a price for an action.
|
|
|
|
* @param execute Logic for validating and executing the action.
|
|
|
|
* @throws An error if the action has already been registered by this or another plugin.
|
|
|
|
*/
|
|
|
|
registerAction(
|
|
|
|
action: string,
|
|
|
|
query: (args: object) => GameActionResult,
|
|
|
|
execute: (args: object) => GameActionResult): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the result of running a game action. This allows you to check the outcome and validity of
|
|
|
|
* an action without actually executing it.
|
|
|
|
* @param action The name of the action.
|
|
|
|
* @param args The action parameters.
|
|
|
|
* @param callback The function to be called with the result of the action.
|
|
|
|
*/
|
|
|
|
queryAction(action: string, args: object, callback: (result: GameActionResult) => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Executes a game action. In a network game, this will send a request to the server and wait
|
|
|
|
* for the server to reply.
|
|
|
|
* @param action The name of the action.
|
|
|
|
* @param args The action parameters.
|
|
|
|
* @param callback The function to be called with the result of the action.
|
|
|
|
*/
|
|
|
|
executeAction(action: string, args: object, callback: (result: GameActionResult) => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribes to the given hook.
|
|
|
|
*/
|
|
|
|
subscribe(hook: HookType, callback: Function): IDisposable;
|
|
|
|
|
|
|
|
subscribe(hook: "action.query", callback: (e: GameActionEventArgs) => void): IDisposable;
|
|
|
|
subscribe(hook: "action.execute", callback: (e: GameActionEventArgs) => void): IDisposable;
|
|
|
|
subscribe(hook: "interval.tick", callback: () => void): IDisposable;
|
|
|
|
subscribe(hook: "interval.day", callback: () => void): IDisposable;
|
|
|
|
subscribe(hook: "network.chat", callback: (e: NetworkChatEventArgs) => void): IDisposable;
|
2020-04-28 20:33:30 +02:00
|
|
|
subscribe(hook: "network.authenticate", callback: (e: NetworkAuthenticateEventArgs) => void): IDisposable;
|
2020-03-07 14:11:08 +01:00
|
|
|
subscribe(hook: "network.join", callback: (e: NetworkEventArgs) => void): IDisposable;
|
|
|
|
subscribe(hook: "network.leave", callback: (e: NetworkEventArgs) => void): IDisposable;
|
2020-05-11 04:26:10 +02:00
|
|
|
subscribe(hook: "ride.ratings.calculate", callback: (e: RideRatingsCalculateArgs) => void): IDisposable;
|
2020-03-07 14:11:08 +01:00
|
|
|
}
|
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
interface Configuration {
|
2020-03-06 21:17:15 +01:00
|
|
|
getAll(namespace: string): { [name: string]: any };
|
2020-02-18 23:31:43 +01:00
|
|
|
get<T>(key: string): T | undefined;
|
|
|
|
get<T>(key: string, defaultValue: T): T;
|
|
|
|
set<T>(key: string, value: T): void;
|
|
|
|
has(key: string): boolean;
|
|
|
|
}
|
|
|
|
|
2020-05-09 13:55:24 +02:00
|
|
|
interface CaptureOptions {
|
|
|
|
/**
|
|
|
|
* A relative filename from the screenshot directory to save the capture as.
|
|
|
|
* By default, the filename will be automatically generated using the system date and time.
|
|
|
|
*/
|
|
|
|
filename?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Width of the capture in pixels.
|
|
|
|
* Do not set if you would like a giant screenshot.
|
|
|
|
*/
|
|
|
|
width?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Height of the capture in pixels.
|
|
|
|
* Do not set if you would like a giant screenshot.
|
|
|
|
*/
|
|
|
|
height?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Map position to centre the view on in map units.
|
|
|
|
* Do not set if you would like a giant screenshot.
|
|
|
|
*/
|
|
|
|
position?: CoordsXY;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The zoom level, 0 is 1:1, 1 is 2:1, 2 is 4:1 etc.
|
|
|
|
*/
|
|
|
|
zoom: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rotation of the camera from 0 to 3.
|
|
|
|
*/
|
|
|
|
rotation: number;
|
|
|
|
}
|
|
|
|
|
2020-03-07 15:41:29 +01:00
|
|
|
type ObjectType =
|
|
|
|
"ride" |
|
|
|
|
"small_scenery" |
|
|
|
|
"large_scenery" |
|
|
|
|
"wall" |
|
|
|
|
"banner" |
|
|
|
|
"footpath" |
|
|
|
|
"footpath_addition" |
|
|
|
|
"scenery_group" |
|
|
|
|
"park_entrance" |
|
|
|
|
"water" |
|
|
|
|
"terrain_surface" |
|
|
|
|
"terrain_edge" |
|
|
|
|
"station" |
|
|
|
|
"music";
|
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
type HookType =
|
|
|
|
"interval.tick" | "interval.day" |
|
2020-05-11 04:26:10 +02:00
|
|
|
"network.chat" | "network.action" | "network.join" | "network.leave" |
|
|
|
|
"ride.ratings.calculate";
|
2020-02-18 23:31:43 +01:00
|
|
|
|
|
|
|
type ExpenditureType =
|
|
|
|
"ride_construction" |
|
|
|
|
"ride_runningcosts" |
|
|
|
|
"land_purchase" |
|
|
|
|
"landscaping" |
|
|
|
|
"park_entrance_tickets" |
|
|
|
|
"park_ride_tickets" |
|
|
|
|
"shop_sales" |
|
|
|
|
"shop_stock" |
|
|
|
|
"food_drink_sales" |
|
|
|
|
"food_drink_stock" |
|
|
|
|
"wages" |
|
|
|
|
"marketing" |
|
|
|
|
"research" |
|
|
|
|
"interest";
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
interface GameActionEventArgs {
|
|
|
|
readonly player: number;
|
|
|
|
readonly type: string;
|
|
|
|
readonly isClientOnly: boolean;
|
2020-05-05 00:01:17 +02:00
|
|
|
readonly args: object;
|
2020-03-07 14:11:08 +01:00
|
|
|
result: GameActionResult;
|
|
|
|
}
|
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
interface GameActionResult {
|
2020-05-02 12:45:05 +02:00
|
|
|
error?: number;
|
2020-03-01 16:52:18 +01:00
|
|
|
errorTitle?: string;
|
|
|
|
errorMessage?: string;
|
2020-05-02 12:42:43 +02:00
|
|
|
position?: CoordsXYZ;
|
2020-03-04 21:03:13 +01:00
|
|
|
cost?: number;
|
|
|
|
expenditureType?: ExpenditureType;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-06 01:04:29 +01:00
|
|
|
interface RideCreateGameActionResult extends GameActionResult {
|
|
|
|
readonly ride: number;
|
|
|
|
}
|
|
|
|
|
2020-03-04 21:03:13 +01:00
|
|
|
interface NetworkEventArgs {
|
|
|
|
readonly player: number;
|
|
|
|
}
|
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
interface NetworkChatEventArgs extends NetworkEventArgs {
|
|
|
|
message: string;
|
|
|
|
}
|
|
|
|
|
2020-04-28 20:33:30 +02:00
|
|
|
interface NetworkAuthenticateEventArgs {
|
|
|
|
readonly name: number;
|
|
|
|
readonly ipAddress: string;
|
|
|
|
readonly publicKeyHash: string;
|
|
|
|
cancel: boolean;
|
|
|
|
}
|
|
|
|
|
2020-05-11 04:26:10 +02:00
|
|
|
interface RideRatingsCalculateArgs {
|
|
|
|
readonly rideId: number;
|
|
|
|
excitement: number;
|
|
|
|
intensity: number;
|
|
|
|
nausea: number;
|
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* APIs for the in-game date.
|
|
|
|
*/
|
|
|
|
interface GameDate {
|
2020-02-18 23:31:43 +01:00
|
|
|
/**
|
2020-03-07 14:11:08 +01:00
|
|
|
* The total number of ticks that have elapsed since the beginning of the game / scenario. This
|
|
|
|
* should never reset.
|
2020-02-18 23:31:43 +01:00
|
|
|
*/
|
2020-03-07 14:11:08 +01:00
|
|
|
readonly ticksElapsed: number;
|
2020-03-01 16:52:18 +01:00
|
|
|
/**
|
2020-03-07 14:11:08 +01:00
|
|
|
* The total number of months that have elapsed. This will equate to 16 on 1st March, Year 2.
|
|
|
|
* Note: this represents the current date and may be reset by cheats or scripts.
|
2020-03-01 16:52:18 +01:00
|
|
|
*/
|
2020-03-07 14:11:08 +01:00
|
|
|
monthsElapsed: number;
|
2020-03-01 16:52:18 +01:00
|
|
|
/**
|
2020-03-07 14:11:08 +01:00
|
|
|
* The total number of years that have elapsed. This always equates to (monthsElapsed / 8).
|
2020-03-01 16:52:18 +01:00
|
|
|
*/
|
2020-03-07 14:11:08 +01:00
|
|
|
readonly yearsElapsed: number;
|
2020-03-01 16:52:18 +01:00
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
/**
|
2020-03-07 14:11:08 +01:00
|
|
|
* How far through the month we are between 0 and 65536. This is incremented by 4 each tick, so
|
|
|
|
* every month takes ~6.8 minutes to complete making a year take just under an hour.
|
2020-02-18 23:31:43 +01:00
|
|
|
*/
|
2020-03-07 14:11:08 +01:00
|
|
|
monthProgress: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/** The day of the month from 1 to 31. */
|
|
|
|
readonly day: number;
|
|
|
|
/** The current month of the year from 0 to 7, where 0 is March and 7 is October. */
|
|
|
|
readonly month: number;
|
|
|
|
/** The current year starting from 1. */
|
|
|
|
readonly year: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* APIs for the map.
|
|
|
|
*/
|
|
|
|
interface GameMap {
|
2020-05-02 12:42:43 +02:00
|
|
|
readonly size: CoordsXY;
|
2020-03-07 14:11:08 +01:00
|
|
|
readonly numRides: number;
|
2020-04-21 20:32:08 +02:00
|
|
|
readonly numEntities: number;
|
2020-03-07 14:11:08 +01:00
|
|
|
readonly rides: Ride[];
|
2020-02-18 23:31:43 +01:00
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
getRide(id: number): Ride;
|
|
|
|
getTile(x: number, y: number): Tile;
|
2020-04-21 20:32:08 +02:00
|
|
|
getEntity(id: number): Entity;
|
2020-05-10 23:20:11 +02:00
|
|
|
getAllEntities(type: EntityType): Entity[];
|
|
|
|
getAllEntities(type: "peep"): Peep[];
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type TileElementType =
|
2020-05-05 00:05:55 +02:00
|
|
|
"surface" | "footpath" | "track" | "small_scenery" | "wall" | "entrance" | "large_scenery" | "banner"
|
|
|
|
/** This only exist to retrieve the types for existing corrupt elements. For hiding elements, use the isHidden field instead. */
|
|
|
|
| "openrct2_corrupt_deprecated";
|
2020-02-18 23:31:43 +01:00
|
|
|
|
|
|
|
interface BaseTileElement {
|
|
|
|
type: TileElementType;
|
2020-04-23 00:20:54 +02:00
|
|
|
baseHeight: number;
|
|
|
|
clearanceHeight: number;
|
2020-05-05 00:05:55 +02:00
|
|
|
isHidden: boolean; /** Take caution when changing this field, it may invalidate TileElements you have stored in your script. */
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface SurfaceElement extends BaseTileElement {
|
|
|
|
slope: number;
|
2020-02-29 22:44:40 +01:00
|
|
|
surfaceStyle: number;
|
|
|
|
edgeStyle: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
waterHeight: number;
|
|
|
|
grassLength: number;
|
|
|
|
ownership: number;
|
|
|
|
parkFences: number;
|
2020-02-29 22:44:40 +01:00
|
|
|
|
|
|
|
readonly hasOwnership: boolean;
|
|
|
|
readonly hasConstructionRights: boolean;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface FootpathElement extends BaseTileElement {
|
|
|
|
footpathType: number;
|
2020-03-08 12:30:57 +01:00
|
|
|
edgesAndCorners: number;
|
|
|
|
slopeDirection: number | null;
|
|
|
|
isBlockedByVehicle: boolean;
|
|
|
|
isWide: boolean;
|
|
|
|
|
2020-02-18 23:31:43 +01:00
|
|
|
isQueue: boolean;
|
2020-03-08 12:30:57 +01:00
|
|
|
queueBannerDirection: number | null;
|
|
|
|
ride: number;
|
|
|
|
station: number;
|
|
|
|
|
|
|
|
addition: number | null;
|
|
|
|
isAdditionBroken: boolean;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface TrackElement extends BaseTileElement {
|
2020-02-29 22:44:40 +01:00
|
|
|
trackType: number;
|
|
|
|
sequence: number;
|
|
|
|
ride: number;
|
|
|
|
station: number;
|
|
|
|
hasChainLift: boolean;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface SmallSceneryElement extends BaseTileElement {
|
2020-02-29 23:08:09 +01:00
|
|
|
object: number;
|
|
|
|
primaryColour: number;
|
|
|
|
secondaryColour: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface EntranceElement extends BaseTileElement {
|
2020-02-29 23:08:09 +01:00
|
|
|
object: number;
|
|
|
|
sequence: number;
|
|
|
|
ride: number;
|
|
|
|
station: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface WallElement extends BaseTileElement {
|
2020-02-29 23:08:09 +01:00
|
|
|
object: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface LargeSceneryElement extends BaseTileElement {
|
2020-02-29 23:08:09 +01:00
|
|
|
object: number;
|
|
|
|
primaryColour: number;
|
|
|
|
secondaryColour: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface BannerElement extends BaseTileElement {
|
|
|
|
}
|
|
|
|
|
|
|
|
interface CorruptElement extends BaseTileElement {
|
|
|
|
}
|
|
|
|
|
2020-02-29 22:44:40 +01:00
|
|
|
type TileElement = SurfaceElement | FootpathElement | TrackElement;
|
|
|
|
|
2020-02-28 21:56:04 +01:00
|
|
|
/**
|
|
|
|
* Represents a tile containing tile elements on the map. This is a fixed handle
|
|
|
|
* for a given tile position. It can be re-used safely between game ticks.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface Tile {
|
2020-02-28 21:56:04 +01:00
|
|
|
/** The x position in tiles. */
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly x: number;
|
2020-02-28 21:56:04 +01:00
|
|
|
/** The y position in tiles. */
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly y: number;
|
2020-02-28 21:56:04 +01:00
|
|
|
/** Gets an array of all the tile elements on this tile. */
|
|
|
|
readonly elements: TileElement[];
|
|
|
|
/** Gets the number of tile elements on this tile. */
|
|
|
|
readonly numElements: number;
|
|
|
|
/**
|
|
|
|
* Gets or sets the raw data for this tile.
|
|
|
|
* This can provide more control and efficiency for tile manipulation but requires
|
|
|
|
* knowledge of tile element structures and may change between versions of OpenRCT2.
|
|
|
|
*/
|
|
|
|
data: Uint8Array;
|
2020-02-18 23:31:43 +01:00
|
|
|
|
2020-02-28 21:56:04 +01:00
|
|
|
/** Gets the tile element at the given index on this tile. */
|
2020-02-18 23:31:43 +01:00
|
|
|
getElement(index: number): TileElement;
|
2020-02-28 21:56:04 +01:00
|
|
|
/** Gets the tile element at the given index on this tile. */
|
|
|
|
getElement<T extends BaseTileElement>(index: number): T;
|
|
|
|
/** Inserts a new tile element at the given index on this tile. */
|
|
|
|
insertElement(index: number): TileElement;
|
|
|
|
/** Removes the tile element at the given index from this tile. */
|
|
|
|
removeElement(index: number): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* Represents the definition of a loaded object (.DAT or .json) such a ride type or scenery item.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface Object {
|
2020-03-07 15:41:29 +01:00
|
|
|
/**
|
|
|
|
* The object type.
|
|
|
|
*/
|
|
|
|
readonly type: ObjectType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The index of the loaded object for the object type.
|
|
|
|
*/
|
|
|
|
readonly index: number;
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-05-07 20:35:30 +02:00
|
|
|
* The unique identifier of the object, e.g. "rct2.burgb".
|
|
|
|
* Only JSON objects will have an identifier.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly identifier: string;
|
2020-05-07 20:35:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The original unique identifier of the object, e.g. "BURGB ".
|
|
|
|
* This may have trailing spaces if the name is shorter than 8 characters.
|
|
|
|
* Only .DAT objects or JSON objects based on .DAT objects will have legacy identifiers.
|
|
|
|
*/
|
|
|
|
readonly legacyIdentifier: string;
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The name in the user's current language.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly name: string;
|
|
|
|
}
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* Represents the object definition of a ride or stall.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface RideObject extends Object {
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The description of the ride / stall in the player's current language.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly description: string;
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* A text description describing the capacity of the ride in the player's current language.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly capacity: string;
|
2020-05-07 21:53:48 +02:00
|
|
|
|
|
|
|
readonly flags: number;
|
|
|
|
readonly rideType: number[];
|
|
|
|
readonly minCarsInTrain: number;
|
|
|
|
readonly maxCarsInTrain: number;
|
|
|
|
readonly carsPerFlatRide: number;
|
|
|
|
readonly zeroCars: number;
|
|
|
|
readonly tabVehicle: number;
|
|
|
|
readonly defaultVehicle: number;
|
|
|
|
readonly frontVehicle: number;
|
|
|
|
readonly secondVehicle: number;
|
|
|
|
readonly rearVehicle: number;
|
|
|
|
readonly thirdVehicle: number;
|
|
|
|
readonly vehicles: RideObjectVehicle[];
|
|
|
|
readonly excitementMultiplier: number;
|
|
|
|
readonly intensityMultiplier: number;
|
|
|
|
readonly nauseaMultiplier: number;
|
|
|
|
readonly maxHeight: number;
|
|
|
|
readonly shopItem: number;
|
|
|
|
readonly shopItemSecondary: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a defined vehicle within a Ride object definition.
|
|
|
|
*/
|
|
|
|
interface RideObjectVehicle {
|
|
|
|
readonly rotationFrameMask: number;
|
|
|
|
readonly numVerticalFrames: number;
|
|
|
|
readonly numHorizontalFrames: number;
|
|
|
|
readonly spacing: number;
|
|
|
|
readonly carMass: number;
|
|
|
|
readonly tabHeight: number;
|
|
|
|
readonly numSeats: number;
|
|
|
|
readonly spriteFlags: number;
|
|
|
|
readonly spriteWidth: number;
|
|
|
|
readonly spriteHeightNegative: number;
|
|
|
|
readonly spriteHeightPositive: number;
|
|
|
|
readonly animation: number;
|
|
|
|
readonly flags: number;
|
|
|
|
readonly baseNumFrames: number;
|
|
|
|
readonly baseImageId: number;
|
|
|
|
readonly restraintImageId: number;
|
|
|
|
readonly gentleSlopeImageId: number;
|
|
|
|
readonly steepSlopeImageId: number;
|
|
|
|
readonly verticalSlopeImageId: number;
|
|
|
|
readonly diagonalSlopeImageId: number;
|
|
|
|
readonly bankedImageId: number;
|
|
|
|
readonly inlineTwistImageId: number;
|
|
|
|
readonly flatToGentleBankImageId: number;
|
|
|
|
readonly diagonalToGentleSlopeBankImageId: number;
|
|
|
|
readonly gentleSlopeToBankImageId: number;
|
|
|
|
readonly gentleSlopeBankTurnImageId: number;
|
|
|
|
readonly flatBankToGentleSlopeImageId: number;
|
|
|
|
readonly curvedLiftHillImageId: number;
|
|
|
|
readonly corkscrewImageId: number;
|
|
|
|
readonly noVehicleImages: number;
|
|
|
|
readonly noSeatingRows: number;
|
|
|
|
readonly spinningInertia: number;
|
|
|
|
readonly spinningFriction: number;
|
|
|
|
readonly frictionSoundId: number;
|
|
|
|
readonly logFlumeReverserVehicleType: number;
|
|
|
|
readonly soundRange: number;
|
|
|
|
readonly doubleSoundFrequency: number;
|
|
|
|
readonly poweredAcceleration: number;
|
|
|
|
readonly poweredMaxSpeed: number;
|
|
|
|
readonly carVisual: number;
|
|
|
|
readonly effectVisual: number;
|
|
|
|
readonly drawOrder: number;
|
|
|
|
readonly numVerticalFramesOverride: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:41:49 +02:00
|
|
|
/**
|
|
|
|
* Represents the object definition of a small scenery item such a tree.
|
|
|
|
*/
|
|
|
|
interface SmallSceneryObject extends Object {
|
|
|
|
/**
|
|
|
|
* Raw bit flags that describe characteristics of the scenery item.
|
|
|
|
*/
|
|
|
|
readonly flags: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default clearance height of the scenery item.
|
|
|
|
*/
|
|
|
|
readonly height: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How much the scenery item costs to build.
|
|
|
|
*/
|
|
|
|
readonly price: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How much the scenery item costs to remove.
|
|
|
|
*/
|
|
|
|
readonly removalPrice: number;
|
|
|
|
}
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* Represents a ride or stall within the park.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
interface Ride {
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The object metadata for this ride.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly object: RideObject;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The unique ID / index of the ride.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
readonly id: number;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The type of the ride represented as the internal built-in ride type ID.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
type: number;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the ride is a ride, shop or facility.
|
|
|
|
*/
|
|
|
|
readonly classification: RideClassification;
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The generated or custom name of the ride.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
name: string;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the ride is open, closed or testing.
|
|
|
|
*/
|
|
|
|
readonly status: RideStatus;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Various flags related to the operation of the ride.
|
|
|
|
*/
|
|
|
|
lifecycleFlags: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The operation mode.
|
|
|
|
*/
|
|
|
|
mode: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flags related to how trains depart.
|
|
|
|
*/
|
|
|
|
departFlags: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The minimum time a train will wait at the station before departing.
|
|
|
|
*/
|
|
|
|
minimumWaitingTime: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum time a train will wait at the station before departing.
|
|
|
|
*/
|
|
|
|
maximumWaitingTime: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The head vehicle IDs associated with the ride, one for each train.
|
|
|
|
*/
|
|
|
|
readonly vehicles: number[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The colour for each vehicle when the ride opens. Modifying this directly will not
|
|
|
|
* change the colour of any currently running trains nor will it reflect them if they
|
|
|
|
* have been modified.
|
|
|
|
*/
|
|
|
|
vehicleColours: VehicleColour[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The track colour schemes for the ride.
|
|
|
|
*/
|
|
|
|
colourSchemes: TrackColour[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The style used for the station, entrance, and exit building.
|
|
|
|
*/
|
|
|
|
stationStyle: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The music track to play at each station.
|
|
|
|
*/
|
|
|
|
music: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Information about each station.
|
|
|
|
*/
|
|
|
|
readonly stations: RideStation[];
|
|
|
|
|
|
|
|
/**
|
2020-05-12 21:35:49 +02:00
|
|
|
* The admission price for the ride and the price of the on-ride photo, or the cost of each item of the stall.
|
2020-05-11 01:00:15 +02:00
|
|
|
*/
|
2020-05-12 21:35:49 +02:00
|
|
|
price: number[];
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The excitement metric of the ride represented as a 2 decimal point fixed integer.
|
|
|
|
* For example, `652` equates to `6.52`.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
excitement: number;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The intensity metric of the ride represented as a 2 decimal point fixed integer.
|
|
|
|
* For example, `652` equates to `6.52`.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
intensity: number;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The nausea metric of the ride represented as a 2 decimal point fixed integer.
|
|
|
|
* For example, `652` equates to `6.52`.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
nausea: number;
|
2020-05-11 01:00:15 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* The total number of customers the ride has served since it was built.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
totalCustomers: number;
|
2020-05-12 20:11:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The date in months when the ride was built.
|
2020-05-16 18:18:27 +02:00
|
|
|
* Subtract this from `date.monthsElapsed` to get the age.
|
2020-05-12 20:11:29 +02:00
|
|
|
*/
|
|
|
|
buildDate: number;
|
2020-05-16 18:18:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* How old the ride is in months.
|
|
|
|
*/
|
|
|
|
readonly age: number;
|
2020-05-12 21:54:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The running cost of the ride billed every fortnight. Multiply this by 16 to get the cost per hour (~ 1 year).
|
|
|
|
*/
|
|
|
|
runningCost: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How often the ride should be inspected by a mechanic.
|
|
|
|
*/
|
|
|
|
inspectionInterval: number;
|
2020-05-15 01:41:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The value of the ride.
|
|
|
|
*/
|
|
|
|
value: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-05-11 01:00:15 +02:00
|
|
|
type RideClassification = "ride" | "stall" | "facility";
|
|
|
|
|
|
|
|
type RideStatus = "closed" | "open" | "testing" | "simulating";
|
|
|
|
|
|
|
|
interface TrackColour {
|
|
|
|
main: number;
|
|
|
|
additional: number;
|
|
|
|
supports: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface VehicleColour {
|
|
|
|
body: number;
|
|
|
|
trim: number;
|
|
|
|
ternary: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface RideStation {
|
|
|
|
start: CoordsXYZ;
|
|
|
|
length: number;
|
|
|
|
entrance: CoordsXYZD;
|
|
|
|
exit: CoordsXYZD;
|
|
|
|
}
|
|
|
|
|
2020-04-21 20:32:08 +02:00
|
|
|
type EntityType =
|
2020-02-18 23:31:43 +01:00
|
|
|
"car" | "duck" | "peep";
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-04-21 20:32:08 +02:00
|
|
|
* Represents an object "entity" on the map that can typically moves and has a sub-tile coordinate.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-04-21 20:32:08 +02:00
|
|
|
interface Entity {
|
2020-05-08 13:39:47 +02:00
|
|
|
/**
|
|
|
|
* The entity index within the entity list.
|
|
|
|
*/
|
|
|
|
readonly id: number;
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-04-21 20:32:08 +02:00
|
|
|
* The type of entity, e.g. car, duck, litter, or peep.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-04-21 20:32:08 +02:00
|
|
|
readonly type: EntityType;
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-04-21 20:32:08 +02:00
|
|
|
* The x-coordinate of the entity in game units.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
x: number;
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-04-21 20:32:08 +02:00
|
|
|
* The y-coordinate of the entity in game units.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
y: number;
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-04-21 20:32:08 +02:00
|
|
|
* The z-coordinate of the entity in game units.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
z: number;
|
2020-05-10 19:07:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the entity from the map.
|
|
|
|
* Note: removing vehicles and peeps that are on rides is currently unsupported.
|
|
|
|
*/
|
|
|
|
remove(): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
|
|
|
* Represents a guest or staff member.
|
|
|
|
*/
|
2020-04-21 20:32:08 +02:00
|
|
|
interface Peep extends Entity {
|
2020-05-08 13:39:47 +02:00
|
|
|
/**
|
2020-05-14 02:21:54 +02:00
|
|
|
* Whether the peep is a guest or staff member.
|
2020-05-08 13:39:47 +02:00
|
|
|
*/
|
2020-05-14 02:21:54 +02:00
|
|
|
peepType: PeepType;
|
2020-05-08 13:39:47 +02:00
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-05-08 13:39:47 +02:00
|
|
|
* Name of the peep.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-05-08 13:39:47 +02:00
|
|
|
name: string;
|
|
|
|
|
2020-03-01 13:44:36 +01:00
|
|
|
/**
|
2020-05-14 02:21:54 +02:00
|
|
|
* The peep's direct destination.
|
2020-03-01 13:44:36 +01:00
|
|
|
*/
|
2020-05-14 02:21:54 +02:00
|
|
|
destination: CoordsXY;
|
2020-05-08 13:39:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* How tired the guest is between 32 and 128 where lower is more tired.
|
|
|
|
*/
|
|
|
|
energy: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The target energy value. Energy will increase / decrease slowly towards this value.
|
|
|
|
*/
|
|
|
|
energyTarget: number;
|
|
|
|
|
2020-05-15 01:24:24 +02:00
|
|
|
/**
|
|
|
|
* Gets whether a given flag is set or not.
|
|
|
|
* @param key The flag to test.
|
|
|
|
*/
|
|
|
|
getFlag(key: PeepFlags): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the given flag to the given value.
|
|
|
|
* @param key The flag to set.
|
|
|
|
* @param value Whether to set or clear the flag.
|
|
|
|
*/
|
|
|
|
setFlag(key: PeepFlags, value: boolean): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
type PeepFlags =
|
|
|
|
"leavingPark" |
|
|
|
|
"slowWalk" |
|
|
|
|
"tracking" |
|
|
|
|
"waving" |
|
|
|
|
"hasPaidForParkEntry" |
|
|
|
|
"photo" |
|
|
|
|
"painting" |
|
|
|
|
"wow" |
|
|
|
|
"litter" |
|
|
|
|
"lost" |
|
|
|
|
"hunger" |
|
|
|
|
"toilet" |
|
|
|
|
"crowded" |
|
|
|
|
"happiness" |
|
|
|
|
"nausea" |
|
|
|
|
"purple" |
|
|
|
|
"pizza" |
|
|
|
|
"explode" |
|
|
|
|
"rideShouldBeMarkedAsFavourite" |
|
|
|
|
"parkEntranceChosen" |
|
|
|
|
"contagious" |
|
|
|
|
"joy" |
|
|
|
|
"angry" |
|
|
|
|
"iceCream" |
|
|
|
|
"hereWeAre";
|
2020-05-14 02:21:54 +02:00
|
|
|
|
|
|
|
type PeepType = "guest" | "staff";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a guest.
|
|
|
|
*/
|
|
|
|
interface Guest extends Peep {
|
|
|
|
/**
|
|
|
|
* Colour of the guest's t-shirt.
|
|
|
|
*/
|
|
|
|
tshirtColour: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Colour of the guest's trousers.
|
|
|
|
*/
|
|
|
|
trousersColour: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Colour of the guest's balloon.
|
|
|
|
*/
|
|
|
|
balloonColour: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Colour of the guest's hat.
|
|
|
|
*/
|
|
|
|
hatColour: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Colour of the guest's umbrella.
|
|
|
|
*/
|
|
|
|
umbrellaColour: number;
|
2020-05-08 13:39:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* How happy the guest is between 0 and 255.
|
|
|
|
*/
|
|
|
|
happiness: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The target happiness value. Happiness will increase / decrease slowly towards this value.
|
|
|
|
*/
|
|
|
|
happinessTarget: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How nauseated the guest is between 0 and 255.
|
|
|
|
*/
|
|
|
|
nausea: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The target nausea value. Nausea will increase / decrease slowly towards this value.
|
|
|
|
*/
|
|
|
|
nauseaTarget: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How hungry the guest is between 0 and 255. Lower is more hungry.
|
|
|
|
*/
|
|
|
|
hunger: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How thirsty the guest is between 0 and 255. Lower is more thirsty.
|
|
|
|
*/
|
|
|
|
thirst: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How much the guest requires the need to go to the toilet between 0 and 255.
|
|
|
|
*/
|
|
|
|
toilet: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The mass of the guest. Affects vehicle mass.
|
|
|
|
*/
|
|
|
|
mass: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The guest's minimum preferred intensity between 0 and 15.
|
|
|
|
*/
|
|
|
|
minIntensity: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The guest's maximum preferred intensity between 0 and 15.
|
|
|
|
*/
|
|
|
|
maxIntensity: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The guest's tolerance to nauseating rides between 0 and 3.
|
|
|
|
*/
|
|
|
|
nauseaTolerance: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Amount of cash in the guest's pocket.
|
|
|
|
*/
|
|
|
|
cash: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-05-14 02:21:54 +02:00
|
|
|
/**
|
|
|
|
* Represents a staff member.
|
|
|
|
*/
|
|
|
|
interface Staff extends Peep {
|
|
|
|
/**
|
|
|
|
* The type of staff member, e.g. handyman, mechanic.
|
|
|
|
*/
|
|
|
|
staffType: StaffType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Colour of the staff member. Not applicable for entertainers.
|
|
|
|
*/
|
|
|
|
colour: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The entertainer's costume, only applicable for entertainers.
|
|
|
|
*/
|
|
|
|
costume: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The enabled jobs the staff can do, e.g. sweep litter, water plants, inspect rides etc.
|
|
|
|
*/
|
|
|
|
orders: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StaffType = "handyman" | "mechanic" | "security" | "entertainer";
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
/**
|
|
|
|
* Network APIs
|
|
|
|
* Use `network.status` to determine whether the current game is a client, server or in single player mode.
|
|
|
|
*/
|
|
|
|
interface Network {
|
|
|
|
readonly mode: NetworkMode;
|
2020-04-27 19:39:42 +02:00
|
|
|
readonly numGroups: number;
|
|
|
|
readonly numPlayers: number;
|
|
|
|
readonly groups: PlayerGroup[];
|
|
|
|
readonly players: Player[];
|
2020-05-03 14:53:36 +02:00
|
|
|
readonly currentPlayer: Player;
|
2020-03-07 14:11:08 +01:00
|
|
|
defaultGroup: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
getServerInfo(): ServerInfo;
|
2020-04-27 19:39:42 +02:00
|
|
|
addGroup(): void;
|
2020-03-07 14:11:08 +01:00
|
|
|
getGroup(index: number): PlayerGroup;
|
2020-04-27 19:39:42 +02:00
|
|
|
removeGroup(index: number): void;
|
2020-03-07 14:11:08 +01:00
|
|
|
getPlayer(index: number): Player;
|
|
|
|
kickPlayer(index: number): void;
|
|
|
|
sendMessage(message: string): void;
|
|
|
|
sendMessage(message: string, players: number[]): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
type NetworkMode = "none" | "server" | "client";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a player within a network game.
|
|
|
|
*/
|
|
|
|
interface Player {
|
|
|
|
readonly id: number;
|
|
|
|
readonly name: string;
|
|
|
|
group: number;
|
|
|
|
readonly ping: number;
|
|
|
|
readonly commandsRan: number;
|
|
|
|
readonly moneySpent: number;
|
2020-04-27 20:54:29 +02:00
|
|
|
readonly ipAddress: string;
|
|
|
|
readonly publicKeyHash: string;
|
2020-03-07 14:11:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface PlayerGroup {
|
|
|
|
readonly id: number;
|
|
|
|
name: string;
|
|
|
|
permissions: PermissionType[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ServerInfo {
|
|
|
|
readonly name: string;
|
|
|
|
readonly description: string;
|
|
|
|
readonly greeting: string;
|
|
|
|
readonly providerName: string;
|
|
|
|
readonly providerEmail: string;
|
|
|
|
readonly providerWebsite: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
type PermissionType =
|
|
|
|
"chat" |
|
|
|
|
"terraform" |
|
|
|
|
"set_water_level" |
|
|
|
|
"toggle_pause" |
|
|
|
|
"create_ride" |
|
|
|
|
"remove_ride" |
|
|
|
|
"build_ride" |
|
|
|
|
"ride_properties" |
|
|
|
|
"scenery" |
|
|
|
|
"path" |
|
|
|
|
"clear_landscape" |
|
|
|
|
"guest" |
|
|
|
|
"staff" |
|
|
|
|
"park_properties" |
|
|
|
|
"park_funding" |
|
|
|
|
"kick_player" |
|
|
|
|
"modify_groups" |
|
|
|
|
"set_player_group" |
|
|
|
|
"cheat" |
|
|
|
|
"toggle_scenery_cluster" |
|
|
|
|
"passwordless_login" |
|
|
|
|
"modify_tile" |
|
|
|
|
"edit_scenario_options";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Park APIs
|
|
|
|
*/
|
|
|
|
|
2020-04-27 18:41:49 +02:00
|
|
|
/**
|
|
|
|
* The type of park message, including icon and behaviour.
|
|
|
|
*/
|
|
|
|
type ParkMessageType =
|
2020-02-18 23:31:43 +01:00
|
|
|
"attraction" | "peep_on_attraction" | "peep" | "money" | "blank" | "research" | "guests" | "award" | "chart";
|
|
|
|
|
|
|
|
interface ParkMessage {
|
2020-05-19 03:59:35 +02:00
|
|
|
/**
|
|
|
|
* Whether the message has been shown and archived.
|
|
|
|
*/
|
|
|
|
readonly isArchived: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The date this message was posted in total elapsed months.
|
|
|
|
*/
|
|
|
|
month: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The day of the month this message was posted.
|
|
|
|
*/
|
|
|
|
day: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How old the message is in number of ticks.
|
|
|
|
*/
|
|
|
|
tickCount: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The format of the message such as the icon and whether location is enabled.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
type: ParkMessageType;
|
2020-05-19 03:59:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The actual message content.
|
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
text: string;
|
2020-04-30 19:51:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ride ID for attraction.
|
|
|
|
* Entity ID for peep_on_attraction or peep.
|
|
|
|
* Researched item for research.
|
|
|
|
*/
|
|
|
|
subject?: number;
|
2020-05-19 03:59:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the message.
|
|
|
|
*/
|
|
|
|
remove(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ParkMessageDesc {
|
|
|
|
type: ParkMessageType;
|
|
|
|
text: string;
|
|
|
|
subject?: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Park {
|
|
|
|
cash: number;
|
|
|
|
rating: number;
|
|
|
|
bankLoan: number;
|
|
|
|
maxBankLoan: number;
|
2020-05-19 03:59:35 +02:00
|
|
|
messages: ParkMessage[];
|
2020-02-18 23:31:43 +01:00
|
|
|
|
|
|
|
postMessage(message: string): void;
|
2020-05-19 03:59:35 +02:00
|
|
|
postMessage(message: ParkMessageDesc): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
2018-03-20 20:40:38 +01:00
|
|
|
|
2020-05-10 18:02:10 +02:00
|
|
|
interface Cheats {
|
|
|
|
allowArbitraryRideTypeChanges: boolean;
|
|
|
|
allowTrackPlaceInvalidHeights: boolean;
|
|
|
|
buildInPauseMode: boolean;
|
|
|
|
disableAllBreakdowns: boolean;
|
|
|
|
disableBrakesFailure: boolean;
|
|
|
|
disableClearanceChecks: boolean;
|
|
|
|
disableLittering: boolean;
|
|
|
|
disablePlantAging: boolean;
|
|
|
|
disableRideValueAging: boolean;
|
|
|
|
disableSupportLimits: boolean;
|
|
|
|
disableTrainLengthLimit: boolean;
|
|
|
|
disableVandalism: boolean;
|
|
|
|
enableAllDrawableTrackPieces: boolean;
|
|
|
|
enableChainLiftOnAllTrack: boolean;
|
|
|
|
fastLiftHill: boolean;
|
|
|
|
freezeWeather: boolean;
|
|
|
|
ignoreResearchStatus: boolean;
|
|
|
|
ignoreRideIntensity: boolean;
|
|
|
|
neverendingMarketing: boolean;
|
|
|
|
sandboxMode: boolean;
|
|
|
|
showAllOperatingModes: boolean;
|
|
|
|
showVehiclesFromOtherTrackTypes: boolean;
|
|
|
|
}
|
|
|
|
|
2020-02-06 14:23:04 +01:00
|
|
|
/**
|
2020-02-18 23:31:43 +01:00
|
|
|
* User Interface APIs
|
|
|
|
* These will only be available to servers and clients that are not running headless mode.
|
|
|
|
* Plugin writers should check if ui is available using `typeof ui !== 'undefined'`.
|
2020-02-06 14:23:04 +01:00
|
|
|
*/
|
2020-03-07 14:11:08 +01:00
|
|
|
interface Ui {
|
|
|
|
readonly width: number;
|
|
|
|
readonly height: number;
|
|
|
|
readonly windows: number;
|
|
|
|
readonly mainViewport: Viewport;
|
2020-05-01 18:04:37 +02:00
|
|
|
readonly tileSelection: TileSelection;
|
2020-05-01 22:32:41 +02:00
|
|
|
readonly tool: Tool;
|
2020-03-07 14:11:08 +01:00
|
|
|
|
|
|
|
getWindow(id: number): Window;
|
2020-04-24 14:26:55 +02:00
|
|
|
getWindow(classification: string): Window;
|
2020-03-07 14:11:08 +01:00
|
|
|
openWindow(desc: WindowDesc): Window;
|
|
|
|
closeWindows(classification: string, id?: number): void;
|
|
|
|
closeAllWindows(): void;
|
|
|
|
|
2020-05-10 19:06:31 +02:00
|
|
|
/**
|
|
|
|
* Show a red error box.
|
|
|
|
* @param title The title / first line of the box.
|
|
|
|
* @param message The message / second line of the box.
|
|
|
|
*/
|
|
|
|
showError(title: string, message: string): void;
|
|
|
|
|
2020-05-09 15:18:50 +02:00
|
|
|
/**
|
|
|
|
* Shows a text input prompt and calls the given callback when entered.
|
|
|
|
* @param desc The parameters for the text input window.
|
|
|
|
*/
|
|
|
|
showTextInput(desc: TextInputDesc): void;
|
|
|
|
|
2020-05-01 18:04:37 +02:00
|
|
|
/**
|
|
|
|
* Begins a new tool session. The cursor will change to the style specified by the
|
|
|
|
* given tool descriptor and cursor events will be provided.
|
|
|
|
* @param tool The properties and event handlers for the tool.
|
|
|
|
*/
|
|
|
|
activateTool(tool: ToolDesc): void;
|
|
|
|
|
2020-03-07 14:11:08 +01:00
|
|
|
registerMenuItem(text: string, callback: () => void): void;
|
|
|
|
}
|
2020-02-06 14:23:04 +01:00
|
|
|
|
2020-05-09 15:18:50 +02:00
|
|
|
/**
|
|
|
|
* Parameters for the text input window.
|
|
|
|
*/
|
|
|
|
interface TextInputDesc {
|
|
|
|
/**
|
|
|
|
* The title of the text input window.
|
|
|
|
*/
|
|
|
|
title: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The description to show above the text box.
|
|
|
|
*/
|
|
|
|
description: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current value of the text box.
|
|
|
|
*/
|
|
|
|
initialValue?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum length the value can be.
|
|
|
|
*/
|
|
|
|
maxLength?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to call when the user has entered a new value and pressed OK.
|
|
|
|
*/
|
|
|
|
callback: (value: string) => void;
|
|
|
|
}
|
|
|
|
|
2020-05-01 18:04:37 +02:00
|
|
|
interface TileSelection {
|
|
|
|
range: MapRange;
|
2020-05-02 12:42:43 +02:00
|
|
|
tiles: CoordsXY[];
|
2020-05-01 18:04:37 +02:00
|
|
|
}
|
|
|
|
|
2020-05-01 22:32:41 +02:00
|
|
|
interface Tool {
|
|
|
|
id: string;
|
|
|
|
cursor: CursorType;
|
2020-05-01 18:04:37 +02:00
|
|
|
|
2020-05-01 22:32:41 +02:00
|
|
|
cancel: () => void;
|
|
|
|
}
|
2020-05-01 18:04:37 +02:00
|
|
|
|
|
|
|
interface ToolEventArgs {
|
2020-05-01 22:32:41 +02:00
|
|
|
readonly isDown: boolean;
|
2020-05-02 12:42:43 +02:00
|
|
|
readonly screenCoords: ScreenCoordsXY;
|
|
|
|
readonly mapCoords?: CoordsXYZ;
|
2020-05-01 22:32:41 +02:00
|
|
|
readonly tileElementIndex?: number;
|
|
|
|
readonly entityId?: number;
|
2020-05-01 18:04:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes the properties and event handlers for a custom tool.
|
|
|
|
*/
|
|
|
|
interface ToolDesc {
|
2020-05-01 22:32:41 +02:00
|
|
|
id: string;
|
2020-05-02 12:38:33 +02:00
|
|
|
cursor?: CursorType;
|
2020-05-01 18:04:37 +02:00
|
|
|
|
2020-05-01 22:32:41 +02:00
|
|
|
onStart: () => void;
|
2020-05-01 18:04:37 +02:00
|
|
|
onDown: (e: ToolEventArgs) => void;
|
|
|
|
onMove: (e: ToolEventArgs) => void;
|
|
|
|
onUp: (e: ToolEventArgs) => void;
|
|
|
|
onFinish: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
type CursorType =
|
|
|
|
"arrow" |
|
|
|
|
"bench_down" |
|
|
|
|
"bin_down" |
|
2020-05-02 12:38:33 +02:00
|
|
|
"blank" |
|
|
|
|
"cross_hair" |
|
|
|
|
"diagonal_arrows" |
|
|
|
|
"dig_down" |
|
|
|
|
"entrance_down" |
|
2020-05-01 18:04:37 +02:00
|
|
|
"fence_down" |
|
|
|
|
"flower_down" |
|
2020-05-02 12:38:33 +02:00
|
|
|
"fountain_down" |
|
|
|
|
"hand_closed" |
|
|
|
|
"hand_open" |
|
|
|
|
"hand_point" |
|
2020-05-01 18:04:37 +02:00
|
|
|
"house_down" |
|
2020-05-02 12:38:33 +02:00
|
|
|
"lamppost_down" |
|
|
|
|
"paint_down" |
|
|
|
|
"path_down" |
|
|
|
|
"picker" |
|
|
|
|
"statue_down" |
|
|
|
|
"tree_down" |
|
|
|
|
"up_arrow" |
|
|
|
|
"up_down_arrow" |
|
2020-05-01 18:04:37 +02:00
|
|
|
"volcano_down" |
|
|
|
|
"walk_down" |
|
2020-05-02 12:38:33 +02:00
|
|
|
"water_down" |
|
|
|
|
"zzz";
|
2020-05-01 18:04:37 +02:00
|
|
|
|
2020-02-06 14:23:04 +01:00
|
|
|
/**
|
2020-02-18 23:31:43 +01:00
|
|
|
* Represents the type of a widget, e.g. button or label.
|
2020-02-06 14:23:04 +01:00
|
|
|
*/
|
2020-02-18 23:31:43 +01:00
|
|
|
type WidgetType =
|
2020-05-02 21:11:07 +02:00
|
|
|
"button" | "checkbox" | "dropdown" | "groupbox" | "label" | "listview" | "spinner" | "viewport";
|
2020-02-18 23:31:43 +01:00
|
|
|
|
|
|
|
interface Widget {
|
|
|
|
type: WidgetType;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
2020-02-20 18:58:15 +01:00
|
|
|
name?: string;
|
2020-05-01 01:06:58 +02:00
|
|
|
tooltip?: string;
|
2020-02-20 18:58:15 +01:00
|
|
|
isDisabled?: boolean;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface ButtonWidget extends Widget {
|
2020-04-30 21:32:39 +02:00
|
|
|
/**
|
|
|
|
* Whether the button has a 3D border.
|
|
|
|
* By default, text buttons have borders and image buttons do not but it can be overridden.
|
|
|
|
*/
|
|
|
|
border?: boolean;
|
2020-02-27 19:22:32 +01:00
|
|
|
image: number;
|
2020-06-02 04:05:24 +02:00
|
|
|
isPressed: boolean;
|
2020-02-18 23:31:43 +01:00
|
|
|
text: string;
|
|
|
|
onClick: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface CheckboxWidget extends Widget {
|
|
|
|
text: string;
|
2020-04-20 00:17:04 +02:00
|
|
|
isChecked: boolean;
|
2020-04-30 21:32:39 +02:00
|
|
|
onChange: (isChecked: boolean) => void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface DropdownWidget extends Widget {
|
|
|
|
items: string[];
|
|
|
|
selectedIndex: number;
|
2020-04-30 21:32:39 +02:00
|
|
|
onChange: (index: number) => void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface LabelWidget extends Widget {
|
|
|
|
text: string;
|
2020-04-30 21:32:39 +02:00
|
|
|
onChange: (index: number) => void;
|
2020-02-27 20:44:51 +01:00
|
|
|
}
|
|
|
|
|
2020-05-02 21:11:07 +02:00
|
|
|
type SortOrder = "none" | "ascending" | "descending";
|
|
|
|
|
2020-05-09 17:06:21 +02:00
|
|
|
type ScrollbarType = "none" | "horizontal" | "vertical" | "both";
|
2020-05-02 21:11:07 +02:00
|
|
|
|
|
|
|
interface ListViewColumn {
|
|
|
|
canSort?: boolean;
|
|
|
|
sortOrder?: SortOrder;
|
|
|
|
header?: string;
|
|
|
|
headerTooltip?: string;
|
|
|
|
width?: number;
|
|
|
|
ratioWidth?: number;
|
|
|
|
minWidth?: number;
|
|
|
|
maxWidth?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ListViewItem = string[];
|
|
|
|
|
2020-05-06 23:34:56 +02:00
|
|
|
interface RowColumn {
|
|
|
|
row: number;
|
|
|
|
column: number;
|
|
|
|
}
|
|
|
|
|
2020-05-02 21:11:07 +02:00
|
|
|
interface ListView extends Widget {
|
2020-05-09 17:06:21 +02:00
|
|
|
scrollbars?: ScrollbarType;
|
2020-05-02 21:11:07 +02:00
|
|
|
isStriped?: boolean;
|
|
|
|
showColumnHeaders?: boolean;
|
|
|
|
columns?: ListViewColumn[];
|
|
|
|
items?: string[] | ListViewItem[];
|
2020-05-06 23:34:56 +02:00
|
|
|
selectedCell?: RowColumn;
|
|
|
|
readonly highlightedCell?: RowColumn;
|
2020-05-03 18:07:27 +02:00
|
|
|
canSelect?: boolean;
|
2020-05-02 21:11:07 +02:00
|
|
|
|
2020-05-03 18:07:27 +02:00
|
|
|
onHighlight: (item: number, column: number) => void;
|
|
|
|
onClick: (item: number, column: number) => void;
|
2020-05-02 21:11:07 +02:00
|
|
|
}
|
|
|
|
|
2020-02-27 20:44:51 +01:00
|
|
|
interface SpinnerWidget extends Widget {
|
|
|
|
text: string;
|
|
|
|
onDecrement: () => void;
|
|
|
|
onIncrement: () => void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface ViewportWidget extends Widget {
|
|
|
|
viewport: Viewport
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Window {
|
2020-02-24 20:25:31 +01:00
|
|
|
classification: number;
|
|
|
|
number: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
2020-04-30 21:32:39 +02:00
|
|
|
minWidth: number;
|
|
|
|
maxWidth: number;
|
|
|
|
minHeight: number;
|
|
|
|
maxHeight: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
isSticky: boolean;
|
|
|
|
colours: number[];
|
|
|
|
title: string;
|
|
|
|
widgets: Widget[];
|
2020-04-30 21:32:39 +02:00
|
|
|
tabIndex: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
|
|
|
|
close(): void;
|
2020-02-20 18:58:15 +01:00
|
|
|
bringToFront(): void;
|
|
|
|
findWidget<T extends Widget>(name: string): T;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface WindowDesc {
|
|
|
|
classification: string;
|
|
|
|
x?: number;
|
|
|
|
y?: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
title: string;
|
|
|
|
id?: number;
|
|
|
|
minWidth?: number;
|
|
|
|
minHeight?: number;
|
2020-04-30 21:32:39 +02:00
|
|
|
maxWidth?: number;
|
|
|
|
maxHeight?: number;
|
2020-02-18 23:31:43 +01:00
|
|
|
widgets?: Widget[];
|
2020-02-27 20:59:46 +01:00
|
|
|
colours?: number[];
|
2020-05-01 23:31:37 +02:00
|
|
|
tabs?: WindowTabDesc[];
|
2020-02-20 18:58:15 +01:00
|
|
|
|
|
|
|
onClose?: () => void;
|
2020-04-30 21:32:39 +02:00
|
|
|
onUpdate?: () => void;
|
|
|
|
tabChange?: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ImageAnimation {
|
|
|
|
frameBase: number;
|
|
|
|
frameCount?: number;
|
|
|
|
frameDuration?: number;
|
2020-05-02 12:42:43 +02:00
|
|
|
offset?: ScreenCoordsXY;
|
2020-04-30 21:32:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface WindowTabDesc {
|
|
|
|
image: number | ImageAnimation;
|
|
|
|
widgets?: Widget[];
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Viewport {
|
|
|
|
left: number;
|
|
|
|
top: number;
|
|
|
|
right: number;
|
|
|
|
bottom: number;
|
|
|
|
rotation: number;
|
|
|
|
zoom: number;
|
|
|
|
visibilityFlags: number;
|
|
|
|
|
2020-05-02 12:42:43 +02:00
|
|
|
getCentrePosition(): CoordsXY;
|
|
|
|
moveTo(position: CoordsXY | CoordsXYZ): void;
|
|
|
|
scrollTo(position: CoordsXY | CoordsXYZ): void;
|
2020-02-18 23:31:43 +01:00
|
|
|
}
|
2018-03-18 02:55:12 +01:00
|
|
|
}
|