From 909aac941cb8e3c30f4187756c95fc473a05d73f Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Sun, 25 Jun 2023 19:06:48 +0200 Subject: [PATCH] added export to Redstone --- src/kernel/peripherals/Redstone.hx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/kernel/peripherals/Redstone.hx b/src/kernel/peripherals/Redstone.hx index 6e0494d..da42530 100644 --- a/src/kernel/peripherals/Redstone.hx +++ b/src/kernel/peripherals/Redstone.hx @@ -1,5 +1,7 @@ package kernel.peripherals; +import lib.exporter.ExportConfig; +import lib.exporter.IExportable; import haxe.ds.ReadOnlyArray; import lib.Color; @@ -41,7 +43,7 @@ abstract BundleMask(Int) from cc.Colors.Color to cc.Colors.Color { } } -class Redstone implements IPeripheral { +class Redstone implements IPeripheral implements IExportable { public final onChange:Signal; @@ -120,4 +122,14 @@ class Redstone implements IPeripheral { return cc.Redstone.testBundledInput(this.addr,mask); } + + public function export():ExportConfig { + return { + type: "redstone", + getDelegates: [ + "input" => (_) -> {return Bool(this.getInput());}, + "analog" => (_) -> {return Number(this.getAnalogInput());} + ] + }; + } }