Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --eventhorizoncomputer?other bad coputersscifi
- -- Rednet Channels:
- -- 9997 - All Action Logging
- -- 8089 - Master Action Logging
- -- 666 - Master Command Channel
- -- 69 - Turtle-Interlink Channel
- -- 420 - Farm Broadcasts
- -- 17 - Quote of the Day
- -- 43 - WhoIs
- -- - FuelLevel
- -- - Inventory Count, Type, table?
- -- Rednet Variables
- -- host - systemname
- -- loc - GPS location
- -- Mod - hasmodem t/f
- --Arguments for location and etc.
- -- x - Direction directly away
- -- y - Direction Left/Right
- -- z - Direction Up/Down
- -- - - Starting Corner (Just L/R to start; middle squares in v.9000)
- -- - - FloorBottom Slab
- -- - - FloorTop Slab
- -- - - Direction (inversion?)
- -- - - Chest (reg,ender,none)
- -- Start modem & announce self on network.
- -- Check GPS Location
- -- No GPS == set local location
- --Move the turtle forward, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveForward()
- if not turtle.forward() then
- if turtle.detect() then
- if not turtle.dig() then
- print("dig returning false after detect")
- return false
- else
- if turtle.forward() == true then
- return true
- else
- return moveForward()
- end
- end
- else
- while turtle.attack() do
- turtle.suck()
- print("Turtle is attacking")
- end
- if turtle.forward() == true then
- return true
- else
- return moveForward()
- end
- end
- else
- return true
- end
- end
- --Move the turtle down, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveDown()
- if not turtle.down() then
- if turtle.detectDown() then
- if not turtle.digDown() then
- print("dig down returning false after detect")
- return false
- else
- turtle.down()
- return true
- end
- else
- attack = True
- while turtle.attackDown() do
- turtle.suckDown()
- turtle.attackDown()
- turtle.suckDown()
- end
- turtle.down()
- return true
- end
- else
- return true
- end
- end
- --Move the turtle up, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveUp()
- if not turtle.up() then
- if turtle.detectUp() then
- if not turtle.digUp() then
- print("dig up returning false after detect")
- return false
- else
- turtle.up()
- return true
- end
- else
- attack = True
- while turtle.attackUp() do
- turtle.suckUp()
- turtle.attackUp()
- turtle.suckUp()
- end
- turtle.up()
- return true
- end
- else
- return true
- end
- end
- local tArgs = {...}
- if #tArgs ~= 3 then
- print("Requires length, width, height")
- return
- end
- local x = tonumber(tArgs[1]) - 1
- local y = tonumber(tArgs[2])
- local z = tonumber(tArgs[3])
- if x == nil or y == nil or z == nil then
- print("Invalid dimensions")
- return
- end
- if x < 0 or y < 0 or z < 0 then
- print("Invalid (negative) dimensions")
- return
- end
- local fuel = turtle.getFuelLevel()
- local roomSize = x * y * z
- while fuel < roomSize do
- if not turtle.refuel(1) then
- print("Not enough fuel")
- return
- end
- end
- local direction = true
- for i = 1, z do
- for j = 1, y do
- for k = 1, x do
- moveForward()
- end
- if j < y then
- if direction then
- turtle.turnRight()
- moveForward()
- turtle.turnRight()
- direction = false
- else
- turtle.turnLeft()
- moveForward()
- turtle.turnLeft()
- direction = true
- end
- end
- end
- if i < z then
- moveUp()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- if y % 2 == 0 then
- turtle.turnRight()
- for i = 1, y do
- turtle.forward()
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- for i = 1, y do
- turtle.forward()
- end
- turtle.turnLeft()
- for i = 1, x do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- for i = 1, z do
- turtle.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement