From 4a9fbc8202a54ab92fb1e5de63b7fd6b7efbcc80 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Wed, 17 Jun 2015 17:51:48 +0200 Subject: [PATCH] generate snow only into air --- src/mapgen_v6.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index c33e2f3..dc9ce00 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -355,9 +355,21 @@ minetest.register_on_generated(function(minp, maxp, seed) local param2s if num ~= 1 then - for _,i in pairs(snow_tab) do - -- set snow - data[area:index(i[3], i[1]+1, i[2])] = c.snow + local unwanteds,u = {},1 + for n,i in pairs(snow_tab) do + local p = area:index(i[3], i[1]+1, i[2]) + if data[p] == c.air then + -- set snow + data[p] = c.snow + else + unwanteds[u] = n + u = u+1 + end + end + if u ~= 1 then + for _,n in pairs(unwanteds) do + snow_tab[n] = nil + end end local wsz, wsx for _,i in pairs(snow_tab) do