1
0
mirror of https://github.com/osmarks/random-stuff synced 2024-12-28 02:50:33 +00:00
random-stuff/computercraft/energyreport.lua

16 lines
559 B
Lua
Raw Normal View History

2024-03-29 14:35:43 +00:00
local modem = {peripheral.find("modem", function(_, o) return o.isWireless() end)}
local storage = {peripheral.find "energy_storage"}
local function send(...)
for _, modem in pairs(modem) do
modem.transmit(48869, 48869, {...})
end
end
while true do
for _, s in pairs(storage) do
local name = settings.get("storage_name_" .. peripheral.getName(s))
send("mc_stored_rf/" .. name, "energy stored in RF", s.getEnergy())
send("mc_capacity_rf/" .. name, "maximum capacity in RF", s.getEnergyCapacity())
end
sleep(1)
end