Skip to content

Commit db129f4

Browse files
committedJul 23, 2016
Flowers: Fix waterlily on-place itemstack code
Add 'record_protection_violation()'
1 parent 72f4c6b commit db129f4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

Diff for: ‎mods/flowers/init.lua

+10-6
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,20 @@ minetest.register_node("flowers:waterlily", {
243243
local def = minetest.registered_nodes[node]
244244
local player_name = placer:get_player_name()
245245

246-
if def and def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0 then
246+
if def and def.liquidtype == "source" and
247+
minetest.get_item_group(node, "water") > 0 then
247248
if not minetest.is_protected(pos, player_name) then
248-
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
249+
minetest.set_node(pos, {name = "flowers:waterlily",
250+
param2 = math.random(0, 3)})
251+
if not minetest.setting_getbool("creative_mode") then
252+
itemstack:take_item()
253+
end
249254
else
250-
minetest.chat_send_player(player_name, "This area is protected")
251-
end
252-
if not minetest.setting_getbool("creative_mode") then
253-
itemstack:take_item()
255+
minetest.chat_send_player(player_name, "Node is protected")
256+
minetest.record_protection_violation(pos, player_name)
254257
end
255258
end
259+
256260
return itemstack
257261
end
258262
})

0 commit comments

Comments
 (0)
Please sign in to comment.