Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SPDX-FileCopyrightText: 2026 Tomodachi94
- -- SPDX-License-Identifier: MIT
- -- Display the status of a Thermal Expansion Energetic Infuser on a monitor.
- print("infuserstatus by Tomodachi94")
- print("Setup:")
- print("Place this computer behind an Energetic Infuser. Place two monitors above the computer, horizontally next to each other.")
- local infuser = peripheral.wrap("top")
- -- The monitor should be two advanced monitors next to each other
- local monitor = peripheral.wrap("right")
- local function round(num)
- local decimalPlaces = 0
- local mult = 10^(decimalPlaces)
- return math.floor(num * mult + 0.5) / mult
- end
- local function chargingItemStatus()
- local item = infuser.getStackInSlot("1")
- monitor.setCursorPos(1, 1)
- monitor.write("Charging " .. item["name"])
- local energyPerTick = tostring(infuser.getEnergyPerTick()) .. " RF/t"
- local energyInItem = tostring(item["energyStored"])
- local itemEnergyCapacity = tostring(item["maxEnergyStored"])
- monitor.setCursorPos(1, 2)
- local chargingMessage = string.format("%s / %s (%s)", energyInItem, itemEnergyCapacity, energyPerTick)
- monitor.write(chargingMessage)
- monitor.setCursorPos(1, 3)
- local percentage = round(( item["energyStored"] / item["maxEnergyStored"] ) * 100)
- monitor.write(tostring(percentage) .. "% charged")
- end
- while true do
- sleep(0)
- monitor.setTextScale(0.5)
- monitor.setCursorPos(1, 1)
- monitor.write("Waiting... ") -- also clears the line
- monitor.setCursorPos(1, 2)
- monitor.clearLine()
- monitor.setCursorPos(1, 3)
- monitor.clearLine()
- while type(infuser.getStackInSlot("1")) == "table" do
- local status = pcall(chargingItemStatus)
- if status == false then return end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment