From 5dbf2beb6a1dc61b42d091da2e66035093858427 Mon Sep 17 00:00:00 2001
From: Wuzzy <almikes@aol.com>
Date: Sun, 14 May 2017 22:16:56 +0200
Subject: [PATCH] Don't make farmland dry while it rains

---
 mods/ITEMS/mcl_farming/depends.txt |  1 +
 mods/ITEMS/mcl_farming/soil.lua    | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/mods/ITEMS/mcl_farming/depends.txt b/mods/ITEMS/mcl_farming/depends.txt
index 9fb1f89a..6cbf6bc9 100644
--- a/mods/ITEMS/mcl_farming/depends.txt
+++ b/mods/ITEMS/mcl_farming/depends.txt
@@ -3,4 +3,5 @@ mcl_sounds
 bucket
 mcl_wool
 mcl_torches
+weather_pack
 doc?
diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua
index 89290498..edb1db7b 100644
--- a/mods/ITEMS/mcl_farming/soil.lua
+++ b/mods/ITEMS/mcl_farming/soil.lua
@@ -84,9 +84,16 @@ minetest.register_abm({
 				node.name = "mcl_farming:soil_wet"
 				minetest.set_node(pos, node)
 			end
-		else
-			-- Decay if no water is nearby.
-			-- But not near unloaded areas since thse might include water.
+		else -- No water nearby.
+			-- The decay branch (make farmland dry or turn back to dirt)
+
+			-- Don't decay while it's raining
+			if rain.raining then
+				if weather.is_outdoor(pos) then
+					return
+				end
+			end
+			-- No decay near unloaded areas since these might include water.
 			if not check_surroundings(pos, "ignore") then
 				if wet <= 0 then
 					local n_def = minetest.registered_nodes[node.name] or nil