Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- p1 = peripheral.wrap("right")
- p2 = peripheral.wrap("left")
- prox = sensor.wrap("back")
- while true do
- local target = prox.getTargets()
- for tarName, _ in pairs(target) do
- --fetch the detailed information table for the current target.
- local details = prox.getTargetDetails(tarName)
- if details ~= nil then
- if details.Riding ~= nil then
- if details.Riding.Name == "Creeper" then
- while p2.testBundledInput("left", colors.green) == false do
- --print("Wait")
- p1.setBundledOutput("right", colors.white)
- os.sleep(1)
- end
- p1.setBundledOutput("right",0)
- --os.reboot()
- break
- elseif details.Riding.Name == "Spider" then
- while p2.testBundledInput("left", colors.green) == false do
- --print("Wait")
- p1.setBundledOutput("right", colors.black)
- os.sleep(1)
- end
- p1.setBundledOutput("right",0)
- --os.reboot()
- break
- elseif details.Riding.Name == "Skeleton" then
- while p2.testBundledInput("left", colors.green) == false do
- -- print("Wait")
- p1.setBundledOutput("right", colors.gray)
- os.sleep(1)
- end
- p1.setBundledOutput("right",0)
- --os.reboot()
- break
- elseif details.Riding.Name == "Zombie" then
- while p2.testBundledInput("left", colors.green) == false do
- -- print("Wait")
- p1.setBundledOutput("right", colors.green)
- --os.reboot()
- os.sleep(1)
- end
- p1.setBundledOutput("right",0)
- break
- else
- while p2.testBundledInput("left", colors.green) == false do
- -- print("Wait")
- p1.setBundledOutput("right", colors.brown)
- --os.reboot()
- os.sleep(1)
- end
- p1.setBundledOutput("right",0)
- break
- end
- else
- --os.reboot()
- break
- end
- else
- break
- end
- end
- os.sleep(1.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement