SHOW:
|
|
- or go back to the newest paste.
1 | local function check() | |
2 | if turtle.getFuelLevel() < 5 then | |
3 | turtle.select(16) | |
4 | turtle.refuel(1) | |
5 | turtle.select(1) | |
6 | end | |
7 | end | |
8 | ||
9 | local function RoxSlave() | |
10 | local run = 1 | |
11 | while run == 1 do | |
12 | local scrap, message = rednet.receive() | |
13 | if message == "MoveForward" then | |
14 | check() | |
15 | turtle.forward() | |
16 | elseif message == "MoveBack" then | |
17 | check() | |
18 | turtle.back() | |
19 | elseif message == "MoveLeft" then | |
20 | turtle.turnLeft() | |
21 | elseif message == "MoveRight" then | |
22 | turtle.turnRight() | |
23 | elseif message == "MoveUp" then | |
24 | check() | |
25 | turtle.up() | |
26 | elseif message == "MoveDown" then | |
27 | check() | |
28 | turtle.down() | |
29 | elseif message == "DigForward" then | |
30 | turtle.dig() | |
31 | elseif message == "DigUp" then | |
32 | turtle.digUp() | |
33 | elseif message == "DigDown" then | |
34 | turtle.digDown() | |
35 | elseif message == "EndTurtle" then | |
36 | run = 0 | |
37 | rednet.close("right") | |
38 | textutils.slowPrint("Console ended program.") | |
39 | elseif message == "EndBoth" then | |
40 | run = 0 | |
41 | rednet.close("right") | |
42 | textutils.slowPrint("Console ended program.") | |
43 | end | |
44 | end | |
45 | end | |
46 | rednet.open("right") | |
47 | term.clear() | |
48 | textutils.slowPrint("Rox Remote Control Turtle \(RoxRCT\)") | |
49 | print("---------------------------------------") | |
50 | textutils.slowPrint("Receiver ready. Awaiting command from") | |
51 | textutils.slowPrint("the console.") | |
52 | textutils.slowPrint("Fuel is used from slot 16.") | |
53 | print("---------------------------------------") | |
54 | RoxSlave() |