restored old behavior of lava+water = something.

a lava source next to any water produces obsidian.
lava flowing into a water source makes basalt.
lava flowing into flowing water makes pumice

This will only work after minetest_game's default/init.lua gets fixed to call
the proper functions.  Without that fix, nothing will happen - minetest_game's
default lava cooling code will run instead.
This commit is contained in:
Vanessa Ezekowitz 2013-03-18 16:28:42 -04:00
parent 9baec9938b
commit ec0d1713f6

View File

@ -449,24 +449,32 @@ minetest.register_abm({
end,
})
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"default:water_source"},
interval = 1.0,
chance = 1,
action = function(pos)
minetest.env:add_node(pos,{name="gloopblocks:basalt"})
end,
})
-- Hook into the default lavacooling function to generate basalt and pumice
default.cool_lava_source = function(pos)
if gloopblocks_search_nearby_nodes(pos,"default:water_source")
or gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then
minetest.env:set_node(pos, {name="default:obsidian"})
end
end
default.cool_lava_flowing = function(pos)
if gloopblocks_search_nearby_nodes(pos,"default:water_source") then
minetest.env:set_node(pos, {name="gloopblocks:basalt"})
elseif gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then
minetest.env:set_node(pos, {name="gloopblocks:pumice"})
end
end
gloopblocks_search_nearby_nodes = function(pos, node)
if minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == node then return true end
if minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == node then return true end
if minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == node then return true end
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == node then return true end
if minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == node then return true end
if minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == node then return true end
return false
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"default:water_flowing"},
interval = 1.0,
chance = 1,
action = function(pos)
minetest.env:add_node(pos,{name="gloopblocks:pumice"})
end,
})
print("Gloopblocks Loaded!")