Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Auflistung Materialien:
- 01 Fußboden innen: 40
- 02 Fußboden Veranda: 6
- 03 Halfsteps: 44
- 04 Sockel: 26
- 05 Wände Typ 1: 63
- 06 Wände Typ 2: 46
- 07 Fenster: 15
- 08 Türen: 1
- 09 Trittplatte: 1
- 10 Craftingtable: 1
- 11 Truhen: 2
- 12 Fackeln: 9
- 13 Öfen: 4
- 14 Dach: 64
- 15 Dach: 48
- 16 Giebel: 10
- http://pastebin.com/J4bcwtGy
- Minecraft Turtle: Simple House
- 2013-12-13 (c) psychedelixx / thebiglebowski33
- Builds a simple house
- Usage:
- - use turtle and type "label set <name>"
- (to give your turtle an unique name so it remembers its programs)
- - type "pastebin get J4bcwtGy house"
- --]]
- --[[ --- Konstanten --- ]]--
- dirCounter = 1
- countList={}
- keyFloorIn = "1"
- keyFloorOut = "2"
- halfSteps = "3"
- keySocket = "4"
- keyWalls1 = "5"
- keyWalls2 = "6"
- keyWindows = "7"
- keyDoors = "8"
- keyPressPlate = "9"
- keyCraftTable = "10"
- keyChests = "11"
- keyTorches = "12"
- keyFurnaces = "13"
- keyRoof1 = "14"
- keyRoof2 = "15"
- keyGable = "16"
- countList[keyFloorIn] = 40
- countList[keyFloorOut] = 6
- countList[halfSteps] = 44
- countList[keySocket] = 26
- countList[keyWalls1] = 63
- countList[keyWalls2] = 46
- countList[keyWindows] = 15
- countList[keyDoors] = 1
- countList[keyPressPlate] = 1
- countList[keyCraftTable] = 1
- countList[keyChests] = 2
- countList[keyTorches] = 9
- countList[keyFurnaces] = 4
- countList[keyRoof1] = 64
- countList[keyRoof2] = 48
- countList[keyGable] = 10
- --[[
- for key, value in pairs(countList) do
- print (key, " = " , value)
- end
- ]]--
- --[[ --- Parameter ---- ]]--
- local args = { ... }
- if #args < 1 then
- print("")
- end
- --[[arg1 = tonumber(args[1])]]--
- --[[ --- Item Check --- ]]--
- function enoughResources()
- for key, value in pairs(countList) do
- if turtle.getItemCount(tonumber(key)) < value then
- return false
- end
- end
- return true
- end
- function calcFuel(blueprint)
- return #blueprint*#blueprint[1]*#blueprint[1][1]
- end
- function turn()
- if dirCounter%2 == 1 then
- t.right()
- t.forward()
- t.right()
- else
- t.left()
- t.forward()
- t.left()
- end
- dirCounter = dirCounter + 1
- end
- function buildHouse(blueprint)
- t.up()
- yMax = #blueprint
- y = 1
- while y <= #blueprint do
- zMax = #blueprint[y]
- z = 1
- while z <= zMax do
- xMax = #blueprint[y][z]
- if dirCounter%2 == 1 then
- x = 1
- else
- x = xMax
- end
- while (x <= xMax and dirCounter%2 == 1)
- or (x >= 1 and dirCounter%2 == 0) do
- slot = blueprint[y][z][x]
- print("x: ", x, "/", xMax, " - ",
- "z: ", z, "/", zMax, " - ",
- "y: ", y, "/", yMax, " - ",
- "slot: ", slot)
- if slot > 0 then
- if turtle.getItemCount(slot) == 0 and
- slot == 14 then
- slot = 15
- end
- if slot == 13 then
- t.left()
- end
- t.placeDown(slot)
- if slot == 13 then
- t.right()
- end
- end
- if (x < xMax and dirCounter%2 == 1)
- or(x > 1 and dirCounter%2 == 0) then
- t.forward()
- end
- if dirCounter%2 == 1 then
- x = x+1
- else
- x = x-1
- end
- end
- if z < zMax then
- turn()
- end
- z = z+1
- end
- if y < yMax then
- driveToStartPos(blueprint, y)
- else
- t.forward()
- for y = 1, yMax, 1 do
- t.down()
- end
- print("Finished!")
- print("All your base are belong to us")
- end
- y = y+1
- end
- end
- --[[ Funktion Rückfahrt: ]]--
- function driveToStartPos(array, y)
- print("Driving to start position")
- if dirCounter%2 == 0 then
- t.right()
- else
- t.right()
- t.right()
- for x = 1, #array[y][#array[y]]-1, 1 do
- t.forward()
- end
- t.right()
- end
- for z = 1, #array[y]-1, 1 do
- t.forward()
- end
- t.right()
- t.up()
- dirCounter = 1
- end
- function start()
- if enoughResources() or 1 == 1 then
- print("forwards, to the moon, alice")
- t.forward(12)
- t.right()
- layer = {}
- --[[
- layer[1] = {{1, 1, 1,1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5, 0},
- { 0, 5,12, 0, 0, 0, 0, 5, 0},
- { 0, 6, 5, 0, 7, 7, 5, 6, 0},
- { 0, 0,12, 0, 0, 0, 0, 0, 0}}
- layer[4] = {{ 0, 6, 5, 5, 5, 5, 5, 6, 0},
- { 0, 5, 3, 3, 3, 3, 1, 5, 0},
- { 0, 5, 3, 3, 3, 3, 0, 5, 0},
- { 0, 5, 3, 3, 3, 3, 0, 5, 0},
- { 0, 5, 3, 3, 3, 3, 0, 5, 0},
- { 0, 5, 3, 3, 3, 3, 0, 5, 0},
- { 0, 5, 3, 3, 3, 3, 3, 5, 0},
- { 0, 5, 3, 3, 3, 3, 3, 5, 0},
- { 0, 5, 3, 3, 3, 3, 3, 5, 0},
- { 0, 6, 5, 5, 5, 5, 5, 6, 0}}
- layer[5] = {{14, 6, 6, 6, 6, 6, 6, 6,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14,14, 0, 0, 0, 0, 0, 0,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14,14, 0, 0, 0, 0, 0, 0,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14,14,11, 0, 0, 0, 0, 0,14},
- {14, 6, 6, 6, 6, 6, 6, 6,14}}
- layer[6] = {{ 0,14, 6, 6, 7, 6, 6,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 0, 0, 0, 0, 0,14, 0},
- { 0,14, 6, 6, 7, 6, 6,14, 0}}
- layer[7] = {{ 0, 0,14, 6, 6, 6,14, 0, 0},
- { 0, 0,14, 0, 0, 0,14, 0, 0},
- { 0, 0,14,12, 0, 0,14, 0, 0},
- { 0, 0,14, 0, 0,12,14, 0, 0},
- { 0, 0,14, 0, 0, 0,14, 0, 0},
- { 0, 0,14, 0, 0, 0,14, 0, 0},
- { 0, 0,14,12, 0, 0,14, 0, 0},
- { 0, 0,14, 0, 0,12,14, 0, 0},
- { 0, 0,14, 0, 0, 0,14, 0, 0},
- { 0, 0,14, 6, 6, 6,14, 0, 0}}
- layer[8] = {{ 0, 0, 0,14, 6,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 0,14, 0, 0, 0},
- { 0, 0, 0,14, 6,14, 0, 0, 0}}
- layer[9] = {{ 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0},
- { 0, 0, 0, 0,16, 0, 0, 0, 0}}
- if turtle.getFuelLevel() < calcFuel(layer) then
- print("Amount of missing fuel: ", calcFuel(layer)-turtle.getFuelLevel())
- print("Missing fuel in coal: ", calcFuel(layer)-turtle.getFuelLevel()/80+1)
- print("Fill fuel in slot 1, type 'refuel <amount>' and try again")
- error()
- end
- buildHouse(layer)
- else
- print("Not enough Resources")
- end
- end
- print("======== 2013 (c) psy & lebo ==========")
- print("======== Simple House Builder =========")
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement