From 3a4850068f1ba2acc7a2c71c2756b88e9a007713 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 15 Jan 2015 22:27:34 -0800 Subject: 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 --- init.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'init.lua') 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 -- cgit v1.2.3