From 7db8a5122fac2c4a83616d1e8cae8d5667f3c7c2 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sun, 1 Mar 2015 11:20:12 +0000 Subject: Updated for 0.4.11 dev and above --- water.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'water.lua') diff --git a/water.lua b/water.lua index e066eec..a99b9af 100644 --- a/water.lua +++ b/water.lua @@ -66,9 +66,9 @@ minetest.register_abm({ local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1} local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1} - local water = minetest.env:find_nodes_in_area(pos0, pos1, "default:water_source") + local water = minetest.find_nodes_in_area(pos0, pos1, "default:water_source") if water then - minetest.env:set_node(water[1], {name="default:ice"}) + minetest.set_node(water[1], {name="default:ice"}) end end, }) @@ -118,12 +118,30 @@ minetest.register_abm({ local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1} local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1} - local water = minetest.env:find_nodes_in_area(pos0, pos1, "group:water") + local water = minetest.find_nodes_in_area(pos0, pos1, "group:water") if water then for n = 1, #water do - minetest.env:set_node(water[n], {name="air"}) + minetest.set_node(water[n], {name="air"}) end end end, }) ]] +--[[ +-- If torch next to water then drop torch +minetest.register_abm({ + nodenames = {"default:torch"}, + neighbors = {"default:water_source", "default:water_flowing"}, + interval = 1, + chance = 1, + + action = function(pos, node) + local pos0 = {x=pos.x-1,y=pos.y,z=pos.z-1} + local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1} + if #minetest.find_nodes_in_area(pos0, pos1, {"default:water_source", "default:water_flowing"}) > 0 then + minetest.set_node(pos, {name="default:water_flowing"}) + minetest.add_item(pos, {name = "default:torch"}) + end + end, +}) +]] -- cgit v1.2.3