Fix syntax, fix startfuel

This commit is contained in:
Dominic Zimmer 2020-07-09 10:18:17 +02:00
parent cfb3074158
commit 41a60f00a3

View File

@ -1,6 +1,5 @@
args = {...}
x, z, direction = 0, 0, 0
startfuel = nil
turtlestate = {
name = os.getComputerLabel(),
id = os.getComputerID(),
@ -106,7 +105,7 @@ function moveSafe(moveAction, inspectAction, digAction)
if block["name"]:lower():find("turtle") then
-- turtle in front of me. lets wait for it to move
sleep(0.6)
elseif block["name"]:lower().find("water") or block["name"]:lower().find("lava") then
elseif block["name"]:lower():find("water") or block["name"]:lower():find("lava") then
if moveAction() then
break
else
@ -636,6 +635,7 @@ function doRefuel2()
sleep(5)
end
end
updateState({ startfuel = turtle.getFuelLevel() })
end
slots = { {7,-6}, {7, -7}, {7, -8}, {7,-5}, {7,-4} }
@ -663,7 +663,7 @@ function reportDuty2()
end
rednet.open("top")
id = turtlestate["job"]
fuelconsumed = startfuel - turtle.getFuelLevel()
fuelconsumed = turtlestate["startfuel"] - turtle.getFuelLevel()
turtlestate["fuel"] = fuelconsumed
rednet.broadcast("syn")
@ -685,7 +685,7 @@ function turtleAI2()
local job = enqueueForJob2()
turtlestate["job"] = job
doRefuel2()
turtlestate["startfuel"] = turtle.getFuelLevel()
--turtlestate["startfuel"] = turtle.getFuelLevel()
goToJob2(job)
digShaft()
goToUnloading()