From: Olav Bakke Svendsen Date: Mon, 30 Oct 2023 16:10:09 +0000 (+0100) Subject: Fixed buggy debug messages X-Git-Tag: skystone~23 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=8bee80d62866bf7a0aead1527a5e345c55fe86e6;p=cc.git Fixed buggy debug messages --- diff --git a/cobble-loader.lua b/cobble-loader.lua index fa6620a..3170544 100644 --- a/cobble-loader.lua +++ b/cobble-loader.lua @@ -51,7 +51,7 @@ local output_amounts = function() item and item.name == "minecraft:cobblestone" and item.count or 0 local free_space = p.getItemLimit(2) - count - debug("Output "..shorten(output).." needs "..free_space.." cobble") + debug("Output "..shorten(output).." needs "..tostring(free_space).." cobble") if free_space > 0 then table.insert(t, { address = output, free_space = free_space }) end @@ -71,7 +71,7 @@ local input_amounts = function() local count = item and item.name == "minecraft:cobblestone" and item.count or 0 - debug("Input "..shorten(input).." has"..count.." cobble") + debug("Input "..shorten(input).." has "..tostring(count).." cobble") table.insert(t, { address = input, count = count }) end table.sort(t, function(a, b) return a.count > b.count end) @@ -89,15 +89,15 @@ local move_cobble = function() to_move_total = to_move_total + output.free_space for _, input in ipairs(input_amounts()) do if to_move <= 0 then - debug("Output "..shorten(output).." full") + debug("Output "..shorten(output.address).." full") break end local moved = p.pullItems(input.address, 1, math.min(input.count, to_move), 2) -- moved may not be integer if pullItems failed.. look out to_move = to_move - moved to_move_total = to_move_total - moved - debug("Moved "..tostring(moved).." cobble from input "..shorten(input).." to output "..shorten(output)) - if to_move > 0 then debug("Output "..shorten(output).." still needs "..tostring(to_move).." cobble") end + debug("Moved "..tostring(moved).." cobble from input "..shorten(input.address).." to output "..shorten(output.address)) + if to_move > 0 then debug("Output "..shorten(output.address).." still needs "..tostring(to_move).." cobble") end end end debug("Done moving cobble")