From 5fcf726b1a2698d1676de6f0a9ac34681628c06c Mon Sep 17 00:00:00 2001 From: Freeman Date: Tue, 24 Oct 2023 19:47:25 +0200 Subject: [PATCH 1/2] underch mod marble compatibility underch is a popular cave improvement mod that adds marble and marble bricks (same as technic) but also stairs, slabs, marble cobble, mossy marble cobble, etc. I have seen some servers where both mods are used and I thought it would be good to add this little compatibility --- technic_worldgen/crafts.lua | 17 ++++++++------- technic_worldgen/mod.conf | 2 +- technic_worldgen/nodes.lua | 42 +++++++++++++++++++++---------------- technic_worldgen/oregen.lua | 3 ++- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index 9482deba..b42e30db 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -1,5 +1,6 @@ local S = minetest.get_translator("technic_worldgen") +local has_underch = minetest.get_modpath("underch") minetest.register_craftitem(":technic:uranium_lump", { description = S("Uranium Lump"), @@ -136,13 +137,15 @@ minetest.register_craft({ output = "technic:wrought_iron_ingot", }) -minetest.register_craft({ - output = "technic:marble_bricks 4", - recipe = { - {"technic:marble","technic:marble"}, - {"technic:marble","technic:marble"} - } -}) +if not has_underch then + minetest.register_craft({ + output = "technic:marble_bricks 4", + recipe = { + {"technic:marble","technic:marble"}, + {"technic:marble","technic:marble"} + } + }) +end minetest.register_craft({ output = "technic:granite_bricks 4", diff --git a/technic_worldgen/mod.conf b/technic_worldgen/mod.conf index 9fc8a211..93ced82d 100644 --- a/technic_worldgen/mod.conf +++ b/technic_worldgen/mod.conf @@ -1,3 +1,3 @@ name = technic_worldgen depends = -optional_depends = default, mcl_core, mcl_sounds, mcl_init, mcl_worlds, mg +optional_depends = default, mcl_core, mcl_sounds, mcl_init, mcl_worlds, mg, underch diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index 36a3fc6b..3f156b8a 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -2,6 +2,7 @@ local S = minetest.get_translator("technic_worldgen") local has_mcl = minetest.get_modpath("mcl_core") +local has_underch = minetest.get_modpath("underch") minetest.register_node(":technic:mineral_uranium", { description = S("Uranium Ore"), @@ -79,25 +80,30 @@ else }) end -minetest.register_node(":technic:marble", { - description = S("Marble"), - tiles = {"technic_marble.png"}, - is_ground_content = true, - groups = {cracky=3, marble=1, pickaxey=1}, - _mcl_hardness = 0.8, - _mcl_blast_resistance = 1, - sounds = technic.sounds.node_sound_stone_defaults(), -}) +if has_underch then + minetest.register_alias("technic:marble", "underch:marble") + minetest.register_alias("technic:marble_bricks", "underch:marble_brick") +else + minetest.register_node(":technic:marble", { + description = S("Marble"), + tiles = {"technic_marble.png"}, + is_ground_content = true, + 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, 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, pickaxey=1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = technic.sounds.node_sound_stone_defaults(), + }) +end minetest.register_node(":technic:uranium_block", { description = S("Uranium Block"), diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 3a193642..d1b261bc 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -1,5 +1,6 @@ local has_mcl = minetest.get_modpath("mcl_core") +local has_underch = minetest.get_modpath("underch") local stones = {"default:stone", "mcl_core:stone", "mcl_deepslate:deepslate"} local uranium_params = { @@ -210,7 +211,7 @@ if has_mcl then }) end -if technic.config:get_bool("enable_marble_generation") then +if technic.config:get_bool("enable_marble_generation") and not has_underch then minetest.register_ore({ ore_type = "sheet", ore = "technic:marble", From 3750765d48dfe5ad4dec67ec278a76d63073a252 Mon Sep 17 00:00:00 2001 From: Freeman Date: Thu, 26 Oct 2023 12:38:23 +0200 Subject: [PATCH 2/2] remove has_underch variables because are only used once in each file --- technic_worldgen/crafts.lua | 3 +-- technic_worldgen/nodes.lua | 3 +-- technic_worldgen/oregen.lua | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index b42e30db..3453111b 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -1,6 +1,5 @@ local S = minetest.get_translator("technic_worldgen") -local has_underch = minetest.get_modpath("underch") minetest.register_craftitem(":technic:uranium_lump", { description = S("Uranium Lump"), @@ -137,7 +136,7 @@ minetest.register_craft({ output = "technic:wrought_iron_ingot", }) -if not has_underch then +if not minetest.get_modpath("underch") then minetest.register_craft({ output = "technic:marble_bricks 4", recipe = { diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index 3f156b8a..6cecebbf 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -2,7 +2,6 @@ local S = minetest.get_translator("technic_worldgen") local has_mcl = minetest.get_modpath("mcl_core") -local has_underch = minetest.get_modpath("underch") minetest.register_node(":technic:mineral_uranium", { description = S("Uranium Ore"), @@ -80,7 +79,7 @@ else }) end -if has_underch then +if minetest.get_modpath("underch") then minetest.register_alias("technic:marble", "underch:marble") minetest.register_alias("technic:marble_bricks", "underch:marble_brick") else diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index d1b261bc..2f78ba30 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -1,6 +1,5 @@ local has_mcl = minetest.get_modpath("mcl_core") -local has_underch = minetest.get_modpath("underch") local stones = {"default:stone", "mcl_core:stone", "mcl_deepslate:deepslate"} local uranium_params = { @@ -211,7 +210,8 @@ if has_mcl then }) end -if technic.config:get_bool("enable_marble_generation") and not has_underch then +if technic.config:get_bool("enable_marble_generation") + and not minetest.get_modpath("underch") then minetest.register_ore({ ore_type = "sheet", ore = "technic:marble",