-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlatform
65 lines (57 loc) · 1.37 KB
/
Platform
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
-- Turtle platform builder, builds a square platform using whatever stuff is in it's inventory
-- put fuel in any slot.
-- USAGE: platform 10 (default is 8)
-- will build a 10x10 platform, one block below the turtle's position starting at the front-left of the platform
-- try to put fuel AFTER the blocks he's placing, otherwise he might try to place the fuel
-- this function places a whole row of stuff
function placeArow()
for row=1,size-1 do
k=1
local count=0
while count<1 do
count=turtle.getItemCount(k)
k=k+1
if (k>16) then
print("No more materials! add some...it's ok, I'll wait...")
os.sleep(10)
k=1;
end --endif
end --endwhile
turtle.select(k-1)
turtle.placeDown()
turtle.forward()
end -- next row
turtle.placeDown()
end
function grabFuel()
for i=1,16 do
turtle.select(i)
turtle.refuel()
end
end
------------------- START
args = {...}
size = args[1]
if (size=="") then
size=8
end
print ("building platform of "..size.." x "..size..", "..turtle.getFuelLevel().." Fuel left..")
grabFuel()
for column=1,math.floor(size/2) do
placeArow()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
grabFuel()
placeArow()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end -- next column
turtle.turnLeft()
for i=1,size do
turtle.forward()
end
turtle.turnRight()
print("I'm done here, hope you like my work.")
sleep(3)