Fix?
This commit is contained in:
parent
268c8679e1
commit
766f72171d
@ -1,5 +1,5 @@
|
||||
args = {...}
|
||||
status = {
|
||||
turtlestatus = {
|
||||
name = os.getComputerLabel(),
|
||||
id = os.getComputerID(),
|
||||
fuel = "",
|
||||
@ -348,51 +348,51 @@ function emptyToBarrel()
|
||||
end
|
||||
|
||||
function drawStatus()
|
||||
print("Turtle ("..status["id"]..")")
|
||||
print("Turtle ("..turtlestatus["id"]..")")
|
||||
print()
|
||||
print(" \""..status["name"].."\"")
|
||||
print(" \""..turtlestatus["name"].."\"")
|
||||
print()
|
||||
print()
|
||||
if status["job"] then
|
||||
print("Current job: "..tostring(status["job"]))
|
||||
if turtlestatus["job"] then
|
||||
print("Current job: "..tostring(turtlestatus["job"]))
|
||||
else
|
||||
print("Current job: ")
|
||||
end
|
||||
print()
|
||||
if status["job"] then
|
||||
print("Last job fuel consumption: "..tostring(status["fuel"]))
|
||||
if turtlestatus["job"] then
|
||||
print("Last job fuel consumption: "..tostring(turtlestatus["fuel"]))
|
||||
else
|
||||
print("Last job fuel consumption: ")
|
||||
end
|
||||
print()
|
||||
print("Status:")
|
||||
print(" "..status["state"])
|
||||
print(" "..turtlestatus["state"])
|
||||
print()
|
||||
print()
|
||||
end
|
||||
|
||||
while true do
|
||||
status["state"] = "Waiting for job..."
|
||||
turtlestatus["state"] = "Waiting for job..."
|
||||
drawStatus()
|
||||
thejob = waitForJob()
|
||||
--status["job"] = thejob
|
||||
status["state"] = "Refueling..."
|
||||
turtlestatus["job"] = thejob
|
||||
turtlestatus["state"] = "Refueling..."
|
||||
drawStatus()
|
||||
doRefuel()
|
||||
fuel = turtle.getFuelLevel()
|
||||
status["state"] = "Headed to the jobsite..."
|
||||
turtlestatus["state"] = "Headed to the jobsite..."
|
||||
drawStatus()
|
||||
goToJob()
|
||||
x, z = ithSpot(thejob)
|
||||
digTo(x,z)
|
||||
status["state"] = "Digging the Shaft..."
|
||||
turtlestatus["state"] = "Digging the Shaft..."
|
||||
drawStatus()
|
||||
digShaft()
|
||||
status["state"] = "Returning to the station..."
|
||||
turtlestatus["state"] = "Returning to the station..."
|
||||
drawStatus()
|
||||
goToSpawn(x, z)
|
||||
path = math.floor(math.random() + 0.5)
|
||||
status["state"] = "Unloading Inventory..."
|
||||
turtlestatus["state"] = "Unloading Inventory..."
|
||||
drawStatus()
|
||||
goToBarrel(path)
|
||||
emptyToBarrel()
|
||||
@ -400,12 +400,12 @@ while true do
|
||||
fuelconsumed = fuel - turtle.getFuelLevel()
|
||||
--print("I consumed "..tostring(fuelconsumed).." fuel")
|
||||
--print("Reporting Duty")
|
||||
status["fuel"] = fuelconsumed
|
||||
status["state"] = "Reporting duty..."
|
||||
turtlestatus["fuel"] = fuelconsumed
|
||||
turtlestatus["state"] = "Reporting duty..."
|
||||
drawStatus()
|
||||
reportDuty(thejob, fuelconsumed)
|
||||
status["job"] = nil
|
||||
status["state"] = "Going back in line..."
|
||||
turtlestatus["job"] = nil
|
||||
turtlestatus["state"] = "Going back in line..."
|
||||
drawStatus()
|
||||
enqueueTurtle()
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user