Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --First time running
- if not fs.exists("kapi") then
- shell.run("pastebin","get","mK2SZvHs","kapi")
- print("enjoy")
- end
- --End first startup
- --Setting Variables
- os.loadAPI("kapi") --Loads my api
- local monitor = peripheral.find("monitor")
- local control = peripheral.find("crafters_smeltery")
- --Getting info from smeltery controller and returning as a value
- function getInfo()
- local q = control.getInfo() --returns a table
- return q
- end
- --Checking if there is any fluid in smeltery returns true or false
- function hasFluid()
- local fluid = getInfo()
- if fluid["contents"] then
- return true
- else
- return false
- end
- end
- --Returns name of the fluid in the smeltery
- function fluidName()
- local fluid = getInfo()
- return fluid["contents"]["rawName"]
- end
- --Returns the amount of the fluid in the smeltery
- function fluidAmount()
- local fluid = getInfo()
- return fluid["contents"]["amount"]
- end
- --Clears monitor
- function monitorReset()
- monitor.clear()
- monitor.setCursorPos(1,1)
- end
- --Unknown as of now
- function monitorOutput()
- if hasFluid() then
- monitorReset()
- monitor.write("Contains: "..fluidName())
- monitor.setCursorPos(1,2)
- monitor.write("Amount: "..kapi.commaValue(fluidAmount()).." MB") --Runs a function to add a comma at the right spot
- else
- print("No fluid in smeltery")
- end
- end
- function checkAmount()
- local fluid = fluidAmount()
- end
- monitorOutput()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement