add base energy to AR

This commit is contained in:
LordMZTE 2021-11-14 17:19:44 +01:00
parent 5e524f14ac
commit 036da52397
1 changed files with 9 additions and 2 deletions

View File

@ -1,8 +1,9 @@
local ar = peripheral.find "arController"
local pl_detector = peripheral.find "playerDetector"
local nrg = peripheral.find "thermal:energy_cell"
if ar == nil or pl_detector == nil then
error "couldnt find all peripherals. need ar controller and player detector"
if ar == nil or pl_detector == nil or nrg == nil then
error "couldnt find all peripherals. need ar controller, player detector and energy cell"
end
local cur_row = 0
@ -39,6 +40,12 @@ while true do
draw_one_line_idx_icon "minecraft:clock",
draw_idx_string(os.date(), 20),
draw_idx_separator(),
draw_one_line_idx_icon "minecraft:redstone_block",
draw_idx_string("Base Power:", 20),
draw_idx_string("Max: " .. nrg.getEnergyCapacity()),
draw_idx_string("Current: " .. nrg.getEnergy()),
draw_idx_string("%: " .. nrg.getEnergy() / nrg.getEnergyCapacity() * 100),
draw_idx_separator(),
draw_one_line_idx_icon "minecraft:player_head",
draw_idx_string("Players:", 20),
}