Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Quarry Dimension Input and Mining Program
- fuelcost = 0
- -- Function to ask the user for input
- function getUserInput(prompt)
- write(prompt .. ": ")
- return read()
- end
- -- Function to Mine to Depth
- function mineDepth()
- for i = 1, depth do
- fuelcost = fuelcost + 1
- end
- for j = 1, depth do
- fuelcost = fuelcost + 1
- end
- end
- -- Function to mine a layer
- function mine(width, length)
- for i = 1, length do
- for j = 1, width do
- mineDepth()
- fuelcost = fuelcost + 1
- end
- if i < length then
- if i % 2 == 1 then
- mineDepth()
- fuelcost = fuelcost + 1
- else
- mineDepth()
- fuelcost = fuelcost + 1
- end
- end
- end
- end
- -- Ask the user for dimensions
- choice = 0
- while choice ~= 1 do
- print("Note DO NOT MINE PAST LEVEL -56!!!")
- width = tonumber(getUserInput("Enter the width"))
- length = tonumber(getUserInput("Enter the length"))
- depth = tonumber(getUserInput("Enter the depth"))
- width = width - 1
- -- Calculate and display the volume
- volume = width * length * depth
- print("The quarry will have a volume of " .. volume .. " cubic blocks.")
- if volume < 800 then
- print("Proceed?")
- choice = tonumber(getUserInput("Refuel = 2, Yes = 1, No = 0"))
- elseif volume >= 800 then
- print("WARNING volume is over 800 (max is 1000)!!!!!")
- print("Proceed?")
- choice = tonumber(getUserInput("Refuel = 2, Yes = 1, No = 0"))
- end
- if choice == 2 then
- fake = tonumber(getUserInput("Please insert Buckets, Press Any Number to Continue..."))
- os.loadAPI("turtleRefuel")
- end
- end
- size = {width, length, depth}
- -- Excavate
- fuelcost = fuelcost + 1
- mine(width, length)
- mineDepth()
- -- Return to Start
- if length % 2 == 1 then
- for i = 1, width do
- fuelcost = fuelcost + 1
- end
- end
- for j = 2, length do
- fuelcost = fuelcost + 1
- end
- fuelcost = fuelcost + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement