Fix indestructable blocks provided by mods

This commit is contained in:
teknomunk 2024-05-07 10:34:31 +00:00
parent 65d6cb1d83
commit d68787ea04
2 changed files with 38 additions and 1 deletions

View File

@ -312,9 +312,45 @@ function mcl_autogroup.get_wear(toolname, diggroup)
return math.ceil(65535 / uses)
end
local GROUP_MAP = {
["choppy"] = "axey",
["oddly_breakable_by_hand"] = "handy",
["cracky"] = "pickaxey",
["crumbly"] = "shovely",
}
function mcl_autogroup.mod_compatibility(groups, ndef)
local grouped = false
for name,_ in pairs(groups) do
local new_group = GROUP_MAP[name]
if new_group then
groups[new_group] = 1
ndef.groups[new_group] = 1
end
if mcl_autogroup.registered_diggroups[name] then
grouped = true
end
end
if not grouped then
groups.handy = 1
end
end
local function overwrite()
local count = 0
for nname, ndef in pairs(minetest.registered_nodes) do
count = count + 1
local newgroups = table.copy(ndef.groups)
if not newgroups.indestructable then
ndef.diggable = true
mcl_autogroup.mod_compatibility(newgroups, ndef)
if not ndef._mcl_hardness then
ndef._mcl_hardness = 0
end
end
if (nname ~= "ignore" and ndef.diggable) then
-- Automatically assign the "solid" group for solid nodes
if (ndef.walkable == nil or ndef.walkable == true)
@ -359,6 +395,7 @@ local function overwrite()
})
end
end
minetest.log("verbose","Total registered blocks: "..tostring(count))
for tname, tdef in pairs(minetest.registered_items) do
-- Assign groupcaps for digging the registered digging groups

View File

@ -728,7 +728,7 @@ minetest.register_node("mcl_core:bedrock", {
S("In the End dimension, starting a fire on this block will create an eternal fire."),
tiles = {"mcl_core_bedrock.png"},
stack_max = 64,
groups = {creative_breakable=1, building_block=1, material_stone=1},
groups = {creative_breakable=1, building_block=1, material_stone=1, indestructable=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
is_ground_content = false,
on_blast = function() end,