Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Get all peripherals on the network
- local line
- local machineName
- local isActive = ""
- local machine
- local mainLoop
- local monX
- local monY
- local itemInSlot1
- local ps = {}
- local energy
- local energyMax
- local titleColor
- -- Write startup message to Terminal
- term.clear()
- -- Check to see if the API file exists
- if fs.exists("ImpAPI") == false then
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- term.write("Missing API File! Attempting to download...")
- term.setTextColor(colors.white)
- shell.run("pastebin get pwBMKNCb ImpAPI") -- Go out and download it
- sInput = nil
- term.setCursorPos(1,5)
- term.setTextColor(colors.green)
- term.write("API Loaded.")
- term.setCursorPos(1,7)
- term.setTextColor(colors.white)
- term.write("Press enter to continue...")
- while true do
- sInput = read()
- if sInput ~= nil or sInput ~= "" then
- break
- end
- end
- end
- os.loadAPI("ImpAPI")
- machines=peripheral.getNames()
- line = 1
- mon=ImpAPI.monitorSearch()
- function writeEnergy(line1, line2)
- ImpAPI.CWrite(1, line1, mon, "Energy: ", colors.yellow)
- ImpAPI.CWrite(3, line2, mon, energy.."/"..energyMax, colors.white)
- end
- if mon then -- Found it
- ImpAPI.CTWrite(1,6,"Monitor Found!",colors.green)
- ImpAPI.CTWrite(1,8,"System Running",colors.orange)
- else -- No monitor Present
- ImpAPI.CTWrite(1,6,"Monitor Not Found!",colors.red)
- ImpAPI.CTWrite(1,8,"Please Attach a Monitor",colors.red)
- term.setCursorPos(1,9)
- return
- end
- mon.clear()
- mon.setTextScale(0.5)
- monX, monY = mon.getSize()
- mainLoop = 1
- while mainLoop > 0 do
- for i = 1, #machines do
- if string.match(machines[i], "slaughter") then
- machine=peripheral.wrap(machines[i])
- machineName = "Slaughterhouse"
- tankInfo = machine.getTankInfo("unknown")
- titleColor = colors.brown
- if machine.getEnergy() > 0 then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "grinder") then
- machine=peripheral.wrap(machines[i])
- machineName = "Grinder"
- tankInfo = machine.getTankInfo("unknown")
- titleColor = colors.green
- if machine.getEnergy() > 0 then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "furnace") then
- machine=peripheral.wrap(machines[i])
- machineName = "Redstone Furnace"
- titleColor = colors.gray
- if machine.getStackInSlot(1) then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "sawmill") then
- machine=peripheral.wrap(machines[i])
- machineName = "Sawmill"
- titleColor = colors.brown
- if machine.getStackInSlot(1) then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "pulverizer") then
- machine=peripheral.wrap(machines[i])
- machineName = "Pulverizer"
- titleColor = colors.orange
- if machine.getStackInSlot(1) then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "transposer") then
- machine=peripheral.wrap(machines[i])
- machineName = "Transposer"
- tankInfo = machine.getTankInfo("unknown")
- titleColor = colors.blue
- if machine.getStackInSlot(1) then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "crucible") then
- machine=peripheral.wrap(machines[i])
- machineName = "Crucible"
- tankInfo = machine.getTankInfo("unknown")
- titleColor = colors.gray
- if machine.getStackInSlot(1) then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "harvester") then
- machine=peripheral.wrap(machines[i])
- machineName = "Harvester"
- tankInfo = machine.getTankInfo("unknown")
- titleColor = colors.yellow
- if machine.getEnergy() > 0 then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "planter") then
- machine=peripheral.wrap(machines[i])
- machineName = "Planter"
- titleColor = colors.yellow
- if machine.getEnergy() > 0 then
- isActive = true
- else
- isActive = false
- end
- elseif string.match(machines[i], "smelter") then
- machine=peripheral.wrap(machines[i])
- machineName = "Induction Smelter"
- titleColor = colors.blue
- if (machine.getStackInSlot(1)) and (machine.getStackInSlot(2)) then
- isActive = true
- else
- isActive = false
- end
- end
- if machine then
- energy = machine.getEnergy()
- energyMax = machine.getMaxEnergy()
- monX, monY = mon.getSize()
- centerPos = math.floor((monX - #machineName) / 2) + 1
- if isActive then
- ImpAPI.draw_line(1, 1, monX, titleColor, mon)
- else
- ImpAPI.draw_line(1, 1, monX, colors.red, mon)
- end
- ImpAPI.CWrite(centerPos, 1, mon, machineName, colors.white)
- ImpAPI.draw_line(1, 2, monX, colors.black, mon)
- if machineName == "Slaughterhouse" then
- psCap = 0
- psAmt = 0
- meatCap = 0
- meatAmt = 0
- for k,v in pairs(tankInfo) do
- for o,c in pairs(v) do
- if c == "pinkslime" then
- for a,b in pairs(v) do
- if a == "amount" then
- psAmt = b
- end
- if a == "capacity" then
- psCap = b
- end
- end
- end
- if c == "meat" then
- for a,b in pairs(v) do
- if a == "amount" then
- meatAmt = b
- end
- if a == "capacity" then
- meatCap = b
- end
- end
- end
- end
- end
- ImpAPI.CWrite(1, 3, mon, "Pink Slime: ", colors.pink)
- ImpAPI.CWrite(3, 4, mon, psAmt.."/"..psCap, colors.white)
- ImpAPI.CWrite(1, 6, mon, "Liquid Meat: ", colors.orange)
- ImpAPI.CWrite(3, 7, mon, meatAmt.."/"..meatCap, colors.white)
- writeEnergy(9,10)
- elseif machineName == "Grinder" then
- essCap = 0
- essAmt = 0
- for k,v in pairs(tankInfo) do
- for o,c in pairs(v) do
- if c == "mobessence" then
- for a,b in pairs(v) do
- if a == "amount" then
- essAmtAmt = b
- end
- if a == "capacity" then
- essAmtCap = b
- end
- end
- end
- end
- end
- ImpAPI.CWrite(1, 3, mon, "Mob Essence: ", colors.green)
- ImpAPI.CWrite(3, 4, mon, essAmt.."/"..essCap, colors.white)
- writeEnergy(6,7)
- elseif machineName == "Pulverizer" then
- itemInSlot1 = ""
- itemQtyInSlot1 = 0
- processing=machine.getStackInSlot(1)
- if processing then
- for k,v in pairs(processing) do
- if k == "name" then
- itemInSlot1 = v
- elseif k == ("qty") then
- itemQtyInSlot1 = tostring(v)
- end
- end
- else
- itemInSlot1 = "nothing"
- itemQtyInSlot1 = 0
- end
- ImpAPI.CWrite(1, 3, mon, "Processing: ", colors.green)
- ImpAPI.CWrite(3, 4, mon, itemInSlot1, colors.white)
- ImpAPI.CWrite(1, 6, mon, "Qty: ", colors.green)
- ImpAPI.CWrite(3, 7, mon, itemQtyInSlot1, colors.white)
- writeEnergy(9,10)
- elseif machineName == "Crucible" then
- itemInSlot1 = ""
- itemQtyInSlot1 = 0
- processing=machine.getStackInSlot(1)
- if processing then
- for k,v in pairs(processing) do
- if k == "name" then
- itemInSlot1 = v
- elseif k == ("qty") then
- itemQtyInSlot1 = tostring(v)
- end
- end
- else
- itemInSlot1 = "nothing"
- itemQtyInSlot1 = 0
- end
- fluidName = ""
- fluidCap = 0
- fluidAmt = 0
- for k,v in pairs(tankInfo) do
- for o,c in pairs(v) do
- if o == "name" then
- fluidName = c
- elseif o == "amount" then
- fluidAmt = c
- elseif o == "capacity" then
- fluidCap = c
- end
- end
- end
- centerItem = math.floor((monX - #itemInSlot1) / 2) + 1
- ImpAPI.CWrite(1, 3, mon, "Processing: ", colors.green)
- ImpAPI.CWrite(centerItem, 4, mon, itemInSlot1, colors.white)
- ImpAPI.CWrite(1, 6, mon, fluidName.." fluid: ", colors.green)
- ImpAPI.CWrite(3, 7, mon, fluidAmt.."/"..fluidCap, colors.white)
- writeEnergy(9,10)
- elseif machineName == "Redstone Furnace" then
- itemInSlot1 = ""
- itemQtyInSlot1 = 0
- processing=machine.getStackInSlot(1)
- if processing then
- for k,v in pairs(processing) do
- if k == "name" then
- itemInSlot1 = v
- elseif k == ("qty") then
- itemQtyInSlot1 = tostring(v)
- end
- end
- else
- itemInSlot1 = "nothing"
- itemQtyInSlot1 = 0
- end
- ImpAPI.CWrite(1, 3, mon, "Processing: ", colors.green)
- ImpAPI.CWrite(3, 4, mon, itemInSlot1, colors.white)
- ImpAPI.CWrite(1, 6, mon, "Qty: ", colors.green)
- ImpAPI.CWrite(3, 7, mon, itemQtyInSlot1, colors.white)
- writeEnergy(9,10)
- elseif machineName == "Sawmill" then
- itemInSlot1 = ""
- itemQtyInSlot1 = 0
- processing=machine.getStackInSlot(1)
- if processing then
- for k,v in pairs(processing) do
- if k == "name" then
- itemInSlot1 = v
- elseif k == ("qty") then
- itemQtyInSlot1 = tostring(v)
- end
- end
- else
- itemInSlot1 = "nothing"
- itemQtyInSlot1 = 0
- end
- ImpAPI.CWrite(1, 3, mon, "Processing: ", colors.green)
- ImpAPI.CWrite(3, 4, mon, itemInSlot1, colors.white)
- ImpAPI.CWrite(1, 6, mon, "Qty: ", colors.green)
- ImpAPI.CWrite(3, 7, mon, itemQtyInSlot1, colors.white)
- writeEnergy(9,10)
- elseif machineName == "Induction Smelter" then
- itemInSlot1 = ""
- itemQtyInSlot1 = 0
- itemInSlot2 = ""
- itemQtyInSlot2 = 0
- processing=machine.getStackInSlot(1)
- processing2=machine.getStackInSlot(2)
- if processing then
- for k,v in pairs(processing) do
- if k == "name" then
- itemInSlot1 = v
- elseif k == ("qty") then
- itemQtyInSlot1 = tostring(v)
- end
- end
- else
- itemInSlot1 = "nothing"
- itemQtyInSlot1 = 0
- end
- if processing2 then
- for k,v in pairs(processing2) do
- if k == "name" then
- itemInSlot2 = v
- elseif k == ("qty") then
- itemQtyInSlot2 = tostring(v)
- end
- end
- else
- itemInSlot2 = "nothing"
- itemQtyInSlot2 = 0
- end
- ImpAPI.CWrite(1, 3, mon, "Processing: ", colors.green)
- ImpAPI.CWrite(3, 4, mon, itemInSlot1.." & "..itemInSlot2, colors.white)
- ImpAPI.CWrite(1, 6, mon, "Qty 1/2: ", colors.green)
- ImpAPI.CWrite(3, 7, mon, itemQtyInSlot1.."/"..itemQtyInSlot2, colors.white)
- writeEnergy(9,10)
- end
- end
- end
- -- Loop timer
- sleep(.50)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement