diff --git a/src/kernel/peripherals/Redstone.hx b/src/kernel/peripherals/Redstone.hx index ce0a172..e431d23 100644 --- a/src/kernel/peripherals/Redstone.hx +++ b/src/kernel/peripherals/Redstone.hx @@ -1,5 +1,6 @@ package kernel.peripherals; +import kernel.peripherals.interfaces.IRedstone; import haxe.ds.ReadOnlyArray; import lib.Color; @@ -41,7 +42,7 @@ abstract BundleMask(Int) from cc.Colors.Color to cc.Colors.Color { } } -class Redstone implements IPeripheral { +class Redstone implements IPeripheral implements IRedstone { public static inline final TYPE_NAME:String = "redstone"; // TODO: there is technically not a type for redstone. public final onChange:Signal; diff --git a/src/kernel/peripherals/exports/RedstoneExport.hx b/src/kernel/peripherals/exports/RedstoneExport.hx new file mode 100644 index 0000000..e105452 --- /dev/null +++ b/src/kernel/peripherals/exports/RedstoneExport.hx @@ -0,0 +1,7 @@ +package kernel.peripherals.exports; + +import macros.rpc.RPCBase; +import kernel.peripherals.interfaces.IRedstone; + +@:build(macros.rpc.RPC.buildRPC(IRedstone)) +class RedstoneExport extends RPCBase {} diff --git a/src/kernel/peripherals/interfaces/IRedstone.hx b/src/kernel/peripherals/interfaces/IRedstone.hx new file mode 100644 index 0000000..09a70a3 --- /dev/null +++ b/src/kernel/peripherals/interfaces/IRedstone.hx @@ -0,0 +1,17 @@ +package kernel.peripherals.interfaces; + +import cc.Colors.Color; +import kernel.peripherals.Redstone.BundleMask; + +interface IRedstone { + function setOutput(on:Bool):Void; + function getOutput():Bool; + function getInput():Bool; + function setAnalogOutput(strength:Int):Void; + function getAnalogOutput():Int; + function getAnalogInput():Int; + function setBundledOutput(output:BundleMask):Void; + function getBundledOutput():BundleMask; + function getBundledInput():BundleMask; + function testBundledInput(mask:Color):Bool; +}