From 31c7b589c15f2e21a21d892ff5e4904f2ff4866e Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sun, 23 Apr 2023 08:54:22 +0100 Subject: [PATCH] tweak soil dry abm --- soil.lua | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/soil.lua b/soil.lua index b24a9b5..ed557ee 100644 --- a/soil.lua +++ b/soil.lua @@ -173,11 +173,6 @@ minetest.register_abm({ return end - -- if map around soil not loaded then skip until loaded - if minetest.find_node_near(pos, 3, {"ignore"}) then - return - end - -- check if water is within 3 nodes if minetest.find_node_near(pos, 3, {"group:water"}) then @@ -186,14 +181,18 @@ minetest.register_abm({ minetest.set_node(pos, {name = ndef.soil.wet}) end - elseif node.name == ndef.soil.wet then - minetest.set_node(pos, {name = ndef.soil.dry}) + -- only dry out soil if no unloaded blocks nearby, just incase + elseif not minetest.find_node_near(pos, 3, {"ignore"}) then - -- if crop or seed found don't turn to dry soil - elseif node.name == ndef.soil.dry - and minetest.get_item_group(nn, "plant") == 0 - and minetest.get_item_group(nn, "growing") == 0 then - minetest.set_node(pos, {name = ndef.soil.base}) + if node.name == ndef.soil.wet then + minetest.set_node(pos, {name = ndef.soil.dry}) + + -- if crop or seed found don't turn to dry soil + elseif node.name == ndef.soil.dry + and minetest.get_item_group(nn, "plant") == 0 + and minetest.get_item_group(nn, "growing") == 0 then + minetest.set_node(pos, {name = ndef.soil.base}) + end end end })