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