View difference between Paste ID: jQ7H0UJd and J4bcwtGy
SHOW: | | - or go back to the newest paste.
1
--[[
2
Auflistung Materialien:
3-
01 Fußboden innen:   40
3+
01 Fußboden innen:   12
4-
02 Fußboden Veranda:  6
4+
02 Fußboden Veranda:  0
5-
03 Halfsteps:        44
5+
03 Halfsteps:         4
6-
04 Sockel:           26
6+
04 Sockel:           14
7-
05 Wände Typ 1:      63
7+
05 Wände Typ 1:      22
8-
06 Wände Typ 2:      46
8+
06 Wände Typ 2:       0
9-
07 Fenster:          15
9+
07 Fenster:           8
10-
08 Türen:             1
10+
08 Türen:             0
11-
09 Trittplatte:       1
11+
09 Trittplatte:       0
12
10 Craftingtable:     1
13-
11 Truhen:            2
13+
11 Truhen:            0
14
12 Fackeln:           9
15-
13 Öfen:              4
15+
13 Öfen:              0
16-
14 Dach:             64
16+
14 Dach:             38
17-
15 Dach:             48
17+
15 Dach:              0
18-
16 Giebel:           10
18+
16 Giebel:            0
19
20-
http://pastebin.com/J4bcwtGy
20+
21
        2013-12-13 (c) psychedelixx / thebiglebowski33
22
 
23
        Builds a simple house
24
 
25
        Usage:
26
        - use turtle and type "label set <name>"
27
          (to give your turtle an unique name so it remembers its programs)
28
        - type "pastebin get jQ7H0UJd house"
29
--]]
30
 
31
--[[ --- Konstanten --- ]]--
32-
        - type "pastebin get J4bcwtGy house"
32+
33
 
34
countList={}
35
keyFloorIn    = "1"
36
keyFloorOut   = "2"
37
halfSteps     = "3"
38
keySocket     = "4"
39
keyWalls1     = "5"
40
keyWalls2     = "6"
41
keyWindows    = "7"
42
keyDoors      = "8"
43
keyPressPlate = "9"
44
keyCraftTable = "10"
45
keyChests     = "11"
46
keyTorches    = "12"
47
keyFurnaces   = "13"
48
keyRoof1      = "14"
49
keyRoof2      = "15"
50
keyGable      = "16"
51
 
52
countList[keyFloorIn]    = 12
53
countList[keyFloorOut]   = 0
54
countList[halfSteps]     = 4
55
countList[keySocket]     = 14
56-
countList[keyFloorIn]    = 40
56+
countList[keyWalls1]     = 22
57-
countList[keyFloorOut]   = 6
57+
countList[keyWalls2]     = 0
58-
countList[halfSteps]     = 44
58+
countList[keyWindows]    = 8
59-
countList[keySocket]     = 26
59+
countList[keyDoors]      = 0
60-
countList[keyWalls1]     = 63
60+
countList[keyPressPlate] = 0
61-
countList[keyWalls2]     = 46
61+
62-
countList[keyWindows]    = 15
62+
countList[keyChests]     = 0
63-
countList[keyDoors]      = 1
63+
64-
countList[keyPressPlate] = 1
64+
countList[keyFurnaces]   = 0
65
countList[keyRoof1]      = 38
66-
countList[keyChests]     = 2
66+
countList[keyRoof2]      = 0
67
countList[keyGable]      = 0
68-
countList[keyFurnaces]   = 4
68+
69-
countList[keyRoof1]      = 64
69+
70-
countList[keyRoof2]      = 48
70+
71-
countList[keyGable]      = 10
71+
72
end
73
]]--
74
 
75
--[[ --- Parameter ---- ]]--
76
local args = { ... }
77
if #args < 1 then
78
        print("")
79
end
80
--[[arg1 = tonumber(args[1])]]--
81
 
82
--[[ --- Item Check --- ]]--
83
function enoughResources()
84
    for key, value in pairs(countList) do
85
        if turtle.getItemCount(tonumber(key)) < value then
86
            return false
87
        end
88
    end
89
    return true
90
end  
91
92
function calcFuel(blueprint)
93
    return #blueprint*#blueprint[1]*#blueprint[1][1]
94
end
95
 
96
function turn()
97
    if dirCounter%2 == 1 then
98
        t.right()
99
        t.forward()
100
        t.right()
101
    else
102
        t.left()
103
        t.forward()
104
        t.left()
105
    end
106
 
107
    dirCounter = dirCounter + 1
108
end
109
 
110
function buildHouse(blueprint)
111
   
112
    t.up()
113
114
    yMax = #blueprint
115
    y = 1
116
117
    while y <= #blueprint do
118
        zMax = #blueprint[y]
119
        z = 1
120
    
121
        while z <= zMax do
122
            xMax = #blueprint[y][z]
123
            
124
            if dirCounter%2 == 1 then 
125
                x = 1
126
            else 
127
                x = xMax
128
            end
129
    
130
            while (x <= xMax and dirCounter%2 == 1) 
131
               or (x >= 1 and dirCounter%2 == 0) do
132
                slot = blueprint[y][z][x]
133
                
134
                print("x: ", x, "/", xMax, " - ", 
135
                      "z: ", z, "/", zMax, " - ", 
136
                      "y: ", y, "/", yMax, " - ", 
137
                      "slot: ", slot)
138
                      
139
                if slot > 0 then
140
                    
141
                    if turtle.getItemCount(slot) == 0 and
142
                       slot == 14 then
143
                        slot = 15
144
                    end
145
		    if slot == 13 then
146
			t.left()
147
		    end
148
149
                    t.placeDown(slot)
150
151
		    if slot == 13 then
152
			t.right()
153
		    end
154
                end
155
                if (x < xMax and dirCounter%2 == 1) 
156
                 or(x > 1 and dirCounter%2 == 0) then
157
                    t.forward()
158
                end
159
                
160
                if dirCounter%2 == 1 then
161
                    x = x+1
162
                else
163
                    x = x-1
164
                end
165
            end
166
            
167
            if z < zMax then
168
                turn()
169
            end
170
            z = z+1
171
        end
172
173
        if y < yMax then
174
            driveToStartPos(blueprint, y)
175
        else
176
            t.forward()
177
            for y = 1, yMax, 1 do
178
                t.down()
179
            end
180
            print("Finished!")
181
            print("All your base are belong to us")  
182
        end
183
        y = y+1
184
    end
185
end
186
187
--[[ Funktion Rückfahrt: ]]--
188
function driveToStartPos(array, y)     
189
    print("Driving to start position")  
190
    if dirCounter%2 == 0 then 
191
        t.right()
192
    else
193
        t.right()
194
        t.right()
195
        for x = 1, #array[y][#array[y]]-1, 1 do
196
            t.forward()
197
        end
198
        t.right()
199
    end
200
     
201
    for z = 1, #array[y]-1, 1 do
202
        t.forward()
203
    end
204
      
205
    t.right()
206
    t.up()
207
    dirCounter = 1
208
end
209
210
function start()
211
    if enoughResources() or 1 == 1 then
212
        print("forwards, to the moon, alice")
213
214
        layer    = {}     
215
216
        layer[1] = {{ 0,12, 4, 4, 4,12},
217
		    { 3, 4, 1, 1, 1, 4},
218-
        t.forward(12)
218+
		    { 3, 4, 1, 1, 1, 4},
219
		    { 3, 4, 1, 1, 1, 4},
220-
        layer    = {}
220+
		    { 3, 4, 1, 1, 1, 4},
221-
--[[        
221+
		    { 0,12, 4, 4, 4,12}}
222-
        layer[1] = {{1, 1, 1,1},
222+
223-
                    {1, 2, 2,1},
223+
        layer[2] = {{ 0, 0, 5, 5, 5, 0},
224-
                    {1, 2, 2,1},
224+
		    { 0, 5, 0, 0, 0, 5},
225-
                    {1, 1, 1,1}}
225+
		    { 0, 0, 0, 0, 0, 5},
226-
        layer[2] = {{2, 2, 2, 2},
226+
		    { 0, 5, 0, 0, 0, 5},
227-
                    {2, 1, 1, 2},
227+
		    { 0, 5, 10, 0, 0, 5},
228-
                    {2, 1, 1, 2},
228+
		    { 0, 0, 5, 5, 5, 0}}
229-
                    {2, 2, 2, 2}}
229+
230-
]]--                    
230+
        layer[3] = {{ 0, 0, 5, 7, 5, 0},
231-
          
231+
		    { 0, 5, 0, 0,12, 5},
232
		    { 0, 0, 0, 0, 0, 7},
233-
        layer[1] = {{ 0, 6, 4, 4, 4, 4, 4, 6, 0},
233+
		    { 0, 5, 0, 0, 0, 7},
234-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
234+
		    { 0, 5, 0, 0, 0, 5},
235-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
235+
		    { 0, 0, 5, 7, 5, 0}}
236-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
236+
237-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
237+
        layer[4] = {{ 0,15,15,15,15,15},
238-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
238+
		    { 0,15, 0, 0, 0,15},
239-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
239+
		    { 0,15, 0, 0, 0,15},
240-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
240+
		    { 0,15, 0, 0, 0,15},
241-
                    { 0, 4, 1, 1, 1, 1, 1, 4, 0},
241+
		    { 0,15, 0, 0, 0,15},
242-
                    { 0, 6, 4, 2, 4, 4, 4, 6, 0},
242+
		    { 0,15,15,15,15,15}}
243-
                    { 0, 3, 2, 2, 2, 2, 2, 3, 0},
243+
244-
                    { 0, 3, 3, 3, 3, 3, 3, 3, 0}}
244+
        layer[5] = {{ 0, 0, 0, 0, 0, 0},
245
		    { 0,15,15,15,15,15},
246-
        layer[2] = {{ 0, 6, 5, 5, 5, 5, 5, 6, 0},
246+
		    { 0, 7, 0, 0, 0, 7},
247-
                    { 0, 5,13,13,13,13, 1, 5, 0},
247+
		    { 0, 7, 0, 0, 0, 7},
248-
                    { 0, 5, 0, 0, 0, 0, 1, 5, 0},
248+
		    { 0,15,15,15,15,15},
249-
                    { 0, 5, 0, 0, 0, 0, 1, 5, 0},
249+
		    { 0, 0, 0, 0, 0, 0}}
250-
                    { 0, 5, 0, 0, 0, 0, 0, 5, 0},
250+
251-
                    { 0, 5, 0, 0, 0, 0, 0, 5, 0},
251+
        layer[6] = {{ 0, 0, 0, 0, 0, 0},
252-
                    { 0, 5, 0, 0, 0, 0, 0, 5, 0},
252+
		    { 0,12, 0, 0, 0,12},
253-
                    { 0, 5, 0, 0, 0, 0, 0, 5, 0},
253+
		    { 0,15,15,15,15,15},
254-
                    { 0, 5, 0, 9, 0, 0,10, 5, 0},
254+
		    { 0,15,15,15,15,15},
255-
                    { 0, 6, 5, 8, 5, 5, 5, 6, 0}}
255+
		    { 0,12, 0, 0, 0,12},
256
		    { 0, 0, 0, 0, 0, 0}}
257-
        layer[3] = {{ 0, 6, 5, 7, 7, 7, 5, 6, 0},
257+
258-
                    { 0, 5, 0, 0, 0,12, 1, 5, 0},
258+
259-
                    { 0, 5,12, 0, 0, 0, 1, 5, 0},
259+
260-
                    { 0, 7, 0, 0, 0, 0, 0, 7, 0},
260+
261-
                    { 0, 7, 0, 0, 0, 0, 0, 7, 0},
261+
262-
                    { 0, 7, 0, 0, 0, 0, 0, 7, 0},
262+
263-
                    { 0, 7, 0, 0, 0, 0, 0, 7, 0},
263+
264-
                    { 0, 5, 0, 0, 0, 0,12, 5, 0},
264+
265-
                    { 0, 5,12, 0, 0, 0, 0, 5, 0},
265+
266-
                    { 0, 6, 5, 0, 7, 7, 5, 6, 0},
266+
267-
                    { 0, 0,12, 0, 0, 0, 0, 0, 0}}
267+
268
    end
269-
        layer[4] = {{ 0, 6, 5, 5, 5, 5, 5, 6, 0},
269+
270-
                    { 0, 5, 3, 3, 3, 3, 1, 5, 0},
270+
271-
                    { 0, 5, 3, 3, 3, 3, 0, 5, 0},
271+
272-
                    { 0, 5, 3, 3, 3, 3, 0, 5, 0},
272+
273-
                    { 0, 5, 3, 3, 3, 3, 0, 5, 0},
273+
274-
                    { 0, 5, 3, 3, 3, 3, 0, 5, 0},
274+
275-
                    { 0, 5, 3, 3, 3, 3, 3, 5, 0},
275+