Posted 25 August 2015 - 08:03 PM
Hello,
I built a mob tower and I would like to sort the mobs with OpenCCSensor but at the moment the empty minecart goes in front of sensor , the system stops and does not sort.
My program:
Best regards,
I built a mob tower and I would like to sort the mobs with OpenCCSensor but at the moment the empty minecart goes in front of sensor , the system stops and does not sort.
My program:
os.loadAPI("ocs/apis/sensor")
prox = sensor.wrap("back")
while true do
local target = prox.getTargets()
for tarName, _ in pairs(target) do
local details = prox.getTargetDetails(tarName)
if details ~= nil then
if details.Riding ~= nil then
if details.Riding.Name == "Creeper" then
while rs.testBundledInput("left", colors.green) == false do
rs.setBundledOutput("right", colors.white)
os.sleep(1)
end
rs.setBundledOutput("right",0)
break
elseif details.Riding.Name == "Spider" then
while rs.testBundledInput("left", colors.green) == false do
rs.setBundledOutput("right", colors.black)
os.sleep(1)
end
rs.setBundledOutput("right",0)
break
elseif details.Riding.Name == "Skeleton" then
while rs.testBundledInput("left", colors.green) == false do
rs.setBundledOutput("right", colors.gray)
os.sleep(1)
end
rs.setBundledOutput("right",0)
break
elseif details.Riding.Name == "Zombie" then
while rs.testBundledInput("left", colors.green) == false do
rs.setBundledOutput("right", colors.green)
os.sleep(1)
end
rs.setBundledOutput("right",0)
break
else
rs.setBundledOutput("right", 0)
break
end
else
break
end
else
break
end
end
os.sleep(1.2)
end
Best regards,