Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --]] Turtle Cat AI By: Redxone [[--
- --]] First, lets make a movement table [[--
- local movements = {
- turtle.forward,
- turtle.back,
- turtle.turnLeft,
- turtle.turnRight,
- }
- local exceptions = {
- "minecraft:stone_brick_stairs",
- "minecraft:oak_stairs",
- "minecraft:stone_stairs",
- "minecraft:brick_stairs",
- "minecraft:red_sandstone_stairs",
- "minecraft:nether_brick_stairs",
- "minecraft:sandstone_stairs",
- "minecraft:spruce_stairs",
- "minecraft:birch_stairs",
- "minecraft:jungle_stairs",
- "minecraft:quartz_stairs",
- "minecraft:acacia_stairs",
- "minecraft:dark_oak_stairs",
- }
- --]] usefull functions [[--
- function move()
- local dir = math.random(1,#movements)
- bl = {turtle.inspect()}
- local ex = false
- if(bl[1])then
- for i=1, #exceptions do
- if(bl[2] == exceptions[i])then
- ex=true
- turtle.up()
- turtle.forward()
- end
- end
- end
- if(not ex and turtle.detect())then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- end
- if(not turtle.detectUp() and turtle.detectDown() and ex)then
- turtle.up()
- else
- if(not turtle.detectDown())then turtle.down() end
- end
- if(turtle.detectDown() and not ex)then movements[dir]() end
- sleep(math.random(0.05,0.3))
- end
- function brain()
- while true do
- sleep(0.05)
- move()
- end
- end
- brain()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement