Made ores breakable

This commit is contained in:
James David Clarke 2023-12-21 08:46:39 +00:00
parent c5e2bd5043
commit b056de8d6d
No known key found for this signature in database
GPG Key ID: 9F5ECFD0E20F1C4C
2 changed files with 45 additions and 12 deletions

View File

@ -59,18 +59,18 @@ if minetest.get_modpath("mcl_core") then
-- Example adjustments for MineClone2 -- Example adjustments for MineClone2
moreores.tin_max_depth_high = 0 moreores.tin_max_depth_high = 0
moreores.tin_min_depth_high = -10 moreores.tin_min_depth_high = -10
moreores.tin_max_depth = -11 moreores.tin_max_depth = 0
moreores.tin_min_depth = -57 moreores.tin_min_depth = -57
-- Similar adjustments for silver and mithril -- Similar adjustments for silver and mithril
moreores.silver_max_depth_high = 0 moreores.silver_max_depth_high = 0
moreores.silver_min_depth_high = -10 moreores.silver_min_depth_high = -10
moreores.silver_max_depth = -11 moreores.silver_max_depth = 0
moreores.silver_min_depth = -57 moreores.silver_min_depth = -57
moreores.mithril_max_depth_high = 0 moreores.mithril_max_depth_high = 0
moreores.mithril_min_depth_high = -20 moreores.mithril_min_depth_high = -20
moreores.mithril_max_depth = -21 moreores.mithril_max_depth = 0
moreores.mithril_min_depth = -57 moreores.mithril_min_depth = -57
else else
-- Maximal and minimal depths of ore generation (Y coordinate, 0 being sea level by default) -- Maximal and minimal depths of ore generation (Y coordinate, 0 being sea level by default)

View File

@ -92,7 +92,7 @@ local function get_recipe(material, item)
end end
end end
local function add_ore(modname, description, mineral_name, oredef) local function add_ore(modname, description, mineral_name, oredef, extra_node_def)
if mineral_name == "copper" and is_mcl_copper_present then if mineral_name == "copper" and is_mcl_copper_present then
return return
@ -106,14 +106,26 @@ local function add_ore(modname, description, mineral_name, oredef)
local ingot = item_base .. "_ingot" local ingot = item_base .. "_ingot"
local lump_item = item_base .. "_lump" local lump_item = item_base .. "_lump"
local function merge_tables(t1, t2)
if t2 then
for k,v in pairs(t2) do t1[k] = v end
end
return t1
end
if oredef.makes.ore then if oredef.makes.ore then
minetest.register_node(modname .. ":mineral_" .. mineral_name, { local node_def_tbl = {
description = S("@1 Ore", S(description)), description = S("@1 Ore", S(description)),
tiles = {"default_stone.png^" .. modname .. "_mineral_" .. mineral_name .. ".png"}, tiles = {"default_stone.png^" .. modname .. "_mineral_" .. mineral_name .. ".png"},
groups = {cracky = 2}, groups = {cracky = 2},
sounds = default_stone_sounds, sounds = default_stone_sounds,
drop = lump_item, drop = lump_item,
}) }
if extra_node_def then
node_def_tbl = merge_tables(node_def_tbl, extra_node_def)
end
minetest.register_node(modname .. ":mineral_" .. mineral_name, node_def_tbl)
if use_frame then if use_frame then
frame.register(modname .. ":mineral_" .. mineral_name) frame.register(modname .. ":mineral_" .. mineral_name)
@ -339,6 +351,13 @@ local oredefs = {
}, },
}, },
full_punch_interval = 1.0, full_punch_interval = 1.0,
extra_node_def = {
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
_mcl_hardness = 4,
_mcl_silk_touch_drop = true,
groups = {pickaxey = 4}
}
}, },
mithril = { mithril = {
description = "Mithril", description = "Mithril",
@ -397,6 +416,13 @@ local oredefs = {
}, },
}, },
full_punch_interval = 0.45, full_punch_interval = 0.45,
extra_node_def = {
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
_mcl_hardness = 5,
_mcl_silk_touch_drop = true,
groups = {pickaxey = 5}
},
} }
} }
@ -439,6 +465,13 @@ else
y_max = moreores.tin_max_depth_deep, y_max = moreores.tin_max_depth_deep,
}, },
tools = {}, tools = {},
extra_node_def = {
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
_mcl_silk_touch_drop = true,
groups = {pickaxey = 3}
},
} }
-- Bronze has some special cases, because it is made from copper and tin -- Bronze has some special cases, because it is made from copper and tin
@ -480,5 +513,5 @@ minetest.register_craft({
for orename, def in pairs(oredefs) do for orename, def in pairs(oredefs) do
-- Register everything -- Register everything
add_ore("moreores", def.description, orename, def) add_ore("moreores", def.description, orename, def, def.extra_node_def)
end end