Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Smeltery Program UNTESTED
- -- FTB Infinty Evolved
- -----
- perif=nil
- mon=nil
- cont=nil
- ---
- ingotSide = "right"
- blockSide = "left"
- ingotTimerGoal = 10
- blockTimerGoal = 36
- ingotTimer = 0
- blockTimer = 0
- ---------
- function scanPer()
- if (mon==nil) and (cont==nil) then
- print("---===###===---")
- while perif == nil do
- perif= peripheral.getNames()
- print("[*] Scanning network...")
- sleep(.5)
- end
- while (mon==nil) and (cont==nil) do
- print("[*] Connected peripherals: ")
- for i=1, #perif do
- print("[+] ---> : "..perif[i])
- if string.find(perif[i],"monitor") then
- mon = peripheral.wrap(perif[i])
- elseif string.find(perif[i],"smeltery") then
- cont = peripheral.wrap(perif[i])
- end
- end
- print("[-] Failed!")
- print("[-] Retry!")
- sleep(.5)
- end
- print("[+] Success!")
- print("---===###===---")
- end
- end
- function posWrite(x,y,z,s)
- mon.setTextScale(s)
- mon.setCursorPos(x,y)
- mon.write(z)
- end
- function getNumber(inp,typ)
- calc = inp / typ
- if calc < 1 then
- leftover = inp
- number = 0
- else
- number = math.floor(calc)
- leftover = inp - ((number) * typ)
- end
- return number,leftover
- end
- function castIngot(inp,inn)
- if inp >= 1 then
- print("[~] Casting "..inn.." ingot!")
- redstone.setOutput(ingotSide,true)
- sleep(.1)
- redstone.setOutput(ingotSide,false)
- end
- end
- function castBlock(inp,inn)
- if inp >= 1 then
- print("[~] Casting "..inn.." block!")
- redstone.setOutput(blockSide,true)
- sleep(.1)
- redstone.setOutput(blockSide,false)
- end
- end
- function doCasting(ina,inc,inn)
- if ina ~= 0 then
- if blockTimer <= 0 and ingotTimer <= 0 then
- castBlock(ina,inn)
- blockTimer = blockTimerGoal
- end
- else
- if blockTimer <= 0 and ingotTimer <= 0 then
- castIngot(inc,inn)
- ingotTimer = ingotTimerGoal
- end
- end
- end
- while true do
- scanPer()
- tbl = cont.getInfo()
- mon.clear()
- if tbl["contents"]~=nil then
- name = tbl["contents"]["rawName"]
- a,b = getNumber(tbl["contents"]["amount"],1296)
- c,d = getNumber(b,144)
- e,f = getNumber(d,16)
- if string.find(name,"Molten") then
- shortName = string.sub(name,8)
- else
- shortName = name
- end
- posWrite(1,1,shortName,0.5)
- posWrite(1,3,"> "..a.." Block",0.5)
- posWrite(1,5,"> "..c.." Ingot",0.5)
- posWrite(1,7,"> "..e.." Nugget",0.5)
- posWrite(1,9,"> "..f.." mB",0.5)
- posWrite(1,10," -= "..ingotTimer.."|"..blockTimer.." =-",0.5)
- doCasting(a,c,shortName)
- else
- posWrite(1,9," -= "..ingotTimer.."|"..blockTimer.." =-",0.75)
- posWrite(1,1," -=|Empty|=-",.75)
- end
- blockTimer = blockTimer - 1
- ingotTimer = ingotTimer - 1
- blockTimer=math.max(blockTimer,0)
- ingotTimer=math.max(ingotTimer,0)
- sleep(.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement