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());} + ] + }; + } }