-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmockturtle.lua
100 lines (99 loc) · 1.91 KB
/
mockturtle.lua
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
-- mock the turtle API
fuelLevel = 101
turtle = {}
turtle['down'] = function()
print("turtle.down()")
fuelLevel = fuelLevel - 1
--sleep(0.2)
return true
end
turtle['up'] = function()
print("turtle.up()")
fuelLevel = fuelLevel - 1
--sleep(0.2)
return true
end
turtle['turnLeft'] = function()
print("turtle.turnLeft()")
--sleep(0.2)
return true
end
turtle['turnRight'] = function()
print("turtle.turnRight()")
--sleep(0.2)
return true
end
turtle['forward'] = function()
-- print("turtle.forward()")
fuelLevel = fuelLevel - 1
sleep(0.2)
return true
end
turtle['back'] = function()
print("turtle.back()")
fuelLevel = fuelLevel - 1
--sleep(0.2)
return true
end
turtle['dig'] = function()
print("turtle.dig()")
--sleep(0.2)
return true
end
turtle['digDown'] = function()
-- print("turtle.digDown()")
--sleep(0.2)
return true
end
turtle['digUp'] = function()
-- print("turtle.digUp()")
--sleep(0.2)
return true
end
turtle['attack'] = function()
-- print("turtle.attack()")
--sleep(0.2)
return true
end
turtle['detect'] = function()
-- print("turtle.detect()")
return false
end
turtle['detectUp'] = function()
-- print("turtle.detectUp()")
return false
end
turtle['detectDown'] = function()
-- print("turtle.detectDown()")
return false
end
turtle['select'] = function(i)
-- print("turtle.select(".. i .. ")")
return true
end
turtle['place'] = function()
print("turtle.place()")
--sleep(0.2)
return true
end
turtle['drop'] = function()
print("turtle.drop()")
--sleep(0.2)
return true
end
turtle['getFuelLevel'] = function()
-- print("turtle.getFuelLevel()")
-- print("fuelLevel: " .. fuelLevel)
return fuelLevel
end
turtle['getItemDetail'] = function()
-- print("turtle.getItemDetail()")
item = {}
item.name = "minecraft:coal"
return item
end
turtle['refuel'] = function()
-- print("turtle.refuel()")
fuelLevel = fuelLevel + 50
return true
end