SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | - | local rec = 31 |
2 | + | This script is used at the server |
3 | Geevancraft 2. | |
4 | It is a secret way of storing | |
5 | my valuables. | |
6 | ]]-- | |
7 | ||
8 | local dif = 25 | |
9 | local rec = 0 -- rednet receiver id | |
10 | ||
11 | rednet.open("right") | |
12 | rednet.send(rec,"Gathering items!") | |
13 | rednet.send(rec,"Heading up... ") | |
14 | write("Heading up... ") | |
15 | ||
16 | function down() | |
17 | write("Heading down... ") | |
18 | rednet.send(rec, "Heading down...") | |
19 | local count = 0 | |
20 | while not turtle.detectDown() do | |
21 | count = count + 1 | |
22 | if count % dif == 0 then | |
23 | rednet.send(rec,"Progress: "..count.." blocks!") | |
24 | end | |
25 | count2 = 0 | |
26 | while not turtle.down() do | |
27 | if not turtle.digDown() then | |
28 | if not turtle.attackDown() then | |
29 | count2 = count2 + 1 | |
30 | if count2 % dif == 0 then | |
31 | print("Failed!") | |
32 | rednet.send(rec,"Failed!") | |
33 | rednet.close("right") | |
34 | return | |
35 | end | |
36 | sleep(1) | |
37 | end | |
38 | end | |
39 | end | |
40 | end | |
41 | print("Success!") | |
42 | rednet.send(rec,"Success!") | |
43 | end | |
44 | ||
45 | local count = 0 | |
46 | repeat | |
47 | status = turtle.up() | |
48 | -- status = true | |
49 | count = count + 1 | |
50 | if count % dif == 0 then | |
51 | rednet.send(rec,"Progress: "..count.." blocks!") | |
52 | end | |
53 | if not status then | |
54 | if count % dif == 0 then | |
55 | rednet.send(rec,"Failed!") | |
56 | print("Failed!") | |
57 | down() | |
58 | rednet.close("right") | |
59 | return | |
60 | end | |
61 | end | |
62 | until turtle.detectUp() | |
63 | ||
64 | print("Success!") | |
65 | rednet.send(rec,"Success!") | |
66 | rednet.send(rec,"Sucking items...") | |
67 | write("Sucking items... ") | |
68 | ||
69 | for i = 1, 16 do | |
70 | if not turtle.suckUp() then | |
71 | if i == 1 then | |
72 | print("Failed!") | |
73 | rednet.send(rec,"Failed!") | |
74 | break | |
75 | end | |
76 | print("Success!") | |
77 | rednet.send(rec,"Sucess!") | |
78 | break | |
79 | end | |
80 | end | |
81 | down() | |
82 | rednet.close("right") |