From f49b1c42c9a526eeceecbc6af53353712d5f339e Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Sun, 26 May 2024 11:08:14 -0400 Subject: [PATCH] makes moretrees game agnostic (#37) * at least boot into minetest * start using some xcompat materials * transition some more materials * translate and default lock some more stuff * handle more stuff * translate leaves and bugfix jungle nodes near * fallback on moretrees spaling texture when default not present * fix https://github.com/mt-mods/moretrees/pull/37#discussion_r1615147786 --- .luacheckrc | 2 +- biome_defs.lua | 74 ++++++++++++++++++++++---------------------- cocos_palm.lua | 2 +- date_palm.lua | 2 +- init.lua | 50 +++++++++++++++--------------- mod.conf | 4 +-- node_defs.lua | 82 +++++++++++++++++++++++++++---------------------- saplings.lua | 12 ++++---- tree_models.lua | 6 ++-- 9 files changed, 122 insertions(+), 112 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 0e916a2..199e53f 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -21,8 +21,8 @@ read_globals = { string = {fields = {"split"}}, table = {fields = {"copy", "getn"}}, - "biome_lib", "stairsplus", "stairs", "doors", + "xcompat", } diff --git a/biome_defs.lua b/biome_defs.lua index 342c80d..7e4b505 100644 --- a/biome_defs.lua +++ b/biome_defs.lua @@ -1,6 +1,6 @@ moretrees.beech_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 8, seed_diff = 2, @@ -9,13 +9,13 @@ moretrees.beech_biome = { } moretrees.palm_biome = { - surface = "default:sand", + surface = xcompat.materials.sand, avoid_nodes = moretrees.avoidnodes, avoid_radius = 5, seed_diff = 330, min_elevation = -1, max_elevation = 1, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_count = 10, temp_min = 0.25, @@ -25,13 +25,13 @@ moretrees.palm_biome = { } moretrees.date_palm_biome = { - surface = "default:desert_sand", + surface = xcompat.materials.desert_sand, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 339, min_elevation = -1, max_elevation = 10, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 20, near_nodes_count = 100, near_nodes_vertical = 20, @@ -42,13 +42,13 @@ moretrees.date_palm_biome = { } moretrees.date_palm_biome_2 = { - surface = "default:desert_sand", + surface = xcompat.materials.desert_sand, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 340, min_elevation = 11, max_elevation = 30, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 1, near_nodes_count = 1, near_nodes_vertical = 30, @@ -59,7 +59,7 @@ moretrees.date_palm_biome_2 = { } moretrees.apple_tree_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 331, @@ -69,13 +69,13 @@ moretrees.apple_tree_biome = { temp_max = -0.15, rarity = 75, max_count = 5, - place_on = {"default:dirt_with_grass"}, + place_on = {xcompat.materials.dirt_with_grass}, biomes = {"deciduous_forest"}, fill_ratio = 0.0001, } moretrees.oak_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 15, seed_diff = 332, @@ -89,7 +89,7 @@ moretrees.oak_biome = { } moretrees.sequoia_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 333, @@ -103,7 +103,7 @@ moretrees.sequoia_biome = { } moretrees.birch_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 5, seed_diff = 334, @@ -117,13 +117,13 @@ moretrees.birch_biome = { } moretrees.willow_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 337, min_elevation = -5, max_elevation = 5, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_count = 5, rarity = 75, @@ -131,13 +131,13 @@ moretrees.willow_biome = { } moretrees.rubber_tree_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 338, min_elevation = -5, max_elevation = 5, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_count = 10, temp_min = -0.15, @@ -147,8 +147,8 @@ moretrees.rubber_tree_biome = { moretrees.jungletree_biome = { surface = { - "default:dirt", - "default:dirt_with_grass", + xcompat.materials.dirt, + xcompat.materials.dirt_with_grass, "woodsoils:dirt_with_leaves_1", "woodsoils:grass_with_leaves_1", "woodsoils:grass_with_leaves_2", @@ -160,16 +160,16 @@ moretrees.jungletree_biome = { rarity = 85, seed_diff = 329, min_elevation = 1, - near_nodes = {"default:jungletree"}, - near_nodes_size = 6, - near_nodes_vertical = 2, - near_nodes_count = 1, + near_nodes = minetest.get_modpath("default") and {"default:jungletree"} or nil, + near_nodes_size = minetest.get_modpath("default") and 6 or nil, + near_nodes_vertical = minetest.get_modpath("default") and 2 or nil, + near_nodes_count = minetest.get_modpath("default") and 1 or nil, plantlife_limit = -0.9, biomes = {"rainforest", "rainforest_swamp"}, } moretrees.spruce_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 335, @@ -181,12 +181,12 @@ moretrees.spruce_biome = { } moretrees.cedar_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 336, min_elevation = 0, --Added to solve an issue where cedar trees would sometimes spawn deep underground - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_count = 5, rarity = 50, @@ -196,13 +196,13 @@ moretrees.cedar_biome = { -- Poplar requires a lot of water. moretrees.poplar_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 6, seed_diff = 341, min_elevation = 0, max_elevation = 50, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_vertical = 5, near_nodes_count = 1, @@ -215,13 +215,13 @@ moretrees.poplar_biome = { -- The humidity requirement it quite restrictive (apparently). -- Spawn an occasional poplar elsewhere. moretrees.poplar_biome_2 = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 6, seed_diff = 341, min_elevation = 0, max_elevation = 50, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 15, near_nodes_vertical = 4, near_nodes_count = 10, @@ -233,13 +233,13 @@ moretrees.poplar_biome_2 = { -- Subterranean lakes provide enough water for poplars to grow moretrees.poplar_biome_3 = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 6, seed_diff = 342, min_elevation = 0, max_elevation = 50, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 1, near_nodes_vertical = 25, near_nodes_count = 1, @@ -250,13 +250,13 @@ moretrees.poplar_biome_3 = { } moretrees.poplar_small_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 4, seed_diff = 343, min_elevation = 0, max_elevation = 50, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 10, near_nodes_vertical = 5, near_nodes_count = 1, @@ -267,13 +267,13 @@ moretrees.poplar_small_biome = { } moretrees.poplar_small_biome_2 = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 4, seed_diff = 343, min_elevation = 0, max_elevation = 50, - near_nodes = {"default:water_source"}, + near_nodes = {xcompat.materials.water_source}, near_nodes_size = 10, near_nodes_vertical = 4, near_nodes_count = 5, @@ -285,7 +285,7 @@ moretrees.poplar_small_biome_2 = { moretrees.fir_biome = { - surface = "default:dirt_with_grass", + surface = xcompat.materials.dirt_with_grass, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 359, @@ -298,7 +298,7 @@ moretrees.fir_biome = { moretrees.fir_biome_snow = { surface = {"snow:dirt_with_snow", "snow:snow"}, - below_nodes = {"default:dirt", "default:dirt_with_grass", "snow:dirt_with_snow"}, + below_nodes = {xcompat.materials.dirt, xcompat.materials.dirt_with_grass, "snow:dirt_with_snow"}, avoid_nodes = moretrees.avoidnodes, avoid_radius = 10, seed_diff = 359, diff --git a/cocos_palm.lua b/cocos_palm.lua index 610b51a..bf9b753 100644 --- a/cocos_palm.lua +++ b/cocos_palm.lua @@ -181,7 +181,7 @@ for _,suffix in ipairs({"_0", "_1", "_2", "_3", ""}) do groups = { fleshy=3, dig_immediate=3, flammable=2, moretrees_coconut=coco_group }, inventory_image = tile.."^[transformR180", wield_image = tile.."^[transformR180", - sounds = default.node_sound_defaults(), + sounds = xcompat.sounds.node_sound_default(), drop = drop, selection_box = { type = "fixed", diff --git a/date_palm.lua b/date_palm.lua index e514c58..3b4261a 100644 --- a/date_palm.lua +++ b/date_palm.lua @@ -727,7 +727,7 @@ for _,suffix in ipairs({"f0", "f1", "f2", "f3", "f4", "m0", "fn", "n"}) do groups = { fleshy=3, dig_immediate=3, flammable=2, moretrees_dates=1 }, inventory_image = "moretrees_dates_"..suffix..".png^[transformR0", wield_image = "moretrees_dates_"..suffix..".png^[transformR90", - sounds = default.node_sound_defaults(), + sounds = xcompat.sounds.node_sound_default(), drop = dropfn, selection_box = { type = "fixed", diff --git a/init.lua b/init.lua index 851c0de..459b4da 100644 --- a/init.lua +++ b/init.lua @@ -15,29 +15,31 @@ moretrees = {} -minetest.override_item("default:sapling", { - description = "Sapling" -}) +if minetest.get_modpath("default") then + minetest.override_item("default:sapling", { + description = "Sapling" + }) -minetest.override_item("default:tree", { - description = "Tree" -}) + minetest.override_item("default:tree", { + description = "Tree" + }) -minetest.override_item("default:wood", { - description = "Wooden Planks" -}) + minetest.override_item("default:wood", { + description = "Wooden Planks" + }) -minetest.override_item("default:leaves", { - description = "Leaves" -}) + minetest.override_item("default:leaves", { + description = "Leaves" + }) -minetest.override_item("default:fence_wood", { - description = "Wooden Fence" -}) + minetest.override_item("default:fence_wood", { + description = "Wooden Fence" + }) -minetest.override_item("default:fence_rail_wood", { - description = "Wooden Fence Rail" -}) + minetest.override_item("default:fence_rail_wood", { + description = "Wooden Fence Rail" + }) +end if minetest.get_modpath("doors") then minetest.override_item("doors:gate_wood_closed", { @@ -89,10 +91,10 @@ end -- tables, load other files moretrees.cutting_tools = { - "default:axe_bronze", - "default:axe_diamond", "default:axe_mese", - "default:axe_steel", + xcompat.materials.axe_steel, + xcompat.materials.axe_diamond, + xcompat.materials.axe_bronze, "glooptest:axe_alatro", "glooptest:axe_arol", "moreores:axe_mithril", @@ -313,7 +315,7 @@ function moretrees.grow_jungletree(pos) minetest.swap_node(pos, {name = "air"}) local leaves = minetest.find_nodes_in_area( {x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1}, - "default:leaves" + xcompat.materials.apple_leaves ) for leaf in ipairs(leaves) do minetest.swap_node(leaves[leaf], {name = "air"}) @@ -344,7 +346,7 @@ function moretrees.grow_fir(pos) local leaves = minetest.find_nodes_in_area( {x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, - "default:leaves" + xcompat.materials.apple_leaves ) for leaf in ipairs(leaves) do minetest.swap_node(leaves[leaf], {name = "air"}) @@ -375,7 +377,7 @@ function moretrees.grow_fir_snow(pos) local leaves = minetest.find_nodes_in_area( {x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y+5, z = pos.z}, - "default:leaves" + xcompat.materials.apple_leaves ) for leaf in ipairs(leaves) do minetest.swap_node(leaves[leaf], {name = "air"}) diff --git a/mod.conf b/mod.conf index a8bfea1..bbbcc4c 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = moretrees -depends = default, vessels -optional_depends = doors, stairs, moreblocks, farming +depends = xcompat +optional_depends = doors, stairs, moreblocks, farming, default, vessels min_minetest_version = 5.2.0 diff --git a/node_defs.lua b/node_defs.lua index 4387148..d805eac 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -2,6 +2,9 @@ local S = minetest.get_translator("moretrees") moretrees.avoidnodes = {} +local jungle_sapling_texture = minetest.get_modpath("default") and "default_junglesapling.png" + or "moretrees_cedar_sapling.png" + moretrees.treelist = { {"beech", S("Beech Tree")}, {"apple_tree", S("Apple Tree")}, @@ -17,7 +20,7 @@ moretrees.treelist = { {"willow", S("Willow Tree")}, {"rubber_tree", S("Rubber Tree")}, {"fir", S("Douglas Fir"), "fir_cone", S("Fir Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, - {"jungletree", S("Jungle Tree"), nil, nil, nil, nil, "default_junglesapling.png" }, + {"jungletree", S("Jungle Tree"), nil, nil, nil, nil, jungle_sapling_texture }, } moretrees.treedesc = { @@ -223,8 +226,8 @@ end -- redefine default leaves to handle plantlike and/or leaf decay options -if moretrees.plantlike_leaves then - minetest.override_item("default:leaves", { +if minetest.get_modpath("default") and moretrees.plantlike_leaves then + minetest.override_item(xcompat.materials.apple_leaves, { inventory_image = minetest.inventorycube("default_leaves.png"), drawtype = "plantlike", visual_scale = math.sqrt(2) @@ -233,8 +236,8 @@ end -- redefine default jungle leaves for same -if moretrees.plantlike_leaves then - minetest.override_item("default:jungleleaves", { +if minetest.get_modpath("default") and moretrees.plantlike_leaves then + minetest.override_item(xcompat.materials.jungle_leaves, { inventory_image = minetest.inventorycube("default_jungleleaves.png"), drawtype = "plantlike", visual_scale = math.sqrt(2) @@ -280,7 +283,7 @@ for i in ipairs(moretrees.treelist) do paramtype2 = "facedir", is_ground_content = false, groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, - sounds = default.node_sound_wood_defaults(), + sounds = xcompat.sounds.node_sound_wood_defaults(), on_place = minetest.rotate_node, }) @@ -289,7 +292,7 @@ for i in ipairs(moretrees.treelist) do tiles = {"moretrees_"..treename.."_wood.png"}, is_ground_content = false, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, - sounds = default.node_sound_wood_defaults(), + sounds = xcompat.sounds.node_sound_wood_defaults(), }) local moretrees_leaves_inventory_image = nil @@ -311,7 +314,7 @@ for i in ipairs(moretrees.treelist) do paramtype = "light", is_ground_content = false, groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 1}, - sounds = default.node_sound_leaves_defaults(), + sounds = xcompat.sounds.node_sound_leaves_defaults(), drop = { max_items = 1, @@ -365,7 +368,7 @@ for i in ipairs(moretrees.treelist) do }, moretrees.treedesc[treename].trunk_stair, moretrees.treedesc[treename].trunk_slab, - default.node_sound_wood_defaults() + xcompat.sounds.node_sound_wood_defaults() ) stairs.register_stair_and_slab( @@ -375,13 +378,13 @@ for i in ipairs(moretrees.treelist) do { "moretrees_"..treename.."_wood.png" }, moretrees.treedesc[treename].planks_stair, moretrees.treedesc[treename].planks_slab, - default.node_sound_wood_defaults() + xcompat.sounds.node_sound_wood_defaults() ) end end - if moretrees.enable_fences then + if minetest.get_modpath("default") and moretrees.enable_fences then local planks_name = "moretrees:" .. treename .. "_planks" local planks_tile = "moretrees_" .. treename .. "_wood.png" default.register_fence("moretrees:" .. treename .. "_fence", { @@ -393,7 +396,7 @@ for i in ipairs(moretrees.treelist) do "^default_fence_overlay.png^[makealpha:255,126,126", material = planks_name, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults() + sounds = xcompat.sounds.node_sound_wood_defaults() }) default.register_fence_rail("moretrees:" .. treename .. "_fence_rail", { description = moretrees.treedesc[treename].fence_rail, @@ -404,7 +407,7 @@ for i in ipairs(moretrees.treelist) do "^default_fence_rail_overlay.png^[makealpha:255,126,126", material = planks_name, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults() + sounds = xcompat.sounds.node_sound_wood_defaults() }) if minetest.global_exists("doors") then doors.register_fencegate("moretrees:" .. treename .. "_gate", { @@ -438,7 +441,7 @@ for i in ipairs(moretrees.treelist) do fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} }, groups = regular_groups, - sounds = default.node_sound_defaults(), + sounds = xcompat.sounds.node_sound_default(), on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "moretrees:" ..treename.. "_sapling", @@ -497,7 +500,7 @@ for i in ipairs(moretrees.treelist) do fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} }, groups = ongen_groups, - sounds = default.node_sound_defaults(), + sounds = xcompat.sounds.node_sound_default(), drop = "moretrees:"..treename.."_sapling", on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, @@ -549,7 +552,7 @@ for i in ipairs(moretrees.treelist) do fixed = selbox }, groups = {fleshy=3,dig_immediate=3,flammable=2, attached_node=1, leafdecay = 1, leafdecay_drop = 1}, - sounds = default.node_sound_defaults(), + sounds = xcompat.sounds.node_sound_default(), after_place_node = function(pos, placer) if placer:is_player() then minetest.set_node(pos, {name = "moretrees:"..fruit, param2 = 1}) @@ -560,7 +563,8 @@ for i in ipairs(moretrees.treelist) do if treename ~= "jungletree" and treename ~= "poplar_small" - and treename ~= "pine" then + and treename ~= "pine" + and minetest.get_modpath("default") then default.register_leafdecay({ trunks = { "moretrees:"..treename.."_trunk" }, leaves = { "moretrees:"..treename.."_leaves", fruitname }, @@ -625,29 +629,31 @@ for color = 1, #jungleleaves do paramtype = "light", is_ground_content = false, groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 3 }, - drop = { + drop = minetest.get_modpath("default") and { max_items = 1, items = { {items = {"default:junglesapling"}, rarity = 100 }, {items = {"moretrees:jungletree_leaves_"..jungleleaves[color]} } } - }, - sounds = default.node_sound_leaves_defaults(), + } or nil, + sounds = xcompat.sounds.node_sound_leaves_defaults(), }) end -- To get Moretrees to generate its own jungle trees among the default mapgen -- we need our own copy of that node, which moretrees will match against. -local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"]) -jungle_tree.drop = "default:jungletree" -minetest.register_node("moretrees:jungletree_trunk", jungle_tree) +if minetest.get_modpath("default") then + local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"]) + jungle_tree.drop = "default:jungletree" + minetest.register_node("moretrees:jungletree_trunk", jungle_tree) -default.register_leafdecay({ - trunks = { "default:jungletree", "moretrees:jungletree_trunk" }, - leaves = { "default:jungleleaves", "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" }, - radius = moretrees.leafdecay_radius, -}) + default.register_leafdecay({ + trunks = { "default:jungletree", "moretrees:jungletree_trunk" }, + leaves = { xcompat.materials.jungle_leaves, "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" }, + radius = moretrees.leafdecay_radius, + }) +end -- Extra needles for firs @@ -674,17 +680,19 @@ minetest.register_node("moretrees:fir_leaves_bright", { {items = {'moretrees:fir_leaves_bright'} } } }, - sounds = default.node_sound_leaves_defaults() + sounds = xcompat.sounds.node_sound_leaves_defaults() }) -default.register_leafdecay({ - trunks = { "moretrees:fir_trunk" }, - leaves = { "moretrees:fir_leaves", "moretrees:fir_leaves_bright" }, - radius = moretrees.leafdecay_radius, -}) +if minetest.get_modpath("default") then + default.register_leafdecay({ + trunks = { "moretrees:fir_trunk" }, + leaves = { "moretrees:fir_leaves", "moretrees:fir_leaves_bright" }, + radius = moretrees.leafdecay_radius, + }) +end -if moretrees.enable_redefine_apple then +if minetest.get_modpath("default") and moretrees.enable_redefine_apple then local appledef = table.copy(minetest.registered_nodes["default:apple"]) appledef.groups.attached_node = 1 minetest.register_node(":default:apple", appledef) @@ -712,7 +720,7 @@ minetest.register_node("moretrees:rubber_tree_trunk_empty", { "moretrees_rubber_tree_trunk_empty.png" }, groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, - sounds = default.node_sound_wood_defaults(), + sounds = xcompat.sounds.node_sound_wood_defaults(), paramtype2 = "facedir", is_ground_content = false, on_place = minetest.rotate_node, @@ -758,7 +766,7 @@ minetest.register_alias("conifers:sapling", "moretrees:fir_sapling") minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling") minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree") minetest.register_alias("moretrees:jungletree_planks", "default:junglewood") -minetest.register_alias("moretrees:jungletree_leaves_green", "default:jungleleaves") +minetest.register_alias("moretrees:jungletree_leaves_green", xcompat.materials.jungle_leaves) minetest.register_alias("moretrees:acacia_trunk", "default:acacia_tree") minetest.register_alias("moretrees:acacia_planks", "default:acacia_wood") diff --git a/saplings.lua b/saplings.lua index 09b1744..32ef7a8 100644 --- a/saplings.lua +++ b/saplings.lua @@ -5,8 +5,8 @@ local dirt_surfaces = { set = true, - ["default:dirt"] = true, - ["default:dirt_with_grass"] = true, + [xcompat.materials.dirt] = true, + [xcompat.materials.dirt_with_grass] = true, ["default:dirt_with_dry_grass"] = true, ["default:dirt_with_coniferous_litter"] = true, ["default:dirt_with_rainforest_litter"] = true, @@ -18,8 +18,8 @@ local dirt_surfaces = { local conifer_surfaces = { set = true, - ["default:dirt"] = true, - ["default:dirt_with_grass"] = true, + [xcompat.materials.dirt] = true, + [xcompat.materials.dirt_with_grass] = true, ["default:dirt_with_dry_grass"] = true, ["default:dirt_with_coniferous_litter"] = true, ["default:dirt_with_rainforest_litter"] = true, @@ -32,8 +32,8 @@ local conifer_surfaces = { local sand_surfaces = { set = true, - ["default:sand"] = true, - ["default:desert_sand"] = true, + [xcompat.materials.sand] = true, + [xcompat.materials.desert_sand] = true, ["cottages:loam"] = true, -- note, no silver sand here. -- too cold for a palm, too... well... sandy for anything else. diff --git a/tree_models.lua b/tree_models.lua index 8be3ec1..7824ea6 100644 --- a/tree_models.lua +++ b/tree_models.lua @@ -25,8 +25,8 @@ moretrees.apple_tree_model={ random_level=0, trunk_type="single", thin_branches=true, - fruit="default:apple", - fruit_chance=15, + fruit=minetest.get_modpath("default") and "default:apple" or nil, + fruit_chance=minetest.get_modpath("default") and 15 or nil, } moretrees.oak_model={ @@ -252,7 +252,7 @@ moretrees.jungletree_model={ rules_a=nil, rules_b=nil, trunk="moretrees:jungletree_trunk", - leaves="default:jungleleaves", + leaves=xcompat.materials.jungle_leaves, leaves2=nil, leaves2_chance=nil, angle=45,