@siredvin/typed-peripheral-turtlematic 0.1.0 → 0.2.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/automata/end.lua +11 -0
- package/automata/end.ts +25 -0
- package/automata/husbandry.lua +11 -0
- package/automata/husbandry.ts +28 -0
- package/automata/mason.lua +23 -0
- package/automata/mason.ts +19 -0
- package/automata/protective.lua +11 -0
- package/automata/protective.ts +23 -0
- package/automata/regular.lua +11 -0
- package/automata/regular.ts +17 -0
- package/automata/smithing.lua +23 -0
- package/automata/smithing.ts +22 -0
- package/mics/chatter.lua +30 -0
- package/mics/chatter.ts +29 -0
- package/mics/lava_bucket.lua +21 -0
- package/mics/lava_bucket.ts +16 -0
- package/mics/mimic.lua +7 -0
- package/mics/mimic.ts +12 -0
- package/mics/piston.lua +29 -0
- package/mics/piston.ts +28 -0
- package/mics/sticky_piston.lua +32 -0
- package/mics/sticky_piston.ts +32 -0
- package/package.json +4 -2
package/automata/end.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.endAutomataProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"endAutomata",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
package/automata/end.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { FuelApi } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
import { InteractionApi } from "@siredvin/typed-peripheral-api/interaction";
|
|
4
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
5
|
+
import { OperationApi } from "@siredvin/typed-peripheral-api/operations";
|
|
6
|
+
import { LookApi } from "@siredvin/typed-peripheral-api/look";
|
|
7
|
+
import { CaptureAPI } from "@siredvin/typed-peripheral-api/capture";
|
|
8
|
+
import { SuckAPI } from "@siredvin/typed-peripheral-api/suck";
|
|
9
|
+
import { WarpAPI } from "@siredvin/typed-peripheral-api/warp";
|
|
10
|
+
|
|
11
|
+
/** @noSelf **/
|
|
12
|
+
export declare interface EndAutomata
|
|
13
|
+
extends FuelApi,
|
|
14
|
+
InteractionApi,
|
|
15
|
+
ConfigurationAPI<object>,
|
|
16
|
+
OperationApi,
|
|
17
|
+
LookApi,
|
|
18
|
+
CaptureAPI,
|
|
19
|
+
SuckAPI,
|
|
20
|
+
WarpAPI {}
|
|
21
|
+
|
|
22
|
+
export const endAutomataProvider = new IPeripheralProvider<EndAutomata>(
|
|
23
|
+
"endAutomata",
|
|
24
|
+
() => null
|
|
25
|
+
);
|
|
@@ -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.husbandryAutomataProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"husbandryAutomata",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { FuelApi, FuelAPIConfiguration } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
import { InteractionApi } from "@siredvin/typed-peripheral-api/interaction";
|
|
4
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
5
|
+
import { OperationApi } from "@siredvin/typed-peripheral-api/operations";
|
|
6
|
+
import { LookApi } from "@siredvin/typed-peripheral-api/look";
|
|
7
|
+
import { CaptureAPI } from "@siredvin/typed-peripheral-api/capture";
|
|
8
|
+
|
|
9
|
+
export declare interface HusbandryConfiguration extends FuelAPIConfiguration {
|
|
10
|
+
maxHusbandryPoints: number;
|
|
11
|
+
simulationGrowCost: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** @noSelf **/
|
|
15
|
+
export declare interface HusbandryAutomata
|
|
16
|
+
extends FuelApi,
|
|
17
|
+
InteractionApi,
|
|
18
|
+
ConfigurationAPI<HusbandryConfiguration>,
|
|
19
|
+
OperationApi,
|
|
20
|
+
LookApi,
|
|
21
|
+
CaptureAPI {
|
|
22
|
+
harvest(direction?: "up" | "down"): Result;
|
|
23
|
+
getHusbandryPoints(): number;
|
|
24
|
+
simulateGrow(): Result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const husbandryAutomataProvider =
|
|
28
|
+
new IPeripheralProvider<HusbandryAutomata>("husbandryAutomata", () => null);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
7
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
8
|
+
local ____fuel = require("@siredvin/typed-peripheral-api/fuel")
|
|
9
|
+
local DummyFuelApi = ____fuel.DummyFuelApi
|
|
10
|
+
---
|
|
11
|
+
-- @noSelf *
|
|
12
|
+
local DummyMasonAutomata = __TS__Class()
|
|
13
|
+
DummyMasonAutomata.name = "DummyMasonAutomata"
|
|
14
|
+
__TS__ClassExtends(DummyMasonAutomata, DummyFuelApi)
|
|
15
|
+
function DummyMasonAutomata.prototype.chisel(mode, target, direction)
|
|
16
|
+
return true, nil
|
|
17
|
+
end
|
|
18
|
+
____exports.masonProvider = __TS__New(
|
|
19
|
+
IPeripheralProvider,
|
|
20
|
+
"masonAutomata",
|
|
21
|
+
function() return __TS__New(DummyMasonAutomata) end
|
|
22
|
+
)
|
|
23
|
+
return ____exports
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { DummyFuelApi, FuelApi } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
|
|
4
|
+
/** @noSelf **/
|
|
5
|
+
export declare interface MasonAutomata extends FuelApi {
|
|
6
|
+
chisel(mode: "block", target: string, direction?: Direction): Result;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** @noSelf **/
|
|
10
|
+
class DummyMasonAutomata extends DummyFuelApi implements MasonAutomata {
|
|
11
|
+
chisel(mode: "block", target: string, direction?: Direction): Result {
|
|
12
|
+
return $multi(true, null);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const masonProvider = new IPeripheralProvider<MasonAutomata>(
|
|
17
|
+
"masonAutomata",
|
|
18
|
+
() => new DummyMasonAutomata()
|
|
19
|
+
);
|
|
@@ -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.protectiveProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"protectiveAutomata",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { DummyFuelApi, FuelApi } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
import { InteractionApi } from "@siredvin/typed-peripheral-api/interaction";
|
|
4
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
5
|
+
import { CaptureAPI } from "@siredvin/typed-peripheral-api/capture";
|
|
6
|
+
import { OperationApi } from "@siredvin/typed-peripheral-api/operations";
|
|
7
|
+
import { LookApi } from "@siredvin/typed-peripheral-api/look";
|
|
8
|
+
import { SuckAPI } from "@siredvin/typed-peripheral-api/suck";
|
|
9
|
+
|
|
10
|
+
/** @noSelf **/
|
|
11
|
+
export declare interface ProtectiveAutomata
|
|
12
|
+
extends FuelApi,
|
|
13
|
+
InteractionApi,
|
|
14
|
+
ConfigurationAPI<object>,
|
|
15
|
+
CaptureAPI,
|
|
16
|
+
OperationApi,
|
|
17
|
+
LookApi,
|
|
18
|
+
SuckAPI {}
|
|
19
|
+
|
|
20
|
+
export const protectiveProvider = new IPeripheralProvider<ProtectiveAutomata>(
|
|
21
|
+
"protectiveAutomata",
|
|
22
|
+
() => null
|
|
23
|
+
);
|
|
@@ -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.automataProvider = __TS__New(
|
|
7
|
+
IPeripheralProvider,
|
|
8
|
+
"automata",
|
|
9
|
+
function() return nil end
|
|
10
|
+
)
|
|
11
|
+
return ____exports
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { FuelApi } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
import { InteractionApi } from "@siredvin/typed-peripheral-api/interaction";
|
|
4
|
+
import { ConfigurationAPI } from "@siredvin/typed-peripheral-api/configuration";
|
|
5
|
+
import { OperationApi } from "@siredvin/typed-peripheral-api/operations";
|
|
6
|
+
|
|
7
|
+
/** @noSelf **/
|
|
8
|
+
export declare interface Automata
|
|
9
|
+
extends FuelApi,
|
|
10
|
+
InteractionApi,
|
|
11
|
+
ConfigurationAPI<object>,
|
|
12
|
+
OperationApi {}
|
|
13
|
+
|
|
14
|
+
export const automataProvider = new IPeripheralProvider<Automata>(
|
|
15
|
+
"automata",
|
|
16
|
+
() => null
|
|
17
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
7
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
8
|
+
local ____fuel = require("@siredvin/typed-peripheral-api/fuel")
|
|
9
|
+
local DummyFuelApi = ____fuel.DummyFuelApi
|
|
10
|
+
---
|
|
11
|
+
-- @noSelf *
|
|
12
|
+
local DummySmithingAutomata = __TS__Class()
|
|
13
|
+
DummySmithingAutomata.name = "DummySmithingAutomata"
|
|
14
|
+
__TS__ClassExtends(DummySmithingAutomata, DummyFuelApi)
|
|
15
|
+
function DummySmithingAutomata.prototype.smelt(mode, limit)
|
|
16
|
+
return true, nil
|
|
17
|
+
end
|
|
18
|
+
____exports.smithingProvider = __TS__New(
|
|
19
|
+
IPeripheralProvider,
|
|
20
|
+
"smithingAutomata",
|
|
21
|
+
function() return __TS__New(DummySmithingAutomata) end
|
|
22
|
+
)
|
|
23
|
+
return ____exports
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
import { DummyFuelApi, FuelApi } from "@siredvin/typed-peripheral-api/fuel";
|
|
3
|
+
|
|
4
|
+
/** @noSelf **/
|
|
5
|
+
export declare interface SmithingAutomata extends FuelApi {
|
|
6
|
+
smelt(mode: "block", direction?: Direction): Result;
|
|
7
|
+
smelt(mode: "inventory", limit: number): Result;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** @noSelf **/
|
|
11
|
+
class DummySmithingAutomata extends DummyFuelApi implements SmithingAutomata {
|
|
12
|
+
smelt(mode: "block", direction?: Direction): Result;
|
|
13
|
+
smelt(mode: "inventory", limit: number): Result;
|
|
14
|
+
smelt(mode: unknown, limit?: unknown): Result {
|
|
15
|
+
return $multi(true, null);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const smithingProvider = new IPeripheralProvider<SmithingAutomata>(
|
|
20
|
+
"smithingAutomata",
|
|
21
|
+
() => new DummySmithingAutomata()
|
|
22
|
+
);
|
package/mics/chatter.lua
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
6
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
7
|
+
local DUMMY_MESSAGE = nil
|
|
8
|
+
---
|
|
9
|
+
-- @noSelf *
|
|
10
|
+
____exports.DummyChatter = __TS__Class()
|
|
11
|
+
local DummyChatter = ____exports.DummyChatter
|
|
12
|
+
DummyChatter.name = "DummyChatter"
|
|
13
|
+
function DummyChatter.prototype.____constructor(self)
|
|
14
|
+
end
|
|
15
|
+
function DummyChatter.prototype.getMessage()
|
|
16
|
+
return DUMMY_MESSAGE
|
|
17
|
+
end
|
|
18
|
+
function DummyChatter.prototype.setMessage(text)
|
|
19
|
+
DUMMY_MESSAGE = text
|
|
20
|
+
print("Setting message to chatter", DUMMY_MESSAGE)
|
|
21
|
+
end
|
|
22
|
+
function DummyChatter.prototype.clearMessage()
|
|
23
|
+
DUMMY_MESSAGE = nil
|
|
24
|
+
end
|
|
25
|
+
____exports.chatterProvider = __TS__New(
|
|
26
|
+
IPeripheralProvider,
|
|
27
|
+
"chatter",
|
|
28
|
+
function() return __TS__New(____exports.DummyChatter) end
|
|
29
|
+
)
|
|
30
|
+
return ____exports
|
package/mics/chatter.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
|
|
3
|
+
let DUMMY_MESSAGE: string | null = null;
|
|
4
|
+
|
|
5
|
+
/** @noSelf **/
|
|
6
|
+
export interface Chatter extends IPeripheral {
|
|
7
|
+
getMessage(): string | null;
|
|
8
|
+
setMessage(text: string): void;
|
|
9
|
+
clearMessage(): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** @noSelf **/
|
|
13
|
+
export class DummyChatter implements Chatter {
|
|
14
|
+
getMessage(): string | null {
|
|
15
|
+
return DUMMY_MESSAGE;
|
|
16
|
+
}
|
|
17
|
+
setMessage(text: string): void {
|
|
18
|
+
DUMMY_MESSAGE = text;
|
|
19
|
+
print("Setting message to chatter", DUMMY_MESSAGE);
|
|
20
|
+
}
|
|
21
|
+
clearMessage(): void {
|
|
22
|
+
DUMMY_MESSAGE = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const chatterProvider = new IPeripheralProvider<Chatter>(
|
|
27
|
+
"chatter",
|
|
28
|
+
() => new DummyChatter()
|
|
29
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
6
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
7
|
+
---
|
|
8
|
+
-- @noSelf *
|
|
9
|
+
____exports.DummyLavaBucket = __TS__Class()
|
|
10
|
+
local DummyLavaBucket = ____exports.DummyLavaBucket
|
|
11
|
+
DummyLavaBucket.name = "DummyLavaBucket"
|
|
12
|
+
function DummyLavaBucket.prototype.____constructor(self)
|
|
13
|
+
end
|
|
14
|
+
function DummyLavaBucket.prototype.void()
|
|
15
|
+
end
|
|
16
|
+
____exports.lavaBucketProvider = __TS__New(
|
|
17
|
+
IPeripheralProvider,
|
|
18
|
+
"lava_bucket",
|
|
19
|
+
function() return __TS__New(____exports.DummyLavaBucket) end
|
|
20
|
+
)
|
|
21
|
+
return ____exports
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
|
|
3
|
+
/** @noSelf **/
|
|
4
|
+
export interface LavaBucket extends IPeripheral {
|
|
5
|
+
void(): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** @noSelf **/
|
|
9
|
+
export class DummyLavaBucket implements LavaBucket {
|
|
10
|
+
void(): void {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const lavaBucketProvider = new IPeripheralProvider<LavaBucket>(
|
|
14
|
+
"lava_bucket",
|
|
15
|
+
() => new DummyLavaBucket()
|
|
16
|
+
);
|
package/mics/mimic.lua
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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.mimicProvider = __TS__New(IPeripheralProvider, "mimic")
|
|
7
|
+
return ____exports
|
package/mics/mimic.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
|
|
3
|
+
/** @noSelf **/
|
|
4
|
+
export interface Mimic extends IPeripheral {
|
|
5
|
+
reset();
|
|
6
|
+
setTransformation(rlm: string);
|
|
7
|
+
getTransformation(): string;
|
|
8
|
+
setMimic(block: LuaTable, nbtData?: string);
|
|
9
|
+
getMimic(): LuaMultiReturn<[LuaTable | null, string | null]>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const mimicProvider = new IPeripheralProvider<Mimic>("mimic");
|
package/mics/piston.lua
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
6
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
7
|
+
local IS_SILENT_GLOBAL = false
|
|
8
|
+
---
|
|
9
|
+
-- @noSelf *
|
|
10
|
+
____exports.DummyPiston = __TS__Class()
|
|
11
|
+
local DummyPiston = ____exports.DummyPiston
|
|
12
|
+
DummyPiston.name = "DummyPiston"
|
|
13
|
+
function DummyPiston.prototype.____constructor(self)
|
|
14
|
+
end
|
|
15
|
+
function DummyPiston.prototype.isSilent()
|
|
16
|
+
return IS_SILENT_GLOBAL
|
|
17
|
+
end
|
|
18
|
+
function DummyPiston.prototype.setSilent(value)
|
|
19
|
+
IS_SILENT_GLOBAL = value
|
|
20
|
+
end
|
|
21
|
+
function DummyPiston.prototype.push(direction)
|
|
22
|
+
return true, nil
|
|
23
|
+
end
|
|
24
|
+
____exports.pistonProvider = __TS__New(
|
|
25
|
+
IPeripheralProvider,
|
|
26
|
+
"piston",
|
|
27
|
+
function() return __TS__New(____exports.DummyPiston) end
|
|
28
|
+
)
|
|
29
|
+
return ____exports
|
package/mics/piston.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
|
|
3
|
+
let IS_SILENT_GLOBAL = false;
|
|
4
|
+
|
|
5
|
+
/** @noSelf **/
|
|
6
|
+
export interface Piston extends IPeripheral {
|
|
7
|
+
push(direction?: Direction): Result;
|
|
8
|
+
isSilent(): boolean;
|
|
9
|
+
setSilent(value: boolean): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** @noSelf **/
|
|
13
|
+
export class DummyPiston implements Piston {
|
|
14
|
+
isSilent(): boolean {
|
|
15
|
+
return IS_SILENT_GLOBAL;
|
|
16
|
+
}
|
|
17
|
+
setSilent(value: boolean): void {
|
|
18
|
+
IS_SILENT_GLOBAL = value;
|
|
19
|
+
}
|
|
20
|
+
push(direction?: Direction): Result {
|
|
21
|
+
return $multi(true, null);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const pistonProvider = new IPeripheralProvider<Piston>(
|
|
26
|
+
"piston",
|
|
27
|
+
() => new DummyPiston()
|
|
28
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____typed_2Dperipheral_2Dbase = require("@siredvin/typed-peripheral-base")
|
|
6
|
+
local IPeripheralProvider = ____typed_2Dperipheral_2Dbase.IPeripheralProvider
|
|
7
|
+
local IS_SILENT_GLOBAL = false
|
|
8
|
+
---
|
|
9
|
+
-- @noSelf *
|
|
10
|
+
____exports.DummyStickyPiston = __TS__Class()
|
|
11
|
+
local DummyStickyPiston = ____exports.DummyStickyPiston
|
|
12
|
+
DummyStickyPiston.name = "DummyStickyPiston"
|
|
13
|
+
function DummyStickyPiston.prototype.____constructor(self)
|
|
14
|
+
end
|
|
15
|
+
function DummyStickyPiston.prototype.isSilent()
|
|
16
|
+
return IS_SILENT_GLOBAL
|
|
17
|
+
end
|
|
18
|
+
function DummyStickyPiston.prototype.setSilent(value)
|
|
19
|
+
IS_SILENT_GLOBAL = value
|
|
20
|
+
end
|
|
21
|
+
function DummyStickyPiston.prototype.push(direction)
|
|
22
|
+
return true, nil
|
|
23
|
+
end
|
|
24
|
+
function DummyStickyPiston.prototype.pull(direction)
|
|
25
|
+
return true, nil
|
|
26
|
+
end
|
|
27
|
+
____exports.stickyPistonProvider = __TS__New(
|
|
28
|
+
IPeripheralProvider,
|
|
29
|
+
"stickyPiston",
|
|
30
|
+
function() return __TS__New(____exports.DummyStickyPiston) end
|
|
31
|
+
)
|
|
32
|
+
return ____exports
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IPeripheralProvider } from "@siredvin/typed-peripheral-base";
|
|
2
|
+
|
|
3
|
+
let IS_SILENT_GLOBAL = false;
|
|
4
|
+
|
|
5
|
+
/** @noSelf **/
|
|
6
|
+
export interface StickyPiston extends IPeripheral {
|
|
7
|
+
pull(direction?: Direction): Result;
|
|
8
|
+
push(direction?: Direction): Result;
|
|
9
|
+
isSilent(): boolean;
|
|
10
|
+
setSilent(value: boolean): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** @noSelf **/
|
|
14
|
+
export class DummyStickyPiston implements StickyPiston {
|
|
15
|
+
isSilent(): boolean {
|
|
16
|
+
return IS_SILENT_GLOBAL;
|
|
17
|
+
}
|
|
18
|
+
setSilent(value: boolean): void {
|
|
19
|
+
IS_SILENT_GLOBAL = value;
|
|
20
|
+
}
|
|
21
|
+
push(direction?: Direction): Result {
|
|
22
|
+
return $multi(true, null);
|
|
23
|
+
}
|
|
24
|
+
pull(direction?: Direction): Result {
|
|
25
|
+
return $multi(true, null);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const stickyPistonProvider = new IPeripheralProvider<StickyPiston>(
|
|
30
|
+
"stickyPiston",
|
|
31
|
+
() => new DummyStickyPiston()
|
|
32
|
+
);
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siredvin/typed-peripheral-turtlematic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typed peripheral library for Turtlematic peripherals",
|
|
5
5
|
"files": [
|
|
6
6
|
"./*.ts",
|
|
7
|
-
"./*.lua"
|
|
7
|
+
"./*.lua",
|
|
8
|
+
"./**/*.ts",
|
|
9
|
+
"./**/*.lua"
|
|
8
10
|
],
|
|
9
11
|
"publishConfig": {
|
|
10
12
|
"access": "public"
|