Fix leaking globals in flowers and default mapgen.lua
authorPenguinDad <tamarok40@gmail.com>
Thu, 20 Nov 2014 16:02:07 +0000 (17:02 +0100)
committerCraig Robbins <kde.psych@gmail.com>
Fri, 21 Nov 2014 14:24:49 +0000 (00:24 +1000)
Signed-off-by: Craig Robbins <kde.psych@gmail.com>
mods/default/mapgen.lua
mods/flowers/mapgen.lua

index 624206f3b5ecbd297a62f0b52d52607aa8bdec9f..386ba417010008dcd19091075d03404206cc6447 100644 (file)
@@ -278,7 +278,7 @@ function default.mgv6_ongen(minp, maxp, seed)
                        end
                end
        end
-       
+
        function default.make_cactus(pos, size)
                for y=0,size-1 do
                        local p = {x=pos.x, y=pos.y+y, z=pos.z}
@@ -377,7 +377,7 @@ function default.mgv6_ongen(minp, maxp, seed)
                                                break
                                        end
                                end
-                               
+
                                if ground_y then
                                        local p = {x=x,y=ground_y+1,z=z}
                                        local nn = minetest.get_node(p).name
@@ -388,14 +388,14 @@ function default.mgv6_ongen(minp, maxp, seed)
                                                -- If desert sand, add dry shrub
                                                if nn == "default:desert_sand" then
                                                        minetest.set_node(p,{name="default:dry_shrub"})
-                                                       
+
                                                -- If dirt with grass, add grass
                                                elseif nn == "default:dirt_with_grass" then
                                                        minetest.set_node(p,{name="default:grass_"..pr:next(1, 5)})
                                                end
                                        end
                                end
-                               
+
                        end
                end
                end
@@ -406,9 +406,8 @@ end
 -- Detect mapgen and register suitable on-generated function
 --
 
-minetest.register_on_mapgen_init(function(MapgenParams)
-       mgname = MapgenParams.mgname
-       if mgname == "v6" then
+minetest.register_on_mapgen_init(function(mg_params)
+       if mg_params.mgname == "v6" then
                minetest.register_on_generated(default.mgv6_ongen)
        end
 end)
@@ -466,4 +465,3 @@ function default.generate_nyancats(minp, maxp, seed)
 end
 
 minetest.register_on_generated(default.generate_nyancats)
-
index 11599ed0da00b38e0244ee26f81a9b8aa22d22c0..55e0edccb37d6c79a43531512f243380227eed53 100644 (file)
@@ -26,7 +26,7 @@ function flowers.mgv6ongen(minp, maxp, seed)
                                                break
                                        end
                                end
-                               
+
                                if ground_y then
                                        local p = {x=x,y=ground_y+1,z=z}
                                        local nn = minetest.get_node(p).name
@@ -54,7 +54,7 @@ function flowers.mgv6ongen(minp, maxp, seed)
                                                end
                                        end
                                end
-                               
+
                        end
                end
                end
@@ -63,10 +63,8 @@ end
 
 -- Enable in mapgen v6 only
 
-minetest.register_on_mapgen_init(function(MapgenParams)
-       mgname = MapgenParams.mgname
-       if mgname == "v6" then
+minetest.register_on_mapgen_init(function(mg_params)
+       if mg_params.mgname == "v6" then
                minetest.register_on_generated(flowers.mgv6ongen)
        end
 end)
-