From 22dd46dcc600360648ecbbabb9f23bb1f3ee8ac7 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 3 Dec 2014 18:46:02 +0100 Subject: [PATCH] Dont dry out soil if unloaded blocks are nearby --- mods/farming/nodes.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua index a36e43e4..10c4afe9 100644 --- a/mods/farming/nodes.lua +++ b/mods/farming/nodes.lua @@ -113,16 +113,20 @@ minetest.register_abm({ minetest.set_node(pos, {name = wet}) end else - -- turn it back into base if it is already dry - if wet_lvl == 0 then - -- only turn it back if there is no plant/seed on top of it - if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then - minetest.set_node(pos, {name = base}) + -- only turn back if there are no unloaded blocks (and therefore + -- possible water sources) nearby + if not minetest.find_node_near(pos, 3, {"ignore"}) then + -- turn it back into base if it is already dry + if wet_lvl == 0 then + -- only turn it back if there is no plant/seed on top of it + if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then + minetest.set_node(pos, {name = base}) + end + + -- if its wet turn it back into dry soil + elseif wet_lvl == 1 then + minetest.set_node(pos, {name = dry}) end - - -- if its wet turn it back into dry soil - elseif wet_lvl == 1 then - minetest.set_node(pos, {name = dry}) end end end, -- 2.25.1