diff --git a/.luacheckrc b/.luacheckrc index 4c933d5c..008e0cd8 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -28,7 +28,8 @@ read_globals = { "unifieddyes", "digiline_remote", "drawers", "mg", "craftguide", "i3", "mtt", - "vizlib", + "vizlib", "mcl_sounds", "mcl_vars", + "mcl_worlds", -- Only used in technic/machines/MV/lighting.lua (disabled) "isprotect", "homedecor_expect_infinite_stacks", diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua index 1ef40bf0..f611d89b 100644 --- a/technic_worldgen/init.lua +++ b/technic_worldgen/init.lua @@ -3,11 +3,21 @@ local modpath = minetest.get_modpath("technic_worldgen") technic = rawget(_G, "technic") or {} +technic.sounds = {} +if minetest.get_modpath("default") then + technic.sounds = default +end +if minetest.get_modpath("mcl_sounds") then + technic.sounds = mcl_sounds +end + dofile(modpath.."/config.lua") dofile(modpath.."/nodes.lua") dofile(modpath.."/oregen.lua") dofile(modpath.."/crafts.lua") -dofile(modpath.."/overrides.lua") +if minetest.get_modpath("default") then + dofile(modpath.."/overrides.lua") +end -- Rubber trees, moretrees also supplies these if not minetest.get_modpath("moretrees") then diff --git a/technic_worldgen/mod.conf b/technic_worldgen/mod.conf index 95685b14..9fc8a211 100644 --- a/technic_worldgen/mod.conf +++ b/technic_worldgen/mod.conf @@ -1,3 +1,3 @@ name = technic_worldgen -depends = default -optional_depends = mg +depends = +optional_depends = default, mcl_core, mcl_sounds, mcl_init, mcl_worlds, mg diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index db0d38bf..36a3fc6b 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -1,12 +1,16 @@ local S = minetest.get_translator("technic_worldgen") +local has_mcl = minetest.get_modpath("mcl_core") + minetest.register_node(":technic:mineral_uranium", { description = S("Uranium Ore"), tiles = {"default_stone.png^technic_mineral_uranium.png"}, is_ground_content = true, - groups = {cracky=3, radioactive=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, radioactive=1, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), drop = "technic:uranium_lump", }) @@ -14,8 +18,10 @@ minetest.register_node(":technic:mineral_chromium", { description = S("Chromium Ore"), tiles = {"default_stone.png^technic_mineral_chromium.png"}, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), drop = "technic:chromium_lump", }) @@ -23,8 +29,10 @@ minetest.register_node(":technic:mineral_zinc", { description = S("Zinc Ore"), tiles = {"default_stone.png^technic_mineral_zinc.png"}, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), drop = "technic:zinc_lump", }) @@ -32,8 +40,10 @@ minetest.register_node(":technic:mineral_lead", { description = S("Lead Ore"), tiles = {"default_stone.png^technic_mineral_lead.png"}, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), drop = "technic:lead_lump", }) @@ -41,112 +51,141 @@ minetest.register_node(":technic:mineral_sulfur", { description = S("Sulfur Ore"), tiles = {"default_stone.png^technic_mineral_sulfur.png"}, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), drop = "technic:sulfur_lump", }) -minetest.register_node(":technic:granite", { - description = S("Granite"), - tiles = {"technic_granite.png"}, - is_ground_content = true, - groups = {cracky=1}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node(":technic:granite_bricks", { - description = S("Granite Bricks"), - tiles = {"technic_granite_bricks.png"}, - is_ground_content = true, - groups = {cracky=1}, - sounds = default.node_sound_stone_defaults(), -}) +if has_mcl then + minetest.register_alias("technic:granite", "mcl_core:granite") + minetest.register_alias("technic:granite_bricks", "mcl_core:granite_smooth") +else + minetest.register_node(":technic:granite", { + description = S("Granite"), + tiles = {"technic_granite.png"}, + is_ground_content = true, + groups = {cracky=1}, + sounds = technic.sounds.node_sound_stone_defaults(), + }) + + minetest.register_node(":technic:granite_bricks", { + description = S("Granite Bricks"), + tiles = {"technic_granite_bricks.png"}, + is_ground_content = true, + groups = {cracky=1}, + sounds = technic.sounds.node_sound_stone_defaults(), + }) +end minetest.register_node(":technic:marble", { description = S("Marble"), tiles = {"technic_marble.png"}, is_ground_content = true, - groups = {cracky=3, marble=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, marble=1, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), }) minetest.register_node(":technic:marble_bricks", { description = S("Marble Bricks"), tiles = {"technic_marble_bricks.png"}, is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), }) minetest.register_node(":technic:uranium_block", { description = S("Uranium Block"), tiles = {"technic_uranium_block.png"}, is_ground_content = true, - groups = {uranium_block=1, cracky=1, level=2, radioactive=2}, - sounds = default.node_sound_stone_defaults() + groups = {uranium_block=1, cracky=1, level=has_mcl and 0 or 2, radioactive=2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:chromium_block", { description = S("Chromium Block"), tiles = {"technic_chromium_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:zinc_block", { description = S("Zinc Block"), tiles = {"technic_zinc_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:lead_block", { description = S("Lead Block"), tiles = {"technic_lead_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:cast_iron_block", { description = S("Cast Iron Block"), tiles = {"technic_cast_iron_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:carbon_steel_block", { description = S("Carbon Steel Block"), tiles = {"technic_carbon_steel_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:stainless_steel_block", { description = S("Stainless Steel Block"), tiles = {"technic_stainless_steel_block.png"}, is_ground_content = true, - groups = {cracky=1, level=2}, - sounds = default.node_sound_stone_defaults() + groups = {cracky=1, level=has_mcl and 0 or 2, pickaxey=4}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:sulfur_block", { description = S("Sulfur Block"), tiles = {"technic_sulfur_block.png"}, is_ground_content = true, - groups = {cracky = 3}, - sounds = default.node_sound_stone_defaults() + groups = {cracky = 3, pickaxey=1, handy=1}, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults() }) minetest.register_node(":technic:blast_resistant_concrete", { description = S("Blast-resistant Concrete Block"), tiles = {"technic_blast_resistant_concrete_block.png"}, - groups = {cracky = 1, level = 3, concrete = 1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = has_mcl and 0 or 3, concrete = 1, pickaxey=5}, + _mcl_hardness = 5, + _mcl_blast_resistance = 9, + sounds = technic.sounds.node_sound_stone_defaults(), on_blast = function(pos, intensity) if intensity > 9 then minetest.remove_node(pos) diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 90f4ba70..3a193642 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -1,3 +1,7 @@ + +local has_mcl = minetest.get_modpath("mcl_core") +local stones = {"default:stone", "mcl_core:stone", "mcl_deepslate:deepslate"} + local uranium_params = { offset = 0, scale = 1, @@ -41,12 +45,12 @@ local lead_threshold = 0.3 minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_uranium", - wherein = "default:stone", + wherein = stones, clust_scarcity = 8*8*8, clust_num_ores = 4, clust_size = 3, - y_min = -300, - y_max = -80, + y_min = has_mcl and mcl_vars.mg_overworld_min or -300, + y_max = has_mcl and mcl_worlds.layer_to_y(80) or -80, noise_params = uranium_params, noise_threshold = uranium_threshold, }) @@ -54,12 +58,12 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_chromium", - wherein = "default:stone", + wherein = stones, clust_scarcity = 8*8*8, clust_num_ores = 2, clust_size = 3, - y_min = -200, - y_max = -100, + y_min = has_mcl and mcl_vars.mg_overworld_min or -200, + y_max = has_mcl and mcl_worlds.layer_to_y(80) or -100, noise_params = chromium_params, noise_threshold = chromium_threshold, }) @@ -67,12 +71,12 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_chromium", - wherein = "default:stone", + wherein = stones, clust_scarcity = 6*6*6, clust_num_ores = 2, clust_size = 3, - y_min = -31000, - y_max = -200, + y_min = has_mcl and mcl_vars.mg_overworld_min or -31000, + y_max = has_mcl and mcl_worlds.layer_to_y(80) or -200, flags = "absheight", noise_params = chromium_params, noise_threshold = chromium_threshold, @@ -81,7 +85,7 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_zinc", - wherein = "default:stone", + wherein = stones, clust_scarcity = 8*8*8, clust_num_ores = 5, clust_size = 7, @@ -94,11 +98,11 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_zinc", - wherein = "default:stone", + wherein = stones, clust_scarcity = 6*6*6, clust_num_ores = 4, clust_size = 3, - y_min = -31000, + y_min = has_mcl and mcl_vars.mg_overworld_min or -31000, y_max = -32, flags = "absheight", noise_params = zinc_params, @@ -108,7 +112,7 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_lead", - wherein = "default:stone", + wherein = stones, clust_scarcity = 9*9*9, clust_num_ores = 5, clust_size = 3, @@ -121,11 +125,11 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_lead", - wherein = "default:stone", + wherein = stones, clust_scarcity = 8*8*8, clust_num_ores = 5, clust_size = 3, - y_min = -128, + y_min = has_mcl and mcl_vars.mg_overworld_min or -128, y_max = -16, noise_params = lead_params, noise_threshold = lead_threshold, @@ -134,12 +138,12 @@ minetest.register_ore({ minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_lead", - wherein = "default:stone", + wherein = stones, clust_scarcity = 6*6*6, clust_num_ores = 5, clust_size = 3, - y_min = -31000, - y_max = -128, + y_min = has_mcl and mcl_vars.mg_overworld_min or -31000, + y_max = has_mcl and mcl_worlds.layer_to_y(80) or -128, flags = "absheight", noise_params = lead_params, noise_threshold = lead_threshold, @@ -156,9 +160,12 @@ minetest.register_on_generated(function(minp, maxp) local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z) sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100) - local c_lava = minetest.get_content_id("default:lava_source") - local c_lava_flowing = minetest.get_content_id("default:lava_flowing") - local c_stone = minetest.get_content_id("default:stone") + local lava = has_mcl and "mcl_core:lava_source" or "default:lava_source" + local lava_flowing = has_mcl and "mcl_core:lava_flowing" or "default:lava_flowing" + local stone = has_mcl and "mcl_core:stone" or "default:stone" + local c_lava = minetest.get_content_id(lava) + local c_lava_flowing = minetest.get_content_id(lava_flowing) + local c_stone = minetest.get_content_id(stone) local c_sulfur = minetest.get_content_id("technic:mineral_sulfur") local grid_size = 5 @@ -189,17 +196,30 @@ minetest.register_on_generated(function(minp, maxp) vm:write_to_map(sulfur_buf) end) +-- in MCL sulfur is generated in the nether +if has_mcl then + minetest.register_ore({ + ore_type = "scatter", + ore = "technic:mineral_sulfur", + wherein = {"mcl_nether:netherrack", "mcl_blackstone:blackstone"}, + clust_scarcity = 830, + clust_num_ores = 5, + clust_size = 3, + y_min = mcl_vars.mg_nether_min, + y_max = mcl_vars.mg_nether_max, + }) +end if technic.config:get_bool("enable_marble_generation") then minetest.register_ore({ ore_type = "sheet", ore = "technic:marble", - wherein = "default:stone", + wherein = stones, clust_scarcity = 1, clust_num_ores = 1, clust_size = 3, - y_min = -31000, - y_max = -50, + y_min = has_mcl and mcl_vars.mg_overworld_min or -31000, + y_max = has_mcl and mcl_worlds.layer_to_y(80) or -50, noise_threshold = 0.4, noise_params = { offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150}, @@ -208,11 +228,11 @@ if technic.config:get_bool("enable_marble_generation") then }) end -if technic.config:get_bool("enable_granite_generation") then +if technic.config:get_bool("enable_granite_generation") and not has_mcl then minetest.register_ore({ ore_type = "sheet", ore = "technic:granite", - wherein = "default:stone", + wherein = stones, clust_scarcity = 1, clust_num_ores = 1, clust_size = 4, diff --git a/technic_worldgen/rubber.lua b/technic_worldgen/rubber.lua index 58adae5a..5917c898 100644 --- a/technic_worldgen/rubber.lua +++ b/technic_worldgen/rubber.lua @@ -2,6 +2,8 @@ local S = minetest.get_translator("technic_worldgen") +local has_mcl = minetest.get_modpath("mcl_core") + minetest.register_node(":moretrees:rubber_tree_sapling", { description = S("Rubber Tree Sapling"), drawtype = "plantlike", @@ -11,7 +13,7 @@ minetest.register_node(":moretrees:rubber_tree_sapling", { paramtype = "light", walkable = false, groups = {dig_immediate=3, flammable=2, sapling=1}, - sounds = default.node_sound_defaults(), + sounds = technic.sounds.node_sound_defaults(), }) minetest.register_craft({ @@ -25,8 +27,10 @@ minetest.register_node(":moretrees:rubber_tree_trunk", { tiles = {"default_tree_top.png", "default_tree_top.png", "technic_rubber_tree_full.png"}, groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, - flammable=2}, - sounds = default.node_sound_wood_defaults(), + flammable=2, axey=1, handy=1}, + _mcl_blast_resistance = 2, + _mcl_hardness = 2, + sounds = technic.sounds.node_sound_wood_defaults(), }) minetest.register_node(":moretrees:rubber_tree_trunk_empty", { @@ -34,28 +38,40 @@ minetest.register_node(":moretrees:rubber_tree_trunk_empty", { tiles = {"default_tree_top.png", "default_tree_top.png", "technic_rubber_tree_empty.png"}, groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, - flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), + flammable=2, not_in_creative_inventory=1, axey=1, handy=1}, + _mcl_blast_resistance = 2, + _mcl_hardness = 2, + sounds = technic.sounds.node_sound_wood_defaults(), }) +local leaves_drop = { + max_items = 1, + items = { + {items = {"moretrees:rubber_tree_sapling"}, rarity = 20}, + {items = {"moretrees:rubber_tree_leaves"}} + } +} + +if has_mcl then + leaves_drop.items = { + {items = {"moretrees:rubber_tree_sapling"}, rarity = 20}, + {items = {"mcl_core:stick 1"}, rarity = 30}, + {items = {"mcl_core:stick 2"}, rarity = 40}, + {items = {"mcl_core:apple"}, rarity = 50} + } +end + minetest.register_node(":moretrees:rubber_tree_leaves", { drawtype = "allfaces_optional", description = S("Rubber Tree Leaves"), tiles = {"technic_rubber_leaves.png"}, paramtype = "light", - groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, - drop = { - max_items = 1, - items = {{ - items = {"moretrees:rubber_tree_sapling"}, - rarity = 20, - }, - { - items = {"moretrees:rubber_tree_leaves"}, - } - } - }, - sounds = default.node_sound_leaves_defaults(), + groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, swordy=1, handy=1}, + _mcl_blast_resistance = 0.2, + _mcl_hardness = 0.2, + _mcl_silk_touch_drop = true, + drop = leaves_drop, + sounds = technic.sounds.node_sound_leaves_defaults(), }) technic.rubber_tree_model={ @@ -92,7 +108,7 @@ if technic.config:get_bool("enable_rubber_tree_generation") then y = (maxp.y - minp.y) / 2 + minp.y, z = (maxp.z - minp.z) / 2 + minp.z} local pos = minetest.find_node_near(tmp, maxp.x - minp.x, - {"default:dirt_with_grass"}) + {has_mcl and "mcl_core:dirt_with_grass" or "default:dirt_with_grass"}) if pos ~= nil then minetest.spawn_tree({x=pos.x, y=pos.y+1, z=pos.z}, technic.rubber_tree_model) end