include tin, oredef.mineral/ block in register_node and tnt resistance for mithril

This commit is contained in:
Dirkfried 2021-12-30 14:22:15 +01:00
parent 293267f4c5
commit 6ac32ee677
1 changed files with 41 additions and 23 deletions

View File

@ -83,28 +83,43 @@ 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"
if oredef.makes.ore then if oredef.mineral then
minetest.register_node(modname .. ":mineral_" .. mineral_name, { if oredef.mineral.description == nil then
description = S("@1 Ore", S(description)), oredef.mineral.description = S("@1 Ore", S(description))
tiles = {"default_stone.png^" .. modname .. "_mineral_" .. mineral_name .. ".png"}, end
groups = oredef.mineral.groups, if oredef.mineral.tiles == nil then
sounds = default_stone_sounds, oredef.mineral.tiles = {"default_stone.png^" .. modname .. "_mineral_" .. mineral_name .. ".png"}
drop = lump_item, end
}) if oredef.mineral.groups == nil then
oredef.mineral.groups = {cracky = 2}
end
if oredef.mineral.sounds == nil then
oredef.mineral.sounds = default_stone_sounds
end
if oredef.mineral.drop == nil then
oredef.mineral.drop = lump_item
end
minetest.register_node(modname .. ":mineral_" .. mineral_name, oredef.mineral)
if use_frame then if use_frame then
frame.register(modname .. ":mineral_" .. mineral_name) frame.register(modname .. ":mineral_" .. mineral_name)
end end
end end
if oredef.makes.block then if oredef.block then
local block_item = item_base .. "_block" local block_item = item_base .. "_block"
minetest.register_node(block_item, { if oredef.block.description == nil then
description = S("@1 Block", S(description)), oredef.block.description = S("@1 Block", S(description))
tiles = {img_base .. "_block.png"}, end
groups = oredef.block.groups, -- {snappy = 1, bendy = 2, cracky = 1, melty = 2, level = 2}, if oredef.block.tiles == nil then
sounds = default_metal_sounds, oredef.block.tiles = {img_base .. "_block.png"}
}) end
if oredef.block.groups == nil then
oredef.block.groups = {cracky = 1, level = 2}
end
if oredef.block.sounds == nil then
oredef.block.sounds = default_metal_sounds
end
minetest.register_node(block_item, oredef.block)
minetest.register_alias(mineral_name.."_block", block_item) minetest.register_alias(mineral_name.."_block", block_item)
if oredef.makes.ingot then if oredef.makes.ingot then
minetest.register_craft( { minetest.register_craft( {
@ -134,7 +149,7 @@ local function add_ore(modname, description, mineral_name, oredef)
type = "cooking", type = "cooking",
output = ingot, output = ingot,
recipe = lump_item, recipe = lump_item,
cooktime = oredef.lump.cooktime, cooktime = oredef.craftingot.cooktime,
}) })
end end
if use_frame then if use_frame then
@ -244,7 +259,7 @@ end
local oredefs = { local oredefs = {
silver = { silver = {
description = "Silver", description = "Silver",
makes = {ore = true, block = true, lump = true, ingot = true, chest = true}, makes = {lump = true, ingot = true, chest = true},
oredef = { oredef = {
clust_scarcity = moreores.silver_chunk_size ^ 3, clust_scarcity = moreores.silver_chunk_size ^ 3,
clust_num_ores = moreores.silver_ore_per_chunk, clust_num_ores = moreores.silver_ore_per_chunk,
@ -254,7 +269,7 @@ local oredefs = {
}, },
mineral = {groups = {cracky = 2}}, mineral = {groups = {cracky = 2}},
block = {groups = {cracky = 1, level = 2}}, block = {groups = {cracky = 1, level = 2}},
lump = {cooktime = 2}, craftingot = {cooktime = 2},
tools = { tools = {
pick = { pick = {
groupcaps = { groupcaps = {
@ -291,7 +306,7 @@ local oredefs = {
}, },
mithril = { mithril = {
description = "Mithril", description = "Mithril",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {lump = true, ingot = true, chest = false},
oredef = { oredef = {
clust_scarcity = moreores.mithril_chunk_size ^ 3, clust_scarcity = moreores.mithril_chunk_size ^ 3,
clust_num_ores = moreores.mithril_ore_per_chunk, clust_num_ores = moreores.mithril_ore_per_chunk,
@ -300,8 +315,8 @@ local oredefs = {
y_max = moreores.mithril_max_depth, y_max = moreores.mithril_max_depth,
}, },
mineral = {groups = {cracky = 1}}, mineral = {groups = {cracky = 1}},
block = {groups = {cracky = 0, level = 4}}, block = {groups = {cracky = 0, level = 4}, on_blast = function() end},
lump = {cooktime = 10}, craftingot = {cooktime = 10},
tools = { tools = {
pick = { pick = {
groupcaps = { groupcaps = {
@ -354,7 +369,7 @@ if default_tin then
else else
oredefs.tin = { oredefs.tin = {
description = "Tin", description = "Tin",
makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, makes = {lump = true, ingot = true, chest = false},
oredef = { oredef = {
clust_scarcity = moreores.tin_chunk_size ^ 3, clust_scarcity = moreores.tin_chunk_size ^ 3,
clust_num_ores = moreores.tin_ore_per_chunk, clust_num_ores = moreores.tin_ore_per_chunk,
@ -362,6 +377,9 @@ else
y_min = moreores.tin_min_depth, y_min = moreores.tin_min_depth,
y_max = moreores.tin_max_depth, y_max = moreores.tin_max_depth,
}, },
mineral = {groups = {cracky = 2}},
block = {groups = {cracky = 1, level = 2}},
craftingot = {cooktime = 3},
tools = {}, tools = {},
} }