Make large plants buildable_to

This commit is contained in:
Wuzzy 2017-03-31 20:25:16 +02:00
parent 47ccf47b0d
commit 5e2ec0a086
1 changed files with 4 additions and 2 deletions

View File

@ -122,6 +122,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true,
drop = drop, drop = drop,
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -165,7 +166,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
-- Remove top half of flower (if it exists) -- Remove top half of flower (if it exists)
local bottom = pos local bottom = pos
local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z }
if minetest.get_node(top).name == "mcl_flowers:"..name.."_top" then if minetest.get_node(bottom).name ~= "mcl_flowers:"..name and minetest.get_node(top).name == "mcl_flowers:"..name.."_top" then
minetest.remove_node(top) minetest.remove_node(top)
end end
end, end,
@ -182,12 +183,13 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true,
drop = "", drop = "",
after_destruct = function(pos, oldnode) after_destruct = function(pos, oldnode)
-- "Dig" bottom half of flower (if it exists) -- "Dig" bottom half of flower (if it exists)
local top = pos local top = pos
local bottom = { x = top.x, y = top.y - 1, z = top.z } local bottom = { x = top.x, y = top.y - 1, z = top.z }
if minetest.get_node(bottom).name == "mcl_flowers:"..name then if minetest.get_node(top).name ~= "mcl_flowers:"..name.."_top" and minetest.get_node(bottom).name == "mcl_flowers:"..name then
minetest.dig_node(bottom) minetest.dig_node(bottom)
end end
end, end,