Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- http://pastebin.com/pTdGAEXm
- rednet.close("top")
- rednet.open("top")
- print("Hosting Quarry Project...")
- print("All values are relative to North")
- function getX()
- print("Width dimension of Quarry Project")
- print("Enter a number >")
- local continue = true
- while continue == true do
- local input = read()
- if tonumber(input) == nil then
- print("Not valid input!")
- elseif tonumber(input) < 0 then
- print("Enter a positive number")
- elseif tonumber(input) > 0 then
- continue = false
- return input
- end
- end
- end
- function getY()
- print("Length Dimension of Quarry Project")
- print("Enter a number >")
- local continue = true
- while continue == true do
- local input = read()
- if tonumber(input) == nil then
- print("Not valid input!")
- elseif tonumber(input) < 0 then
- print("Enter a positive number")
- elseif tonumber(input) > 0 then
- continue = false
- return input
- end
- end
- end
- function getHoleSize()
- print("Enter the size of the hole the drone will dig. This is a Square dimension.")
- print("Enter a number >")
- local continue = true
- while continue == true do
- local input = read()
- if tonumber(input) == nil then
- print("Not valid input!")
- elseif tonumber(input) < 0 then
- print("Enter a positive number")
- elseif tonumber(input) > 0 then
- continue = false
- return input
- end
- end
- end
- function getLoc()
- print("Type X Coord: ")
- local continue = true
- while continue == true do
- local input = read()
- if tonumber(input) == nil then
- print("Not valid input!")
- elseif tonumber(input) > 0 or tonumber(input) < 0 then
- continue = false
- xCoord = input
- end
- end
- print("Type Z Coord: ")
- local continue = true
- while continue == true do
- local input = read()
- if tonumber(input) == nil then
- print("Not valid input!")
- elseif tonumber(input) > 0 or tonumber(input) < 0 then
- continue = false
- zCoord = input
- end
- end
- return xCoord,zCoord
- end
- jobAvailable = true
- xAxis = getX()
- startX = xAxis
- yAxis = getY()
- keepAlive = true
- hole = getHoleSize()
- loc = vector.new(gps.locate())
- loc.x,loc.z = getLoc()
- function reset()
- print("Resetting vars...")
- jobAvailable = true
- xAxis = getX()
- startX = xAxis
- yAxis = getY()
- hole = getHoleSize()
- loc.x,loc.z = getLoc()
- end
- while keepAlive == true do
- id,message,dist = rednet.receive()
- if message == "Query: CNC ID" then
- rednet.send(id,"ID Sent")
- elseif message == "Query: Job" then
- if jobAvailable == true then
- rednet.send(id,"Yes")
- rednet.send(id,hole)
- rednet.send(id,loc.x+(xAxis*hole))
- rednet.send(id,loc.y)
- rednet.send(id,loc.z+(yAxis*hole))
- end
- elseif message == "Quarry Starting" then
- xAxis = xAxis - 1
- if xAxis == 0 then
- yAxis = yAxis - 1
- xAxis = startX
- if yAxis == 0 then
- jobAvailable = false
- print("Job Complete!")
- reset()
- print("Hosting new project...")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement