SHOW:
|
|
- or go back to the newest paste.
| 1 | local start = false | |
| 2 | - | --local AE = "back" |
| 2 | + | local respondSide = "right" |
| 3 | - | --local turtleDir = "south" |
| 3 | + | --local lArm = "left" |
| 4 | - | local head = "top" |
| 4 | + | --local rArm = "right" |
| 5 | - | local belly = "front" |
| 5 | + | --local feet = "bottom" |
| 6 | - | local feet = "bottom" |
| 6 | + | local bodyParts = {"bottom", "left", "right"}
|
| 7 | - | local itemIDs = {[head]=86,[belly]=80,[feet]=80}
|
| 7 | + | |
| 8 | local function respond() | |
| 9 | - | --local ae = peripheral.wrap(AE) |
| 9 | + | rs.setOutput(respondSide,true) |
| 10 | sleep(0.1) | |
| 11 | - | local inv = {}
|
| 11 | + | rs.setOutput(respondSide,false) |
| 12 | - | inv[head] = peripheral.wrap(head) |
| 12 | + | --sleep(1) |
| 13 | - | inv[feet] = peripheral.wrap(feet) |
| 13 | + | |
| 14 | ||
| 15 | - | --local function clearInv() |
| 15 | + | local function query(side) |
| 16 | - | -- for i = 1,16 do |
| 16 | + | |
| 17 | - | -- ae.pullItem(turtleDir, i, 64) |
| 17 | + | |
| 18 | - | -- end |
| 18 | + | |
| 19 | - | --end |
| 19 | + | os.pullEvent("redstone")
|
| 20 | end | |
| 21 | - | local function place(side) |
| 21 | + | |
| 22 | - | --local item = inv[side].getStackInSlot(1) |
| 22 | + | |
| 23 | - | --if not item then |
| 23 | + | |
| 24 | - | |
| 24 | + | if not start then os.pullEvent("redstone")
|
| 25 | - | --elseif item and item.id ~= itemIDs[side] then |
| 25 | + | else |
| 26 | - | -- print("item mismatch in "..side.." block placer")
|
| 26 | + | for _,part in pairs(bodyParts) do query(part) end |
| 27 | - | |
| 27 | + | |
| 28 | - | --end |
| 28 | + | |
| 29 | while not turtle.place() do | |
| 30 | sleep(0.5) | |
| 31 | end | |
| 32 | end | |
| 33 | if not start then | |
| 34 | sleep(0.2) | |
| 35 | - | --place(feet) |
| 35 | + | respond() |
| 36 | - | --turtle.select(1) |
| 36 | + | else sleep(15) end |
| 37 | - | --turtle.place() |
| 37 | + |