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 1/4] 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 4c5da34c..ae99e48a 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 "" From 1cf9a197bb6c0d88390b121b7e72a51b2361fc1a Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:35:20 +0200 Subject: [PATCH 2/4] Update circular_saw.lua --- circular_saw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circular_saw.lua b/circular_saw.lua index ae99e48a..c910710e 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -159,7 +159,7 @@ function circular_saw:update_inventory(pos, amount) self:reset(pos) return end - +-- Determine the kind of stairs from either the normal block or micro block. local stack = inv:get_stack("input", 1) local node_name = "" if stack:is_empty() then From 25450416f49ff1548a2ffd822b840cabb9c0bae8 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 13 Jul 2023 17:35:46 +0200 Subject: [PATCH 3/4] Apply suggestions from code review --- circular_saw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circular_saw.lua b/circular_saw.lua index c910710e..cc436b4e 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -159,7 +159,7 @@ function circular_saw:update_inventory(pos, amount) self:reset(pos) return end --- Determine the kind of stairs from either the normal block or micro block. + -- Determine the kind of stairs from either the normal block or micro block. local stack = inv:get_stack("input", 1) local node_name = "" if stack:is_empty() then From 0325c84a11d2bedc04240713c43a9b47dcfb3ab6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 13 Jul 2023 17:37:15 +0200 Subject: [PATCH 4/4] Apply suggestions from code review --- circular_saw.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/circular_saw.lua b/circular_saw.lua index cc436b4e..dd5bea13 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -159,6 +159,7 @@ function circular_saw:update_inventory(pos, amount) self:reset(pos) return end + -- Determine the kind of stairs from either the normal block or micro block. local stack = inv:get_stack("input", 1) local node_name = ""