Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hasTeleFocus()
- return turtle.getItemCount(1) ~= 0
- end
- function acceptItems(accept)
- redstone.setOutput("left", not accept)
- end
- function isSource()
- return redstone.getInput("back")
- end
- function getOtherFocus()
- acceptItems(false)
- turtle.dropDown()
- print("Pushing item to chest")
- -- Source should allow target some time to
- -- fetch other focus. 3s should be enough.
- if isSource() then
- print("Waiting for target")
- os.sleep(3)
- end
- while not turtle.suckDown() do
- os.sleep(1)
- end
- print("Got other focus")
- turtle.dropUp()
- acceptItems(true)
- end
- function triggerTeleport()
- print("Triggering teleport")
- redstone.setOutput("top", true)
- os.sleep(1)
- redstone.setOutput("top", false)
- end
- while true do
- if hasTeleFocus() then
- print("Have foci")
- getOtherFocus()
- if isSource() then
- triggerTeleport()
- end
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement