mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 22:22:25 +01:00
Flowers: Fix waterlily on-place itemstack code
Add 'record_protection_violation()'
This commit is contained in:
parent
72f4c6be48
commit
db129f4ca0
@ -243,16 +243,20 @@ minetest.register_node("flowers:waterlily", {
|
|||||||
local def = minetest.registered_nodes[node]
|
local def = minetest.registered_nodes[node]
|
||||||
local player_name = placer:get_player_name()
|
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
|
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
|
else
|
||||||
minetest.chat_send_player(player_name, "This area is protected")
|
minetest.chat_send_player(player_name, "Node is protected")
|
||||||
end
|
minetest.record_protection_violation(pos, player_name)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user