From be59464bef0d6e011f3979f9c0fb9b2ee0fbe54a Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:22:18 +0200 Subject: [PATCH] Conserve left-over microblocks. (RE-DONE) Commits originally from @fozolo . --- circular_saw.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/circular_saw.lua b/circular_saw.lua index 4c5da34..ae99e48 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -161,15 +161,12 @@ function circular_saw:update_inventory(pos, amount) end local stack = inv:get_stack("input", 1) - -- At least one "normal" block is necessary to see what kind of stairs are requested. + local node_name = "" if stack:is_empty() then - -- Any microblocks not taken out yet are now lost. - -- (covers material loss in the machine) - self:reset(pos) - return - + node_name = inv:get_stack("micro", 1):get_name():gsub(":micro_", ":") or "" + else + node_name = stack:get_name() or "" end - local node_name = stack:get_name() or "" local node_def = stack:get_definition() local name_parts = circular_saw.known_nodes[node_name] or "" local modname = name_parts[1] or ""