From: paramat Date: Tue, 19 Jul 2016 21:26:02 +0000 (+0100) Subject: Flowers: Fix waterlily on-place itemstack code X-Git-Tag: 0.4.15~124 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=db129f4ca077f5b3dbdb524511bedd13bc9207f3;p=oweals%2Fminetest_game.git Flowers: Fix waterlily on-place itemstack code Add 'record_protection_violation()' --- diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 2ec661e1..83a05fad 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -243,16 +243,20 @@ minetest.register_node("flowers:waterlily", { local def = minetest.registered_nodes[node] local player_name = placer:get_player_name() - if def and def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0 then + if def and def.liquidtype == "source" and + minetest.get_item_group(node, "water") > 0 then if not minetest.is_protected(pos, player_name) then - minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)}) + minetest.set_node(pos, {name = "flowers:waterlily", + param2 = math.random(0, 3)}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end else - minetest.chat_send_player(player_name, "This area is protected") - end - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) end end + return itemstack end })