Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------Zone Editable-----------
- --ici les direction sont par rapport a l'altar (down,up,east,west,north,south)
- local sStone = "down" --direction du coffre stone
- local sOut = "east" --direction du coffre sortie
- local sOrb = "west" --direction du coffre BloodOrb
- --ici les direction sont par rapport au computer (top,bottom,left,right,forward,back)
- m = peripheral.wrap("top") --direction de monitor
- altar = peripheral.wrap("back") --direction de l'altar
- ---------Zone Non Editable--------
- local max,amount,pourcent
- local pmax = 60
- local pmin = 10
- local maj = true
- slot={
- [1] = {["id"] = "blankSlate",["lp"] = 1000,["lpt"] = 1000},
- [2] = {["id"] = "reinforcedSlate",["lp"] = 2000, ["lpt"] = 3000},
- [3] = {["id"] = "imbuedSlate",["lp"] = 5000, ["lpt"] = 8000},
- [4] = {["id"] = "demonicSlate",["lp"] = 15000, ["lpt"] = 23000},
- [5] = {["id"] = "bloodMagicBaseItems",["lp"] = 30000, ["lpt"] = 53000}
- }
- local craft = {["id"] = "", ["count"] = 0, ["lpt"] = 0}
- function myread(de,a,reset)
- truc = tonumber(read())
- if truc ~= nil and (truc < a and truc > de) then
- return truc
- else
- return reset
- end
- end
- function screen()
- m.clear()
- m.setCursorPos(1,2)
- m.write(amount.." /")
- m.setCursorPos(1,3)
- m.write(max.."")
- m.setCursorPos(1,4)
- m.write(math.ceil(pourcent).." %")
- term.clear()
- term.setCursorPos(2,2)
- term.write("current pourcentage : "..pourcent)
- term.setCursorPos(2,3)
- term.write("1 : pourcentage min (redstone+) : "..pmin)
- temp = max*(pmin/100)
- term.write(" ("..temp..")")
- term.setCursorPos(2,4)
- term.write("2 : pourcentage max (redstone-) : "..pmax)
- temp = max*(pmax/100)
- term.write(" ("..temp..")")
- term.setCursorPos(2,5)
- term.write("current redstone signal : ")
- term.write(tostring(rs.getOutput("right")))
- --zone auto
- if craft.count ~= 0 then
- term.setCursorPos(2,7)
- term.write("Craft en cours : "..craft.id.." encore "..craft.count)
- end
- term.setCursorPos(2,8)
- term.write("3 : blank slate")
- term.setCursorPos(2,9)
- term.write("4 : reinforced slate")
- term.setCursorPos(2,10)
- term.write("5 : imbued slate")
- term.setCursorPos(2,11)
- term.write("6 : demonic slate")
- term.setCursorPos(2,12)
- term.write("7 : ethereal slate")
- end
- function craftauto()
- if craft.count ~= 0 then
- item = altar.getStackInSlot(1)
- if item ~= nil then
- if string.find(item.name,"BloodOrb") then
- altar.pushItem(sOrb,1)
- end
- if item.name == craft.id then
- altar.pushItem(sOut,1)
- craft.count = craft.count - 1
- end
- else
- if amount >= craft.lpt then
- altar.pullItem(sStone,1,1)
- end
- end
- end
- if craft.count == 0 and altar.getStackInSlot(1) == nil then
- altar.pullItem(sOrb,1,1)
- end
- end
- function principal()
- while true do
- if maj then
- l=peripheral.call("back","getTankInfo")
- max = l[1].capacity
- amount = l[1].contents.amount
- pourcent=amount*100/max
- if pourcent <= pmin then
- rs.setOutput("right",true)
- end
- if pourcent >= pmax then
- rs.setOutput("right",false)
- end
- screen()
- end
- craftauto()
- sleep(1)
- end
- end
- function red()
- m.setBackgroundColor(0x4000)
- m.clear()
- m.setBackgroundColor(0x8000)
- term.clear()
- term.setCursorPos(1,1)
- end
- function selectCraft(nb)
- if craft.count == 0 then
- sleep(0.5)
- maj = false
- red()
- craft.id = slot[nb].id
- craft.lpt = slot[nb].lpt
- print("selection nb de "..slot[nb].id.." a creer (0 pour annuler)")
- craft.count = myread(0,64,0)
- m.clear()
- end
- end
- function event()
- while true do
- local event, key, isHeld = os.pullEvent("key")
- key = keys.getName(key)
- if key == "numPad1" then
- sleep(0.5)
- maj = false
- red()
- print("Changement de pourcentage min ("..pmin..")")
- pmin = myread(0,100,pmin)
- m.clear()
- elseif key == "numPad2" then
- sleep(0.5)
- maj = false
- red()
- print("Changement de pourcentage max ("..pmax..")")
- pmax = myread(0,100,pmax)
- m.clear()
- end
- if key == "numPad3" then
- selectCraft(1)
- elseif key == "numPad4" then
- selectCraft(2)
- elseif key == "numPad5" then
- selectCraft(3)
- elseif key == "numPad6" then
- selectCraft(4)
- elseif key == "numPad7" then
- selectCraft(5)
- end
- maj = true
- end
- end
- parallel.waitForAny(principal,event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement