Skip to content

Commit 127c488

Browse files
ShadowNinjaPilzAdam
authored andcommittedMay 20, 2013
Use the group "soil" for nodes that saplings grow on
1 parent 981c6c9 commit 127c488

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed
 

‎doc/lua_api.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ Usage:
510510
- Groups are stored in a table, having the group names with keys and the
511511
group ratings as values. For example:
512512
groups = {crumbly=3, soil=1}
513-
^ Default dirt (soil group actually currently not defined; TODO)
513+
^ Default dirt
514514
groups = {crumbly=2, soil=1, level=2, outerspace=1}
515515
^ A more special dirt-kind of thing
516516
- Groups always have a rating associated with them. If there is no
@@ -583,6 +583,7 @@ Special groups
583583
- attached_node: if the node under it is not a walkable block the node will be
584584
dropped as an item. If the node is wallmounted the
585585
wallmounted direction is checked.
586+
- soil: saplings will grow on nodes in this group
586587

587588
Known damage and digging time defining groups
588589
----------------------------------------------

‎games/minimal/mods/default/init.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ minetest.register_node("default:dirt_with_grass", {
741741
description = "Dirt with grass",
742742
tiles ={"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
743743
is_ground_content = true,
744-
groups = {crumbly=3},
744+
groups = {crumbly=3, soil=1},
745745
drop = 'default:dirt',
746746
sounds = default.node_sound_dirt_defaults({
747747
footstep = {name="default_grass_footstep", gain=0.4},
@@ -752,7 +752,7 @@ minetest.register_node("default:dirt_with_grass_footsteps", {
752752
description = "Dirt with grass and footsteps",
753753
tiles ={"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
754754
is_ground_content = true,
755-
groups = {crumbly=3},
755+
groups = {crumbly=3, soil=1},
756756
drop = 'default:dirt',
757757
sounds = default.node_sound_dirt_defaults({
758758
footstep = {name="default_grass_footstep", gain=0.4},
@@ -763,7 +763,7 @@ minetest.register_node("default:dirt", {
763763
description = "Dirt",
764764
tiles ={"default_dirt.png"},
765765
is_ground_content = true,
766-
groups = {crumbly=3},
766+
groups = {crumbly=3, soil=1},
767767
sounds = default.node_sound_dirt_defaults(),
768768
})
769769

‎src/content_abm.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,10 @@ class MakeTreesFromSaplingsABM : public ActiveBlockModifier
9999
{
100100
private:
101101
content_t c_junglesapling;
102-
content_t c_dirt;
103-
content_t c_dirt_with_grass;
104102

105103
public:
106104
MakeTreesFromSaplingsABM(ServerEnvironment *env, INodeDefManager *nodemgr) {
107-
c_junglesapling = nodemgr->getId("junglesapling");
108-
c_dirt = nodemgr->getId("mapgen_dirt");
109-
c_dirt_with_grass = nodemgr->getId("mapgen_dirt_with_grass");
105+
c_junglesapling = nodemgr->getId("junglesapling");
110106
}
111107

112108
virtual std::set<std::string> getTriggerContents()
@@ -127,8 +123,7 @@ class MakeTreesFromSaplingsABM : public ActiveBlockModifier
127123
ServerMap *map = &env->getServerMap();
128124

129125
MapNode n_below = map->getNodeNoEx(p - v3s16(0, 1, 0));
130-
if (n_below.getContent() != c_dirt &&
131-
n_below.getContent() != c_dirt_with_grass)
126+
if (!((ItemGroupList) ndef->get(n_below).groups)["soil"])
132127
return;
133128

134129
bool is_jungle_tree = n.getContent() == c_junglesapling;

0 commit comments

Comments
 (0)
Please sign in to comment.