Update 'Controller/CropController.lua'

This commit is contained in:
manuel 2023-01-13 18:24:08 +00:00
parent 4ad48d4131
commit 81f8fc3a70

View File

@ -25,14 +25,20 @@ function CropController:initMonitor()
term.redirect(self.monitor)
end
function CropController:displayMatrix()
function CropController:displayMatrix(x,y)
if(type(x) ~= "number") then
x = 1
end
if(type(y) ~= "number") then
y = 1
end
assert(type(self.matrix) == "table")
assert(type(self.matrix[1]) == "table")
local width = #self.matrix
local length = #self.matrix[1]
for i = 1, width do
for j = 1, length do
term.setCursorPos(i,j)
term.setCursorPos(i + x - 1,j + y - 1)
if(self.matrix[i][j] >= 0) then
if(self.matrix[i][j] >= 6) then
term.setTextColour(colours.orange)
@ -52,6 +58,14 @@ function CropController:displayMatrix()
end
end
function CropController:updateFuelLevel()
local s, fuelLevel = self:doAction(self.slaveID, "getFuelLevel")
if(s == true) then
self.turtleFuelLevel = fuelLevel
end
return s
end
function CropController:toMatrix(str)
local matrix = {}
assert(type(str) == "string")