From e35e8d8d242d7b96539c297e4310092e1bcb4bb6 Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Sun, 5 Jul 2020 02:01:31 +0200 Subject: [PATCH] Update server + client --- dominic/canemine.lua | 13 +++++++++++++ dominic/server.lua | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dominic/canemine.lua b/dominic/canemine.lua index 4ed08be..fc10c3d 100644 --- a/dominic/canemine.lua +++ b/dominic/canemine.lua @@ -110,6 +110,16 @@ function selectCobble() end end +function selectFuel() + for i = 1,16 do + turtle.select(i) + item = turtle.getItemDetail() + if item and (item["name"] == "minecraft:coal" or item["name"] == "minecraft:charcoal") then + break + end + end +end + function digShaft() turtle.digDown() selectCobble() @@ -264,6 +274,7 @@ function doRefuel() turtle.select(1) while turtle.getFuelLevel() < 1500 do turtle.suck(1) + selectFuel() turtle.refuel(1) end end @@ -297,8 +308,10 @@ function waitForJob() end function emptyToBarrel() + sleep(0.4) for i = 1,16 do turtle.select(i) + sleep(0.1) turtle.dropDown() end end diff --git a/dominic/server.lua b/dominic/server.lua index 99fbe2d..197f333 100644 --- a/dominic/server.lua +++ b/dominic/server.lua @@ -1,6 +1,15 @@ rednet.open("back") -curjob = 29 +curjob = 69 +while true do + print("From what index do you want to resume jobs?") + x = read() + if x then + curjob = tonumber(x) + break + end + print("That's not a number.") +end function getNextJob() curjob = curjob + 1 @@ -13,9 +22,11 @@ while true do sleep(0.6) else if message == "gibjob" then - job = getNextJob() - rednet.broadcast(tostring(job), "newjob") - print("Found request for job. Offering "..tostring(job)) + if rs.getInput("right") then + job = getNextJob() + rednet.broadcast(tostring(job), "newjob") + print("Found job request. Offering "..tostring(job)) + end else -- numberic job is complete completejob = tonumber(message)