mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-03-11 06:07:44 +01:00
Fix indestructable blocks provided by mods
This commit is contained in:
parent
64b92a5b0b
commit
d7995d81bb
2 changed files with 38 additions and 1 deletions
|
@ -309,6 +309,31 @@ function mcl_autogroup.get_wear(toolname, diggroup)
|
||||||
return math.ceil(65535 / uses)
|
return math.ceil(65535 / uses)
|
||||||
end
|
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 function overwrite()
|
||||||
-- Refresh, now that all groups are known.
|
-- Refresh, now that all groups are known.
|
||||||
hardness_values = get_hardness_values_for_groups()
|
hardness_values = get_hardness_values_for_groups()
|
||||||
|
@ -317,8 +342,19 @@ local function overwrite()
|
||||||
-- hardness_value. Used for quick lookup.
|
-- hardness_value. Used for quick lookup.
|
||||||
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
|
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
|
||||||
|
|
||||||
|
local count = 0
|
||||||
for nname, ndef in pairs(minetest.registered_nodes) do
|
for nname, ndef in pairs(minetest.registered_nodes) do
|
||||||
|
count = count + 1
|
||||||
local newgroups = table.copy(ndef.groups)
|
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
|
if (nname ~= "ignore" and ndef.diggable) then
|
||||||
-- Automatically assign the "solid" group for solid nodes
|
-- Automatically assign the "solid" group for solid nodes
|
||||||
if (ndef.walkable == nil or ndef.walkable == true)
|
if (ndef.walkable == nil or ndef.walkable == true)
|
||||||
|
@ -363,6 +399,7 @@ local function overwrite()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
minetest.log("verbose","Total registered blocks: "..tostring(count))
|
||||||
|
|
||||||
for tname, tdef in pairs(minetest.registered_items) do
|
for tname, tdef in pairs(minetest.registered_items) do
|
||||||
-- Assign groupcaps for digging the registered digging groups
|
-- Assign groupcaps for digging the registered digging groups
|
||||||
|
|
|
@ -744,7 +744,7 @@ minetest.register_node("mcl_core:bedrock", {
|
||||||
S("In the End dimension, starting a fire on this block will create an eternal fire."),
|
S("In the End dimension, starting a fire on this block will create an eternal fire."),
|
||||||
tiles = {"mcl_core_bedrock.png"},
|
tiles = {"mcl_core_bedrock.png"},
|
||||||
stack_max = 64,
|
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(),
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
|
|
Loading…
Reference in a new issue