Grow dirt_with_snow instead of dirt_with_grass if snow is above it
authorPilzAdam <pilzadam@minetest.net>
Tue, 23 Apr 2013 17:02:41 +0000 (19:02 +0200)
committerPilzAdam <pilzadam@minetest.net>
Tue, 23 Apr 2013 17:02:41 +0000 (19:02 +0200)
src/content_abm.cpp

index ccd9ca19ce326884d10f46b4ac45d4fd39ba514c..e20201dcf7aa2aa1ea5ccd71724327dc46e4ac85 100644 (file)
@@ -51,11 +51,15 @@ public:
                ServerMap *map = &env->getServerMap();
                
                MapNode n_top = map->getNodeNoEx(p+v3s16(0,1,0));
+               content_t c_snow = ndef->getId("snow");
                if(ndef->get(n_top).light_propagates &&
                                !ndef->get(n_top).isLiquid() &&
                                n_top.getLightBlend(env->getDayNightRatio(), ndef) >= 13)
                {
-                       n.setContent(ndef->getId("mapgen_dirt_with_grass"));
+                       if(c_snow != CONTENT_IGNORE && n_top.getContent() == c_snow)
+                               n.setContent(ndef->getId("dirt_with_snow"));
+                       else
+                               n.setContent(ndef->getId("mapgen_dirt_with_grass"));
                        map->addNodeWithEvent(p, n);
                }
        }