Update 'Turtle/Wheat.lua'
This commit is contained in:
parent
38f32f6e1c
commit
048237aafa
@ -203,3 +203,44 @@ function Wheat:calculateSeeds()
|
|||||||
end
|
end
|
||||||
return seeds
|
return seeds
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Wheat:plantAll()
|
||||||
|
self:fillSeeds("firstCrop")
|
||||||
|
for i = 1, self.width do
|
||||||
|
local line = self.cropMatrix[i]
|
||||||
|
if(i % 2 == 0) then
|
||||||
|
line = self:reverseArray(line)
|
||||||
|
end
|
||||||
|
for j = 1, self.length do
|
||||||
|
if(line[j] == -2) then
|
||||||
|
self:selectPlantable(true)
|
||||||
|
turtle.placeDown()
|
||||||
|
line[j] = 0
|
||||||
|
elseif(line[j] >= 0) then
|
||||||
|
line[j] = self:getStatusDown()
|
||||||
|
end
|
||||||
|
if(j < self.length) then
|
||||||
|
digForward()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if(i % 2 == 0) then
|
||||||
|
self.cropMatrix[i] = self:reverseArray(line)
|
||||||
|
else
|
||||||
|
self.cropMatrix[i] = line
|
||||||
|
end
|
||||||
|
if(i < self.width) then
|
||||||
|
if(i % 2 == 0) then
|
||||||
|
turtle.turnRight()
|
||||||
|
digForward()
|
||||||
|
turtle.turnRight()
|
||||||
|
self.dir = (self.dir + 2) % 4
|
||||||
|
else
|
||||||
|
turtle.turnLeft()
|
||||||
|
digForward()
|
||||||
|
turtle.turnLeft()
|
||||||
|
self.dir = (self.dir + 2) % 4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.x, self.y, self.z = gps.locate()
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user