From bce5306abea765fed1fdfeb775ed3abd21ff2863 Mon Sep 17 00:00:00 2001 From: SmallJoker <mk939@ymail.com> Date: Sun, 19 Jun 2022 16:50:20 +0200 Subject: [PATCH] Fix Mining Drill Mk1 not drilling --- technic/tools/prospector.lua | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/technic/tools/prospector.lua b/technic/tools/prospector.lua index d663bd2..b9bd039 100644 --- a/technic/tools/prospector.lua +++ b/technic/tools/prospector.lua @@ -28,9 +28,12 @@ minetest.chat_send_player(user:get_player_name(), "Right-click to set target block type") return end - toolmeta.charge = toolmeta.charge - charge_to_take - toolstack:set_metadata(minetest.serialize(toolmeta)) - technic.set_RE_wear(toolstack, toolmeta.charge, technic.power_tools[toolstack:get_name()]) + if not technic.creative_mode then + toolmeta.charge = toolmeta.charge - charge_to_take + toolstack:set_metadata(minetest.serialize(toolmeta)) + technic.set_RE_wear(toolstack, toolmeta.charge, technic.power_tools[toolstack:get_name()]) + end + -- What in the heaven's name is this evil sorcery ? local start_pos = pointed_thing.under local forward = minetest.facedir_to_dir(minetest.dir_to_facedir(user:get_look_dir(), true)) local right = forward.x ~= 0 and { x=0, y=1, z=0 } or (forward.y ~= 0 and { x=0, y=0, z=1 } or { x=1, y=0, z=0 }) @@ -40,13 +43,36 @@ for f = 0, toolmeta.look_depth-1 do for r = 0, look_diameter-1 do for u = 0, look_diameter-1 do - if minetest.get_node(vector.add(vector.add(vector.add(base_pos, vector.multiply(forward, f)), vector.multiply(right, r)), vector.multiply(up, u))).name == toolmeta.target then found = true end + if minetest.get_node( + vector.add( + vector.add( + vector.add(base_pos, + vector.multiply(forward, f)), + vector.multiply(right, r)), + vector.multiply(up, u)) + ).name == toolmeta.target then + found = true + break + end end + if found then break end end + if found then break end end - if math.random() < 0.02 then found = not found end - minetest.chat_send_player(user:get_player_name(), minetest.registered_nodes[toolmeta.target].description.." is "..(found and "present" or "absent").." in "..look_diameter.."x"..look_diameter.."x"..toolmeta.look_depth.." region") - minetest.sound_play("technic_prospector_"..(found and "hit" or "miss"), { pos = vector.add(user:getpos(), { x = 0, y = 1, z = 0 }), gain = 1.0, max_hear_distance = 10 }) + if math.random() < 0.02 then + found = not found + end + + local ndef = minetest.registered_nodes[toolmeta.target] + minetest.chat_send_player(user:get_player_name(), + ndef.description.." is "..(found and "present" or "absent").. + " in "..look_diameter.."x"..look_diameter.."x"..toolmeta.look_depth.." region") + + minetest.sound_play("technic_prospector_"..(found and "hit" or "miss"), { + pos = vector.add(user:get_pos(), { x = 0, y = 1, z = 0 }), + gain = 1.0, + max_hear_distance = 10 + }) return toolstack end, on_place = function(toolstack, user, pointed_thing) @@ -91,7 +117,7 @@ "label[0,7.5;Accuracy:]".. "label[0,8;98%]") return - end, + end, }) minetest.register_on_player_receive_fields(function(user, formname, fields) @@ -115,12 +141,12 @@ user:set_wielded_item(toolstack) return true end) - + minetest.register_craft({ output = "technic:prospector", recipe = { {"moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1"}, - {"technic:brass_ingot", "technic:control_logic_unit", "technic:brass_ingot"}, + {"basic_materials:brass_ingot", "technic:control_logic_unit", "basic_materials:brass_ingot"}, {"", "technic:blue_energy_crystal", ""}, } }) -- Gitblit v1.8.0