@siredvin/typed-peripheral-digitalitems 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/advanced_digitizer.lua +11 -0
- package/advanced_digitizer.ts +57 -0
- package/digitizer.lua +11 -0
- package/digitizer.ts +24 -0
- package/lualib_bundle.lua +9 -0
- package/package.json +55 -0
- package/shared.lua +3 -0
- package/shared.ts +10 -0
|
@@ -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.advancedDigitizerProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"advanced_digitizer",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
2
|
+
import { InventoryAPI } from "@siredvin/typed-peripheral-api/inventory";
|
|
3
|
+
import { FluidDetail, IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
4
|
+
import { IDInfo, ItemIDInfo } from "./shared";
|
|
5
|
+
|
|
6
|
+
export declare type FluidIDInfo = IDInfo & {
|
|
7
|
+
fluid: {
|
|
8
|
+
amount: number;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare type EnergyIDInfo = IDInfo & {
|
|
14
|
+
energy: {
|
|
15
|
+
amount: number;
|
|
16
|
+
unit: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export declare interface AdvancedDigitizerConfiguration {
|
|
21
|
+
decayEnabled: boolean;
|
|
22
|
+
decayTicks: number;
|
|
23
|
+
energyStackLimit: number;
|
|
24
|
+
fluidStackLimit: number;
|
|
25
|
+
itemStackLimit: number;
|
|
26
|
+
inventoryAPIVersion: [number, number];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @noSelf **/
|
|
30
|
+
export interface AdvancedDigitizer
|
|
31
|
+
extends IPeripheral,
|
|
32
|
+
InventoryAPI,
|
|
33
|
+
ConfigurationAPI<AdvancedDigitizerConfiguration> {
|
|
34
|
+
digitize(
|
|
35
|
+
mode: "item" | "fluid" | "energy",
|
|
36
|
+
source?: string,
|
|
37
|
+
filter?: number | LuaTable,
|
|
38
|
+
limit?: number,
|
|
39
|
+
destination?: string
|
|
40
|
+
): LuaMultiReturn<[null, string] | [string, null]>;
|
|
41
|
+
rematerialize(
|
|
42
|
+
mode: "item" | "fluid" | "energy",
|
|
43
|
+
id: string,
|
|
44
|
+
limit?: number,
|
|
45
|
+
destination?: string
|
|
46
|
+
): LuaMultiReturn<[null, string] | [number, null]>;
|
|
47
|
+
refresh(mode: "item" | "fluid" | "energy", id: string): boolean;
|
|
48
|
+
get(mode: "item", id: string): ItemIDInfo | null;
|
|
49
|
+
get(mode: "fluid", id: string): FluidIDInfo | null;
|
|
50
|
+
get(mode: "energy", id: string): EnergyIDInfo | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const advancedDigitizerProvider =
|
|
54
|
+
new IPeripheralProvider<AdvancedDigitizer>(
|
|
55
|
+
"advanced_digitizer",
|
|
56
|
+
() => null
|
|
57
|
+
);
|
package/digitizer.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.digitizerProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"digitizer",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
package/digitizer.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
2
|
+
import { InventoryAPI } from "@siredvin/typed-peripheral-api/inventory";
|
|
3
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
4
|
+
import { ItemIDInfo } from "./shared";
|
|
5
|
+
|
|
6
|
+
/** @noSelf **/
|
|
7
|
+
export interface Digitizer
|
|
8
|
+
extends IPeripheral,
|
|
9
|
+
InventoryAPI,
|
|
10
|
+
ConfigurationAPI<object> {
|
|
11
|
+
getDecayEnabled(): boolean;
|
|
12
|
+
getDecayTicks(): number;
|
|
13
|
+
digitize(): string;
|
|
14
|
+
rematerialize(id: string);
|
|
15
|
+
digitizeAmount(amount: number): string;
|
|
16
|
+
rematerializeAmount(id: string, amount: number);
|
|
17
|
+
refresh(id: string);
|
|
18
|
+
getIDInfo(id): ItemIDInfo;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const digitizerProvider = new IPeripheralProvider<Digitizer>(
|
|
22
|
+
"digitizer",
|
|
23
|
+
() => null
|
|
24
|
+
);
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siredvin/typed-peripheral-digitalitems",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed peripheral library for Digital Items 3 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
|
+
"@siredvin/typed-peripheral-api": "0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript-to-lua": "*",
|
|
31
|
+
"typescript": "*"
|
|
32
|
+
},
|
|
33
|
+
"nx": {
|
|
34
|
+
"targets": {
|
|
35
|
+
"lint": {
|
|
36
|
+
"executor": "@nx/linter:eslint",
|
|
37
|
+
"outputs": [
|
|
38
|
+
"{options.outputFile}"
|
|
39
|
+
],
|
|
40
|
+
"options": {
|
|
41
|
+
"lintFilePatterns": [
|
|
42
|
+
"packages/typed-peripheral/**/*.{ts,tsx,js,jsx}"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"depcheck": {
|
|
47
|
+
"executor": "nx:run-commands",
|
|
48
|
+
"options": {
|
|
49
|
+
"command": "depcheck",
|
|
50
|
+
"cwd": "packages/typed-peripheral"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/shared.lua
ADDED