From 0c3fbcffe05ffeec7f9e1afc4e915609805b4fed Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Fri, 22 Mar 2024 21:57:57 -0400 Subject: [PATCH] at least boot into minetest --- .luacheckrc | 2 +- cocos_palm.lua | 2 +- date_palm.lua | 2 +- init.lua | 38 +++++++++++++++--------------- mod.conf | 4 ++-- node_defs.lua | 63 +++++++++++++++++++++++++++----------------------- 6 files changed, 59 insertions(+), 52 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/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..55e1ab5 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", { 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..383f0f6 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -280,7 +280,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 +289,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 +311,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 +365,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 +375,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 +393,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 +404,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 +438,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 +497,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 +549,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 +560,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 }, @@ -632,22 +633,24 @@ for color = 1, #jungleleaves do {items = {"moretrees:jungletree_leaves_"..jungleleaves[color]} } } }, - sounds = default.node_sound_leaves_defaults(), + 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 = { "default:jungleleaves", "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" }, + radius = moretrees.leafdecay_radius, + }) +end -- Extra needles for firs @@ -674,17 +677,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 +717,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,