added export to Redstone

This commit is contained in:
Djeeberjr 2023-06-25 19:06:48 +02:00
parent e686afb298
commit 909aac941c

View File

@ -1,5 +1,7 @@
package kernel.peripherals; package kernel.peripherals;
import lib.exporter.ExportConfig;
import lib.exporter.IExportable;
import haxe.ds.ReadOnlyArray; import haxe.ds.ReadOnlyArray;
import lib.Color; 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<Noise>; public final onChange:Signal<Noise>;
@ -120,4 +122,14 @@ class Redstone implements IPeripheral {
return cc.Redstone.testBundledInput(this.addr,mask); 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());}
]
};
}
} }