Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- just dump one item each from the first (four)six slots, wait for signal change from one to two and than throw down a piece of living rock from slot 16
- local signalSide = "back"
- local function checkSignal()
- return rs.getAnalogInput(signalSide)
- end
- local pistonSide = "right"
- local function piston(onOff)
- rs.setOutput(pistonSide,onOff)
- end
- local itemPattern = {1,2,3,4}
- local extPattern = {5,6}
- local finalReagent = {16}
- local function checkInv(pattern)
- for _,k in pairs(pattern) do
- if turtle.getItemCount(k) == 0 then
- return false
- end
- end
- return true
- end
- local function checkInventory()
- return checkInv(itemPattern)
- end
- local function checkExtInv()
- return checkInv(extPattern)
- end
- local function checkReagent()
- return checkInv(finalReagent)
- end
- local function checkNWait(pattern)
- if not checkInv(pattern) then
- print("Waiting for items: ingredients in slots 1-6 and living rock in slot 16")
- local event = os.pullEvent("turtle_inventory")
- while not checkInv(pattern) do sleep(1) end
- end
- return checkInv(pattern)
- end
- local function dropItems(pattern)
- for _,k in pairs(pattern) do
- turtle.select(k)
- turtle.drop(1)
- sleep(0.5)
- end
- end
- local function wait2sOrSignal1()
- sleep(1)
- if checkSignal() == 1 then return true end
- sleep(1)
- if checkSignal() == 1 then return true else return false end
- end
- local function finishRecipe()
- checkNWait(finalReagent)
- print("Finishing Runic Altar Creation")
- sleep(1)
- dropItems(finalReagent)
- sleep(1.5)
- piston(true)
- sleep(3.5)
- piston(false)
- end
- piston(false)
- while true do
- if checkSignal() == 0 then
- checkNWait(itemPattern)
- dropItems(itemPattern)
- if checkSignal() == 0 then
- if not wait2sOrSignal1() then
- checkNWait(extPattern)
- dropItems(extPattern)
- wait2sOrSignal1()
- end
- end
- end
- if checkSignal() == 1 then
- local event = os.pullEvent("redstone")
- if checkSignal() == 2 then
- finishRecipe()
- end
- elseif checkSignal() == 2 then
- finishRecipe()
- elseif checkSignal() > 2 then
- print("Weird Signal Alert: ", checkSignal())
- end
- sleep(2)
- print("Starting next item creation")
- end
Advertisement
Add Comment
Please, Sign In to add comment