View difference between Paste ID: mWGQ55vQ and GXRtuRpk
SHOW: | | - or go back to the newest paste.
1
--[[
2
Changes:
3
Turtles no longer monitor how many rows they've gone forward (no more rowsProgressed file)
4
Master turtle simply waits for (numberNeighbours) unique turtles to send messages saying
5
they are ready and waiting. Slave turtles repeatedly send ready and waiting signals to prevent
6
the sync problems we were having before.
7
--]]
8
 
9
-- Open up modem to receive wireless broadcasts
10
rednet.open("right")
11
 
12
-- Wait until neighbouring turtles are ready
13
function waitForMaster()
14
  local event, param1, param2
15
 
16
  rednet.broadcast("I am ready and waiting master")
17
  os.startTimer(1)
18
 
19
  while true do
20
    event, param1, param2 = os.pullEvent()
21
 
22
    -- Resend ready message every second, in case master is not yet ready
23
    if event == "timer" then
24
      rednet.broadcast("I am ready and waiting master")
25
      os.startTimer(1)
26
   
27
    -- Wait for master turtle to give the OK to proceed before continuing digging
28
    elseif event == "rednet_message" then
29
      local message = param2
30
      if message == "You are authorised to proceed" then
31
        break
32
      end -- if message
33
    end -- if event
34
  end -- while
35
end -- function
36
 
37
bool=true
38
 
39
while bool==true do
40
  if rs.getInput("back", true) then
41
      print ("Waiting")
42
      sleep (1)
43
  else
44
    print ("Let's Roll!")
45
    bool=false
46
  end
47
end
48
 
49
X=66
50
 
51-
51+
52
 
53
  print ("---------------------------")
54
  print ("Starting World Eating Scripts!")
55
  print ("---------------------------")
56
 
57-
  turtle.dig()
57+
58
 
59-
  while not turtle.forward() do
59+
60-
    turtle.attack()
60+
61
 
62
moves = 0
63
 
64
ore = false
65-
65+
66-
66+
turtle.select(2)
67-
67+
ore = turtle.compareDown()
68-
68+
turtle.select(3)
69-
69+
70
while ore == false and moves < 65 do
71-
71+
72-
    
72+
        moves = moves + 1
73
        while not turtle.down() do
74-
      for c = 1, X do
74+
                turtle.attack()
75-
	turtle.select(2)
75+
76-
	ore = turtle.compareDown()
76+
        turtle.select(2)
77-
	if ore == true then
77+
        ore = turtle.compareDown()
78-
78+
        turtle.select(3)
79-
		for t = 1, c do
79+
80-
			turtle.digUp()
80+
81-
			while not turtle.up()
81+
for q=1, moves do
82-
				turtle.digUp()
82+
83-
				turtle.attackUp()
83+
84-
			end
84+
                turtle.attack()
85-
		end
85+
                turtle.digUp()
86-
	else
86+
87-
87+
88
 
89
 
90-
       		 while not turtle.down() do
90+
91-
          		turtle.attackDown()
91+
92-
       		 end
92+
93-
	end
93+
94
      for r = 1, 2 do
95
        turtle.dig()
96-
if ore == false then
96+
97-
      for d = 1, X do
97+
98
        end
99
 
100
      end
101-
          turtle.attackUp()
101+
102
    print ("Dropping off items")
103-
else
103+
104
        turtle.dig()
105
        turtle.attack()
106-
106+
107-
107+
108-
108+
109-
109+
110-
110+
111-
111+
112-
112+
113-
113+
114
 
115
    for dropslot = 3, 16 do
116
      turtle.select(dropslot)
117
      turtle.drop()
118
    end
119
 
120
    waitForMaster()
121
 
122
    turtle.select(1)
123
 
124
    turtle.dig()
125
 
126
    turtle.select(3)
127
 
128
  end
129
end