Fix nil check assertions

This commit is contained in:
Gabriel Tofvesson 2024-12-03 23:10:09 +01:00
parent 408fed1ad2
commit f6b76a522f

View File

@ -79,7 +79,7 @@ end
local function handleFullInv(minEmpty)
local didPlace = false
local result, drop, dig, onComplete
local result, drop, dig, onComplete = false, nil, nil, nil
-- Empty inventory
while isFull(minEmpty) do
if not didPlace then
@ -117,14 +117,16 @@ local function handleFullInv(minEmpty)
::continue::
end
assert(dig ~= nil, "Placed chest, but dig operation is nil")
if didPlace and CHEST_PICKUP then
turtle.select(CHEST_SLOT)
dig()
if result then
assert(dig ~= nil, "Placed chest, but dig operation is nil")
if didPlace and CHEST_PICKUP then
turtle.select(CHEST_SLOT)
dig()
end
assert(onComplete ~= nil, "Placed chest, but onComplete operation is nil")
onComplete()
end
assert(onComplete ~= nil, "Placed chest, but onComplete operation is nil")
onComplete()
end
local function dig(checkRefuel)