SHOW:
|
|
- or go back to the newest paste.
1 | - | os.loadAPI("turtleForward.lua") |
1 | + | |
2 | fuelcost = 0 | |
3 | -- Function to ask the user for input | |
4 | function getUserInput(prompt) | |
5 | - | -- Get the dimensions |
5 | + | write(prompt .. ": ") |
6 | - | function input(newWidth, newLength, newDepth) |
6 | + | return read() |
7 | - | width = newWidth |
7 | + | |
8 | - | length = newLength |
8 | + | |
9 | - | depth = newDepth |
9 | + | |
10 | - | fuelcost = 0 |
10 | + | |
11 | for i = 1, depth do | |
12 | fuelcost = fuelcost + 1 | |
13 | - | function setDepth(newDepth) |
13 | + | |
14 | - | depth = newDepth |
14 | + | for j = 1, depth do |
15 | fuelcost = fuelcost + 1 | |
16 | end | |
17 | end | |
18 | ||
19 | -- Function to mine a layer | |
20 | - | turtle.digDown() |
20 | + | |
21 | - | turtle.down() |
21 | + | |
22 | for j = 1, width do | |
23 | mineDepth() | |
24 | fuelcost = fuelcost + 1 | |
25 | - | function mineHeight() |
25 | + | |
26 | - | for j = 1, depth do |
26 | + | |
27 | - | turtle.digUp() |
27 | + | |
28 | - | turtle.up() |
28 | + | mineDepth() |
29 | - | end |
29 | + | fuelcost = fuelcost + 1 |
30 | else | |
31 | mineDepth() | |
32 | fuelcost = fuelcost + 1 | |
33 | end | |
34 | - | down = true |
34 | + | |
35 | end | |
36 | end | |
37 | - | if down then |
37 | + | |
38 | - | mineDepth() |
38 | + | -- Ask the user for dimensions |
39 | - | down = false |
39 | + | choice = 0 |
40 | - | else |
40 | + | while choice ~= 1 do |
41 | - | mineHeight() |
41 | + | print("Note DO NOT MINE PAST LEVEL -56!!!") |
42 | - | down = true |
42 | + | width = tonumber(getUserInput("Enter the width")) |
43 | - | end |
43 | + | length = tonumber(getUserInput("Enter the length")) |
44 | - | turtleForward.moveForward() |
44 | + | depth = tonumber(getUserInput("Enter the depth")) |
45 | width = width - 1 | |
46 | ||
47 | -- Calculate and display the volume | |
48 | - | if down then |
48 | + | volume = width * length * depth |
49 | - | mineDepth() |
49 | + | print("The quarry will have a volume of " .. volume .. " cubic blocks.") |
50 | - | down = false |
50 | + | if volume < 800 then |
51 | - | else |
51 | + | print("Proceed?") |
52 | - | mineHeight() |
52 | + | choice = tonumber(getUserInput("Refuel = 2, Yes = 1, No = 0")) |
53 | - | down = true |
53 | + | elseif volume >= 800 then |
54 | - | end |
54 | + | print("WARNING volume is over 800 (max is 1000)!!!!!") |
55 | - | turtle.turnRight() |
55 | + | print("Proceed?") |
56 | - | turtleForward.moveForward() |
56 | + | choice = tonumber(getUserInput("Refuel = 2, Yes = 1, No = 0")) |
57 | - | turtle.turnRight() |
57 | + | |
58 | if choice == 2 then | |
59 | - | if down then |
59 | + | fake = tonumber(getUserInput("Please insert Buckets, Press Any Number to Continue...")) |
60 | - | mineDepth() |
60 | + | os.loadAPI("turtleRefuel") |
61 | - | down = false |
61 | + | |
62 | - | else |
62 | + | |
63 | - | mineHeight() |
63 | + | size = {width, length, depth} |
64 | - | down = true |
64 | + | -- Excavate |
65 | - | end |
65 | + | fuelcost = fuelcost + 1 |
66 | - | turtle.turnLeft() |
66 | + | mine(width, length) |
67 | - | turtleForward.moveForward() |
67 | + | mineDepth() |
68 | - | turtle.turnLeft() |
68 | + | |
69 | -- Return to Start | |
70 | if length % 2 == 1 then | |
71 | for i = 1, width do | |
72 | fuelcost = fuelcost + 1 | |
73 | end | |
74 | - | function toStart() |
74 | + | |
75 | - | if length % 2 == 1 then |
75 | + | for j = 2, length do |
76 | - | turtle.turnLeft() |
76 | + | fuelcost = fuelcost + 1 |
77 | - | turtle.turnLeft() |
77 | + | |
78 | - | for i = 1, width do |
78 | + | fuelcost = fuelcost + 1 |