Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- size = 49
- caseslot = 1
- controlslot = 9
- fuelslot = 15
- curslot = "case"
- blocksneeded = size * size * size + (size-2)*(size-2)*(size-2)
- print(blocksneeded.." reactor case blocks are required to complete a size "..size.." reactor. Please ensure there is enough!")
- starttime = os.clock()
- size = size - 1 --This is just needed.
- function place2(side)
- gotstuff = false
- while gotstuff == false do
- if curslot == "case" then
- turtle.select(caseslot)
- elseif curslot == "control" then
- turtle.select(controlslot)
- else
- print("NO SUCH ITEM: "..curslot)
- end
- if turtle.getItemCount(turtle.getSelectedSlot()) == 0 then
- if curslot == "case" then
- caseslot = caseslot + 1
- elseif curslot == "control" then
- controlslot = controlslot + 1
- end
- else
- gotstuff = true
- end
- if caseslot == 5 then
- caseslot = 1
- end
- if controlslot == 10 then
- controlslot = 5
- end
- end
- if side == "f" then
- turtle.place()
- elseif side == "u" then
- turtle.placeUp()
- else
- turtle.placeDown()
- end
- end
- function forward()
- if turtle.getFuelLevel() == 0 then
- curslot2 = turtle.getSelectedSlot()
- turtle.select(15)
- turtle.refuel()
- turtle.select(curslot2)
- end
- while not turtle.forward() do
- turtle.dig()
- end
- end
- function placeUp(height)
- iii = 0
- while iii<height do
- place2()
- turtle.up()
- iii = iii + 1
- end
- end
- print("Doing floor 1")
- i = 0
- ii = 0
- while ii < size do
- turtle.turnRight()
- i = 0
- while i < size do
- print("Building floor with "..turtle.getFuelLevel().."/"..turtle.getFuelLimit().." fuel left")
- place2()
- forward()
- i = i + 1
- end
- place2()
- i = 0
- turtle.turnRight()
- turtle.turnRight()
- while i < size do
- forward()
- i = i + 1
- end
- turtle.turnRight()
- forward()
- ii = ii + 1
- end
- turtle.back()
- turtle.turnRight()
- print("Doing wall 1")
- iv = 0
- while iv<size do
- placeUp(size)
- turtle.forward()
- v = 0
- while v<size do
- turtle.down()
- v = v + 1
- end
- iv = iv + 1
- end
- turtle.turnRight()
- print("Doing wall 2")
- iv = 0
- while iv<size do
- placeUp(size)
- turtle.forward()
- v = 0
- while v<size do
- turtle.down()
- v = v + 1
- end
- iv = iv + 1
- end
- turtle.turnRight()
- print("Doing wall 3")
- iv = 0
- while iv<size do
- placeUp(size)
- turtle.forward()
- v = 0
- while v<size do
- turtle.down()
- v = v + 1
- end
- iv = iv + 1
- end
- turtle.turnRight()
- print("Doing wall 4")
- iv = 0
- while iv<size do
- placeUp(size)
- turtle.forward()
- v = 0
- while v<size do
- turtle.down()
- v = v + 1
- end
- iv = iv + 1
- end
- turtle.turnRight()
- turtle.up()
- print("Doing floor 2")
- i = 0
- ii = 0
- controlrod = true
- while ii <= size do
- turtle.turnRight()
- i = 0
- while i < size do
- print("Building floor with "..turtle.getFuelLevel().."/"..turtle.getFuelLimit().." fuel left")
- print("Completed: "..i.." and "..ii.." with cr toggle on: "..controlrod)
- if i ~= 0 and i ~= size-1 and ii ~= 0 and ii ~= size-1 then
- if controlrod then
- curslot = "control"
- controlrod = not controlrod
- else
- curslot = "case"
- controlrod = not controlrod
- end
- else
- curslot = "case"
- end
- place2()
- forward()
- i = i + 1
- end
- place2()
- i = 0
- turtle.turnRight()
- turtle.turnRight()
- while i < size do
- forward()
- i = i + 1
- end
- turtle.turnRight()
- forward()
- ii = ii + 1
- end
- print("A size "..size.." reactor was completed in "..(os.clock()-starttime).." seconds")
Advertisement
Add Comment
Please, Sign In to add comment