Skip to content

Commit

Permalink
at least boot into minetest
Browse files Browse the repository at this point in the history
  • Loading branch information
wsor4035 committed Mar 23, 2024
1 parent 670f7f4 commit 0c3fbcf
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},

"biome_lib",
"stairsplus",
"stairs",
"doors",
"xcompat",
}
2 changes: 1 addition & 1 deletion cocos_palm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion date_palm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
38 changes: 20 additions & 18 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
4 changes: 2 additions & 2 deletions mod.conf
Original file line number Diff line number Diff line change
@@ -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
63 changes: 34 additions & 29 deletions node_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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", {
Expand All @@ -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,
Expand All @@ -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", {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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})
Expand All @@ -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 },
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0c3fbcf

Please sign in to comment.