-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdoApi.cc.lua
More file actions
48 lines (42 loc) · 798 Bytes
/
doApi.cc.lua
File metadata and controls
48 lines (42 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local _version = 0.1
local junk_slot = 4
function version()
return _version
end
function doUp(count=1)
local trycount=20
while movecount < count do
while trycount > 0 and not turtle.up() do
trycount = trycount - 1
turtle.select(junk_slot)
turtle.digDown()
end
end
return movecount == count
end
function wander(wander_func = NULL)
while true do
rnum = (math.random(1,10))
if rnum > 5 then
turtle.turnLeft()
else if rnum < 5 then
turtle.turnRight()
end
for i=1, math.random(10, 30), 1 do
if not turtle.detect() then
turtle.forward()
end
end
if ( wander_func) then
wander_func()
end
sleep(1)
end
end
function wanderer(exec)
local wand=true
while wand do
local tmp=loadstring(exec)
parallel.waitForAny(wander, tmp)
end
end