Compare commits
No commits in common. "ddf13c76e4d7a457fb942f9759143eddce8b5f54" and "117b22041d954f6ce422b4d54e6b1d72e5458657" have entirely different histories.
ddf13c76e4
...
117b22041d
@ -29,11 +29,11 @@ end
|
||||
|
||||
function Controller:doAction(id, message, protocol)
|
||||
self:sendMessage(id, message, protocol)
|
||||
local id2, message2, protocol2
|
||||
local id2, message2
|
||||
repeat
|
||||
id2, message2, protocol2 = rednet.receive()
|
||||
id2, message2 = rednet.receive()
|
||||
until id2 == id
|
||||
return protocol2 == "confirm", message2
|
||||
return message2 == "confirm", message2
|
||||
end
|
||||
|
||||
function Controller:setSlaveID(id)
|
||||
@ -76,7 +76,6 @@ end
|
||||
function Controller:autoWood()
|
||||
self.stop = false
|
||||
while(self.stop == false) do
|
||||
self.turtleStatus = "checking tree"
|
||||
self:updateFuelLevel()
|
||||
self:updateDisplay(4)
|
||||
local update = self:updateTreeStatus()
|
||||
@ -96,18 +95,16 @@ function Controller:autoWood()
|
||||
self:updateDisplay(4)
|
||||
self:doAction(self.slaveID, "cutTree")
|
||||
self.turtleStatus = "planting tree"
|
||||
self:updateFuelLevel()
|
||||
self:updateFuelLevel
|
||||
self:updateDisplay(4)
|
||||
self:doAction(self.slaveID, "plantTree")
|
||||
end
|
||||
if self.turtleFuelLevel < 1000 then
|
||||
self:doAction(self.slaveID, "refuel")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Controller:updateFuelLevel()
|
||||
local s, fuelLevel = self:doAction(self.slaveID, "getFuelLevel")
|
||||
self.turtleStatus = "checking tree"
|
||||
local s, fuelLevel = self:doAction("getFuelLevel")
|
||||
if(s == true) then
|
||||
self.turtleFuelLevel = fuelLevel
|
||||
end
|
||||
@ -123,7 +120,7 @@ end
|
||||
|
||||
function Controller:displayFuelLevel(line)
|
||||
if(self.monitor.sb.lines[line] ~= self.turtleFuelLevel) then
|
||||
self.monitor:setStatus(line, "fuel Level:" .. self.turtleFuelLevel)
|
||||
self.monitor:setStatus(line, self.turtleFuelLevel)
|
||||
end
|
||||
end
|
||||
|
@ -389,17 +389,3 @@ function Wood:assertInvUpdate(update)
|
||||
self:updateInv()
|
||||
end
|
||||
end
|
||||
|
||||
function Wood:refuel(goBack)
|
||||
if (goBack == nil) then goBack = true end
|
||||
if(goBack == true) then
|
||||
goBack = {self.x, self.y, self.z, self.dir}
|
||||
end
|
||||
|
||||
self:clearInv("coalChest")
|
||||
turtle.select(1)
|
||||
turtle.suckDown()
|
||||
turtle.refuel()
|
||||
|
||||
self:moveTo(goBack)
|
||||
end
|
@ -34,9 +34,6 @@ function answer(message, id)
|
||||
end
|
||||
elseif(message == "getFuelLevel") then
|
||||
rednet.send(id, tostring(tree:getFuelLevel()), "confirm")
|
||||
elseif(message == "refuel") then
|
||||
tree:refuel()
|
||||
rednet.send(id, "refueled", "confirm")
|
||||
end
|
||||
rednet.send(id, "could not resolve message", "error")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user