Upload files to 'Turtle'

This commit is contained in:
manuel 2023-01-08 13:47:41 +00:00
parent 3a072d0848
commit 23dbfbed8b
2 changed files with 51 additions and 0 deletions

8
Turtle/Turtle.lua Normal file
View 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
View 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