diff --git a/df_dependencies/helper_functions.lua b/df_dependencies/helper_functions.lua index a350961..0e752fb 100644 --- a/df_dependencies/helper_functions.lua +++ b/df_dependencies/helper_functions.lua @@ -3,8 +3,12 @@ local S = minetest.get_translator(minetest.get_current_modname()) if minetest.get_modpath("default") then df_dependencies.register_leafdecay = default.register_leafdecay df_dependencies.after_place_leaves = default.after_place_leaves -else - --TODO +elseif ("mcl_core") then + -- Mineclone does leaf decay differently, it uses the "leafdecay" group to require that leaves remain + -- within the group value distance of any node of group "tree". + -- make sure to add place_param2 = 1 to leaves to prevent decay of player-placed leaves + df_dependencies.register_leafdecay = function() end + df_dependencies.after_place_leaves = function() end end diff --git a/df_dependencies/init.lua b/df_dependencies/init.lua index 7948d10..3041261 100644 --- a/df_dependencies/init.lua +++ b/df_dependencies/init.lua @@ -22,11 +22,14 @@ df_dependencies.select_required = function(def) end df_dependencies.select_optional = function(def) + local ret for mod, item in pairs(def) do + df_dependencies.mods_required[mod] = true if minetest.get_modpath(mod) then - return item + ret = item end end + return ret end dofile(modpath.."/nodes.lua") @@ -34,7 +37,16 @@ dofile(modpath.."/sounds.lua") dofile(modpath.."/helper_functions.lua") dofile(modpath.."/misc.lua") -minetest.debug(dump(df_dependencies.mods_required)) +local mods_required = "" +local mods_sorted = {} +for mod, _ in pairs(df_dependencies.mods_required) do + table.insert(mods_sorted, mod) +end +table.sort(mods_sorted) +for _, mod in ipairs(mods_sorted) do + mods_required = mods_required .. ", " .. mod +end +minetest.debug(mods_required) -- This mod is meant to only exist at initialization time. Other mods should make copies of anything it points to for their own use. minetest.after(1, function() df_dependencies = nil end) diff --git a/df_dependencies/mod.conf b/df_dependencies/mod.conf index 24378bd..7785305 100644 --- a/df_dependencies/mod.conf +++ b/df_dependencies/mod.conf @@ -1,4 +1,4 @@ name = df_dependencies description = A utility mod for df_caverns that gathers all dependencies on minetest_game in one place, to ease compatibility efforts with mineclone and other such games -depends = default -optional_depends = moreblocks, stairs, doors, farming, wool, fireflies, vessels, bucket, beds \ No newline at end of file +depends = +optional_depends = beds, bucket, default, doors, farming, fireflies, mcl_beds, mcl_buckets, mcl_chests, mcl_copper, mcl_core, mcl_doors, mcl_farming, mcl_furnaces, mcl_lanterns, mcl_mobitems, mcl_ocean, mcl_potions, mcl_sounds, mcl_strongholds, mcl_torches, mcl_vars, mcl_wool, mcl_worlds, mclx_core, mesecons, moreblocks, stairs, vessels, wool \ No newline at end of file diff --git a/df_dependencies/nodes.lua b/df_dependencies/nodes.lua index 8271a0c..114d91c 100644 --- a/df_dependencies/nodes.lua +++ b/df_dependencies/nodes.lua @@ -39,7 +39,7 @@ df_dependencies.node_name_ice = select_required("default:ice", "mcl_core:ice") df_dependencies.node_name_junglewood = select_required("default:junglewood", "mcl_core:junglewood") df_dependencies.node_name_lava_source = select_required("default:lava_source", "mcl_core:lava_source") df_dependencies.node_name_mese_crystal = select_required("default:mese_crystal", "mesecons:redstone") -- TODO make sure this is properly balanced. Also, mesecons mod conflict with non-mcl mesecons? -df_dependencies.node_name_meselamp = select_required("default:meselamp") +df_dependencies.node_name_meselamp = select_required("default:meselamp", "mcl_lanterns:lantern_floor") df_dependencies.node_name_mossycobble = select_required("default:mossycobble", "mcl_core:mossycobble") df_dependencies.node_name_obsidian = select_required("default:obsidian", "mcl_core:obsidian") df_dependencies.node_name_paper = select_required("default:paper", "mcl_core:paper") @@ -57,7 +57,7 @@ df_dependencies.node_name_water_flowing = select_required("default:water_flowing df_dependencies.node_name_water_source = select_required("default:water_source", "mcl_core:water_source") df_dependencies.node_name_stone_with_iron = select_required("default:stone_with_iron", "mcl_core:stone_with_iron") df_dependencies.node_name_steelblock = select_required("default:steelblock", "mcl_core:ironblock") -df_dependencies.node_name_stone_with_copper = select_required("default:stone_with_copper", "mcl_core:stone_with_copper") +df_dependencies.node_name_stone_with_copper = select_required("default:stone_with_copper", "mcl_copper:stone_with_copper") df_dependencies.node_name_copperblock = select_required("default:copperblock", "mcl_copper:block_raw") df_dependencies.node_name_dirt_furrowed = select_required("farming:soil", "mcl_farming:soil") diff --git a/df_primordial_items/giant_fern.lua b/df_primordial_items/giant_fern.lua index 2c44a15..b56a7f0 100644 --- a/df_primordial_items/giant_fern.lua +++ b/df_primordial_items/giant_fern.lua @@ -157,7 +157,7 @@ minetest.register_node("df_primordial_items:giant_fern_leaves", { visual_scale = 1.41, inventory_image = "dfcaverns_jungle_fern_leaves_01.png", wield_image = "dfcaverns_jungle_fern_leaves_01.png", - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + groups = {snappy = 3, leafdecay = 2, flammable = 2, leaves = 1}, is_ground_content = false, paramtype = "light", drawtype = "plantlike", @@ -168,6 +168,7 @@ minetest.register_node("df_primordial_items:giant_fern_leaves", { use_texture_alpha = "clip", sunlight_propagates = true, after_place_node = df_primordial_items.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes drop = { max_items = 1, items = { diff --git a/df_primordial_items/jungle_mushroom.lua b/df_primordial_items/jungle_mushroom.lua index e98aea6..5b76145 100644 --- a/df_primordial_items/jungle_mushroom.lua +++ b/df_primordial_items/jungle_mushroom.lua @@ -22,7 +22,7 @@ minetest.register_node("df_primordial_items:jungle_mushroom_cap_1", { tiles = {"dfcaverns_jungle_mushroom_top_02.png"}, paramtype2 = "facedir", is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, primordial_mushroom_cap = 1}, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, primordial_mushroom_cap = 1}, sounds = df_trees.node_sound_tree_soft_fungus_defaults(), on_place = minetest.rotate_node, drop = { @@ -46,7 +46,7 @@ minetest.register_node("df_primordial_items:jungle_mushroom_cap_2", { tiles = {"dfcaverns_jungle_mushroom_top_01.png"}, paramtype2 = "facedir", is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, primordial_mushroom_cap = 1}, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, primordial_mushroom_cap = 1}, sounds = df_trees.node_sound_tree_soft_fungus_defaults(), on_place = minetest.rotate_node, drop = { diff --git a/df_primordial_items/jungle_tree.lua b/df_primordial_items/jungle_tree.lua index 7ee54eb..53a99df 100644 --- a/df_primordial_items/jungle_tree.lua +++ b/df_primordial_items/jungle_tree.lua @@ -15,7 +15,7 @@ minetest.register_node("df_primordial_items:jungle_leaves", { paramtype = "light", is_ground_content = false, buildable_to = true, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + groups = {snappy = 3, leafdecay = 1, flammable = 2, leaves = 1}, sounds = df_primordial_items.sounds.leaves, drop = { max_items = 1, @@ -30,6 +30,7 @@ minetest.register_node("df_primordial_items:jungle_leaves", { } }, after_place_node = df_primordial_items.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) minetest.register_node("df_primordial_items:jungle_leaves_glowing", { @@ -47,7 +48,7 @@ minetest.register_node("df_primordial_items:jungle_leaves_glowing", { is_ground_content = false, buildable_to = true, light_source = 2, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + groups = {snappy = 3, leafdecay = 1, flammable = 2, leaves = 1}, sounds = df_primordial_items.sounds.leaves, drop = { max_items = 1, @@ -62,6 +63,7 @@ minetest.register_node("df_primordial_items:jungle_leaves_glowing", { } }, after_place_node = df_primordial_items.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) -- Trunk diff --git a/df_primordial_items/primordial_mushroom.lua b/df_primordial_items/primordial_mushroom.lua index 01fef05..e961bd3 100644 --- a/df_primordial_items/primordial_mushroom.lua +++ b/df_primordial_items/primordial_mushroom.lua @@ -31,7 +31,7 @@ minetest.register_node("df_primordial_items:mushroom_gills", { tiles = {"dfcaverns_mush_gills.png"}, inventory_image = "dfcaverns_mush_gills.png", wield_image = "dfcaverns_mush_gills.png", - groups = {snappy = 3, flora = 1, flammable = 1, leaves = 1}, + groups = {snappy = 3, flora = 1, flammable = 1, leaves = 1, leafdecay = 5}, paramtype = "light", drawtype = "plantlike", waving = 2, @@ -55,6 +55,7 @@ minetest.register_node("df_primordial_items:mushroom_gills", { } }, after_place_node = df_primordial_items.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) minetest.register_node("df_primordial_items:mushroom_gills_glowing", { @@ -64,7 +65,7 @@ minetest.register_node("df_primordial_items:mushroom_gills_glowing", { tiles = {"dfcaverns_mush_gills_glow.png"}, inventory_image = "dfcaverns_mush_gills_glow.png", wield_image = "dfcaverns_mush_gills_glow.png", - groups = {snappy = 3, flora = 1, flammable = 1, leaves = 1}, + groups = {snappy = 3, flora = 1, flammable = 1, leaves = 1, leafdecay = 5}, paramtype = "light", drawtype = "plantlike", waving = 2, @@ -89,6 +90,7 @@ minetest.register_node("df_primordial_items:mushroom_gills_glowing", { } }, after_place_node = df_primordial_items.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_primordial_items.register_leafdecay({ diff --git a/df_trees/black_cap.lua b/df_trees/black_cap.lua index 749a291..5247ff9 100644 --- a/df_trees/black_cap.lua +++ b/df_trees/black_cap.lua @@ -29,7 +29,7 @@ minetest.register_node("df_trees:black_cap_gills", { _doc_items_usagehelp = df_trees.doc.black_cap_usage, tiles = {"dfcaverns_black_cap_gills.png"}, is_ground_content = false, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + groups = {snappy = 3, leafdecay = 1, flammable = 2, leaves = 1}, sounds = df_trees.sounds.leaves, drawtype = "plantlike", paramtype = "light", @@ -46,6 +46,7 @@ minetest.register_node("df_trees:black_cap_gills", { } }, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_trees.register_leafdecay({ diff --git a/df_trees/fungiwood.lua b/df_trees/fungiwood.lua index 50294cb..2697130 100644 --- a/df_trees/fungiwood.lua +++ b/df_trees/fungiwood.lua @@ -81,7 +81,7 @@ minetest.register_node("df_trees:fungiwood_shelf",{ } }, is_ground_content = false, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + groups = {snappy = 3, leafdecay = 5, flammable = 2, leaves = 1}, drop = { max_items = 1, items = { @@ -92,6 +92,7 @@ minetest.register_node("df_trees:fungiwood_shelf",{ sounds = df_trees.sounds.leaves, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_trees.register_leafdecay({ diff --git a/df_trees/goblin_cap.lua b/df_trees/goblin_cap.lua index fec4b83..b1ae243 100644 --- a/df_trees/goblin_cap.lua +++ b/df_trees/goblin_cap.lua @@ -35,7 +35,7 @@ minetest.register_node("df_trees:goblin_cap_gills", { _doc_items_usagehelp = df_trees.doc.goblin_cap_usage, tiles = {"dfcaverns_goblin_cap_gills.png"}, is_ground_content = false, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1, goblin_cap = 1}, + groups = {snappy = 3, leafdecay = 1, flammable = 2, leaves = 1, goblin_cap = 1}, sounds = df_trees.sounds.leaves, drawtype = "plantlike", paramtype = "light", @@ -52,6 +52,7 @@ minetest.register_node("df_trees:goblin_cap_gills", { } }, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_trees.register_leafdecay({ diff --git a/df_trees/nether_cap.lua b/df_trees/nether_cap.lua index 945e198..f8066a9 100644 --- a/df_trees/nether_cap.lua +++ b/df_trees/nether_cap.lua @@ -30,7 +30,7 @@ minetest.register_node("df_trees:nether_cap_gills", { tiles = {"dfcaverns_nether_cap_gills.png"}, is_ground_content = false, light_source = 6, - groups = {snappy = 3, leafdecay = 3, leaves = 1, puts_out_fire = 1, cools_lava = 1, freezes_water = 1, nether_cap = 1}, + groups = {snappy = 3, leafdecay = 1, leaves = 1, puts_out_fire = 1, cools_lava = 1, freezes_water = 1, nether_cap = 1}, sounds = df_trees.sounds.leaves, drawtype = "plantlike", paramtype = "light", @@ -47,6 +47,7 @@ minetest.register_node("df_trees:nether_cap_gills", { } }, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_trees.register_leafdecay({ diff --git a/df_trees/spore_tree.lua b/df_trees/spore_tree.lua index 7198c1e..8217b98 100644 --- a/df_trees/spore_tree.lua +++ b/df_trees/spore_tree.lua @@ -94,6 +94,7 @@ minetest.register_node("df_trees:spore_tree_hyphae", { sounds = df_trees.sounds.leaves, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) minetest.register_node("df_trees:spore_tree_fruiting_body", { @@ -134,6 +135,7 @@ minetest.register_node("df_trees:spore_tree_fruiting_body", { sounds = df_trees.sounds.leaves, after_place_node = df_trees.after_place_leaves, + place_param2 = 1, -- Prevent leafdecay for placed nodes }) df_trees.register_leafdecay({ diff --git a/ice_sprites/init.lua b/ice_sprites/init.lua index 3a1ce5b..5113823 100644 --- a/ice_sprites/init.lua +++ b/ice_sprites/init.lua @@ -109,6 +109,11 @@ minetest.register_node("ice_sprites:hidden_ice_sprite", { -- ice sprite in a bottle if node_name_glass_bottle then +local glass_sounds +if minetest.get_modpath("df_dependencies") then + glass_sounds = df_dependencies.sound_glass +end + minetest.register_node("ice_sprites:ice_sprite_bottle", { description = S("Ice Sprite in a Bottle"), _doc_items_longdesc = ice_sprite_bottle_desc, @@ -135,7 +140,7 @@ minetest.register_node("ice_sprites:ice_sprite_bottle", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - sounds = default.node_sound_glass_defaults(), + sounds = glass_sounds(), on_rightclick = function(pos, node, player, itemstack, pointed_thing) local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z} if minetest.is_protected(pos, player:get_player_name()) or diff --git a/oil/init.lua b/oil/init.lua index 8927b22..7f1946a 100644 --- a/oil/init.lua +++ b/oil/init.lua @@ -11,6 +11,10 @@ end local oil_sounds = {footstep = {name = "oil_oil_footstep", gain = 0.2}} +local water_source = df_dependencies.node_name_water_source +local water_flowing = df_dependencies.node_name_water_flowing +local bucket_empty = df_dependencies.node_name_bucket_empty + minetest.register_node("oil:oil_source", { description = S("Oil"), _doc_items_longdesc = oil_desc, @@ -124,7 +128,7 @@ if minetest.get_modpath("dynamic_liquid") then minetest.register_abm({ label = "oil:oil floats", nodenames = {"oil:oil_source"}, - neighbors = {"default:water_source"}, + neighbors = {water_source}, interval = 1.0, chance = 1, catch_up = true, @@ -132,7 +136,7 @@ if minetest.get_modpath("dynamic_liquid") then local next_pos = {x=pos.x, y=pos.y+1, z=pos.z} local next_node = minetest.get_node(next_pos) local above_name = next_node.name - if above_name == "default:water_source" then + if above_name == water_source then minetest.swap_node(next_pos, {name="oil:oil_source"}) minetest.swap_node(pos, next_node) else @@ -145,7 +149,7 @@ if minetest.get_modpath("dynamic_liquid") then next_pos.z = next_pos.z + displacement end next_node = minetest.get_node(next_pos) - if next_node.name == "default:water_source" then + if next_node.name == water_source then if above_name ~= "air" then -- we're not on the surface, so try any lateral movement minetest.swap_node(next_pos, {name="oil:oil_source"}) @@ -169,14 +173,14 @@ if minetest.get_modpath("dynamic_liquid") then minetest.register_abm({ label = "oil:oil settles", nodenames = {"oil:oil_source"}, - neighbors = {"default:water_flowing"}, + neighbors = {water_flowing}, interval = 1.0, chance = 1, catch_up = true, action = function(pos, node) local next_pos = {x=pos.x, y=pos.y-1, z=pos.z} local next_node = minetest.get_node(next_pos) - if next_node.name == "default:water_flowing" then + if next_node.name == water_flowing then minetest.swap_node(next_pos, {name="oil:oil_source"}) minetest.swap_node(pos, next_node) end @@ -198,7 +202,7 @@ if minetest.get_modpath("bucket") then type = "fuel", recipe = "oil:oil_bucket", burntime = 370, -- same as coalblock - replacements = {{"oil:oil_bucket", "bucket:bucket_empty"}}, + replacements = {{"oil:oil_bucket", bucket_empty}}, }) if minetest.get_modpath("basic_materials") then @@ -207,7 +211,7 @@ if minetest.get_modpath("bucket") then output = "basic_materials:paraffin", recipe = "oil:oil_bucket", cooktime = 5, - replacements = {{"oil:oil_bucket", "bucket:bucket_empty"}}, + replacements = {{"oil:oil_bucket", bucket_empty}}, }) end end \ No newline at end of file diff --git a/oil/mod.conf b/oil/mod.conf index e262a4e..762bc1e 100644 --- a/oil/mod.conf +++ b/oil/mod.conf @@ -1,4 +1,4 @@ name = oil description = Oil liquid type -depends = default -optional_depends = dynamic_liquid, bucket, doc, basic_materials \ No newline at end of file +depends = df_dependencies +optional_depends = dynamic_liquid, doc, basic_materials \ No newline at end of file