View difference between Paste ID: VnRd9e6C and R9NXSxDx
SHOW: | | - or go back to the newest paste.
1
--[[
2
	2013 (c) psychedelixx
3-
	Minecraft Turtle: Stairs
3+
	Minecraft Turtle: Hallway
4
	2013-05-21
5
6-
	Digs a simple stair and places missing ground blocks and torches (every 4th horizontal block).
6+
	Digs a simple hallway and places missing ground blocks and torches (every 11th horizontal block).
7
8
	Usage: 
9
	- use turtle and type "label set <name>" 
10
	  (to give your turtle an unique name so it remembers its programs)
11-
	- type "pastebin get R9NXSxDx stairs"
11+
	- type "pastebin get VnRd9e6C hallway"
12
	- place solid blocks in slot 16 (lower right corner)
13
	- place torches in slot 15 (left of slot 16)
14-
	- type "stairs <height> [<limit>]"
14+
	- type "hallway <length>"
15-
		• where <height> represents the height of the hallway (3-5 seems good)
15+
		• where <length> represents the maximum length of the hallway
16-
		• and <limit> (optional) represents the Y coordinates digged down
16+
17-
		  (if you're at y64 and type in 10, it will dig until it's at y54)
17+
18
local args = { ... }
19
if #args < 1 then
20
  print( "Usage: hallway <length>" )
21
  error()
22-
  print( "Usage: stairs <height> [<limit>]" )
22+
23
limit = tonumber(args[1])
24
25-
height = tonumber(args[1])
25+
if turtle.getFuelLevel() == 0 then
26-
limit = 256
26+
	turtle.refuel()
27-
if #args == 2 then
27+
28-
	limit = tonumber(args[2])
28+
29
if turtle.getFuelLevel() == 0 then
30
	print("I need fuel!")
31-
if height < 2 then
31+
else
32-
  print( "The height must be >= 2." )
32+
33
	print("Let's go!")
34
35
	torchCount = 0
36
	
37
	while turtle.getFuelLevel() > 0 and limit > 0 do
38-
	while limit > 0 do
38+
39
		print("Remaining: " .. limit) 
40-
	        if turtle.getFuelLevel() < height*2 then
40+
		print("Fuel: " .. turtle.getFuelLevel())
41-
	                turtle.refuel()
41+
		print("Next torch in: " .. 11-torchCount%11 .. "m")
42-
	        end
42+
43-
	        if turtle.getFuelLevel() < height*2 then
43+
		turtle.dig()
44-
	                print("Fuel is almost empty!")
44+
45-
	        end
45+
		turtle.digUp()
46
47
		if not turtle.detectDown() then	
48
			turtle.select(16)
49-
		print("Next torch in: " .. limit%4 .. "m")
49+
50
		end
51-
		for var = 0, height-3 do
51+
52-
			turtle.digUp()
52+
		if torchCount%11 == 0 then
53-
			if var < height-3 then
53+
			turtle.turnRight()
54-
				turtle.up()
54+
			turtle.dig()
55-
			end
55+
			turtle.select(15)
56-
			if var == 0 and limit%4 == 0 then
56+
			turtle.place()
57-
				turtle.turnRight()
57+
			turtle.turnLeft()
58-
				turtle.dig()
58+
59-
				turtle.select(15)
59+
60-
				turtle.place()
60+
		torchCount = torchCount + 1
61-
				turtle.turnLeft()
61+
		if limit > 0 and turtle.getFuelLevel() < 2 then 
62-
			end
62+
			turtle.refuel() 
63
		end
64-
		for var = 0, height-4 do turtle.down() end
64+
	end
65-
		turtle.digDown()
65+
end