Merge pull request #431 from sapier/dtime_clamping
[oweals/minetest.git] / src / content_abm.cpp
index 12dbeea8e99a80a65d20df3f28b3abbf5e2e1f53..ce1751117630d7b84488dde3dc93d84595fe17a2 100644 (file)
@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_sao.h"
 #include "settings.h"
 #include "mapblock.h" // For getNodeBlockPos
-#include "mapgen.h" // For mapgen::make_tree
+#include "treegen.h" // For treegen::make_tree
 #include "map.h"
 
 #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
@@ -37,7 +37,7 @@ public:
        virtual std::set<std::string> getTriggerContents()
        {
                std::set<std::string> s;
-               s.insert("dirt");
+               s.insert("mapgen_dirt");
                return s;
        }
        virtual float getTriggerInterval()
@@ -54,7 +54,7 @@ public:
                                !ndef->get(n_top).isLiquid() &&
                                n_top.getLightBlend(env->getDayNightRatio(), ndef) >= 13)
                {
-                       n.setContent(ndef->getId("dirt_with_grass"));
+                       n.setContent(ndef->getId("mapgen_dirt_with_grass"));
                        map->addNodeWithEvent(p, n);
                }
        }
@@ -67,7 +67,7 @@ public:
        virtual std::set<std::string> getTriggerContents()
        {
                std::set<std::string> s;
-               s.insert("dirt_with_grass");
+               s.insert("mapgen_dirt_with_grass");
                return s;
        }
        virtual float getTriggerInterval()
@@ -80,10 +80,11 @@ public:
                ServerMap *map = &env->getServerMap();
                
                MapNode n_top = map->getNodeNoEx(p+v3s16(0,1,0));
-               if(!ndef->get(n_top).light_propagates ||
+               if((!ndef->get(n_top).light_propagates &&
+                               n_top.getContent() != CONTENT_IGNORE) ||
                                ndef->get(n_top).isLiquid())
                {
-                       n.setContent(ndef->getId("dirt"));
+                       n.setContent(ndef->getId("mapgen_dirt"));
                        map->addNodeWithEvent(p, n);
                }
        }
@@ -118,7 +119,7 @@ public:
                v3s16 tree_blockp = getNodeBlockPos(tree_p);
                vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
                bool is_apple_tree = myrand()%4 == 0;
-               mapgen::make_tree(vmanip, tree_p, is_apple_tree, ndef);
+               treegen::make_tree(vmanip, tree_p, is_apple_tree, ndef);
                vmanip.blitBackAll(&modified_blocks);
 
                // update lighting