Advertisement
Guest User

asdad

a guest
Jun 6th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. function flowers.register_large(name, desc, inv_img, bot_img, colr) --change in function
  2.     -- Double Plant Func
  3.     function flowers_double(itemstack, placer, pointed_thing)
  4.         pos.y = pos.y-1
  5.         local name = minetest.get_node(pos).name
  6.         if minetest.get_item_group(name, "soil") ~= 0 then
  7.             pos.y = pos.y+1
  8.             local height = 0
  9.             while minetest.get_node(pos).name == "flowers:"..name.."_bottom" and height < 2 do
  10.                 height = height+1
  11.                 pos.y = pos.y+1
  12.             end
  13.             if height <2 then
  14.                 if minetest.get_node(pos).name == "air" then
  15.                     minetest.set_node(pos, {name="flowers:"..name.."_top"})
  16.                 end
  17.             end
  18.         end
  19.     end
  20.    
  21.     -- Bottom
  22.     minetest.register_node("flowers:"..name.."_bottom", {
  23.         description = desc.." Bottom",
  24.         drawtype = "plantlike",
  25.         tiles = { "double_plant_"..name.."_bottom.png" },
  26.         inventory_image = "flowers_"..inv_img..".png",
  27.         wield_image = "flowers_"..inv_img..".png",
  28.         sunlight_propagates = true,
  29.         paramtype = "light",
  30.         walkable = false,
  31.         buildable_to = true,
  32.         on_place = flowers_double(itemstack, placer, pointed_thing),
  33.         drop = "flowers:"..name,
  34.         groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,colr=1, drop_by_liquid=1, double_bottom =1},
  35.         sounds = default.node_sound_leaves_defaults(),
  36.         selection_box = {
  37.             type = "fixed",
  38.             fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 },
  39.         },
  40.     })
  41.  
  42.     -- Top
  43.     minetest.register_node("flowers:"..name.."_top", {
  44.         description = desc.." Top",
  45.         drawtype = "plantlike",
  46.         tiles = { "double_plant_"..name.."_top.png" },
  47.         inventory_image = "double_plant_"..inv_img.."_top.png",
  48.         wield_image = "double_plant_"..inv_img.."_top.png",
  49.         sunlight_propagates = true,
  50.         paramtype = "light",
  51.         walkable = false,
  52.         buildable_to = true,
  53.         drop = "flowers:"..name,
  54.         groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,colr=1, drop_by_liquid=1, not_in_creative_inventory = 1, double_top =1},
  55.         sounds = default.node_sound_leaves_defaults(),
  56.         selection_box = {
  57.             type = "fixed",
  58.             fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 },
  59.         },
  60.     })
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement