aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2020-05-25 21:11:57 +0100
committerGitHub <noreply@github.com>2020-05-25 21:11:57 +0100
commitb546e8938d41aa9e3101fb9d4d5b02924ed73b60 (patch)
tree17abf21d9f7a79c3e5854042b1f08bb4a36be2ea /src
parent5311a275235d2132443643199330953c877b794a (diff)
downloadminetest-b546e8938d41aa9e3101fb9d4d5b02924ed73b60.tar.gz
minetest-b546e8938d41aa9e3101fb9d4d5b02924ed73b60.tar.bz2
minetest-b546e8938d41aa9e3101fb9d4d5b02924ed73b60.zip
L-System trees: Remove hardcoded use of 'mapgen_dirt' alias (#9931)
Games often and increasingly do not use this mapgen alias, as it is only required for Mapgen V6. Such games were triggering the recently added error message. Even if this mapgen alias was defined, dirt nodes placed under a wide trunk were inconsistent with biomes that do not use dirt surface nodes. Place trunk nodes below a wide trunk instead of 'mapgen_dirt'. On sloping ground, the trunk then extends down to the surface, instead of the surface rising up to meet the trunk. This looks more natural and does not alter the terrain.
Diffstat (limited to 'src')
-rw-r--r--src/mapgen/treegen.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp
index d538e15b4..e7e30c880 100644
--- a/src/mapgen/treegen.cpp
+++ b/src/mapgen/treegen.cpp
@@ -148,10 +148,6 @@ treegen::error spawn_ltree(ServerMap *map, v3s16 p0,
treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
const NodeDefManager *ndef, TreeDef tree_definition)
{
- MapNode dirtnode(ndef->getId("mapgen_dirt"));
- if (dirtnode == CONTENT_IGNORE)
- errorstream << "Treegen (make_ltree): Mapgen alias 'mapgen_dirt' is invalid!" << std::endl;
-
s32 seed;
if (tree_definition.explicit_seed)
seed = tree_definition.seed + 14002;
@@ -229,43 +225,43 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
axiom = temp;
}
- //make sure tree is not floating in the air
+ // Add trunk nodes below a wide trunk to avoid gaps when tree is on sloping ground
if (tree_definition.trunk_type == "double") {
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X + 1, position.Y - 1, position.Z),
- dirtnode
+ tree_definition
);
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X, position.Y - 1, position.Z + 1),
- dirtnode
+ tree_definition
);
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X + 1, position.Y - 1, position.Z + 1),
- dirtnode
+ tree_definition
);
} else if (tree_definition.trunk_type == "crossed") {
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X + 1, position.Y - 1, position.Z),
- dirtnode
+ tree_definition
);
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X - 1, position.Y - 1, position.Z),
- dirtnode
+ tree_definition
);
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X, position.Y - 1, position.Z + 1),
- dirtnode
+ tree_definition
);
- tree_node_placement(
+ tree_trunk_placement(
vmanip,
v3f(position.X, position.Y - 1, position.Z - 1),
- dirtnode
+ tree_definition
);
}
@@ -372,7 +368,7 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
!tree_definition.thin_branches)) {
tree_trunk_placement(
vmanip,
- v3f(position.X +1 , position.Y, position.Z),
+ v3f(position.X + 1, position.Y, position.Z),
tree_definition
);
tree_trunk_placement(