View difference between Paste ID: 7N7DCgS6 and gxQVnYqT
SHOW: | | - or go back to the newest paste.
1
    rednet.open("right")
2
    local func
3
    local tArgs = {...}
4
     
5
    function cleanup()
6
       for i = 1,12 do
7
          turtle.select(i)
8
          turtle.dropDown()
9
       end
10
    end
11
     
12
    function place()
13
       turtle.select(16)
14
       turtle.place()
15
       turtle.down()
16
       turtle.select(15)
17
       turtle.place()
18
       turtle.select(14)
19
       turtle.placeDown()
20
    end
21
	
22
    function placePower()
23
       turtle.select(1)
24
       turtle.place()
25
       turtle.down()
26
       turtle.select(2)
27
       turtle.place()
28
       turtle.attack()
29
    end
30
	
31
    function removePower()
32
       turtle.select(2)
33
       turtle.dig()
34
       turtle.up()
35
       turtle.select(1)
36
       turtle.dig()
37
    end
38
     
39
    function remove()
40
       turtle.select(14)
41
       turtle.digDown()
42
       turtle.select(15)
43
       turtle.dig()
44
       turtle.up()
45
       turtle.select(16)
46
       turtle.dig()
47
    end
48
     
49
    function fuel()
50
       turtle.select(13)
51
       turtle.placeUp()
52
       turtle.select(1)
53
       turtle.suckUp()
54
       turtle.dropUp(turtle.getItemCount(1) - 4)
55
       turtle.refuel()
56
       turtle.select(13)
57
       turtle.digUp()
58
    end
59
     
60
    function fuelBoss(powerStation)
61
      turtle.select(13)
62
      turtle.placeUp()
63
      turtle.select(1)
64
      turtle.suckUp()
65-
      turtle.dropUp(4(table.getn(powerStation) + table.getn(powerStation[2]) - (powerStation[2] ~= nil and 1 or 0)))
65+
      turtle.dropUp(doMath(powerStation))
66
      turtle.select(13)
67
      turtle.digUp()
68
      turtle.up()
69
      for x,y in pairs(powerStation) do
70
        if (type(y) not "table") and (y not nil) then
71
	  turtle.turnLeft()
72
	  turtle.drop(4)
73
	  turtle.turnRight()
74
	else
75
          for w,z in pairs(y)
76
	    turtle.forward()
77
            turtle.turnRight()
78
            turtle.forward(z+1)
79
	    turtle.turnRight()
80
	    turtle.drop(4)
81
	    turtle.turnRight()
82
	    turtle.forward(z+1)
83
	    turtle.turnRight()
84
	  end
85
        end
86
      end
87
    end
88
89
    function doMath(tbl)
90
      y = table.getn(tbl) + table.getn(tbl[2])
91
      if tbl[2] ~= nil then
92
        y=y-1
93
      end
94
      y=4*y
95
      return y
96
    end
97
	 
98
    function checkFuel()
99
       if turtle.getFuelLevel() < 600 then
100
          fuel()
101
       end
102
    end
103
	
104
    function checkStationFuel(id)
105
      if turtle.getFuelLevel() < 600 then
106
        rednet.send("true", id)
107
      else
108
        rednet.send("false", id)
109
      end
110
    end
111
112
    function eatFuel()
113
      turtle.select(3)
114
      turtle.refuel()
115
      turtle.select(1)
116
    end
117
	
118
    function cycle()
119
       place()
120
       sleep(25)
121
       while turtle.getItemCount(1) > 0 do
122
          cleanup()
123
          sleep(2)
124
       end
125
       remove()
126
       checkFuel()
127
       turtle.forward()
128
    end
129
     
130
    function checkIn(fromID)
131
       rednet.send(fromID, tArgs[1])
132
    end
133
     
134
    function chunkLoad()
135
       turtle.select(16)
136
       turtle.digUp()
137
       checkFuel()
138
       turtle.select(16)
139
       turtle.forward()
140
       turtle.placeUp()
141
    end
142
     
143
    while true do
144
       local id,msg,dist = rednet.receive()
145
       func = loadstring(msg)
146
       setfenv(func, getfenv())
147
       func(id)
148
       rednet.send(id,"Done")
149
    end