Flowers: Allow placing waterlily on river water

Add 'buildable_to = true' to flowers and waterlily
This commit is contained in:
paramat 2015-10-05 00:06:07 +01:00
parent 2119054a95
commit 8148bbf95e

@ -46,6 +46,7 @@ local function add_simple_flower(name, desc, box, f_groups)
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true,
stack_max = 99, stack_max = 99,
groups = f_groups, groups = f_groups,
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
@ -252,6 +253,7 @@ minetest.register_node("flowers:waterlily", {
wield_image = "flowers_waterlily.png", wield_image = "flowers_waterlily.png",
liquids_pointable = true, liquids_pointable = true,
walkable = false, walkable = false,
buildable_to = true,
groups = {snappy = 3, flower = 1}, groups = {snappy = 3, flower = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
node_box = { node_box = {
@ -266,10 +268,19 @@ minetest.register_node("flowers:waterlily", {
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1}, local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source") {x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source")
local find_river_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:river_water_source")
if #find_water ~= 0 then if #find_water ~= 0 then
minetest.set_node(pos, {name = "default:water_source"}) minetest.set_node(pos, {name = "default:water_source"})
pos.y = pos.y + 1 pos.y = pos.y + 1
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
elseif #find_river_water ~= 0 then
minetest.set_node(pos, {name = "default:river_water_source"})
pos.y = pos.y + 1
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
else
minetest.remove_node(pos)
return true
end end
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
end end
}) })