From 32f6f4d3bf65f4c579ff20ebc77ec2a227d228df Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 14 May 2017 21:47:45 +0200 Subject: [PATCH] Destroy farmland when under solid node --- mods/ITEMS/mcl_farming/soil.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index e4aa7b11..98d70607 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -62,6 +62,16 @@ minetest.register_abm({ end end + -- Turn back into dirt when covered by solid node + local above_node = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z}) + if above_node then + if minetest.get_item_group(above_node.name, "solid") then + node.name = "mcl_core:dirt" + minetest.set_node(pos, node) + return + end + end + -- Check an area of 9×2×9 around the node for nodename local check_surroundings = function(pos, nodename) local nodes = minetest.find_nodes_in_area({x=pos.x-4,y=pos.y-1,z=pos.z-4}, {x=pos.x+4,y=pos.y,z=pos.z+4}, {nodename})