added type to IPerph

This commit is contained in:
2023-06-26 19:05:48 +02:00
parent f124525d2d
commit 4dcc060e9a
8 changed files with 74 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ abstract BundleMask(Int) from cc.Colors.Color to cc.Colors.Color {
}
class Redstone implements IPeripheral implements IExportable {
public static inline final TYPE_NAME:String = "redstone"; // TODO: there is technically not a type for redstone.
public final onChange:Signal<Noise>;
@@ -74,6 +75,10 @@ class Redstone implements IPeripheral implements IExportable {
return this.addr;
}
public function getType():String {
return TYPE_NAME;
}
private function updateState() {
this.analogInputState = cc.Redstone.getAnalogInput(this.addr);
this.bundleInputState = cc.Redstone.getBundledInput(this.addr);
@@ -125,7 +130,6 @@ class Redstone implements IPeripheral implements IExportable {
public function export():ExportConfig {
return {
type: "redstone",
getDelegates: [
"input" => (_) -> {return Bool(this.getInput());},
"analog" => (_) -> {return Number(this.getAnalogInput());}