From dd8e8e755c52ab4f29ad438f39264c15adcfe004 Mon Sep 17 00:00:00 2001 From: Gael-de-Sailly Date: Fri, 28 Aug 2015 13:44:23 +0200 Subject: [PATCH] Reorganized ores code --- minetestforfun_game/mods/default/mapgen.lua | 136 +++++++++++--------- mods/moreores/_config.txt | 35 ----- mods/moreores/init.lua | 28 +--- mods/moreores/ores.lua | 34 +++++ 4 files changed, 108 insertions(+), 125 deletions(-) delete mode 100755 mods/moreores/_config.txt create mode 100644 mods/moreores/ores.lua diff --git a/minetestforfun_game/mods/default/mapgen.lua b/minetestforfun_game/mods/default/mapgen.lua index c5314583..49f8d96d 100755 --- a/minetestforfun_game/mods/default/mapgen.lua +++ b/minetestforfun_game/mods/default/mapgen.lua @@ -171,6 +171,17 @@ function default.register_ores() flags = "absheight", }) + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 32 * 32 * 32, + clust_num_ores = 40, + clust_size = 4, + y_max = 64, + y_min = -30000, + }) + -- Iron minetest.register_ore({ @@ -219,7 +230,18 @@ function default.register_ores() flags = "absheight", }) - --Mese + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 48 * 48 * 48, + clust_num_ores = 40, + clust_size = 4, + y_max = 64, + y_min = -30000, + }) + + -- Mese minetest.register_ore({ ore_type = "scatter", @@ -269,18 +291,6 @@ function default.register_ores() flags = "absheight", }) - minetest.register_ore({ - ore_type = "scatter", - ore = "default:meze", - wherein = "default:stone", - clust_scarcity = 40 * 40 * 40, - clust_num_ores = 3, - clust_size = 2, - y_min = 0, - y_max = 64, - flags = "absheight", - }) - minetest.register_ore({ ore_type = "scatter", ore = "default:mese", @@ -293,6 +303,20 @@ function default.register_ores() flags = "absheight", }) + -- Beware of Meze + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:meze", + wherein = "default:stone", + clust_scarcity = 40 * 40 * 40, + clust_num_ores = 3, + clust_size = 2, + y_min = 0, + y_max = 64, + flags = "absheight", + }) + minetest.register_ore({ ore_type = "scatter", ore = "default:meze", @@ -305,39 +329,6 @@ function default.register_ores() flags = "absheight", }) - minetest.register_ore({ - ore_type = "scatter", - ore = "maptools:superapple", - wherein = "default:apple", - clust_scarcity = 6 * 6 * 6, - clust_num_ores = 5, - clust_size = 2, - y_min = 0, - y_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "maptools:superapple", - wherein = "default:jungleleaves", - clust_scarcity = 16 * 16 * 16, - clust_num_ores = 5, - clust_size = 2, - y_min = 0, - y_max = 64, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_coin", - wherein = "default:stone", - clust_scarcity = 26 * 26 * 26, - clust_num_ores = 1, - clust_size = 1, - y_min = -30000, - y_max = 0, - flags = "absheight", - }) -- Gold @@ -391,6 +382,17 @@ function default.register_ores() flags = "absheight", }) + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 30 * 30 * 30, + clust_num_ores = 64, + clust_size = 5, + y_max = -1024, + y_min = -30000, + }) + -- Copper minetest.register_ore({ @@ -427,36 +429,42 @@ function default.register_ores() flags = "absheight", }) + -- Gold Coins + minetest.register_ore({ ore_type = "scatter", - ore = "default:stone_with_coal", + ore = "default:stone_with_coin", wherein = "default:stone", - clust_scarcity = 32 * 32 * 32, - clust_num_ores = 40, - clust_size = 4, - y_max = 64, + clust_scarcity = 26 * 26 * 26, + clust_num_ores = 1, + clust_size = 1, y_min = -30000, + y_max = 0, + flags = "absheight", }) + + -- Super Apples + minetest.register_ore({ ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 48 * 48 * 48, - clust_num_ores = 40, - clust_size = 4, + ore = "maptools:superapple", + wherein = "default:apple", + clust_scarcity = 6 * 6 * 6, + clust_num_ores = 5, + clust_size = 2, + y_min = 0, y_max = 64, - y_min = -30000, }) minetest.register_ore({ ore_type = "scatter", - ore = "default:stone_with_diamond", - wherein = "default:stone", - clust_scarcity = 30 * 30 * 30, - clust_num_ores = 64, - clust_size = 5, - y_max = -1024, - y_min = -30000, + ore = "maptools:superapple", + wherein = "default:jungleleaves", + clust_scarcity = 16 * 16 * 16, + clust_num_ores = 5, + clust_size = 2, + y_min = 0, + y_max = 64, }) if minetest.setting_get("mg_name") == "indev" then diff --git a/mods/moreores/_config.txt b/mods/moreores/_config.txt deleted file mode 100755 index f2eeed34..00000000 --- a/mods/moreores/_config.txt +++ /dev/null @@ -1,35 +0,0 @@ ------------------------------------------------------------------------------- ------------------------------- CONFIGURATION --------------------------------- ------------------------------------------------------------------------------- - ------------------------------------------------------------------------------- --------- Change settings by changing the values after the "=". --------------- ------------------------------------------------------------------------------- - --- Chunk sizes for ore generation (bigger = ore deposits are more scattered around) -moreores_copper_chunk_size = 8 -moreores_tin_chunk_size = 7 -moreores_silver_chunk_size = 11 -moreores_gold_chunk_size = 14 -moreores_mithril_chunk_size = 11 - --- Amount of ore per chunk (higher = bigger ore deposits) -moreores_copper_ore_per_chunk = 6 -moreores_tin_ore_per_chunk = 3 -moreores_silver_ore_per_chunk = 4 -moreores_gold_ore_per_chunk = 4 -moreores_mithril_ore_per_chunk = 1 - --- Minimal depths of ore generation (Y coordinate, 0 being sea level by default) -moreores_copper_min_depth = -31000 -moreores_tin_min_depth = -31000 -moreores_silver_min_depth = -31000 -moreores_gold_min_depth = -31000 -moreores_mithril_min_depth = -31000 - --- Maximal depths of ore generation (Y coordinate, 0 being sea level by default) -moreores_copper_max_depth = 64 -moreores_tin_max_depth = 12 -moreores_silver_max_depth = -12 -moreores_gold_max_depth = -128 -moreores_mithril_max_depth = -1024 diff --git a/mods/moreores/init.lua b/mods/moreores/init.lua index 40a4e15a..13777c28 100755 --- a/mods/moreores/init.lua +++ b/mods/moreores/init.lua @@ -17,8 +17,6 @@ end local modpath = minetest.get_modpath("moreores") -dofile(modpath .. "/_config.txt") - -- `mg` support: if minetest.get_modpath("mg") then dofile(modpath .. "/mg.lua") @@ -165,12 +163,6 @@ local function add_ore(modname, description, mineral_name, oredef) }) end - oredef.oredef.ore_type = "scatter" - oredef.oredef.ore = modname .. ":mineral_" .. mineral_name - oredef.oredef.wherein = "default:stone" - - minetest.register_ore(oredef.oredef) - for tool_name, tooldef in pairs(oredef.tools) do local tdef = { description = "", @@ -232,12 +224,6 @@ local oredefs = { silver = { description = "Silver", makes = {ore = true, block = true, lump = true, ingot = true, chest = true}, - oredef = {clust_scarcity = moreores_silver_chunk_size * moreores_silver_chunk_size * moreores_silver_chunk_size, - clust_num_ores = moreores_silver_ore_per_chunk, - clust_size = moreores_silver_chunk_size, - height_min = moreores_silver_min_depth, - height_max = moreores_silver_max_depth - }, tools = { pick = { groupcaps = { @@ -278,23 +264,11 @@ local oredefs = { tin = { description = "Tin", makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, - oredef = {clust_scarcity = moreores_tin_chunk_size * moreores_tin_chunk_size * moreores_tin_chunk_size, - clust_num_ores = moreores_tin_ore_per_chunk, - clust_size = moreores_tin_chunk_size, - height_min = moreores_tin_min_depth, - height_max = moreores_tin_max_depth - }, tools = {} }, mithril = { description = "Mithril", makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, - oredef = {clust_scarcity = moreores_mithril_chunk_size * moreores_mithril_chunk_size * moreores_mithril_chunk_size, - clust_num_ores = moreores_mithril_ore_per_chunk, - clust_size = moreores_mithril_chunk_size, - height_min = moreores_mithril_min_depth, - height_max = moreores_mithril_max_depth - }, tools = { pick = { groupcaps = { @@ -338,6 +312,8 @@ for orename,def in pairs(oredefs) do add_ore(modname, def.description, orename, def) end +dofile(modpath .. "/ores.lua") + --[[ -- Copper rail (special node): minetest.register_craft({ diff --git a/mods/moreores/ores.lua b/mods/moreores/ores.lua new file mode 100644 index 00000000..a2fe443f --- /dev/null +++ b/mods/moreores/ores.lua @@ -0,0 +1,34 @@ +-- Register ores + +minetest.register_ore({ + ore_type = "scatter", + ore = "moreores:mineral_silver", + wherein = "default:stone", + clust_scarcity = 11 * 11 * 11, + clust_num_ores = 4, + clust_size = 11, + y_min = -31000, + y_max = -12, +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "moreores:mineral_tin", + wherein = "default:stone", + clust_scarcity = 7 * 7 * 7, + clust_num_ores = 3, + clust_size = 7, + y_min = -31000, + y_max = 12, +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "moreores:mineral_mithril", + wherein = "default:stone", + clust_scarcity = 11 * 11 * 11, + clust_num_ores = 1, + clust_size = 1, + y_min = -31000, + y_max = -1024, +})