From d176ce79a6a81f6bd6a0ca71f6259f6f5b59d26c Mon Sep 17 00:00:00 2001 From: Freeman Date: Wed, 8 Nov 2023 21:28:30 +0100 Subject: [PATCH] Corium check _mcl_hardness if node has _mcl_hardness param and _mcl_hardness > 0 then corium eats that node --- technic/radiation.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/technic/radiation.lua b/technic/radiation.lua index 27807d54..3f181ac7 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -32,6 +32,7 @@ local MP = minetest.get_modpath("technic") local throttle = dofile(MP .. "/util/throttle.lua") local S = technic.getter +local has_mcl = minetest.get_modpath("mcl_core") local rad_resistance_node = { ["default:brick"] = 13, @@ -503,8 +504,6 @@ if minetest.get_modpath("mcl_buckets") then }) end -local has_mcl = minetest.get_modpath("mcl_core") - minetest.register_node("technic:chernobylite_block", { description = S("Chernobylite Block"), tiles = {"technic_chernobylite_block.png"}, @@ -562,8 +561,17 @@ if griefing then vector.new(0,0,-1), vector.new(0,-1,0), }) do - if math.random(8) == 1 then - minetest.dig_node(vector.add(pos, offset)) + local vpos = vector.add(pos, offset) + local vnode = minetest.get_node(vpos) + local can_dig = true + if vnode and vnode.name and minetest.registered_nodes[vnode.name] then + local hardness = minetest.registered_nodes[vnode.name]._mcl_hardness + if hardness and type(hardness) == "number" then + can_dig = hardness > 0 + end + end + if math.random(8) == 1 and can_dig then + minetest.dig_node(vpos) end end end,