SHOW:
|
|
- or go back to the newest paste.
1 | os.loadAPI("ocs/apis/sensor") | |
2 | p1 = peripheral.wrap("right") | |
3 | p2 = peripheral.wrap("left") | |
4 | prox = sensor.wrap("back") | |
5 | ||
6 | - | |
6 | + | |
7 | while true do | |
8 | - | local target = prox.getTargets() |
8 | + | |
9 | - | for tarName, _ in pairs(target) do |
9 | + | while p2.testBundledInput(colors.green) == false do |
10 | - | --fetch the detailed information table for the current target. |
10 | + | |
11 | - | local details = prox.getTargetDetails(tarName) |
11 | + | |
12 | - | if details ~= nil then |
12 | + | os.sleep(1) |
13 | - | if details.Riding ~= nil then |
13 | + | |
14 | - | if details.Riding.Name == "Creeper" then |
14 | + | p1.setBundledOutput(0) |
15 | - | print("Creper") |
15 | + | |
16 | - | while p2.testBundledInput("west",colors.green) == false do |
16 | + | os.sleep(0.5) |
17 | - | --print("Wait") |
17 | + | |
18 | - | p1.setBundledOutput(colors.white) |
18 | + |