SHOW:
|
|
- or go back to the newest paste.
1 | --config | |
2 | url = "http://192.168.1.2:92/cc/variables/" | |
3 | p=peripheral.wrap("right") -- keeps turtle loaded with the chunk loader mod | |
4 | ||
5 | waitTime = 1500 | |
6 | - | turtle.placeDown() |
6 | + | length = 42 |
7 | suckDelay = 1 | |
8 | seedSuckAmmount = 10 | |
9 | fuelSuckAmmount = 5 | |
10 | ||
11 | ||
12 | -- not config | |
13 | - | while turtle.getFuelLevel() < 31 do |
13 | + | function wait() |
14 | for i=1,waitTime do | |
15 | - | turtle.suck(5) |
15 | + | print(i .. "/" .. waitTime) |
16 | sleep(1) | |
17 | end | |
18 | - | sleep(2) |
18 | + | |
19 | function getSeedCount() | |
20 | local seeds = 0 | |
21 | for i=1,16 do | |
22 | - | while turtle.getItemCount(1) < 31 do |
22 | + | |
23 | - | turtle.suck(5) |
23 | + | |
24 | if data then | |
25 | - | sleep(2) |
25 | + | |
26 | seeds = seeds + turtle.getItemCount(i) | |
27 | end | |
28 | end | |
29 | end | |
30 | return seeds | |
31 | end | |
32 | - | for i=1,10 do |
32 | + | |
33 | while type(http.get(url .. "altervariable.php?cmd=set&val=" .. turtle.getFuelLevel() .. "&var=billyAndBenFarmingTurtle3fuel")) ~= "table" do | |
34 | sleep(1) | |
35 | end | |
36 | while type(http.get(url .. "altervariable.php?cmd=set&val=" .. getSeedCount() .. "&var=billyAndBenFarmingTurtle3seeds")) ~= "table" do | |
37 | sleep(1) | |
38 | end | |
39 | x,y = turtle.inspectDown() | |
40 | if(y.name == "minecraft:wheat") then | |
41 | if(y.metadata == 7) then | |
42 | turtle.digDown() | |
43 | for i=1,16 do | |
44 | turtle.select(i) | |
45 | local data = turtle.getItemDetail(i) | |
46 | if data then | |
47 | if(data.name == "minecraft:wheat_seeds") then | |
48 | turtle.placeDown() | |
49 | end | |
50 | - | for i=1,10 do |
50 | + | |
51 | end | |
52 | end | |
53 | end | |
54 | end | |
55 | wait() | |
56 | while true do | |
57 | turtle.select(16) | |
58 | turtle.turnLeft() | |
59 | while turtle.getFuelLevel() < (length * 5)+10 do | |
60 | turtle.select(16) | |
61 | turtle.suck(fuelSuckAmmount) | |
62 | turtle.refuel(5) | |
63 | print("needs fuel") | |
64 | while type(http.get(url .. "altervariable.php?cmd=set&val=" .. turtle.getFuelLevel() .. "&var=billyAndBenFarmingTurtle3fuel")) ~= "table" do | |
65 | sleep(1) | |
66 | end | |
67 | sleep(suckDelay) | |
68 | end | |
69 | turtle.select(1) | |
70 | turtle.turnRight() | |
71 | turtle.turnRight() | |
72 | while getSeedCount() < (length * 3)+1 do | |
73 | turtle.select(1) | |
74 | - | for i=1,100 do |
74 | + | turtle.suck(seedSuckAmmount) |
75 | - | print(i) |
75 | + | |
76 | while type(http.get(url .. "altervariable.php?cmd=set&val=" .. getSeedCount() .. "&var=billyAndBenFarmingTurtle3seeds")) ~= "table" do | |
77 | sleep(1) | |
78 | end | |
79 | sleep(suckDelay) | |
80 | end | |
81 | turtle.turnLeft() | |
82 | ------------------------------------- | |
83 | turtle.select(1) | |
84 | turtle.forward() | |
85 | turtle.up() | |
86 | for i=1,length do | |
87 | turtle.forward() | |
88 | a() | |
89 | turtle.turnLeft() | |
90 | turtle.forward() | |
91 | a() | |
92 | turtle.turnRight() | |
93 | turtle.turnRight() | |
94 | turtle.forward() | |
95 | turtle.forward() | |
96 | a() | |
97 | turtle.turnLeft() | |
98 | turtle.turnLeft() | |
99 | turtle.forward() | |
100 | turtle.turnRight() | |
101 | end | |
102 | turtle.turnLeft() | |
103 | turtle.turnLeft() | |
104 | for i=1,length do | |
105 | turtle.forward() | |
106 | end | |
107 | turtle.down() | |
108 | turtle.forward() | |
109 | turtle.turnLeft() | |
110 | turtle.turnLeft() | |
111 | for i=1,16 do | |
112 | turtle.select(i) | |
113 | local data = turtle.getItemDetail(i) | |
114 | if data then | |
115 | if(data.name == "minecraft:wheat_seeds") then | |
116 | if(i > 1)then | |
117 | turtle.turnRight() | |
118 | turtle.drop(64) | |
119 | turtle.turnLeft() | |
120 | end | |
121 | end | |
122 | if(data.name == "minecraft:wheat") then | |
123 | turtle.dropUp(64) | |
124 | end | |
125 | end | |
126 | end | |
127 | turtle.select(1) | |
128 | wait() | |
129 | end |