Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("Toolkit")
- rednet.open("back")
- pos = {}
- offset = {}
- offset.x, offset.y, offset.z = 0, -3, 0
- pos.x, pos.y, pos.z = gps.locate()
- posOff = {}
- posOff.x = pos.x + offset.x
- posOff.y = pos.y + offset.y
- posOff.z = pos.z + offset.z
- while true do
- state = true
- id, message, protocol = rednet.receive()
- if protocol == "door" then
- distance = Toolkit.distanceTo(message, posOff)
- if distance < 5 then
- state = false
- end
- end
- redstone.setOutput("bottom", state)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement