summaryrefslogtreecommitdiff
path: root/water.lua
diff options
context:
space:
mode:
authortenplus1 <kinsellaja@yahoo.com>2015-03-01 11:20:12 +0000
committertenplus1 <kinsellaja@yahoo.com>2015-03-01 11:20:12 +0000
commit7db8a5122fac2c4a83616d1e8cae8d5667f3c7c2 (patch)
tree82c8157042a2e5e5dfb4bbbbc75214c34a594d7c /water.lua
parent41e4423dd952e58793ff19ea001997cad92d6b2f (diff)
Updated for 0.4.11 dev and above
Diffstat (limited to 'water.lua')
-rw-r--r--water.lua26
1 files changed, 22 insertions, 4 deletions
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,
+})
+]]