From d13fe532c51205a75a93e374fe560489fcadef91 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 20 May 2017 00:38:10 +0200 Subject: [PATCH] Create drips only below solids below liquids --- mods/ENTITIES/drippingwater/init.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/drippingwater/init.lua b/mods/ENTITIES/drippingwater/init.lua index 7888e16ea1..739fe5c719 100644 --- a/mods/ENTITIES/drippingwater/init.lua +++ b/mods/ENTITIES/drippingwater/init.lua @@ -91,10 +91,11 @@ minetest.register_abm( interval = 2, chance = 22, action = function(pos) - if minetest.get_node({x=pos.x, y=pos.y -1, z=pos.z}).name == "air" and - minetest.get_node({x=pos.x, y=pos.y -2, z=pos.z}).name == "air" then - local i = math.random(-45,45) / 100 - minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_water") + if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name, "water") ~= 0 and + minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" and + minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "air" then + local i = math.random(-45,45) / 100 + minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_water") end end, }) @@ -109,10 +110,11 @@ minetest.register_abm( interval = 2, chance = 22, action = function(pos) - if minetest.get_node({x=pos.x, y=pos.y -1, z=pos.z}).name == "air" and - minetest.get_node({x=pos.x, y=pos.y -2, z=pos.z}).name == "air" then - local i = math.random(-45,45) / 100 - minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_lava") + if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name, "lava") ~= 0 and + minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" and + minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "air" then + local i = math.random(-45,45) / 100 + minetest.add_entity({x=pos.x + i, y=pos.y - 0.501, z=pos.z + i}, "drippingwater:drop_lava") end end, })