Upload files to 'Turtle'
This commit is contained in:
parent
3a072d0848
commit
23dbfbed8b
8
Turtle/Turtle.lua
Normal file
8
Turtle/Turtle.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Turtle = {}
|
||||||
|
|
||||||
|
function Turtle:new(t)
|
||||||
|
t = t or {}
|
||||||
|
setmetatable(t, self)
|
||||||
|
self.__index = self
|
||||||
|
return t
|
||||||
|
end
|
43
Turtle/Wheat.lua
Normal file
43
Turtle/Wheat.lua
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
Wheat = {}
|
||||||
|
|
||||||
|
function Wheat:new(t)
|
||||||
|
t = t or {}
|
||||||
|
setmetatable(t, self)
|
||||||
|
self.__index = self
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
function Wheat:getStatusDown()
|
||||||
|
local bd, data = turtle.inspectDown()
|
||||||
|
if(bd == true) then
|
||||||
|
if(data.state.age == nil) then
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Wheat:isPlantable(slot, update)
|
||||||
|
self:assertInvUpdate(update)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function Wood:updateInv()
|
||||||
|
self.inv = {}
|
||||||
|
for slot = 1, 16 do
|
||||||
|
self.inv[slot] = turtle.getItemDetail(slot, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Wood:assertInvUpdate(update)
|
||||||
|
if (update ~= false) then update = true end
|
||||||
|
|
||||||
|
if self.inv == nil then
|
||||||
|
update = true
|
||||||
|
end
|
||||||
|
|
||||||
|
assert(type(update) == "boolean","update must be of the type boolean")
|
||||||
|
if update == true then
|
||||||
|
self:updateInv()
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user