View difference between Paste ID: hV6x6tNr and FgcnJWmH
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("predictSimpleQuarry.lua")
2
os.loadAPI("userInput.lua")
3
os.loadAPI("getTurtleFuel.lua")
4
os.loadAPI("simpleQuarry.lua")
5
os.loadAPI("turtleForward.lua")
6-
os.loadAPI("turtleRefuel.lua")
6+
7
local function clearScreen()
8
    term.clear()
9
    term.setCursorPos(1, 1)
10
end
11
12
function volumeCheck(width, length, depth)
13-
function fuelcheckandmine(width, length, depth)
13+
    tw = width
14-
	predictSimpleQuarry.predict(width, length, depth)
14+
    tl = length
15-
	fuelcost = predictSimpleQuarry.getFuelCost()
15+
    td = depth
16-
	if fuelcost > turtle.getFuelLevel() then
16+
    if tw == 0 then
17-
		getTurtleFuel.displayFuelInfo()
17+
        tw = 1
18-
		print("Quarry Fuel Cost = " .. fuelcost)
18+
    end
19-
		print("Fuel too Low to Start, Please Insert Buckets")
19+
    if tl == 0 then
20-
		choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
20+
        tl = 1
21
    end
22-
			turtleRefuel.refuelWithLava()
22+
    if td == 0 then
23-
			turtle.select(1)
23+
        td = 1
24-
			if fuelcost > turtle.getFuelLevel() then
24+
    end
25-
				print("Fuel Still too Low to Start, Terminating Program")
25+
    volume = tw * tl * td
26-
				os.sleep(3)
26+
    width = width - 1
27
    print("Volume: " .. volume .. " blocks")
28-
				simpleQuarry.quarry(width, length, depth)
28+
    
29
    if volume > 800 then
30
        print("WARNING! Volume over 800")
31-
	else
31+
        print("Max is 1024 with Empty Inventory")
32
        print("With Stacks of 64.")
33-
			simpleQuarry.quarry(width, length, depth)
33+
    end
34
    choice = tonumber(userInput.getUserInput("Proceed? 1 for yes, 2 for no"))
35
    if choice == 1 then
36
        return false
37
    else
38-
function mine()
38+
        return true
39
    end
40-
	while choice ~= 1 do
40+
41-
		invalid = true
41+
 
42-
		while invalid do
42+
function fuelCheck(width, length, depth)
43-
			clearScreen()
43+
    predictSimpleQuarry.predict(width, length, depth)
44-
			width = tonumber(userInput.getUserInput("Enter Length: "))
44+
    fuelcost = predictSimpleQuarry.getFuelCost()
45-
			length = tonumber(userInput.getUserInput("Enter Width: "))
45+
    if fuelcost > turtle.getFuelLevel() then
46-
			depth = tonumber(userInput.getUserInput("Enter Depth"))
46+
        getTurtleFuel.displayFuelInfo()
47-
			if width == nil then
47+
        print("Quarry Fuel Cost = " .. fuelcost)
48-
				print("Invalid Length!")
48+
        print("Fuel too Low to Start, Please Insert Buckets")
49-
			elseif length == nil then
49+
        choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
50-
				print("Invalid Width!")
50+
        if choice == 1 then
51-
			elseif depth == nil then
51+
            turtleRefuel.refuelWithLava()
52-
				print("Invalid Depth!")
52+
            turtle.select(1)
53
            if fuelcost > turtle.getFuelLevel() then
54-
				invalid = false
54+
                print("Fuel Still too Low to Start, Terminating Program")
55
                os.sleep(3)
56
            end
57
        else
58
            return false
59
        end
60
    end
61
    return true
62
end
63
64
function smartQuarry()
65
	check = true
66
	while check do
67
		clearScreen()
68
		width = tonumber(userInput.getUserInput("Enter Length: "))
69-
		volume = tw * tl * td
69+
		length = tonumber(userInput.getUserInput("Enter Width: "))
70
		depth = tonumber(userInput.getUserInput("Enter Depth"))
71-
		print("Volume: " .. volume .. " blocks")
71+
72
		tl = length
73-
		if volume > 800 then
73+
74-
			print("WARNING! Volume over 800")
74+
75-
			print("Max is 1024 with Empty Inventory")
75+
76-
			print("With Stacks of 64.")
76+
77
		if tl == 0 then
78-
		max = volume > 9000
78+
79-
		if not max then
79+
80-
			print("Proceed?")
80+
81-
			choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
81+
82-
			fuelcheckandmine(width, length, depth)
82+
83
		width = width - 1
84-
			print("Volume = " .. volume)
84+
		check = not fuelCheck(width, length, depth)
85-
			print("Volume Over 5000, Please Reselect Size Constraints")
85+
        if not check then
86-
			print("continue?")
86+
            check = volumeCheck(width, length, depth)
87-
			choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
87+
        end
88
	end
89-
				fuelcheckandmine(width, length, depth)
89+
90
	while choice ~= 1 and choice ~= 2 do
91
		print("Use a Preset?")
92
		choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
93-
end
93+
94
			choice = tonumber(userInput.getUserInput("1 for sand, 2 for gravel"))
95
			if choice == 1 then
96
				blockname = "minecraft:sand"
97
			elseif choice == 2 then
98
				blockname = "minecraft:gravel"
99
			else
100
				print("Incorrect Input")
101
			end
102
		elseif choice == 2 then
103
			blockname = userInput.getUserInput("Please Input Block ID")
104
		else
105
			print("Incorrect Input")
106
		end
107
	end
108
	
109
	simpleQuarry.smartQuarry(width, length, depth, blockname)
110
end
111