Initial
This commit is contained in:
commit
2f4aec6544
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/node_modules
|
||||
|
192
package-lock.json
generated
Normal file
192
package-lock.json
generated
Normal file
|
@ -0,0 +1,192 @@
|
|||
{
|
||||
"name": "keypados",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "keypados",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.5.2",
|
||||
"typescript-to-lua": "^1.26.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-to-lua/language-extensions": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-to-lua/language-extensions/-/language-extensions-1.19.0.tgz",
|
||||
"integrity": "sha512-Os5wOKwviTD4LeqI29N0btYOjokSJ97iCf45EOjIABlb5IwNQy7AE/AqZJobRw3ywHH8+KzJUMkEirWPzh2tUA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.17.1",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz",
|
||||
"integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.15.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz",
|
||||
"integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.8",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
|
||||
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.13.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"resolve": "bin/resolve"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
|
||||
"integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-preserve-symlinks-flag": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/tapable": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
|
||||
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
|
||||
"integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-to-lua": {
|
||||
"version": "1.26.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.26.2.tgz",
|
||||
"integrity": "sha512-nmlYhi0mlXOKK5q3GumstC/fk30xPSILQTK5GHcTovSiCzSovLUq0F6NNBnSMskmw9ENjUwdMtHUl2IpfeiGrw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-to-lua/language-extensions": "1.19.0",
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"picomatch": "^2.3.1",
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3"
|
||||
},
|
||||
"bin": {
|
||||
"tstl": "dist/tstl.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.10.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "5.5.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
package.json
Normal file
15
package.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "keypados",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.5.2",
|
||||
"typescript-to-lua": "^1.26.2"
|
||||
}
|
||||
}
|
11
src/index.ts
Normal file
11
src/index.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
function main() {
|
||||
const d: peripheral = peripheral.wrap("disk") as peripheral;
|
||||
|
||||
|
||||
}
|
||||
|
||||
main()
|
859
src/types/cct.d.ts
vendored
Normal file
859
src/types/cct.d.ts
vendored
Normal file
|
@ -0,0 +1,859 @@
|
|||
|
||||
|
||||
declare function print(s: string): number;
|
||||
declare function write(s: string): number;
|
||||
declare function sleep(time: number): void;
|
||||
declare function printError(...values: any): void;
|
||||
declare function read(replaceChar?: string, history?: string[], completeFn?: (par: string) => string[]): void;
|
||||
declare function Command(args: string): [boolean, string[], number|null];
|
||||
declare function AsyncCommand(args: string): number;
|
||||
|
||||
declare const _HOST: string;
|
||||
declare const _CC_DEFAULT_SETTINGS: string;
|
||||
|
||||
type Color = number;
|
||||
type Coords = [number, number, number];
|
||||
type CoordsNullable = [number|null, number|null, number|null];
|
||||
|
||||
declare class colors {
|
||||
/// White: Written as **`0`** in paint files and term.blit, has a default terminal color of #F0F0F0
|
||||
public static white: Color;
|
||||
/// Orange: Written as **`1`** in paint files and term.blit, has a default terminal color of #F2B233.
|
||||
public static orange: Color;
|
||||
// Magenta: Written as **`2`** in paint files and term.blit, has a default terminal color of #E57FD8.
|
||||
public static magenta: Color;
|
||||
// LightBlue: Written as **`3`** in paint files and `term.blit`, has a default terminal color of #99B2F2.
|
||||
public static lightBlue: Color;
|
||||
// Yellow: Written as **`4`** in paint files and `term.blit`, has a default terminal color of #DEDE6C.
|
||||
public static yellow: Color;
|
||||
// Lime: Written as **`5`** in paint files and `term.blit`, has a default terminal color of #7FCC19.
|
||||
public static lime: Color;
|
||||
// Pink: Written as **`6`** in paint files and `term.blit`, has a default terminal color of #F2B2CC.
|
||||
public static pink: Color;
|
||||
// Gray: Written as **`7`** in paint files and `term.blit`, has a default terminal color of #4C4C4C.
|
||||
public static gray: Color;
|
||||
// LightGray: Written as **`8`** in paint files and `term.blit`, has a default terminal color of #999999.
|
||||
public static lightGray: Color;
|
||||
// Cyan: Written as **`9`** in paint files and `term.blit`, has a default terminal color of #4C99B2.
|
||||
public static cyan: Color;
|
||||
// Purple: Written as **`a`** in paint files and `term.blit`, has a default terminal color of #B266E5.
|
||||
public static purple: Color;
|
||||
// Blue: Written as **`b`** in paint files and `term.blit`, has a default terminal color of #3366CC.
|
||||
public static blue: Color;
|
||||
// Brown: Written as **`c`** in paint files and `term.blit`, has a default terminal color of #7F664C.
|
||||
public static brown: Color;
|
||||
// Green: Written as **`d`** in paint files and `term.blit`, has a default terminal color of #57A64E.
|
||||
public static green: Color;
|
||||
/// Red: Written as **`e`** in paint files and `term.blit`, has a default terminal color of #CC4C4C.
|
||||
public static red: Color;
|
||||
/// Black: Written as **`f`** in paint files and `term.blit`, has a default terminal color of #111111.
|
||||
public static black: Color;
|
||||
|
||||
static combine(...colors: Color[]): Color;
|
||||
static subtract(from: Color, what: Color): Color;
|
||||
static test(from: Color, what: Color): boolean;
|
||||
static packRGB(r: number, g: number, b: number): Color;
|
||||
static unpackRGB(rgb: Color): [number, number, number];
|
||||
static toBlit(color: Color): string;
|
||||
}
|
||||
|
||||
declare class BlockInfo extends Map<string, any> {
|
||||
public static name: string;
|
||||
public static state: Map<string, any>;
|
||||
public static tags: Map<string, boolean>;
|
||||
public static nbt: Map<string, any>;
|
||||
}
|
||||
|
||||
declare class native {
|
||||
static exec(command: string): [boolean, string[], number|null];
|
||||
static execAsync(command: string): number;
|
||||
static list(...subcommand: string[]): string[];
|
||||
static getBlockPosition(): Coords;
|
||||
static getBlockInfos(minX: number, minY: number, minZ: number,
|
||||
maxX: number, maxY: number, maxZ: number, dimension?: string): BlockInfo[];
|
||||
static getBlockInfo(x: number, y: number, z: number, dimension: string): BlockInfo;
|
||||
}
|
||||
|
||||
declare class async {
|
||||
static exec(command: string): number;
|
||||
static execAsync(command: string): number;
|
||||
static list(...subcommand: string[]): number;
|
||||
static getBlockPosition(): number;
|
||||
static getBlockInfos(minX: number, minY: number, minZ: number,
|
||||
maxX: number, maxY: number, maxZ: number, dimension?: string): number;
|
||||
static getBlockInfo(x: number, y: number, z: number, dimension: string): number;
|
||||
}
|
||||
declare class commands {
|
||||
public static native: native;
|
||||
public static async: async;
|
||||
static exec(command: string): [boolean, string[], number|null];
|
||||
static execAsync(command: string): number;
|
||||
static list(...subcommand: string[]): string[];
|
||||
static getBlockPosition(): Coords;
|
||||
static getBlockInfos(minX: number, minY: number, minZ: number,
|
||||
maxX: number, maxY: number, maxZ: number, dimension?: string): BlockInfo[];
|
||||
static getBlockInfo(x: number, y: number, z: number, dimension: string): BlockInfo;
|
||||
}
|
||||
|
||||
type AnyPeripheral = command | computer | drive | modem | Monitor | printer | speaker | BigReactors;
|
||||
|
||||
declare class peripheral {
|
||||
/**
|
||||
* Provides a list of all peripherals available.
|
||||
* If a device is located directly next to the system,
|
||||
* then its name will be listed as the side it is attached to.
|
||||
* If a device is attached via a Wired Modem,
|
||||
* then it'll be reported according to its name on the wired network.
|
||||
*/
|
||||
static getNames(): string[];
|
||||
/**
|
||||
* Determines if a peripheral is present with the given name.
|
||||
*/
|
||||
static isPresent(name: string): boolean;
|
||||
|
||||
static getType(peripheral: string|peripheral): string|null;
|
||||
|
||||
static hasType(peripheral: string|peripheral, peripheral_type: string): boolean|null;
|
||||
|
||||
static getMethods(name: string): string[]|null;
|
||||
|
||||
static getName(peripheral: peripheral): string;
|
||||
|
||||
static call(name: string, method: string, ...arguments: unknown[]): unknown;
|
||||
|
||||
static wrap(name: string): peripheral| null;
|
||||
|
||||
static find(ty: string,
|
||||
filter: (name: string, wrapped: peripheral) => boolean
|
||||
): [peripheral, peripheral|null, peripheral|null, peripheral|null];
|
||||
}
|
||||
|
||||
declare class inventory {
|
||||
static size(): number;
|
||||
static list(): Map<number, ItemInfo>;
|
||||
static getItemDetail(slot: number): ItemInfo|null;
|
||||
static getItemLimit(slot: number): number;
|
||||
static pushItems(toName: string, fromSlot: number, limit: number, toSlot: number): number;
|
||||
static pullItems(fromName: string, fromSlot: number, limit: number, toSlot: number): number;
|
||||
}
|
||||
|
||||
declare class fluid_storage {
|
||||
static tanks(): Map<number, object>;
|
||||
static pushFluid(toName: string, limit?: number, fluidName?: string): number;
|
||||
static pullFluid(fromName: string, limit?: number, fluidName?: string): number;
|
||||
}
|
||||
|
||||
declare class energy_storage {
|
||||
static getEnergy(): number;
|
||||
static getEnergyCapacity(): number;
|
||||
}
|
||||
|
||||
type Instrument = "harp" | "basedrum" | "snare" | "hat" | "bass" | "flute" | "bell" | "guitar" | "chime" | "xylophone" |
|
||||
"iron_xylophone" | "cow_bell" | "didgeridoo" | "bit" | "banjo" | "pling";
|
||||
|
||||
declare class speaker {
|
||||
static playNote(instrument: Instrument, volume?: number, pitch?: number): boolean;
|
||||
static playSound(name: string, volume?: number, pitch?: number): boolean;
|
||||
static playAudio(audio: number[], volume?: number): boolean;
|
||||
static stop(): void;
|
||||
}
|
||||
|
||||
declare class printer {
|
||||
static write(...args: (string|number)[]): void;
|
||||
static getCursorPos(): [number, number];
|
||||
static setCursorPos(x: number, y: number): void;
|
||||
static getPageSize(): number;
|
||||
static newPaget(): void;
|
||||
static endPage(): boolean;
|
||||
static setPageTitle(s: string): void;
|
||||
static getInkLevel(): number;
|
||||
static getPaperLevel(): number;
|
||||
}
|
||||
|
||||
declare class Monitor extends Redirect {
|
||||
static getNames(): string[];
|
||||
static isPresent(name: string): boolean;
|
||||
static getType(peripheral: string|peripheral): string|null;
|
||||
static hasType(peripheral: string|peripheral, peripheral_type: string): boolean|null;
|
||||
static getMethods(name: string): string[]|null;
|
||||
static getName(peripheral: peripheral): string;
|
||||
static call(name: string, method: string, ...arguments: unknown[]): unknown;
|
||||
static wrap(name: string): peripheral| null;
|
||||
static find(ty: string,
|
||||
filter: (name: string, wrapped: peripheral) => boolean
|
||||
): [peripheral, peripheral|null, peripheral|null, peripheral|null];
|
||||
setTextScale(scale: number): void;
|
||||
getTextScale(): number;
|
||||
}
|
||||
|
||||
declare class modem {
|
||||
static open(channel: number): void;
|
||||
static isOpen(channel: number): boolean;
|
||||
static close(channel: number): void;
|
||||
static closeAll(): void;
|
||||
static transmit(channel: number, replyChannel: number, payload: any): void;
|
||||
static isWireless(): boolean;
|
||||
static getNamesRemote(): string[];
|
||||
static isPresentRemote(name: string): boolean;
|
||||
static getTypeRemote(name: string): string|null;
|
||||
static hasTypeRemote(name: string, typ: string): boolean;
|
||||
static getMethodsRemote(name: string): string|null;
|
||||
static callRemote(remoteName: string, method: string, ...args: any[]): any[];
|
||||
static getNameLocal(): string|null;
|
||||
}
|
||||
|
||||
declare class drive {
|
||||
static isDiskPresent(): boolean;
|
||||
static getDiskLabel(): string|null;
|
||||
static setDiskLabel(l?: string): null;
|
||||
static hasData(): boolean;
|
||||
static getMountPath(): string|null;
|
||||
static hasAudio(): boolean;
|
||||
static getAudioTitle(name: string): string|"false"|null;
|
||||
static playAudio(name: string): void;
|
||||
static stopAudio(name: string): void;
|
||||
static ejectDisk(name: string): void;
|
||||
static getDiskID(name: string): string|null;
|
||||
}
|
||||
|
||||
declare class disk {
|
||||
static getLabel(name: string): string|null;
|
||||
static setLabel(name: string, label?: string): void;
|
||||
static hasData(name: string): boolean;
|
||||
static getMountPath(name: string): string|null;
|
||||
static hasAudio(name: string): boolean;
|
||||
static getAudioTitle(name: string): string|"false"|null;
|
||||
static playAudio(name: string): void;
|
||||
static stopAudio(name: string): void;
|
||||
static eject(name: string): void;
|
||||
static getID(name: string): string|null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare class computer {
|
||||
static turnOn(): void;
|
||||
static shutdown(): void;
|
||||
static reboot(): void;
|
||||
static getID(): number;
|
||||
static isOn(): boolean;
|
||||
static getLabel(): string;
|
||||
}
|
||||
|
||||
declare class command {
|
||||
static getCommand(): string;
|
||||
static setCommand(command: string): void;
|
||||
static runCommand(): [boolean, string|null];
|
||||
}
|
||||
|
||||
declare class fs {
|
||||
static isDriveRoot(path: string): boolean;
|
||||
static include(path: string, location: string, include_files?: boolean, include_dirs?: boolean): string[];
|
||||
static list(path: string): string[];
|
||||
static combine(path: string, ...paths: string[]): string;
|
||||
static getName(path: string): string;
|
||||
static getDir(path: string): string;
|
||||
static getSize(path: string): number;
|
||||
static exists(path: string): boolean;
|
||||
static isDir(path: string): boolean;
|
||||
static isReadOnly(path: string): boolean;
|
||||
static makeDir(path: string): void;
|
||||
static move(from: string, to: string): void;
|
||||
static copy(from: string, to: string): void;
|
||||
static delete(path: string): void;
|
||||
static open(path: string, mode: "r"): ReadHandle;
|
||||
static open(path: string, mode: "rb"): BinaryReadHandle;
|
||||
static open(path: string, mode: "w" | "a"): WriteHandle;
|
||||
static open(path: string, mode: "wb" | "ab"): BinaryWriteHandle;
|
||||
static getDrive(path: string): string;
|
||||
static getFreeSpace(path: string): number|"unlimited";
|
||||
static find(path: string): string[];
|
||||
static getCapacity(path: string): number|null;
|
||||
static attributes(path: string): Attributes;
|
||||
}
|
||||
|
||||
interface Attributes {
|
||||
size: number;
|
||||
isDir: boolean;
|
||||
isReadOnly: boolean;
|
||||
created: number;
|
||||
modified: number;
|
||||
}
|
||||
|
||||
declare class FileHandle {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
declare class ReadHandle extends FileHandle {
|
||||
readLine(withTrailing?: boolean): string|null;
|
||||
readAll(): string|null;
|
||||
read(count?: number): string|null;
|
||||
}
|
||||
|
||||
declare class BinaryReadHandle extends FileHandle {
|
||||
read(): number;
|
||||
read(count?: number): string|null;
|
||||
readLine(withTrailing?: boolean): string|null;
|
||||
readAll(): string|null;
|
||||
seek(whence?: "set"|"cur"|"end", offset?: number): [number|null, string|null];
|
||||
}
|
||||
|
||||
declare class WriteHandle extends FileHandle {
|
||||
write(val: string): void;
|
||||
writeLine(val: string): void;
|
||||
flush(): void;
|
||||
}
|
||||
|
||||
declare class BinaryWriteHandle extends FileHandle {
|
||||
write(val: string|number): void;
|
||||
flush(): void;
|
||||
seek(whence?: "set"|"cur"|"end", offset?: number): [number|null, string|null];
|
||||
}
|
||||
|
||||
declare class gps {
|
||||
public static CHANNEL_GPS: number;
|
||||
static locate(timeout?: number, debug?: boolean): CoordsNullable;
|
||||
}
|
||||
|
||||
declare class help {
|
||||
static path(): string;
|
||||
static setPath(newPath: string): void;
|
||||
static lookup(topic: string): string|null;
|
||||
static topics(): string[];
|
||||
static completeTopic(prefix: string): string[];
|
||||
}
|
||||
|
||||
declare class Request {
|
||||
public static url: string;
|
||||
public static body?: string;
|
||||
public static headers?: Map<string, string>;
|
||||
public static binary?: boolean;
|
||||
public static method?: string;
|
||||
public static redirect?: boolean;
|
||||
}
|
||||
|
||||
declare class GetRequest {
|
||||
public static url: string;
|
||||
public static headers?: Map<string, string>;
|
||||
public static binary?: boolean;
|
||||
public static method?: string;
|
||||
public static redirect?: boolean;
|
||||
}
|
||||
|
||||
declare class http {
|
||||
static request(request: Request): [boolean, string|null];
|
||||
static request(url: string, body?: string, headers?: Map<string, string>, binary?: boolean): [boolean, string|null];
|
||||
static get(request: GetRequest): [Response|null, string|null, Response|null];
|
||||
static get(url: string, headers?: Map<string, string>, binary?: boolean): [Response|null, string|null, Response|null];
|
||||
static post(request: Request): [Response|null, string|null, Response|null];
|
||||
static post(url: string, body?: string, headers?: Map<string, string>, binary?: boolean): [Response|null, string|null, Response|null];
|
||||
static checkUrl(url: string): [boolean, string|null];
|
||||
static checkUrlAsync(url: string): [boolean, string|null];
|
||||
static websocket(url: string, headers?: Map<string, string>): [Websocket | "false", string|null];
|
||||
static websocketAsync(url: string, headers?: Map<string, string>): "true";
|
||||
}
|
||||
|
||||
declare class Websocket {
|
||||
receive(timeout?: number): [string|null, boolean];
|
||||
send(message: any, binary?: boolean): void;
|
||||
close(): void;
|
||||
getResponseCode(): [number, string];
|
||||
getResponseHeaders(): Map<string, string>;
|
||||
}
|
||||
|
||||
declare class Response extends BinaryReadHandle {}
|
||||
|
||||
declare class Handle {
|
||||
close(): ["true"|null, string|null];
|
||||
flush(): void;
|
||||
lines(...params: any[]): () => string|null;
|
||||
read(...format: ("l" | "L" | "n" | "a" | "*l" | "*L" | "*n" | "*a")[]): [string|null, string|null, string|null, string|null];
|
||||
seek(whence?: "set"|"cur"|"end", offset?: number): number;
|
||||
write(...val: (string|number)[]): [Handle|null, string|null];
|
||||
}
|
||||
|
||||
declare class io {
|
||||
public static stdin: Handle;
|
||||
public static stdout: Handle;
|
||||
public static stderr: Handle;
|
||||
static close(file: Handle): void;
|
||||
static flush(): void;
|
||||
static input(file?: Handle|string): Handle;
|
||||
static lines(filename?: string, ...args: any[]): () => string|null;
|
||||
static open(filename: string, mode?: "r"|"w"|"a"|"rb"|"wb"|"ab"): [Handle|null, string|null];
|
||||
static output(file?: Handle|string): Handle;
|
||||
static read(...formats: any): [string|null, string|null, string|null, string|null];
|
||||
static type(handle: Handle): "file"|"closed file"|null;
|
||||
static write(...strings: string[]): [Handle|null, string|null];
|
||||
}
|
||||
|
||||
interface keys {
|
||||
a: number;
|
||||
b: number;
|
||||
c: number;
|
||||
d: number;
|
||||
e: number;
|
||||
f: number;
|
||||
g: number;
|
||||
h: number;
|
||||
i: number;
|
||||
j: number;
|
||||
k: number;
|
||||
l: number;
|
||||
m: number;
|
||||
n: number;
|
||||
o: number;
|
||||
p: number;
|
||||
q: number;
|
||||
r: number;
|
||||
s: number;
|
||||
t: number;
|
||||
u: number;
|
||||
v: number;
|
||||
w: number;
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
f1: number;
|
||||
f2: number;
|
||||
f3: number;
|
||||
f4: number;
|
||||
f5: number;
|
||||
f6: number;
|
||||
f7: number;
|
||||
f8: number;
|
||||
f9: number;
|
||||
f10: number;
|
||||
f11: number;
|
||||
f12: number;
|
||||
f13: number;
|
||||
f14: number;
|
||||
f15: number;
|
||||
f16: number;
|
||||
f17: number;
|
||||
f18: number;
|
||||
f19: number;
|
||||
f20: number;
|
||||
f21: number;
|
||||
f22: number;
|
||||
f23: number;
|
||||
f24: number;
|
||||
f25: number;
|
||||
left: number;
|
||||
leftAlt: number;
|
||||
leftBracket: number;
|
||||
leftCtrl: number;
|
||||
leftShift: number;
|
||||
leftSuper: number;
|
||||
right: number;
|
||||
rightAlt: number;
|
||||
rightBracket: number;
|
||||
rightCtrl: number;
|
||||
rightShift: number;
|
||||
up: number;
|
||||
down: number;
|
||||
pageUp: number;
|
||||
pageDown: number;
|
||||
home: number;
|
||||
en: number;
|
||||
apostrophe: number;
|
||||
backslash: number;
|
||||
comma: number;
|
||||
equals: number;
|
||||
grave: number;
|
||||
minus: number;
|
||||
period: number;
|
||||
semicolon: number;
|
||||
slash: number;
|
||||
space: number;
|
||||
tab: number;
|
||||
numPad0: number;
|
||||
numPad1: number;
|
||||
numPad2: number;
|
||||
numPad3: number;
|
||||
numPad4: number;
|
||||
numPad5: number;
|
||||
numPad6: number;
|
||||
numPad7: number;
|
||||
numPad8: number;
|
||||
numPad9: number;
|
||||
numLock: number;
|
||||
numPadAdd: number;
|
||||
numPadDecimal: number;
|
||||
numPadDivide: number;
|
||||
numPadEnter: number;
|
||||
numPadEqual: number;
|
||||
numPadMultiply: number;
|
||||
numPadSubtract: number;
|
||||
backspace: number;
|
||||
delete: number;
|
||||
capsLock: number;
|
||||
scollLock: number;
|
||||
scrollLock: number;
|
||||
enter: number;
|
||||
return: number;
|
||||
insert: number;
|
||||
menu: number;
|
||||
pause: number;
|
||||
printScreen: number;
|
||||
zero: number;
|
||||
one: number;
|
||||
two: number;
|
||||
three: number;
|
||||
four: number;
|
||||
five: number;
|
||||
six: number;
|
||||
seven: number;
|
||||
eight: number;
|
||||
nine: number;
|
||||
|
||||
getName: (code: number) => string|null;
|
||||
}
|
||||
|
||||
declare class multishell {
|
||||
static getFocus(): number;
|
||||
static setFocus(n: number): boolean;
|
||||
static getTitle(n: number): string|null;
|
||||
static setTitle(n: number, title: string): void;
|
||||
static get_current(): number;
|
||||
static launch(tProgramEnv: Map<any, any>, sProgramPath: string, ...args: string[]): number;
|
||||
static getCount(): number;
|
||||
}
|
||||
|
||||
declare class os {
|
||||
static pullEvent(filter?: string): [string, unknown, unknown, unknown, unknown];
|
||||
static pullEventRaw(filter?: string): [string, unknown, unknown, unknown, unknown];
|
||||
static sleep(n: number): void;
|
||||
static version(): string;
|
||||
static run(env: Map<any, any>, path: string, ...args: string[]): boolean;
|
||||
static queueEvent(name: string, ...args: any[]): void;
|
||||
static startTimer(time: number): number;
|
||||
static cancelTimer(token: number): void;
|
||||
static setAlarm(time: number): number;
|
||||
static cancelAlarm(token: number): void;
|
||||
static shutdown(): void;
|
||||
static reboot(): void;
|
||||
static getComputerID(): number;
|
||||
static setComputerLabel(label?: string): void;
|
||||
static clock(): number;
|
||||
static time(locale?: "ingame" | "utc" | "local"): number;
|
||||
static time(locale?: date): number;
|
||||
static day(locale?: "ingame" | "utc" | "local"): number;
|
||||
static epoch(locale?: "ingame" | "utc" | "local"): number;
|
||||
static date(format?: string, time?: number): number;
|
||||
static date(format?: "*t" | "!*t", time?: number): date;
|
||||
}
|
||||
|
||||
interface date {
|
||||
isdst: boolean;
|
||||
hour: number;
|
||||
min: number;
|
||||
sec: number;
|
||||
day: number;
|
||||
month: number;
|
||||
year: number;
|
||||
wday: number;
|
||||
yday: number;
|
||||
}
|
||||
|
||||
type Image = number[][];
|
||||
|
||||
declare class paintutils {
|
||||
static parseImage(image: string): Image;
|
||||
static loadImage(path: string): Image|null;
|
||||
static drawPixel(xPos: number, yPos: number, color?: Color): void;
|
||||
static drawBox(startX: number, startY: number, endX: number, endY: number, color: Color): void;
|
||||
static drawFilledBox(startX: number, startY: number, endX: number, endY: number, color: Color): void;
|
||||
static drawImage(image: Image, xPos: number, yPos: number): void;
|
||||
}
|
||||
|
||||
declare class parallel {
|
||||
static waitForAny(...functions: ((...args: any[]) => any)[]): void;
|
||||
static waitForAll(...functions: ((...args: any[]) => any)[]): void;
|
||||
}
|
||||
|
||||
declare class pocket {
|
||||
static equipBack(): [boolean, string|null];
|
||||
static unequipBack(): [boolean, string|null];
|
||||
}
|
||||
|
||||
declare class rednet {
|
||||
public static CHANNEL_BROADCAST: number;
|
||||
public static CHANNEL_REPEAT: number;
|
||||
public static MAX_ID_CHANNELS: number;
|
||||
|
||||
static open(modem: string): void;
|
||||
static close(modem?: string): void;
|
||||
static isOpen(modem?: string): boolean;
|
||||
static send(recipient: number, message: any, protocol?: string): boolean;
|
||||
static broadcast(message: any, protocol?: string): boolean;
|
||||
static receive(protocol_filter?: string, timeout?: number): [number|null, unknown, string|null];
|
||||
static host(protocol: string, hostname: string): void;
|
||||
static unhost(protocol: string): void;
|
||||
static lookup(protocol: string, hostname: string): [number|null, number, number, number];
|
||||
static run(): void;
|
||||
}
|
||||
|
||||
type Side = "top"|"bottom"|"left"|"right"|"front"|"back";
|
||||
|
||||
declare class redstone {
|
||||
static getSides(): string;
|
||||
static setOutput(side: Side, on: boolean): void;
|
||||
static getOutput(side: Side): boolean;
|
||||
static getInput(side: Side): boolean;
|
||||
static setAnalogOutput(side: Side, val: number): number;
|
||||
static getAnalogOutput(side: Side): number;
|
||||
static getAnalogInput(side: Side): number;
|
||||
static setBundledOutput(side: Side, val: number): number;
|
||||
static getBundledOutput(side: Side): number;
|
||||
static getBundledInput(side: Side): number;
|
||||
static testBundledInput(side: Side, mask: number): boolean;
|
||||
}
|
||||
|
||||
declare class settings {
|
||||
static define(name: string, options: settingsOptions): void;
|
||||
static undefine(name: string): void;
|
||||
static set(name: string, value: any): void;
|
||||
static get(name: string, deflt?: any): unknown;
|
||||
static getDetails(name: string): settingsDetails;
|
||||
static unset(name: string): void;
|
||||
static clear(): void;
|
||||
static getNames(): string[];
|
||||
static load(path?: string): boolean;
|
||||
static save(path?: string): boolean;
|
||||
}
|
||||
|
||||
interface settingsOptions {
|
||||
description?: string;
|
||||
default?: any;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface settingsDetails {
|
||||
description?: string;
|
||||
default?: any;
|
||||
type?: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
type completionFn = (shell: shell, index: number, argument: string, previous: string[]) => string[]|null;
|
||||
|
||||
declare class shell {
|
||||
static execute(command: string, ...args: string[]): boolean;
|
||||
static run(...args: string[]): boolean;
|
||||
static exit(): void;
|
||||
static dir(): string;
|
||||
static setDir(dir: string): void;
|
||||
static path(): string;
|
||||
static setPath(path: string): void;
|
||||
static resolve(p: string): void;
|
||||
static resolveProgram(p: string): string|null;
|
||||
static programs(include_hidden?: boolean): string[];
|
||||
static complete(input: string): string[];
|
||||
static completeProgram(program: string): string[];
|
||||
static setCompletionFunction(program: string, complete: completionFn): void;
|
||||
static getCompletionInfo(): Map<string, completionInfo>;
|
||||
static getRunningProgram(): string;
|
||||
static setAlias(command: string, program: string): void;
|
||||
static clearAlias(command: string): void;
|
||||
static aliases(): Map<string, string>;
|
||||
static openTab(...args: string[]): number;
|
||||
static switchTab(id: number): void;
|
||||
}
|
||||
|
||||
interface completionInfo {
|
||||
fnComplete: completionFn;
|
||||
}
|
||||
|
||||
declare class Redirect {
|
||||
static write(s: string): void;
|
||||
static scroll(y: number): void;
|
||||
static getCursorPos(): [number, number];
|
||||
static setCursorPos(x: number, y: number): void;
|
||||
static getCursorBlink(): boolean;
|
||||
static setCursorBlink(b: boolean): void;
|
||||
static getSize(): [number, number];
|
||||
static clear(): void;
|
||||
static clearLine(): void;
|
||||
static getTextColor(): Color;
|
||||
static setTextColor(c: Color): void;
|
||||
static getBackgroundColor(): Color;
|
||||
static setBackgroundColor(c: Color): void;
|
||||
static isColor(): boolean;
|
||||
static blit(text: string, textColor: string, backgroundColor: string): void;
|
||||
static setPaletteColor(index: number, color: Color): void;
|
||||
static setPaletteColor(index: number, r: number, g: number, b: number): void;
|
||||
static getPaletteColor(color: Color): [number, number, number];
|
||||
}
|
||||
|
||||
declare class term extends Redirect {
|
||||
static nativePaletteColor(color: Color): [number, number, number];
|
||||
static redirect(target: Redirect): Redirect;
|
||||
static current(): Redirect;
|
||||
static native(): Redirect;
|
||||
}
|
||||
|
||||
declare class turtle {
|
||||
static forward(): [boolean, string|null];
|
||||
static back(): [boolean, string|null];
|
||||
static up(): [boolean, string|null];
|
||||
static down(): [boolean, string|null];
|
||||
static turnLeft(): [boolean, string|null];
|
||||
static turnRight(): [boolean, string|null];
|
||||
static dig(side?: "left" | "right"): [boolean, string|null];
|
||||
static digUp(side?: "left" | "right"): [boolean, string|null];
|
||||
static digDown(side?: "left" | "right"): [boolean, string|null];
|
||||
static place(text?: string): [boolean, string|null];
|
||||
static placeUp(text?: string): [boolean, string|null];
|
||||
static placeDown(text?: string): [boolean, string|null];
|
||||
static drop(count?: number): [boolean, string|null];
|
||||
static dropUp(count?: number): [boolean, string|null];
|
||||
static dropDown(count?: number): [boolean, string|null];
|
||||
static select(slot: number): boolean;
|
||||
static getItemCount(slot?: number): number;
|
||||
static detect(): boolean;
|
||||
static detectUp(): boolean;
|
||||
static detectDown(): boolean;
|
||||
static compare(): boolean;
|
||||
static compareUp(): boolean;
|
||||
static compareDown(): boolean;
|
||||
static attack(side?: "left" | "right"): [boolean, string|null];
|
||||
static attackUp(side?: "left" | "right"): [boolean, string|null];
|
||||
static attackDown(side?: "left" | "right"): [boolean, string|null];
|
||||
static suck(count?: number): [boolean, string|null];
|
||||
static suckUp(count?: number): [boolean, string|null];
|
||||
static suckDown(count?: number): [boolean, string|null];
|
||||
static getFuelLevel(): number|"unlimited";
|
||||
static refuel(count?: number): [boolean, string|null];
|
||||
static compareTo(slot: number): boolean;
|
||||
static compareTo(slot: number, count?: number): boolean;
|
||||
static getSelectedSlot(): number;
|
||||
static getFuelLimit(): number|"unlimited";
|
||||
static equpLeft(): [boolean, string|null];
|
||||
static equipRight(): [boolean, string|null];
|
||||
static inspect(): [boolean, BlockInfo|string];
|
||||
static inspectUp(): [boolean, BlockInfo|string];
|
||||
static inspectDown(): [boolean, BlockInfo|string];
|
||||
static getItemDetail(slot?: number, detailed?: boolean): ItemInfo | null;
|
||||
static craft(limit?: number): [boolean, string|null];
|
||||
}
|
||||
|
||||
interface ItemInfo {
|
||||
name: string;
|
||||
displayName: string;
|
||||
count: number;
|
||||
damage?: number;
|
||||
durability?: number;
|
||||
maxCount?: number;
|
||||
maxDamage?: number;
|
||||
nbt?: string;
|
||||
tags?: Map<string, boolean>;
|
||||
}
|
||||
|
||||
declare class vector {
|
||||
static new(x: number, y: number, z: number): Vector;
|
||||
}
|
||||
|
||||
declare class Vector {
|
||||
constructor(x: number, y: number, z: number);
|
||||
|
||||
add(v: Vector): Vector;
|
||||
sub(v: Vector): Vector;
|
||||
mul(v: Vector): Vector;
|
||||
unm(): Vector;
|
||||
dot(v: Vector): Vector;
|
||||
cross(v: Vector): Vector;
|
||||
length(): Vector;
|
||||
normalise(): Vector;
|
||||
round(tol: number): Vector;
|
||||
tostring(): string;
|
||||
equals(v: Vector): boolean;
|
||||
}
|
||||
|
||||
declare class window {
|
||||
static new(parent: Redirect, x: number, y: number, w: number, h: number, visible: boolean): Window;
|
||||
}
|
||||
|
||||
declare class Window extends Redirect {
|
||||
getLine(y: number): [string, string, string];
|
||||
setVisible(v: boolean): void;
|
||||
isVisible(): boolean;
|
||||
redraw(): void;
|
||||
restoreCursor(): void;
|
||||
getPosition(): [number, number];
|
||||
reposition(x: number, y: number, w: number, h: number, parent: Redirect): void;
|
||||
}
|
||||
|
||||
declare module cc {
|
||||
// TODO
|
||||
//
|
||||
}
|
||||
|
||||
interface EnergyStats {
|
||||
energyStored: number;
|
||||
energyCapacity: number;
|
||||
energyProducedLastTick: number;
|
||||
energySystem: string;
|
||||
}
|
||||
|
||||
interface FuelStats {
|
||||
fuelAmount: number;
|
||||
fuelCapacity: number;
|
||||
fuelTemperature: number;
|
||||
fuelConsumedLastTick: number;
|
||||
fuelReactivity: number;
|
||||
wasteAmount: number;
|
||||
}
|
||||
|
||||
interface HotFluidStats {
|
||||
fluidType: string;
|
||||
fluidAmount: number;
|
||||
fluidCapacity: number;
|
||||
fluidProducedLastTick: number;
|
||||
}
|
||||
|
||||
interface CoolantFluidStats {
|
||||
fluidType: string;
|
||||
fluidAmount: number;
|
||||
fluidCapacity: number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare class BigReactors {
|
||||
getVariant(): string;
|
||||
getEnergyStored(): number;
|
||||
getEnergyStoredAsText(): string;
|
||||
getNumberOfControllRods(): number;
|
||||
getActive(): boolean;
|
||||
getFuelTemperature(): number;
|
||||
getCasingTemperature(): number;
|
||||
getFuelAmount(): number;
|
||||
getWasteAmount(): number;
|
||||
getFuelAmountMax(): number;
|
||||
getControllRodName(idx: number): string;
|
||||
getControllRodLevel(idx: number): number;
|
||||
getEnergyProducedLastTick(): number;
|
||||
getHotFluidProducedLastTick(): number;
|
||||
isActivelyCooled(): boolean;
|
||||
getCoolantAmount(): number;
|
||||
getCoolantAmountMax(): number;
|
||||
getHotFluidAmount(): number;
|
||||
getHotFluidAmountMax(): number;
|
||||
getHotFluidType(): string;
|
||||
getFuelReactivity(): number;
|
||||
getFuelConsumedLastTick(): number;
|
||||
getControllRodLocation(idx: number): Coords;
|
||||
getEnergyCapacity(): number;
|
||||
getControllRodLevels(): Map<number, number>;
|
||||
setControllRodLevels(levels: Map<number, number>): void;
|
||||
getEnergyStats(): EnergyStats;
|
||||
getHotFluidStats(): HotFluidStats;
|
||||
getCoolantFluidStats(): CoolantFluidStats;
|
||||
setActive(active: boolean): void;
|
||||
setControllRodLevel(idx: number, level: number): void;
|
||||
setAllControllRodLevels(level: number): void;
|
||||
setControllRodName(idx: number, name: string): void;
|
||||
doEjectWaste(): void;
|
||||
doEjectFuel(): void;
|
||||
}
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/TypeScriptToLua/TypeScriptToLua/master/tsconfig-schema.json",
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["ESNext"],
|
||||
"moduleResolution": "NodeNext",
|
||||
"module": "NodeNext",
|
||||
"types": [],
|
||||
"strict": true
|
||||
},
|
||||
"tstl": {
|
||||
"luaTarget": "universal",
|
||||
"luaBundleEntry": "src/index.ts",
|
||||
"luaBundle": "rOSs.lua"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user