From 035ab99fccbc7868cf36dbdfde398b17065c8320 Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Thu, 9 Jul 2020 10:14:29 +0200 Subject: [PATCH] Update client for lava/water --- mine/client.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mine/client.lua b/mine/client.lua index 1777804..e36af4b 100644 --- a/mine/client.lua +++ b/mine/client.lua @@ -106,6 +106,13 @@ 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 + if moveAction() then + break + else + digAction() + updateState({ state = "I am stuck trying to walk into a liquid." }) + end else digAction() end @@ -414,13 +421,17 @@ function drawStatus() print() print(" \""..turtlestate["name"].."\"") print() - print() if turtlestate["job"] then print("Current job: "..tostring(turtlestate["job"])) else print("Current job: ") end print() + if turtle["startfuel"] then + print("Starting Fuel: "..tostring(turtlestate["startfuel"])) + else + print("Starting Fuel: ") + end if turtlestate["job"] then print("Recent fuel usage: "..tostring(turtlestate["fuel"])) else @@ -674,7 +685,7 @@ function turtleAI2() local job = enqueueForJob2() turtlestate["job"] = job doRefuel2() - startfuel = turtle.getFuelLevel() + turtlestate["startfuel"] = turtle.getFuelLevel() goToJob2(job) digShaft() goToUnloading()