From 127c48835573f9e7bd89137ecb2176c2a8e5f783 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 14 Apr 2013 03:01:27 -0400 Subject: [PATCH] Use the group "soil" for nodes that saplings grow on --- doc/lua_api.txt | 3 ++- games/minimal/mods/default/init.lua | 6 +++--- src/content_abm.cpp | 9 ++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b7be5020..e2abcbfe 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -510,7 +510,7 @@ Usage: - Groups are stored in a table, having the group names with keys and the group ratings as values. For example: groups = {crumbly=3, soil=1} - ^ Default dirt (soil group actually currently not defined; TODO) + ^ Default dirt groups = {crumbly=2, soil=1, level=2, outerspace=1} ^ A more special dirt-kind of thing - Groups always have a rating associated with them. If there is no @@ -583,6 +583,7 @@ Special groups - attached_node: if the node under it is not a walkable block the node will be dropped as an item. If the node is wallmounted the wallmounted direction is checked. +- soil: saplings will grow on nodes in this group Known damage and digging time defining groups ---------------------------------------------- diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index d8067d21..b375cda1 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -741,7 +741,7 @@ minetest.register_node("default:dirt_with_grass", { description = "Dirt with grass", tiles ={"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, soil=1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, @@ -752,7 +752,7 @@ minetest.register_node("default:dirt_with_grass_footsteps", { description = "Dirt with grass and footsteps", tiles ={"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, soil=1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, @@ -763,7 +763,7 @@ minetest.register_node("default:dirt", { description = "Dirt", tiles ={"default_dirt.png"}, is_ground_content = true, - groups = {crumbly=3}, + groups = {crumbly=3, soil=1}, sounds = default.node_sound_dirt_defaults(), }) diff --git a/src/content_abm.cpp b/src/content_abm.cpp index e20201dc..f19caf74 100644 --- a/src/content_abm.cpp +++ b/src/content_abm.cpp @@ -99,14 +99,10 @@ class MakeTreesFromSaplingsABM : public ActiveBlockModifier { private: content_t c_junglesapling; - content_t c_dirt; - content_t c_dirt_with_grass; public: MakeTreesFromSaplingsABM(ServerEnvironment *env, INodeDefManager *nodemgr) { - c_junglesapling = nodemgr->getId("junglesapling"); - c_dirt = nodemgr->getId("mapgen_dirt"); - c_dirt_with_grass = nodemgr->getId("mapgen_dirt_with_grass"); + c_junglesapling = nodemgr->getId("junglesapling"); } virtual std::set getTriggerContents() @@ -127,8 +123,7 @@ public: ServerMap *map = &env->getServerMap(); MapNode n_below = map->getNodeNoEx(p - v3s16(0, 1, 0)); - if (n_below.getContent() != c_dirt && - n_below.getContent() != c_dirt_with_grass) + if (!((ItemGroupList) ndef->get(n_below).groups)["soil"]) return; bool is_jungle_tree = n.getContent() == c_junglesapling; -- 2.30.2