@siredvin/typed-peripheral-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/computer.lua ADDED
@@ -0,0 +1,11 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local ____exports = {}
4
+ local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
5
+ local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
6
+ ____exports.computerProvider = __TS__New(
7
+ IPeripheralProvider,
8
+ "computer",
9
+ function() return nil end
10
+ )
11
+ return ____exports
package/computer.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
2
+
3
+ /** @noSelf **/
4
+ export interface Computer extends IPeripheral {
5
+ turnOn();
6
+ shutdown();
7
+ reboot();
8
+ getID(): number;
9
+ isOn(): boolean;
10
+ getLabel(): string;
11
+ }
12
+
13
+ export const computerProvider = new IPeripheralProvider<Computer>(
14
+ "computer",
15
+ () => null
16
+ );
package/drive.lua ADDED
@@ -0,0 +1,11 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local ____exports = {}
4
+ local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
5
+ local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
6
+ ____exports.driveProvider = __TS__New(
7
+ IPeripheralProvider,
8
+ "drive",
9
+ function() return nil end
10
+ )
11
+ return ____exports
package/drive.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
2
+
3
+ /** @noSelf **/
4
+ export interface Drive extends IPeripheral {
5
+ isDiskPresent(): boolean;
6
+ getDiskLabel(): string;
7
+ setDiskLabel(label?: string | null): void;
8
+ hasData(): boolean;
9
+ getMountPath(): string;
10
+ hasAudio(): boolean;
11
+ getAudioTitle(): string;
12
+ playAudio(): void;
13
+ stopAudio(): void;
14
+ ejectDisk(): void;
15
+ getDiskID(): number;
16
+ }
17
+
18
+ export const driveProvider = new IPeripheralProvider<Drive>(
19
+ "drive",
20
+ () => null
21
+ );
@@ -0,0 +1,9 @@
1
+ local function __TS__New(target, ...)
2
+ local instance = setmetatable({}, target.prototype)
3
+ instance:____constructor(...)
4
+ return instance
5
+ end
6
+
7
+ return {
8
+ __TS__New = __TS__New
9
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@siredvin/typed-peripheral-core",
3
+ "version": "0.1.0",
4
+ "description": "Typed peripheral library for basic CC:Tweaked peripherals",
5
+ "files": [
6
+ "./*.ts",
7
+ "./*.lua"
8
+ ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "author": "SirEdvin",
13
+ "license": "MIT",
14
+ "scripts": {
15
+ "test": "echo \"Error: no test specified\" && exit 1",
16
+ "build": "tstl",
17
+ "clean": "rm -f *.lua",
18
+ "lint": "eslint . --ext .ts,.js",
19
+ "depcheck": "depcheck"
20
+ },
21
+ "dependencies": {
22
+ "@siredvin/cc-types": "1.1.0",
23
+ "@siredvin/craftos-types": "1.2.0",
24
+ "@siredvin/api-types": "1.1.0",
25
+ "@jackmacwindows/lua-types": "^2.13.1",
26
+ "@siredvin/typed-peripheral-base": "0.4.0"
27
+ },
28
+ "devDependencies": {
29
+ "typescript-to-lua": "*",
30
+ "typescript": "*"
31
+ },
32
+ "nx": {
33
+ "targets": {
34
+ "lint": {
35
+ "executor": "@nx/linter:eslint",
36
+ "outputs": [
37
+ "{options.outputFile}"
38
+ ],
39
+ "options": {
40
+ "lintFilePatterns": [
41
+ "packages/typed-peripheral/**/*.{ts,tsx,js,jsx}"
42
+ ]
43
+ }
44
+ },
45
+ "depcheck": {
46
+ "executor": "nx:run-commands",
47
+ "options": {
48
+ "command": "depcheck",
49
+ "cwd": "packages/typed-peripheral"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local ____exports = {}
4
+ local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
5
+ local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
6
+ ____exports.redstoneRelayProvider = __TS__New(
7
+ IPeripheralProvider,
8
+ "restone_relay",
9
+ function() return nil end
10
+ )
11
+ return ____exports
@@ -0,0 +1,28 @@
1
+ import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
2
+
3
+ export declare type Side =
4
+ | "top"
5
+ | "bottom"
6
+ | "left"
7
+ | "right"
8
+ | "front"
9
+ | "back";
10
+
11
+ /** @noSelf **/
12
+ export interface RedstoneRelay extends IPeripheral {
13
+ setOutput(side: Side, on: boolean);
14
+ getOutput(side: Side);
15
+ getInput(side: Side): boolean;
16
+ setAnalogOutput(side: Side, value: number);
17
+ getAnalogOutput(side: Side): number;
18
+ getAnalogInput(side: Side): number;
19
+ setBundledOutput(side: Side, output: number);
20
+ getBundledInput(side: Side): number;
21
+ getBundledOutput(side: Side): number;
22
+ testBundledInput(side: Side, mask: number): boolean;
23
+ }
24
+
25
+ export const redstoneRelayProvider = new IPeripheralProvider<RedstoneRelay>(
26
+ "restone_relay",
27
+ () => null
28
+ );
package/turtle.lua ADDED
@@ -0,0 +1,11 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__New = ____lualib.__TS__New
3
+ local ____exports = {}
4
+ local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
5
+ local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
6
+ ____exports.turtleProvider = __TS__New(
7
+ IPeripheralProvider,
8
+ "turtle",
9
+ function() return nil end
10
+ )
11
+ return ____exports
package/turtle.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Computer } from "./computer";
2
+ import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
3
+
4
+ /** @noSelf **/
5
+ export interface Turtle extends Computer {}
6
+
7
+ export const turtleProvider = new IPeripheralProvider<Turtle>(
8
+ "turtle",
9
+ () => null
10
+ );