added exporter and interface for redstone
This commit is contained in:
parent
99489e37df
commit
7bd18c1a4c
@ -1,5 +1,6 @@
|
|||||||
package kernel.peripherals;
|
package kernel.peripherals;
|
||||||
|
|
||||||
|
import kernel.peripherals.interfaces.IRedstone;
|
||||||
import haxe.ds.ReadOnlyArray;
|
import haxe.ds.ReadOnlyArray;
|
||||||
import lib.Color;
|
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 static inline final TYPE_NAME:String = "redstone"; // TODO: there is technically not a type for redstone.
|
||||||
|
|
||||||
public final onChange:Signal<Noise>;
|
public final onChange:Signal<Noise>;
|
||||||
|
7
src/kernel/peripherals/exports/RedstoneExport.hx
Normal file
7
src/kernel/peripherals/exports/RedstoneExport.hx
Normal 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 {}
|
17
src/kernel/peripherals/interfaces/IRedstone.hx
Normal file
17
src/kernel/peripherals/interfaces/IRedstone.hx
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user