2024-06-17 14:32:51 -06:00

62 lines
2.1 KiB
Lua

PyuTestCore.make_ore = function (id, desc, ifix, idfix, btxt, itxt, color, y_max, scarcity, count, btype)
local oid = "pyutest_core:"..id.."_ore"
local iid = "pyutest_core:"..id.."_"..ifix
local block_type = btype ~= nil and btype or PyuTestCore.BLOCK_BREAKABLE_MIDDLE
minetest.register_node(oid, {
description = Translate(desc .. " Ore"),
groups = {block = block_type},
tiles = {btxt},
drop = iid .. " " .. tostring(count or 1),
sounds = PyuTestCore.make_node_sounds(),
light_source = 3.9, -- Make ores emit little light
})
minetest.register_craftitem(iid, {
description = Translate(desc .. " " .. idfix),
inventory_image = itxt,
wield_image = itxt,
color = color
})
minetest.register_ore({
ore_type = "scatter",
ore = oid,
wherein = "pyutest_core:stone_block",
clust_scarcity = scarcity * scarcity * scarcity, -- I spent 1 hour debugging this just because I mispelled scarcity as scarity :sob:
clust_num_ores = 5,
clust_size = 3,
y_max = y_max,
y_min = PyuTestCore_WorldBottom,
biomes = PyuTestCore.BIOMES,
})
PyuTestCore.make_building_blocks(id, desc, {"metal.png"}, color, {
block = block_type
})
local bid = "pyutest_core:"..id.."_block"
minetest.register_craft({
output = bid,
recipe = {
{iid, iid},
{iid, iid}
}
})
minetest.register_craft({
output = iid .. " 4",
recipe = {
bid
},
type = "shapeless"
})
end
PyuTestCore.make_ore("coal", "Coal", "lump", "Lump", "ore-coal.png", "lump.png", {r = 32, g = 32, b = 32}, 48, 8, 5)
PyuTestCore.make_ore("iron", "Iron", "ingot", "Ingot", "ore-iron.png", "ingot.png", nil, 21, 12, 4)
PyuTestCore.make_ore("gold", "Gold", "ingot", "Ingot", "ore-gold.png", "ingot.png", "gold", -50, 14.5, 3, PyuTestCore.BLOCK_BREAKABLE_LONG)
PyuTestCore.make_ore("diamond", "Diamond", "shard", "Shard", "ore-diamond.png", "shard.png", "cyan", -60, 15.7, 3, PyuTestCore.BLOCK_BREAKABLE_LONG)
PyuTestCore.make_ore("emerald", "Emerald", "shard", "Shard", "ore-emerald.png", "shard.png", "seagreen", -110, 17.3, 1, PyuTestCore.BLOCK_BREAKABLE_LONG)