SHOW:
|
|
- or go back to the newest paste.
1 | if turtle.getFuelLevel() == 0 then | |
2 | print("No Fuel") | |
3 | error() | |
4 | elseif turtle.getFuelLevel() < 300 then | |
5 | print("Low Fuel") | |
6 | error() | |
7 | end | |
8 | ||
9 | if fs.exists("schemAPI") then | |
10 | fs.delete("schemAPI") | |
11 | end | |
12 | - | shell.run("pastebin get 8JvHwrmJ schemAPI") |
12 | + | shell.run("pastebin get 13QunP89 schemAPI") |
13 | ||
14 | ||
15 | function gpsSetup() | |
16 | if gps.locate() then | |
17 | gpsi = true | |
18 | origDir = calibrateDir() | |
19 | local h,k,l = gps.locate() | |
20 | local k = k + 1 | |
21 | Hoff,Koff,Loff = h,k,l | |
22 | Hoff = math.floor(Hoff) | |
23 | Koff = math.floor(Koff) | |
24 | Loff = math.floor(Loff) | |
25 | else | |
26 | origDir = "south" | |
27 | end | |
28 | end | |
29 | ||
30 | ||
31 | function copySetupVars() | |
32 | local h = fs.open("reference",'w') | |
33 | h.writeLine("slots = {}") | |
34 | h.writeLine("filename = ".."\""..tostring(filename).."\"") | |
35 | for i,v in pairs(slots) do | |
36 | h.writeLine("slots\["..i.."\] = {}") | |
37 | for i2,v2 in pairs(v) do | |
38 | h.writeLine("slots\["..i.."\]\["..i2.."\] = {}") | |
39 | for i3,v3 in pairs(v2) do | |
40 | h.writeLine("slots\["..i.."\]\["..i2.."\]\["..i3.."\] = "..tostring(v3)) | |
41 | end | |
42 | end | |
43 | end | |
44 | h.writeLine("invList = {}") | |
45 | for i,v in pairs(invList) do | |
46 | h.writeLine("invList\["..i.."\] = {}") | |
47 | for i2,v2 in pairs(v) do | |
48 | h.writeLine("invList\["..i.."\]\[".."\""..i2.."\"".."\] = "..tostring(v2)) | |
49 | end | |
50 | end | |
51 | h.writeLine("height = "..tostring(height)) | |
52 | h.writeLine("width = "..tostring(width)) | |
53 | h.writeLine("length = "..tostring(length)) | |
54 | h.writeLine("chestOrder = "..tostring(chestOrder)) | |
55 | h.writeLine("enderchest1 = "..tostring(enderchest1)) | |
56 | h.writeLine("enderchest2 = "..tostring(enderchest2)) | |
57 | h.writeLine("origDir = ".."\""..tostring(origDir).."\"") | |
58 | h.writeLine("Hoff, Koff, Loff = "..tostring(Hoff)..", "..tostring(Koff)..", "..tostring(Loff)) | |
59 | h.writeLine("blocks = {}") | |
60 | for i,v in pairs(blocks) do | |
61 | h.writeLine("blocks\["..i.."\] = "..tostring(v)) | |
62 | end | |
63 | ||
64 | h.writeLine("data = {}") | |
65 | for i,v in pairs(data) do | |
66 | h.writeLine("data\["..i.."\] = "..tostring(v)) | |
67 | end | |
68 | ||
69 | h.close() | |
70 | end | |
71 | ||
72 | if not fs.exists("reference") then | |
73 | if fs.exists("position") then | |
74 | fs.delete("position") | |
75 | end | |
76 | if fs.exists("objective") then | |
77 | fs.delete("objective") | |
78 | end | |
79 | shell.run("schemAPI") | |
80 | heightPos = -1 | |
81 | widthPos = 0 | |
82 | lengthPos = 0 | |
83 | face = "south" | |
84 | x = 0 | |
85 | y = 0 | |
86 | z = 0 | |
87 | enderchest1 = 15 | |
88 | enderchest2 = 16 | |
89 | chestOrder = 1 | |
90 | blocks = {} | |
91 | data = {} | |
92 | openRednet() | |
93 | gpsSetup() | |
94 | tArgs = {...} | |
95 | if #tArgs ~= 1 then | |
96 | print("Usage: schemSetup <gunzipped schematic file>") | |
97 | return | |
98 | end | |
99 | ||
100 | filename = tArgs[1] | |
101 | ||
102 | if not fs.exists(filename) then | |
103 | print("File does not exist.") | |
104 | return | |
105 | end | |
106 | ||
107 | handle = fs.open(filename, "rb") | |
108 | ||
109 | setup() | |
110 | copySetupVars() | |
111 | end | |
112 | ||
113 | if tArgs then | |
114 | recordPos(-1,0,0,"south") | |
115 | recordObj(x,y,z) | |
116 | recordObjNum(1) | |
117 | else | |
118 | shell.run("reference") | |
119 | shell.run("position") | |
120 | shell.run("objective") | |
121 | end | |
122 | ||
123 | local h = fs.open("startup","w") | |
124 | h.write([[ | |
125 | shell.run("reference") | |
126 | ||
127 | shell.run("schemAPI") | |
128 | openRednet() | |
129 | checkIfRefill() | |
130 | if gps.locate() then | |
131 | gpsi = true | |
132 | else | |
133 | gpsi = false | |
134 | - | autorun() |
134 | + | |
135 | resynchronize() | |
136 | pcall(checkIfAir2(slots,height,width,length)) | |
137 | autorun2() | |
138 | ]]) | |
139 | h.close() |