From f85ff77728aa28bcee537232f135242c5a27f84d Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Wed, 7 Jun 2023 15:15:50 +0200 Subject: [PATCH] added energyStorage perf --- src/kernel/peripherals/EnergyStorage.hx | 25 +++++++++++++++++++++++++ src/kernel/peripherals/Peripherals.hx | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/kernel/peripherals/EnergyStorage.hx diff --git a/src/kernel/peripherals/EnergyStorage.hx b/src/kernel/peripherals/EnergyStorage.hx new file mode 100644 index 0000000..cf3da2d --- /dev/null +++ b/src/kernel/peripherals/EnergyStorage.hx @@ -0,0 +1,25 @@ +package kernel.peripherals; + +class EnergyStorage implements IPeripheral{ + public static inline final TYPE_NAME:String = "energyCell"; + + private final addr:String; + private final native: cc.periphs.EnergyStorage; + + public function new(addr: String) { + this.addr = addr; + this.native = cc.Peripheral.wrap(addr); + } + + public function getEnergy(): Int { + return this.native.getEnergy(); + } + + public function getEnergyCapacity(): Int { + return this.native.getEnergyCapacity(); + } + + public function getAddr():String { + return this.addr; + } +} diff --git a/src/kernel/peripherals/Peripherals.hx b/src/kernel/peripherals/Peripherals.hx index 9d40485..9c45ede 100644 --- a/src/kernel/peripherals/Peripherals.hx +++ b/src/kernel/peripherals/Peripherals.hx @@ -1,6 +1,5 @@ package kernel.peripherals; -import haxe.ds.ReadOnlyArray; import kernel.peripherals.Modem; import kernel.peripherals.Screen;