From 81f8fc3a704c6c5d899502c6ca527b4a82dfbb3f Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 13 Jan 2023 18:24:08 +0000 Subject: [PATCH] Update 'Controller/CropController.lua' --- Controller/CropController.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Controller/CropController.lua b/Controller/CropController.lua index 9bcafb1..fb4a91e 100644 --- a/Controller/CropController.lua +++ b/Controller/CropController.lua @@ -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")