added exporter and interface for redstone

This commit is contained in:
Niklas Kapelle 2024-04-13 12:07:46 +02:00
parent 99489e37df
commit 7bd18c1a4c
Signed by: niklas
GPG Key ID: 4EB651B36D841D16
3 changed files with 26 additions and 1 deletions

View File

@ -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<Noise>;

View File

@ -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 {}

View File

@ -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;
}