From f9035e4aead161f8484429438f1923e66c1f2671 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 20 Jun 2023 21:41:30 +0200 Subject: [PATCH] Fix quarry depth bug --- basic_machines/quarry.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/basic_machines/quarry.lua b/basic_machines/quarry.lua index 446de64..c8e5434 100644 --- a/basic_machines/quarry.lua +++ b/basic_machines/quarry.lua @@ -46,6 +46,8 @@ local function formspec(self, pos, nvm) local hsize_list = "5x5" if CRD(pos).stage == 4 then hsize_list = "3x3,5x5,7x7,9x9,11x11" + elseif CRD(pos).stage == 3 then + hsize_list = "3x3,5x5,7x7" end local depth_list = "1,2,3,5,10,15,20,25,40,60,80" if CRD(pos).stage == 3 then @@ -162,7 +164,7 @@ local function quarry_task(pos, crd, nvm) nvm.quarry_depth = nvm.quarry_depth or 1 nvm.hole_diameter = nvm.hole_diameter or 5 local y_first = pos.y + nvm.start_level - local y_last = y_first - nvm.quarry_depth + 1 + local y_last = y_first - nvm.quarry_depth local facedir = minetest.get_node(pos).param2 local owner = M(pos):get_string("owner") local fake_player = techage.Fake_player:new() @@ -302,6 +304,13 @@ local function on_receive_fields(pos, formname, fields, player) mem.co = nil CRD(pos).State:stop(pos, nvm) end + elseif CRD(pos).stage == 3 then + if fields.hole_size ~= nvm.hole_size then + nvm.hole_size = fields.hole_size + nvm.hole_diameter = Holesize2Diameter[fields.hole_size or "7x7"] or 7 + mem.co = nil + CRD(pos).State:stop(pos, nvm) + end else nvm.hole_size = "5x5" nvm.hole_diameter = 5