Flowers: Fix itemstack when waterlily is placed
authorkilbith <jeanpatrick.guerrero@gmail.com>
Fri, 8 Apr 2016 12:29:48 +0000 (14:29 +0200)
committerparamat <mat.gregory@virginmedia.com>
Tue, 12 Apr 2016 00:28:16 +0000 (01:28 +0100)
mods/flowers/init.lua

index f5e6d2cf8ece56b49bb81fda91e3b40779fba150..d5581d0cd06431c66e1171f203c850c25e820d9d 100644 (file)
@@ -229,12 +229,16 @@ minetest.register_node("flowers:waterlily", {
                fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
        },
 
-       on_place = function(_, _, pointed_thing)
+       on_place = function(itemstack, _, pointed_thing)
                local pos = pointed_thing.above
                local node = minetest.get_node(pointed_thing.under).name
                local def = minetest.registered_nodes[node]
                if def and def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0 then
                        minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
+                       if not minetest.setting_getbool("creative_mode") then
+                               itemstack:take_item()
+                               return itemstack
+                       end
                end
        end
 })