summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-01-15 22:27:34 -0800
committerAuke Kok <auke-jan.h.kok@intel.com>2015-01-15 22:27:34 -0800
commit3a4850068f1ba2acc7a2c71c2756b88e9a007713 (patch)
treeb90be501b18d15aa902340cab271856f4d448882
parented78d442b39510ed9a67249811914e92a18360cf (diff)
Sand creation fixes
- don't make sand unless we should make desert_sand - don't make sand unless there's already some form of sand around
-rw-r--r--init.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 0917861..aa6a55b 100644
--- a/init.lua
+++ b/init.lua
@@ -389,12 +389,22 @@ local function sed()
return
end
- -- prevent dirt-to-sand outside deserts
- -- FIXME should account for Biome here too
+ -- prevent sand-to-clay unless under water
+ -- FIXME should account for Biome here too (should be ocean, river, or beach-like)
if (underliquid < 1) and (node.name == "default:sand" or node.name == "default:desert_sand") then
return
end
+ -- prevent sand in dirt-dominated areas
+ if node.name == "default:dirt" then
+ -- since we don't have biome information, we'll assume that if there is no sand or
+ -- desert sand anywhere nearby, we shouldn't degrade this block further
+ local fpos = minetest.find_node_near(pos, 2, {"default:sand", "default:desert_sand"})
+ if not fpos then
+ return
+ end
+ end
+
if roll(hardness) then
return
end
@@ -403,7 +413,12 @@ local function sed()
local newmat = "air"
if node.name == "default:dirt" then
- newmat = "default:sand"
+ local fpos = minetest.find_node_near(pos, 2, "default:desert_sand")
+ if not fpos then
+ newmat = "default:sand"
+ else
+ newmat = "default:desert_sand"
+ end
elseif node.name == "default:dirt_with_grass" or
node.name == "default:dirt_with_grass_footsteps" or
node.name == "default:dirt_with_snow" then