SHOW:
|
|
- or go back to the newest paste.
1 | - | --[[function saveVarsToConsole(name) |
1 | + | |
2 | - | local h = fs.open(name,'w') |
2 | + | |
3 | - | local env = getfenv() |
3 | + | |
4 | - | for i,v in pairs(env) do |
4 | + | |
5 | - | if i then |
5 | + | |
6 | - | h.write(i) |
6 | + | |
7 | - | if v then |
7 | + | |
8 | - | --h.write("("..tostring(type(v))..")") |
8 | + | |
9 | - | h.write(': ') |
9 | + | |
10 | - | h.writeLine(v) |
10 | + | |
11 | --[[Schematic Functions]]-- | |
12 | ||
13 | ||
14 | - | h.close() |
14 | + | |
15 | - | end]] |
15 | + | |
16 | ||
17 | - | function openRednet() |
17 | + | |
18 | - | for _,v in ipairs(peripheral.getNames()) do |
18 | + | |
19 | - | if peripheral.getType(v)=="modem" then |
19 | + | |
20 | - | rednet.open(v) |
20 | + | |
21 | --[[ | |
22 | function run() | |
23 | print("Press key to start building...") | |
24 | read() | |
25 | - | function checkIfRefill() |
25 | + | |
26 | - | local _,inFront = turtle.inspect() |
26 | + | |
27 | - | local _,below = turtle.inspectDown() |
27 | + | |
28 | - | local mem = turtle.getSelectedSlot() |
28 | + | |
29 | - | turtle.select(16) |
29 | + | |
30 | - | local check = turtle.getItemDetail() |
30 | + | |
31 | - | if check and check.name ~= "EnderStorage:enderChest" then |
31 | + | |
32 | - | if not turtle.dropDown() then |
32 | + | |
33 | - | if not turtle.drop() then |
33 | + | |
34 | - | turtle.dropUp() |
34 | + | |
35 | blockData = getData(x-1,y-1,z-1) | |
36 | - | end |
36 | + | |
37 | turtle.digDown() | |
38 | - | if inFront or below then |
38 | + | |
39 | - | if inFront.name == "EnderStorage:enderChest" then |
39 | + | |
40 | - | turtle.select(enderchest1) |
40 | + | |
41 | - | turtle.dig() |
41 | + | |
42 | for i,v in ipairs(slot_lst) do | |
43 | - | if below.name == "EnderStorage:enderChest" then |
43 | + | |
44 | - | turtle.select(enderchest2) |
44 | + | |
45 | - | turtle.digDown() |
45 | + | |
46 | break | |
47 | end | |
48 | - | turtle.select(mem) |
48 | + | |
49 | if not found then | |
50 | print("Not enough " .. getBlockName(blockID, blockData) .. ". Please refill...") | |
51 | - | function calibrateDir() |
51 | + | |
52 | - | --if gpsi then |
52 | + | |
53 | - | local dir |
53 | + | |
54 | - | local h,k,l = gps.locate() |
54 | + | |
55 | - | h = math.floor(h) |
55 | + | |
56 | - | k = math.floor(k) |
56 | + | |
57 | - | l = math.floor(l) |
57 | + | |
58 | - | while not turtle.forward() do |
58 | + | |
59 | - | turtle.dig() |
59 | + | |
60 | end | |
61 | - | local h2,k2,l2 = gps.locate() |
61 | + | |
62 | - | turtle.back() |
62 | + | |
63 | - | if h2>h then |
63 | + | |
64 | - | dir = "east" |
64 | + | |
65 | - | elseif h2<h then |
65 | + | |
66 | - | dir = "west" |
66 | + | |
67 | - | elseif l2>l then |
67 | + | |
68 | - | dir = "south" |
68 | + | |
69 | - | elseif l2<l then |
69 | + | |
70 | - | dir = "north" |
70 | + | |
71 | right() | |
72 | - | return dir |
72 | + | |
73 | - | --end |
73 | + | |
74 | end | |
75 | left() | |
76 | - | function recalibratePos() |
76 | + | |
77 | - | local h,k,l = gps.locate() |
77 | + | |
78 | - | local xtemp,ytemp,ztemp = h - Hoff, k - Koff, l - Loff |
78 | + | |
79 | for i=1,height+1 do | |
80 | - | if origDir == "south" then |
80 | + | |
81 | - | widthPos = 0 + xtemp |
81 | + | |
82 | - | heightPos = ytemp |
82 | + | |
83 | - | lengthPos = 0 + ztemp |
83 | + | ]]-- |