diff --git a/README.md b/README.md index e7ef584..023e03b 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,21 @@ A library for handling events in a nicer way (e.g. using named properties rather Example: ```ts -const timer = os.startTimer(5) +import * as event from "./event"; + +const timer = os.startTimer(5); while (true) { - const ev = event.pullEventAs("timer"); + const ev = event.pullEventAs(event.TimerEvent, "timer"); if (ev.id == timer) break; } ``` +All types are included in the compiled output, even if they were never used. To avoid this, comment out the event class declarations you don't need, and remove the init functions from `eventInitializers`. Do not remove `GenericEvent`, as this is the fallback event type when other types aren't available. + ## `tsconfig.json` Options The `tsconfig.json` file contains some options used by TypeScriptToLua to adjust how Lua code is generated. Some of these may be useful for CC development. See [the TSTL webpage](https://typescripttolua.github.io/docs/configuration) for the rest of the options. +* `luaTarget`: Sets the version of Lua the compiler should target. This affects things like bitwise operators and `continue` support. CC has a feature set mixed between multiple versions; it uses 5.1 as a base language but supports many of 5.2 and 5.3's library features, including `bit32`. By default, TSTL will not compile bitwise operators in 5.1 mode even though CC supports it, but using 5.2 will enable `continue`, which is not supported in CC. I have chosen a middle ground of LuaJIT, but if you have issues you may change this to another version, depending on what you need. * `noImplicitSelf`: Controls whether functions have a `this`/`self`. By default, all functions are given a `self` parameter (even ones not in tables!) to allow JavaScript's `this` value to work. This can be disabled per-function with `/** @noSelf **/` or per-file with `/** @noSelfInFile **/`; but if you don't use `this` or don't want to have `self` added to functions, you can set this option to `true` to disable `this`/`self`. * `luaLibImport`: Controls how TypeScript polyfills are emitted in the Lua code. The following options are available: * `inline`: Inserts the only required boilerplate code in each file. This is the default, and is recommended for projects with few files. However, this may generate duplicate code in projects with lots of files. diff --git a/event.ts b/event.ts index ac8cf70..85efcf5 100755 --- a/event.ts +++ b/event.ts @@ -276,6 +276,31 @@ export class TurtleInventoryEvent implements IEvent { return ev; } } + +class SpeakerAudioEmptyEvent implements IEvent { + public side: string = ""; + public get_name() {return "speaker_audio_empty";} + public get_args() {return [this.side];} + public static init(args: any[]): IEvent | null { + if (!(typeof args[0] === "string") || (args[0] as string) != "speaker_audio_empty") return null; + let ev: SpeakerAudioEmptyEvent; + ev.side = args[1] as string; + return ev; + } +} + +class ComputerCommandEvent implements IEvent { + public args: string[] = []; + public get_name() {return "computer_command";} + public get_args() {return this.args;} + public static init(args: any[]): IEvent | null { + if (!(typeof args[0] === "string") || (args[0] as string) != "computer_command") return null; + let ev: ComputerCommandEvent; + ev.args = args.slice(1); + return ev; + } +} + /* class Event implements IEvent { @@ -318,9 +343,12 @@ let eventInitializers: ((args: any[]) => IEvent | null)[] = [ MouseEvent.init, ResizeEvent.init, TurtleInventoryEvent.init, + SpeakerAudioEmptyEvent.init, + ComputerCommandEvent.init, GenericEvent.init ]; +type Constructor = new (...args: any[]) => T; export function pullEventRaw(filter: string | null = null): IEvent | null { let args: any[] = table.pack(coroutine.yield(filter)); for (let init of eventInitializers) { @@ -334,12 +362,12 @@ export function pullEvent(filter: string | null = null): IEvent | null { if (ev instanceof TerminateEvent) throw "Terminated"; return ev; } -export function pullEventRawAs(type: () => T, filter: string | null = null): T | null { +export function pullEventRawAs(type: Constructor, filter: string | null = null): T | null { let ev = pullEventRaw(filter); if ((ev instanceof type)) return ev as T; else return null; } -export function pullEventAs(type: () => T, filter: string | null = null): T | null { +export function pullEventAs(type: Constructor, filter: string | null = null): T | null { let ev = pullEvent(filter); if ((ev instanceof type)) return ev as T; else return null; diff --git a/package-lock.json b/package-lock.json index f7f499a..a279dbd 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,24 @@ { "name": "cc-tstl-template", - "version": "1.100.1", + "version": "1.100.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cc-tstl-template", - "version": "1.100.1", + "version": "1.100.2", "license": "MIT", - "dependencies": { + "devDependencies": { "lua-types": "^2.8.0", + "typescript": "^4.5.0", "typescript-to-lua": "^1.3.0" } }, "node_modules/enhanced-resolve": { - "version": "5.8.3", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", - "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz", + "integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==", + "dev": true, "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -28,17 +30,20 @@ "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "node_modules/graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -50,6 +55,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, "dependencies": { "has": "^1.0.3" }, @@ -58,21 +64,27 @@ } }, "node_modules/lua-types": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.8.0.tgz", - "integrity": "sha512-FJY32giHIqD/XW1XGkJnl8XotXIJsJ2M42fj9A2UudttWA6orJioToW1OpgPdayTr+S1/oTO7i+hfBY3UVG8Fg==" + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.11.0.tgz", + "integrity": "sha512-J/8qHrOjkZuPBDhnuAg0DWoaJEImqXNzgEnUigCTVrSVCcchM5Y5zpcI3aWAZPhuZlb0QKC/f3nc7VGmZmBg7w==", + "dev": true, + "peerDependencies": { + "typescript-to-lua": "^1.0.0" + } }, "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==" + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true }, "node_modules/resolve": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", - "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, "dependencies": { - "is-core-module": "^2.8.0", + "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -87,6 +99,7 @@ "version": "0.7.3", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, "engines": { "node": ">= 8" } @@ -95,6 +108,7 @@ "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, "engines": { "node": ">= 0.4" }, @@ -106,15 +120,16 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, "engines": { "node": ">=6" } }, "node_modules/typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", - "peer": true, + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -124,9 +139,10 @@ } }, "node_modules/typescript-to-lua": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.1.tgz", - "integrity": "sha512-kizX/U0f1rXIUgs8MMqRiZkAi1t30+9cm8ZKuK6hZalJgX30IEQk4KPzgr1AQ17Bd+kBTJTw9XKHpVLKVC0Lyw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.4.tgz", + "integrity": "sha512-9NkUOSUd9tufvwCGiWJ6Z1edizYcECUfjdZJZfDRKTEXKIddbAdV3IFR6u5gxvYYRfXhfNV6IKvqHS2HxHFs6w==", + "dev": true, "dependencies": { "enhanced-resolve": "^5.8.2", "resolve": "^1.15.1", @@ -145,9 +161,10 @@ }, "dependencies": { "enhanced-resolve": { - "version": "5.8.3", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", - "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz", + "integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==", + "dev": true, "requires": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -156,17 +173,20 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", + "dev": true }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -175,26 +195,31 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, "requires": { "has": "^1.0.3" } }, "lua-types": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.8.0.tgz", - "integrity": "sha512-FJY32giHIqD/XW1XGkJnl8XotXIJsJ2M42fj9A2UudttWA6orJioToW1OpgPdayTr+S1/oTO7i+hfBY3UVG8Fg==" + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.11.0.tgz", + "integrity": "sha512-J/8qHrOjkZuPBDhnuAg0DWoaJEImqXNzgEnUigCTVrSVCcchM5Y5zpcI3aWAZPhuZlb0QKC/f3nc7VGmZmBg7w==", + "dev": true, + "requires": {} }, "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==" + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true }, "resolve": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", - "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, "requires": { - "is-core-module": "^2.8.0", + "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -202,28 +227,32 @@ "source-map": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true }, "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==" + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true }, "tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==" + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", - "peer": true + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true }, "typescript-to-lua": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.1.tgz", - "integrity": "sha512-kizX/U0f1rXIUgs8MMqRiZkAi1t30+9cm8ZKuK6hZalJgX30IEQk4KPzgr1AQ17Bd+kBTJTw9XKHpVLKVC0Lyw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.4.tgz", + "integrity": "sha512-9NkUOSUd9tufvwCGiWJ6Z1edizYcECUfjdZJZfDRKTEXKIddbAdV3IFR6u5gxvYYRfXhfNV6IKvqHS2HxHFs6w==", + "dev": true, "requires": { "enhanced-resolve": "^5.8.2", "resolve": "^1.15.1", diff --git a/package.json b/package.json index 8b71aeb..231f486 100755 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "cc-tstl-template", - "version": "1.100.1", + "version": "1.100.3", "description": "Template project for ComputerCraft programs written in TypeScript.", - "main": "index.js", + "main": "main.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "tstl" }, - "dependencies": { + "devDependencies": { + "typescript": "^4.5.0", "lua-types": "^2.8.0", "typescript-to-lua": "^1.3.0" }, diff --git a/types/craftos/craftos.d.ts b/types/craftos/craftos.d.ts index 2952263..da397bc 100755 --- a/types/craftos/craftos.d.ts +++ b/types/craftos/craftos.d.ts @@ -1,6 +1,6 @@ /** @noSelfInFile **/ -// Latest CC version: 1.100.1 +// Latest CC version: 1.100.3 type Color = number; type Colour = Color; @@ -85,7 +85,7 @@ declare namespace disk { function eject(name: string): void; function getID(name: string): number; } -/* @noSelf */ +/** @noSelf */ declare class FileHandle { public close(): void; public seek(whence?: string, offset?: number): number; @@ -118,7 +118,7 @@ declare const fs: { move(from: string, to: string): void; copy(from: string, to: string): void; 'delete'(path: string): void; - combine(base: string, ...local: string[]): void; + combine(base: string, ...local: string[]): string; open(path: string, mode: string): LuaMultiReturn<[FileHandle] | [null, string]>; find(wildcard: string): string[]; getDir(path: string): string; @@ -168,7 +168,7 @@ type RequestOptions = { redirect: boolean | null; } -/* @noSelf */ +/** @noSelf */ declare class HTTPResponse { public getResponseCode(): number; public getResponseHeaders(): Map; @@ -178,7 +178,7 @@ declare class HTTPResponse { public close(): void; } -/* @noSelf */ +/** @noSelf */ declare class WebSocket { public receive(timeout?: number): string | null; public send(message: string, binary?: boolean): void; @@ -405,17 +405,17 @@ declare namespace parallel { function waitForany(...args: (() => void)[]): void; function waitForAll(...args: (() => void)[]): void; } -/* @noSelf */ +/** @noSelf */ interface IPeripheral {} -/* @noSelf */ +/** @noSelf */ declare class CommandPeripheral implements IPeripheral { getCommand(): string; setCommand(command: string): void; runCommand(): LuaMultiReturn<[boolean, string | null]>; } -/* @noSelf */ +/** @noSelf */ declare class ComputerPeripheral implements IPeripheral { turnOn(): void; shutdown(): void; @@ -425,7 +425,7 @@ declare class ComputerPeripheral implements IPeripheral { getLabel(): string; } -/* @noSelf */ +/** @noSelf */ declare class DrivePeripheral implements IPeripheral { isDiskPresent(): boolean; getDiskLabel(): string; @@ -440,7 +440,7 @@ declare class DrivePeripheral implements IPeripheral { getDiskID(): number; } -/* @noSelf */ +/** @noSelf */ declare class ModemPeripheral implements IPeripheral { open(channel: number): void; isOpen(channel: number): boolean; @@ -450,7 +450,7 @@ declare class ModemPeripheral implements IPeripheral { isWireless(): boolean; } -/* @noSelf */ +/** @noSelf */ declare class WiredModemPeripheral extends ModemPeripheral { getNamesRemote(): string[]; isPresentRemote(name: string): boolean; @@ -460,7 +460,7 @@ declare class WiredModemPeripheral extends ModemPeripheral { getNameLocal(): string; } -/* @noSelf */ +/** @noSelf */ declare class MonitorPeripheral implements IPeripheral, ITerminal { write(text: string): void; blit(text: string, textColors: string, backgroundColors: string): void; @@ -499,7 +499,7 @@ declare class MonitorPeripheral implements IPeripheral, ITerminal { setTextScale(scale: number): void; } -/* @noSelf */ +/** @noSelf */ declare class PrinterPeripheral implements IPeripheral { write(...args: (string | number)[]): void; getCursorPos(): LuaMultiReturn<[number, number]>; @@ -512,7 +512,7 @@ declare class PrinterPeripheral implements IPeripheral { getPaperLevel(): number; } -/* @noSelf */ +/** @noSelf */ declare class SpeakerPeripheral implements IPeripheral { playSound(name: string, volume?: number, pitch?: number): void; playNote(name: string, volume?: number, pitch?: number): void; @@ -520,13 +520,13 @@ declare class SpeakerPeripheral implements IPeripheral { stop(): void; } -/* @noSelf */ +/** @noSelf */ declare class EnergyStoragePeripheral implements IPeripheral { getEnergy(): number; getEnergyCapacity(): number; } -/* @noSelf */ +/** @noSelf */ declare class FluidStoragePeripheral implements IPeripheral { tanks(): {[index: number]: {name: string, amount: number}}; pushFluid(to: string, limit?: number, name?: string): number; @@ -548,7 +548,7 @@ declare type ItemDetail = { unbreakable?: boolean; } -/* @noSelf */ +/** @noSelf */ declare class InventoryPeripheral implements IPeripheral { size(): number; list(): {[index: number]: {name: string, count: number, nbt?: string}}; @@ -674,7 +674,7 @@ declare namespace table { function pack(...args: any[]): any[]; function unpack(tab: any[], start?: number, end?: number): LuaMultiReturn<[...any[]]>; } -/* @noSelf */ +/** @noSelf */ interface ITerminal { write(text: string): void; blit(text: string, textColors: string, backgroundColors: string): void; diff --git a/types/craftos/package.json b/types/craftos/package.json index 20889b6..a0443f3 100755 --- a/types/craftos/package.json +++ b/types/craftos/package.json @@ -1,6 +1,6 @@ { "name": "craftos", - "version": "1.0.0", + "version": "1.1.0", "types": "./craftos.d.ts", "files": ["./craftos.d.ts"] } \ No newline at end of file