summaryrefslogtreecommitdiff
path: root/farming/soil.lua
diff options
context:
space:
mode:
Diffstat (limited to 'farming/soil.lua')
-rw-r--r--farming/soil.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/farming/soil.lua b/farming/soil.lua
index 0b4844a..d379f5d 100644
--- a/farming/soil.lua
+++ b/farming/soil.lua
@@ -52,7 +52,14 @@ minetest.register_abm({
end
-- check if there is water nearby and change soil accordingly
- if minetest.find_node_near(pos, 3, {"group:water"}) then
+-- if minetest.find_node_near(pos, 3, {"group:water"}) then
+
+ -- check if water is within 3 nodes horizontally and 1 below
+ if #minetest.find_nodes_in_area(
+ {x = pos.x + 3, y = pos.y - 1, z = pos.z + 3},
+ {x = pos.x - 3, y = pos.y , z = pos.z - 3},
+ {"group:water"}) > 0 then
+
if node.name == "farming:soil" then
minetest.set_node(pos, {name = "farming:soil_wet"})
end
@@ -64,4 +71,4 @@ minetest.register_abm({
minetest.set_node(pos, {name = "default:dirt"})
end
end,
-}) \ No newline at end of file
+})