Skip to content

Commit

Permalink
makes moretrees game agnostic (#37)
Browse files Browse the repository at this point in the history
* 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 #37 (comment)
  • Loading branch information
wsor4035 authored May 26, 2024
1 parent 670f7f4 commit f49b1c4
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 112 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",
}
74 changes: 37 additions & 37 deletions biome_defs.lua
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -117,27 +117,27 @@ 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,
max_count = 5,
}

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,
Expand All @@ -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",
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
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
50 changes: 26 additions & 24 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 Expand Up @@ -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",
Expand Down Expand Up @@ -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"})
Expand Down Expand Up @@ -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"})
Expand Down Expand Up @@ -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"})
Expand Down
Loading

0 comments on commit f49b1c4

Please sign in to comment.