Update 'Controller/CropController.lua'
This commit is contained in:
parent
4ad48d4131
commit
81f8fc3a70
@ -25,14 +25,20 @@ function CropController:initMonitor()
|
|||||||
term.redirect(self.monitor)
|
term.redirect(self.monitor)
|
||||||
end
|
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) == "table")
|
||||||
assert(type(self.matrix[1]) == "table")
|
assert(type(self.matrix[1]) == "table")
|
||||||
local width = #self.matrix
|
local width = #self.matrix
|
||||||
local length = #self.matrix[1]
|
local length = #self.matrix[1]
|
||||||
for i = 1, width do
|
for i = 1, width do
|
||||||
for j = 1, length 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] >= 0) then
|
||||||
if(self.matrix[i][j] >= 6) then
|
if(self.matrix[i][j] >= 6) then
|
||||||
term.setTextColour(colours.orange)
|
term.setTextColour(colours.orange)
|
||||||
@ -52,6 +58,14 @@ function CropController:displayMatrix()
|
|||||||
end
|
end
|
||||||
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)
|
function CropController:toMatrix(str)
|
||||||
local matrix = {}
|
local matrix = {}
|
||||||
assert(type(str) == "string")
|
assert(type(str) == "string")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user